odule('user')->getCurrentUserPosition();
// For multi-sites network admin role is undefined, let's do this here
if (is_multisite() && is_admin() && is_super_admin()) {
$currentUserPosition = WPF_ADMIN;
}
foreach ($permissions[WPF_USERLEVELS] as $userlevel => $methods) {
if (is_array($methods)) {
$lowerMethods = array_map('strtolower', $methods); // Make case-insensitive
if (in_array($action, $lowerMethods)) { // Permission for this method exists
if ($currentUserPosition != $userlevel) {
$res = false;
}
break;
}
} else {
$lowerMethod = strtolower($methods); // Make case-insensitive
if ($lowerMethod == $action) { // Permission for this method exists
if ($currentUserPosition != $userlevel) {
$res = false;
}
break;
}
}
}
}
}
if ($res) { // Additional check for nonces
$noncedMethods = $mod->getController()->getNoncedMethods();
if (!empty($noncedMethods)) {
$noncedMethods = array_map('strtolower', $noncedMethods);
if (in_array($action, $noncedMethods)) {
$nonce = isset($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : ReqWpf::getVar('_wpnonce');
if (!wp_verify_nonce( $nonce, $action )) {
die();
}
}
}
}
}
return $res;
}
public function getRes() {
return $this->_res;
}
public function execAfterWpInit() {
$this->_doExec();
}
/**
* Check if method for module require some special permission. We can detect users permissions only after wp init action was done.
*/
protected function _execOnlyAfterWpInit() {
$res = false;
$mod = $this->getModule( $this->_mod );
$action = strtolower( $this->_action );
if ($mod) {
$permissions = $mod->getController()->getPermissions();
if (!empty($permissions)) { // Special permissions
if (isset($permissions[WPF_METHODS]) && !empty($permissions[WPF_METHODS])) {
foreach ($permissions[WPF_METHODS] as $method => $permissions) { // Make case-insensitive
$permissions[WPF_METHODS][strtolower($method)] = $permissions;
}
if (array_key_exists($action, $permissions[WPF_METHODS])) { // Permission for this method exists
$res = true;
}
}
if (isset($permissions[WPF_USERLEVELS]) && !empty($permissions[WPF_USERLEVELS])) {
$res = true;
}
}
}
return $res;
}
protected function _execModules() {
if ($this->_mod) {
// If module exist and is active
$mod = $this->getModule($this->_mod);
if ($mod && !empty($this->_action)) {
if ($this->_execOnlyAfterWpInit()) {
add_action('init', array($this, 'execAfterWpInit'));
} else {
$this->_doExec();
}
}
}
}
protected function _doExec() {
$mod = $this->getModule($this->_mod);
if ($mod && $this->checkPermissions($this->_mod, $this->_action)) {
switch (ReqWpf::getVar('reqType')) {
case 'ajax':
add_action('wp_ajax_' . $this->_action, array($mod->getController(), $this->_action));
add_action('wp_ajax_nopriv_' . $this->_action, array($mod->getController(), $this->_action));
break;
default:
$this->_res = $mod->exec($this->_action);
break;
}
}
}
protected function _extractTables( $tablesDir = WPF_TABLES_DIR ) {
$mDirHandle = opendir($tablesDir);
while ( ( $file = readdir($mDirHandle) ) !== false ) {
if ( is_file($tablesDir . $file) && ( '.' != $file ) && ( '..' != $file ) && strpos($file, '.php') ) {
$this->_extractTable( str_replace('.php', '', $file), $tablesDir );
}
}
}
protected function _extractTable( $tableName, $tablesDir = WPF_TABLES_DIR ) {
//importClassWpf('noClassNameHere', $tablesDir . $tableName . '.php');
if (!class_exists('noClassNameHere')) {
if (file_exists($tablesDir . $tableName . '.php')) {
require $tablesDir . $tableName . '.php';
}
}
$this->_tables[$tableName] = TableWpf::_($tableName);
}
/**
* Public alias for _extractTables method
*
* @see _extractTables
*/
public function extractTables( $tablesDir ) {
if (!empty($tablesDir)) {
$this->_extractTables($tablesDir);
}
}
public function exec() {
//deprecated
}
public function getTables () {
return $this->_tables;
}
/**
* Return table by name
*
* @param string $tableName table name in database
* @return object table
* @example FrameWpf::_()->getTable('products')->getAll()
*/
public function getTable( $tableName ) {
if (empty($this->_tables[$tableName])) {
$this->_extractTable($tableName);
}
return $this->_tables[$tableName];
}
public function getModules( $filter = array() ) {
$res = array();
if (empty($filter)) {
$res = $this->_modules;
} else {
foreach ($this->_modules as $code => $mod) {
if (isset($filter['type'])) {
if (is_numeric($filter['type']) && $filter['type'] == $mod->getTypeID()) {
$res[$code] = $mod;
} elseif ($filter['type'] == $mod->getType()) {
$res[$code] = $mod;
}
}
}
}
return $res;
}
public function getModule( $code ) {
return ( isset($this->_modules[$code]) ? $this->_modules[$code] : null );
}
public function inPlugin() {
return $this->_inPlugin;
}
public function usePackAssets() {
if (!$this->_useFootAssets && $this->getModule('options') && $this->getModule('options')->get('foot_assets')) {
$this->_useFootAssets = true;
}
return $this->_useFootAssets;
}
/**
* Push data to script array to use it all in addScripts method
*
* @see wp_enqueue_script definition
*/
public function addScript( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false, $vars = array() ) {
$src = empty($src) ? $src : UriWpf::_($src);
if (!$ver) {
$ver = WPF_VERSION;
}
if ($this->_scriptsInitialized) {
wp_enqueue_script($handle, $src, $deps, $ver, $in_footer);
} else {
$this->_scripts[] = array(
'handle' => $handle,
'src' => $src,
'deps' => $deps,
'ver' => $ver,
'in_footer' => $in_footer,
'vars' => $vars
);
}
}
/**
* Add all scripts from _scripts array to wordpress
*/
public function addScripts() {
if (!empty($this->_scripts)) {
foreach ($this->_scripts as $s) {
if ( ! function_exists( 'is_plugin_active' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$enqueue = true;
// if the oxygen plugin is activated then check if the script is already registered
if ( is_plugin_active( 'oxygen/functions.php' ) && 'jquery-ui-autocomplete' === $s['handle'] ) {
$wp_scripts = wp_scripts();
if ( isset( $wp_scripts->registered[ $s['handle'] ] ) ) {
$enqueue = false;
}
}
if ( $enqueue ) {
wp_enqueue_script( $s['handle'], $s['src'], $s['deps'], $s['ver'], $s['in_footer'] );
}
if ($s['vars'] || isset($this->_scriptsVars[$s['handle']])) {
$vars = array();
if ($s['vars']) {
$vars = $s['vars'];
}
if ($this->_scriptsVars[$s['handle']]) {
$vars = array_merge($vars, $this->_scriptsVars[$s['handle']]);
}
if ($vars) {
foreach ($vars as $k => $v) {
if ( is_array( $v ) ) {
wp_localize_script( $s['handle'], $k, $v );
}
}
}
}
}
}
$this->_scriptsInitialized = true;
}
public function addJSVar( $script, $name, $val ) {
if ($this->_scriptsInitialized) {
if ( is_array( $val ) ) {
wp_localize_script( $script, $name, $val );
} else {
$code = "var {$name} = '{$val}';";
wp_add_inline_script( $script, $code, 'before' );
}
} else {
$this->_scriptsVars[$script][$name] = $val;
}
}
public function addStyle( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
$src = empty($src) ? $src : UriWpf::_($src);
if (!$ver) {
$ver = WPF_VERSION;
}
if ($this->_stylesInitialized) {
wp_enqueue_style($handle, $src, $deps, $ver, $media);
} else {
$this->_styles[] = array(
'handle' => $handle,
'src' => $src,
'deps' => $deps,
'ver' => $ver,
'media' => $media
);
}
}
public function addStyles() {
if (!empty($this->_styles)) {
foreach ($this->_styles as $s) {
wp_enqueue_style($s['handle'], $s['src'], $s['deps'], $s['ver'], $s['media']);
}
}
$this->_stylesInitialized = true;
}
//Very interesting thing going here.............
public function loadPlugins() {
require_once(ABSPATH . 'wp-includes/pluggable.php');
}
public function loadWPSettings() {
require_once(ABSPATH . 'wp-settings.php');
}
public function loadLocale() {
require_once(ABSPATH . 'wp-includes/locale.php');
}
public function moduleActive( $code ) {
return isset($this->_modules[$code]);
}
public function moduleExists( $code ) {
if ($this->moduleActive($code)) {
return true;
}
return isset($this->_allModules[$code]);
}
public function isTplEditor() {
$tplEditor = ReqWpf::getVar('tplEditor');
return (bool) $tplEditor;
}
/**
* This is custom method for each plugin and should be modified if you create copy from this instance.
*/
public function isAdminPlugOptsPage() {
$page = ReqWpf::getVar('page');
if (is_admin() && !empty($page) && strpos($page, self::_()->getModule('adminmenu')->getMainSlug()) !== false) {
return true;
}
return false;
}
public function isAdminPlugPage() {
if ($this->isAdminPlugOptsPage()) {
return true;
}
return false;
}
public function licenseDeactivated() {
return ( !$this->getModule('license') && $this->moduleExists('license') );
}
public function savePluginActivationErrors() {
update_option(WPF_CODE . '_plugin_activation_errors', ob_get_contents());
}
public function getActivationErrors() {
return get_option(WPF_CODE . '_plugin_activation_errors');
}
public function isPro() {
return $this->moduleExists('license') && $this->getModule('license') && $this->getModule('access');
}
public function proVersionCompare( $requires, $compare = '>', $notPro = true ) {
if ( is_null( $this->_proVersion ) ) {
if ( $this->isPro() && function_exists( 'getProPlugFullPathWpf' ) ) {
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
$plugin_data = get_file_data( getProPlugFullPathWpf(), array( 'Version' => 'Version' ) );
$this->_proVersion = $plugin_data['Version'];
} else {
$this->_proVersion = false;
}
}
return ( ( $notPro && false === $this->_proVersion ) || version_compare( $this->_proVersion, $requires, $compare ) );
}
public function isWCLicense() {
return $this->moduleExists('license') && $this->getModule('license') && isset($this->getModule('license')->isWooLicense) && $this->getModule('license')->isWooLicense;
}
}
Fatal error: Uncaught Error: Class 'FrameWpf' not found in /home/negarray/domains/negato.ir/public_html/wp-content/plugins/woo-product-filter/woo-product-filter.php:65
Stack trace:
#0 /home/negarray/domains/negato.ir/public_html/wp-settings.php(522): include_once()
#1 /home/negarray/domains/negato.ir/public_html/wp-config.php(92): require_once('/home/negarray/...')
#2 /home/negarray/domains/negato.ir/public_html/wp-load.php(50): require_once('/home/negarray/...')
#3 /home/negarray/domains/negato.ir/public_html/wp-blog-header.php(13): require_once('/home/negarray/...')
#4 /home/negarray/domains/negato.ir/public_html/index.php(17): require('/home/negarray/...')
#5 {main}
thrown in /home/negarray/domains/negato.ir/public_html/wp-content/plugins/woo-product-filter/woo-product-filter.php on line 65