| Server IP : 54.36.91.62 / Your IP : 216.73.216.15 Web Server : Apache System : Linux webm021.cluster127.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : uxhactp ( 169076) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/uxhactp/www/wp-content/plugins/visualcomposer/visualcomposer/Helpers/ |
Upload File : |
<?php
namespace VisualComposer\Helpers;
if (!defined('ABSPATH')) {
header('Status: 403 Forbidden');
header('HTTP/1.1 403 Forbidden');
exit;
}
use VisualComposer\Framework\Illuminate\Support\Helper;
/**
* Class Nonce.
*/
class Nonce implements Helper
{
/**
* @return mixed
*/
public function user()
{
return wp_create_nonce('vcv:nonce');
}
/**
* @return mixed
*/
public function admin()
{
return vchelper('AccessCurrentUser')->wpAll('edit_posts')->get() ? wp_create_nonce('vcv:nonce:admin') : false;
}
/**
* @param $nonce
*
* @return bool
*/
public function verifyUser($nonce)
{
return !empty($nonce) && wp_verify_nonce($nonce, 'vcv:nonce');
}
/**
* @param $nonce
*
* @return bool
*/
public function verifyAdmin($nonce)
{
// TODO: Use exact post type cap (if there is any)
return !empty($nonce) && vchelper('AccessCurrentUser')->wpAll('edit_posts')->get()
&& wp_verify_nonce(
$nonce,
'vcv:nonce:admin'
);
}
/**
* Create nonce for pageEditable url
*
* @return mixed
*/
public function pageEditable()
{
// TODO: Use exact post type cap
return vchelper('AccessCurrentUser')->wpAll('edit_posts')->get() ? $this->createPageEditableNonce() : false;
}
/**
* Verify pageEditable nonce
*
* @param $nonce
*
* @return bool
*/
public function verifyPageEditable($nonce)
{
if (empty($nonce)) {
return false;
}
// Nonce generated 0-12 hours ago.
$firstTick = wp_nonce_tick();
if ($nonce === $this->createPageEditableNonce($firstTick)) {
return true;
}
// Nonce generated 12-24 hours ago.
$secondTick = $firstTick - 1;
if ($nonce === $this->createPageEditableNonce($secondTick)) {
return true;
}
return false;
}
/**
* Create nonce string for pageEditable
*
* @param bool $i
*
* @return string
*/
protected function createPageEditableNonce($i = false)
{
if (!$i) {
$i = wp_nonce_tick();
}
$nonceKey = get_option('nonce_key', '');
$nonceSalt = get_option('nonce_salt', '');
return substr(wp_hash($i . '|' . $nonceKey . '|' . $nonceSalt, 'pageEditable'), -12, 10);
}
}