public function __construct() { require_once $GLOBALS['ithemes_sync_path'] . '/functions.php'; $this->path_url = Ithemes_Sync_Functions::get_url($GLOBALS['ithemes_sync_path']); list($this->self_url) = explode('?', $_SERVER['REQUEST_URI']); $this->self_url .= '?page=' . $this->page_name; add_action('ithemes_sync_settings_page_index', array($this, 'index')); add_action('admin_print_styles', array($this, 'add_styles')); add_action('admin_print_scripts', array($this, 'add_scripts')); }
public function init() { require_once dirname(__FILE__) . '/settings.php'; $show_sync = $GLOBALS['ithemes-sync-settings']->get_option('show_sync'); if (is_array($show_sync)) { $show_sync = in_array(get_current_user_id(), $show_sync); } if (!$show_sync && current_user_can('manage_options')) { $user_id = get_current_user_id(); if (isset($_GET['ithemes-sync-force-display'])) { if (!empty($_GET['ithemes-sync-force-display'])) { $show_sync = true; set_site_transient("ithemes-sync-force-display-{$user_id}", true, 600); add_action('all_admin_notices', array($this, 'show_force_display_notice'), 0); } else { delete_site_transient("ithemes-sync-force-display-{$user_id}"); add_action('all_admin_notices', array($this, 'show_force_display_disable_notice'), 0); } } else { if (false !== get_site_transient("ithemes-sync-force-display-{$user_id}")) { $show_sync = true; add_action('all_admin_notices', array($this, 'show_force_display_notice'), 0); } } } if ($show_sync) { if (!is_multisite() || is_super_admin()) { add_action('admin_menu', array($this, 'add_admin_pages')); } add_action('network_admin_menu', array($this, 'add_network_admin_pages')); if (current_user_can('manage_options')) { if (!get_site_option('ithemes-sync-authenticated') && (empty($_GET['page']) || $this->page_name != $_GET['page']) && !get_site_option('ithemes_sync_hide_authenticate_notice')) { require_once dirname(__FILE__) . '/functions.php'; $path_url = Ithemes_Sync_Functions::get_url(dirname(__FILE__)); wp_enqueue_style('ithemes-updater-admin-notice-style', "{$path_url}/css/admin-notice.css"); wp_enqueue_script('ithemes-updater-admin-notice-script', "{$path_url}/js/admin-notice.js", array('jquery')); add_action('all_admin_notices', array($this, 'show_authenticate_notice'), 0); delete_site_transient('ithemes-sync-activated'); } else { if (!empty($_GET['activate']) && get_site_transient('ithemes-sync-activated')) { require_once dirname(__FILE__) . '/functions.php'; $path_url = Ithemes_Sync_Functions::get_url(dirname(__FILE__)); wp_enqueue_style('ithemes-updater-admin-notice-style', "{$path_url}/css/admin-notice.css"); wp_enqueue_script('ithemes-updater-admin-notice-script', "{$path_url}/js/admin-notice.js", array('jquery')); add_action('all_admin_notices', array($this, 'show_activate_notice'), 0); delete_site_transient('ithemes-sync-activated'); } } } } else { add_action('load-plugins.php', array($this, 'modify_plugins_page')); } }