| Server IP : 89.108.64.180 / Your IP : 216.73.216.229 Web Server : Apache/2.4.41 (Ubuntu) System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-root ( 1010) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/hotelzm.com/wp-content/plugins/clearfy/libs/factory/pages/ |
Upload File : |
<?php
/**
* A group of classes and methods to create and manage pages.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com>
* @copyright (c) 2018, Webcraftic Ltd
*
* @package core
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
add_action('admin_menu', 'Wbcr_FactoryPages451::actionAdminMenu');
add_action('network_admin_menu', 'Wbcr_FactoryPages451::actionAdminMenu');
if( !class_exists('Wbcr_FactoryPages451') ) {
/**
* A base class to manage pages.
*
* @since 1.0.0
*/
class Wbcr_FactoryPages451 {
/**
* @var Wbcr_FactoryPages451_Page[]
*/
private static $pages = array();
/**
* @param Wbcr_Factory452_Plugin $plugin
* @param $class_name
*/
public static function register($plugin, $class_name)
{
if( !isset(self::$pages[$plugin->getPluginName()]) ) {
self::$pages[$plugin->getPluginName()] = array();
}
$page = new $class_name($plugin);
if( is_multisite() && is_network_admin() && !$page->available_for_multisite ) {
return;
}
self::$pages[$plugin->getPluginName()][] = $page;
}
public static function actionAdminMenu()
{
if( empty(self::$pages) ) {
return;
}
foreach(self::$pages as $plugin_pages) {
foreach($plugin_pages as $page) {
$page->connect();
}
}
}
public static function getPageUrl(Wbcr_Factory452_Plugin $plugin, $page_id, $args = array())
{
if( isset(self::$pages[$plugin->getPluginName()]) ) {
$pages = self::$pages[$plugin->getPluginName()];
foreach($pages as $page) {
if( $page->id == $page_id ) {
return $page->getBaseUrl($page_id, $args);
}
}
} else {
_doing_it_wrong(__METHOD__, __('You are trying to call this earlier than the plugin menu will be registered.'), '4.0.8');
}
}
/**
* @param Wbcr_Factory452_Plugin $plugin
* @return array
*/
public static function getIds($plugin)
{
if( !isset(self::$pages[$plugin->getPluginName()]) ) {
return array();
}
$result = array();
foreach(self::$pages[$plugin->getPluginName()] as $page)
$result[] = $page->getResultId();
return $result;
}
}
}
if( !function_exists('wbcr_factory_pages_451_get_page_id') ) {
/**
*
* @param Wbcr_Factory452_Plugin $plugin
* @param string $page_id
* @return string
*/
function wbcr_factory_pages_451_get_page_id($plugin, $page_id)
{
return $page_id . '-' . $plugin->getPluginName();
}
}