示例#1
1
 public function __construct($args = array())
 {
     $screen = WP_Screen::get(Tribe__Events__Aggregator__Records::$post_type);
     $default = array('screen' => $screen, 'tab' => Tribe__Events__Aggregator__Tabs::instance()->get_active());
     $args = wp_parse_args($args, $default);
     parent::__construct($args);
     // Set Current Tab
     $this->tab = $args['tab'];
     // Set page Instance
     $this->page = Tribe__Events__Aggregator__Page::instance();
     // Set current user
     $this->user = wp_get_current_user();
 }
 /**
  * Register and handle the help tabs for the import snippets admin page
  */
 private function load_import_help()
 {
     $manage_url = code_snippets()->get_menu_url('manage');
     $this->screen->add_help_tab(array('id' => 'overview', 'title' => __('Overview', 'code-snippets'), 'content' => '<p>' . __('Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can load snippets from a Code Snippets (.xml) import file into the database with your existing snippets.', 'code-snippets') . '</p>'));
     $this->screen->add_help_tab(array('id' => 'import', 'title' => __('Importing', 'code-snippets'), 'content' => '<p>' . __('You can load your snippets from a code snippets (.xml) export file using this page.', 'code-snippets') . sprintf(__('Snippets will be added to the database along with your existing snippets. Regardless of whether the snippets were active on the previous site, imported snippets are always inactive until activated using the <a href="%s">Manage Snippets</a> page.</p>', 'code-snippets'), $manage_url) . '</p>'));
     $this->screen->add_help_tab(array('id' => 'export', 'title' => __('Exporting', 'code-snippets'), 'content' => '<p>' . sprintf(__('You can save your snippets to a Code Snippets (.xml) export file using the <a href="%s">Manage Snippets</a> page.', 'code-snippets'), $manage_url) . '</p>'));
 }
示例#3
0
 /**
  * This function adds help tabs and a help sidebar to a screen.
  *
  * @since 0.5.0
  * @param WP_Screen $screen the screen to add the help data to
  * @param array $data help tabs and sidebar (if specified)
  */
 public static function render_help($screen, $data)
 {
     foreach ($data['tabs'] as $slug => $tab) {
         $args = array_merge(array('id' => $slug), $tab);
         $screen->add_help_tab($args);
     }
     if (!empty($data['sidebar'])) {
         $screen->set_help_sidebar($data['sidebar']);
     }
 }
示例#4
0
 /**
  * Screen option value.
  *
  * @since 141111 First documented version.
  *
  * @param \WP_Screen $screen  A screen object instance.
  * @param string     $option  The screen option to get.
  * @param int        $user_id A specific user ID. Defaults to `NULL`.
  *                            A `NULL` value indicates the current user.
  *
  * @return mixed The screen option value; only if not empty; and only it has a valid data type.
  *               If empty, or not the same data type as the default value; returns the default value.
  */
 public function screenOption(\WP_Screen $screen, $option, $user_id = null)
 {
     $user_id = $this->issetOr($user_id, (int) get_current_user_id(), 'integer');
     $value = get_user_meta($user_id, $screen->get_option($option, 'option'), true);
     $default_value = $screen->get_option($option, 'default');
     if (!$value || gettype($value) !== gettype($default_value)) {
         $value = $default_value;
     }
     return $value;
 }
示例#5
0
	public function create_help_screen() {
		global $wp_list_table,$sitemember_screen_manage;
		
	/* 	if($_REQUEST['action']=='view'){
			$wp_list_table = new members_list_Table();
			$this->admin_screen = WP_Screen::get($this->admin_page);
			//$event_per_page = get_option( 'horse_racing_events_per_page', 10 );
			$this->admin_screen->add_option(
				'per_page', 
				array(
					'label' => 'Price per page', 
					'default' => 10, 
					'option' => 'edit_per_page'
				)
			);
		}*/
		
		$wp_list_table = new members_list_Table();
		$this->admin_screen = WP_Screen::get($sitemember_screen_manage[site_members::levelID()]);
		$this->admin_screen->add_option(
			'per_page', 
			array(
				'label' => 'List per page', 
				'default' => 10, 
				'option' => 'list_per_page'
			)
		);
	}
 /**
  * Render screen options for Menus.
  *
  * @since 4.3.0
  * @access public
  */
 public function render_screen_options()
 {
     // Essentially adds the screen options.
     add_filter('manage_nav-menus_columns', array($this, 'wp_nav_menu_manage_columns'));
     // Display screen options.
     $screen = WP_Screen::get('nav-menus.php');
     $screen->render_screen_options(array('wrap' => false));
 }
 /**
  * Applies the new sidebar contents based on loaded files.
  *
  * This should be called during WordPress's `admin_head` hook.
  *
  * @link https://developer.wordpress.org/reference/hooks/admin_head/
  *
  * @uses Parsedown::text()
  * @uses WP_Screen::get_help_sidebar()
  * @uses WP_Screen::set_help_sidebar()
  *
  * @return @void
  */
 public function applySidebar()
 {
     foreach ($this->_sidebar_files as $file) {
         if (is_readable($file)) {
             $this->_screen->set_help_sidebar($this->_screen->get_help_sidebar() . $this->get_parsedown()->text(file_get_contents($file)));
         }
     }
 }
 /**
  * Render screen options for Menus.
  *
  * @since 4.3.0
  * @access public
  */
 public function render_screen_options()
 {
     // Adds the screen options.
     require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
     add_filter('manage_nav-menus_columns', 'wp_nav_menu_manage_columns');
     // Display screen options.
     $screen = WP_Screen::get('nav-menus.php');
     $screen->render_screen_options(array('wrap' => false));
 }
 /**
  * Adds Screen Options for This Tab
  *
  * @return void
  */
 public function action_screen_options($screen)
 {
     if (!$this->is_active()) {
         return;
     }
     $record_screen = WP_Screen::get(Tribe__Events__Aggregator__Records::$post_type);
     $args = array('label' => esc_html__('Records per page', 'the-events-calendar'), 'default' => 10, 'option' => 'tribe_records_scheduled_per_page');
     $record_screen->add_option('per_page', $args);
     $screen->add_option('per_page', $args);
 }
示例#10
0
 /**
  * Adds Screen Options for This Tab
  *
  * @return void
  */
 public function action_screen_options($screen)
 {
     if (!$this->is_active()) {
         return;
     }
     $record_screen = WP_Screen::get(Tribe__Events__Aggregator__Records::$post_type);
     $args = array('label' => esc_html__('Records per page', 'the-events-calendar'), 'default' => 10, 'option' => 'tribe_records_history_per_page');
     // We need to Add on both because of a WP Limitation on WP_Screen
     $record_screen->add_option('per_page', $args);
     $screen->add_option('per_page', $args);
 }
示例#11
0
        public function create_help_screen()
        {
            $current_screen = get_current_screen();
            $this->admin_screen = WP_Screen::get($current_screen);
            $this->admin_screen->add_help_tab(array('title' => __('Similar Settings', WP_ULIKE_SLUG), 'id' => 'overview_tab', 'content' => '<p>' . __('WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.', WP_ULIKE_SLUG) . '</p>' . '<p>' . '<strong>' . __('Logging Method', WP_ULIKE_SLUG) . ' : </strong></p>' . '<ul>' . '<li>' . __('If you select <strong>"Do Not Log"</strong> method: Any data logs can\'t save, There is no limitation in the like/dislike, unlike/undislike capacity do not work', WP_ULIKE_SLUG) . '</li>' . '<li>' . __('If you select <strong>"Logged By Cookie"</strong> method: Any data logs can\'t save, The like/dislike condition will be limited by SetCookie, unlike/undislike capacity do not work', WP_ULIKE_SLUG) . '</li>' . '<li>' . __('If you select <strong>"Logged By IP"</strong> method: Data logs will save for all users, the convey of like/dislike condition will check by user IP', WP_ULIKE_SLUG) . '</li>' . '<li>' . __('If you select <strong>"Logged By Cookie & IP"</strong> method: Data logs will save for all users, the convey of like/dislike condition will check by user IP & SetCookie', WP_ULIKE_SLUG) . '</li>' . '<li>' . __('If you select <strong>"Logged By Username"</strong> method: data logs only is saved for registered users, the convey of like/dislike condition will check by username, There is no permission for guest users to unlike/undislike', WP_ULIKE_SLUG) . '</li>
			</ul>' . '<p>' . '<strong>' . __('Template Variables', WP_ULIKE_SLUG) . ' : </strong></p>' . '<ul>' . '<li>' . '<code>%START_WHILE%</code> : ' . __('Start the loop of logs', WP_ULIKE_SLUG) . ' <span style="color:red">(' . __('required', WP_ULIKE_SLUG) . ')</span></li>' . '<li>' . '<code>%END_WHILE%</code> : ' . __('End of the while loop', WP_ULIKE_SLUG) . ' <span style="color:red">(' . __('required', WP_ULIKE_SLUG) . ')</span></li>' . '<li>' . '<code>%USER_NAME%</code> : ' . __('Display the liker name', WP_ULIKE_SLUG) . '</li>' . '<li>' . '<code>%USER_AVATAR%</code> : ' . __('Display the liker avatar (By Gravatar)', WP_ULIKE_SLUG) . '</li>' . '<li>' . '<code>%BP_PROFILE_URL%</code> : ' . __('Display the BuddyPress user profile url', WP_ULIKE_SLUG) . '</li>' . '<li>' . '<code>%UM_PROFILE_URL%</code> : ' . __('Display the UltimateMemebr user profile url', WP_ULIKE_SLUG) . '</li><hr>' . '<li>' . '<code>%POST_LIKER%</code> : ' . __('Display the liker name', WP_ULIKE_SLUG) . '</li>' . '<li>' . '<code>%POST_PERMALINK%</code> : ' . __('Display the permalink', WP_ULIKE_SLUG) . '</li>' . '<li>' . '<code>%POST_COUNT%</code> : ' . __('Display the likes count number', WP_ULIKE_SLUG) . '</li>' . '<li>' . '<code>%POST_TITLE%</code> : ' . __('Display the post title', WP_ULIKE_SLUG) . '</li><hr>' . '<li>' . '<code>%COMMENT_LIKER%</code> : ' . __('Display the liker name', WP_ULIKE_SLUG) . '</li>' . '<li>' . '<code>%COMMENT_AUTHOR%</code> : ' . __('Display the comment author name', WP_ULIKE_SLUG) . '</li>' . '<li>' . '<code>%COMMENT_COUNT%</code> : ' . __('Display the likes count number', WP_ULIKE_SLUG) . '</li>' . '</ul>', 'callback' => false));
            $this->admin_screen->add_help_tab(array('title' => __('Posts', WP_ULIKE_SLUG), 'id' => 'posts_tab', 'content' => '<p>' . '<strong>' . __('Automatic display', WP_ULIKE_SLUG) . ' : </strong></p><ul><li>' . __('If you disable this option, you have to put manually this code on wordpress while loop', WP_ULIKE_SLUG) . '<br /><code dir="ltr">&lt;?php if(function_exists(\'wp_ulike\')) wp_ulike(\'get\'); ?&gt;</code>' . '</li></ul>' . '<p>' . '<strong>' . __('Users Like Box Template', WP_ULIKE_SLUG) . ' - ' . __('Default Template:', WP_ULIKE_SLUG) . ' </strong></p><ul><li><code>&lt;p style="margin-top:5px"&gt; ' . __('Users who have LIKED this post:', WP_ULIKE_SLUG) . '&lt;/p&gt; &lt;ul class="tiles"&gt;%START_WHILE%&lt;li&gt;&lt;a  href="%BP_PROFILE_URL%" class="user-tooltip" title="%USER_NAME%"&gt;%USER_AVATAR%&lt;/a&gt;&lt;/li&gt;%END_WHILE%&lt;/ul&gt;</code>' . '</li></ul>', 'callback' => false));
            $this->admin_screen->add_help_tab(array('title' => __('Comments', WP_ULIKE_SLUG), 'id' => 'comments_tab', 'content' => '<p>' . '<strong>' . __('Automatic display', WP_ULIKE_SLUG) . ' : </strong></p><ul><li>' . __('If you disable this option, you have to put manually this code on comments text', WP_ULIKE_SLUG) . '<br /><code dir="ltr">&lt;?php if(function_exists(\'wp_ulike_comments\')) wp_ulike_comments(\'get\'); ?&gt;</code>' . '</li></ul>' . '<p>' . '<strong>' . __('Users Like Box Template', WP_ULIKE_SLUG) . ' - ' . __('Default Template:', WP_ULIKE_SLUG) . ' </strong></p><ul><li><code>&lt;p style="margin-top:5px"&gt; ' . __('Users who have LIKED this comment:', WP_ULIKE_SLUG) . '&lt;/p&gt; &lt;ul class="tiles"&gt;%START_WHILE%&lt;li&gt;&lt;a  href="%BP_PROFILE_URL%" class="user-tooltip" title="%USER_NAME%"&gt;%USER_AVATAR%&lt;/a&gt;&lt;/li&gt;%END_WHILE%&lt;/ul&gt;</code>' . '</li></ul>', 'callback' => false));
            $this->admin_screen->add_help_tab(array('title' => __('BuddyPress', WP_ULIKE_SLUG), 'id' => 'bp_tab', 'content' => '<p>' . '<strong>' . __('Automatic display', WP_ULIKE_SLUG) . ' : </strong></p><ul><li>' . __('If you disable this option, you have to put manually this code on buddypres activities content', WP_ULIKE_SLUG) . '<br /><code dir="ltr">&lt;?php if(function_exists(\'wp_ulike_buddypress\')) wp_ulike_buddypress(\'get\'); ?&gt;</code>' . '</li></ul>' . '<p>' . '<strong>' . __('Users Like Box Template', WP_ULIKE_SLUG) . ' - ' . __('Default Template:', WP_ULIKE_SLUG) . ' </strong></p><ul><li><code>&lt;p style="margin-top:5px"&gt; ' . __('Users who have liked this activity:', WP_ULIKE_SLUG) . '&lt;/p&gt; &lt;ul class="tiles"&gt;%START_WHILE%&lt;li&gt;&lt;a  href="%BP_PROFILE_URL%" class="user-tooltip" title="%USER_NAME%"&gt;%USER_AVATAR%&lt;/a&gt;&lt;/li&gt;%END_WHILE%&lt;/ul&gt;</code>' . '</li></ul>' . '<p>' . '<strong>' . __('Post Activity Text', WP_ULIKE_SLUG) . ' - ' . __('Default Template:', WP_ULIKE_SLUG) . ' </strong></p><ul><li><code>&lt;strong&gt;%POST_LIKER%&lt;/strong&gt; liked &lt;a href="%POST_PERMALINK%" title="%POST_TITLE%"&gt;%POST_TITLE%&lt;/a&gt;. (So far, This post has &lt;span class="badge"&gt;%POST_COUNT%&lt;/span&gt; likes)</code>' . '</li></ul>' . '<p>' . '<strong>' . __('Comment Activity Text', WP_ULIKE_SLUG) . ' - ' . __('Default Template:', WP_ULIKE_SLUG) . ' </strong></p><ul><li><code>&lt;strong&gt;%COMMENT_LIKER%&lt;/strong&gt; liked &lt;strong&gt;%COMMENT_AUTHOR%&lt;/strong&gt; comment. (So far, %COMMENT_AUTHOR% has &lt;span class="badge"&gt;%COMMENT_COUNT%&lt;/span&gt; likes for this comment)</code>' . '</li></ul>', 'callback' => false));
            $this->admin_screen->add_help_tab(array('title' => __('bbPress', WP_ULIKE_SLUG), 'id' => 'bb_tab', 'content' => '<p>' . '<strong>' . __('Automatic display', WP_ULIKE_SLUG) . ' : </strong></p><ul><li>' . __('If you disable this option, you have to put manually this code on buddypres activities content', WP_ULIKE_SLUG) . '<br /><code dir="ltr">&lt;?php if(function_exists(\'wp_ulike_bbpress\')) wp_ulike_bbpress(\'get\'); ?&gt;</code>' . '</li></ul>' . '<p>' . '<strong>' . __('Users Like Box Template', WP_ULIKE_SLUG) . ' - ' . __('Default Template:', WP_ULIKE_SLUG) . ' </strong></p><ul><li><code>&lt;p style="margin-top:5px"&gt; ' . __('Users who have liked this activity:', WP_ULIKE_SLUG) . '&lt;/p&gt; &lt;ul class="tiles"&gt;%START_WHILE%&lt;li&gt;&lt;a  href="%BP_PROFILE_URL%" class="user-tooltip" title="%USER_NAME%"&gt;%USER_AVATAR%&lt;/a&gt;&lt;/li&gt;%END_WHILE%&lt;/ul&gt;</code>' . '</li></ul>', 'callback' => false));
            $this->admin_screen->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p><p><a href="https://wordpress.org/plugins/wp-ulike/faq/" target="_blank">' . __('FAQ', WP_ULIKE_SLUG) . '</a></p><p><a href="https://wordpress.org/support/plugin/wp-ulike" target="_blank">' . __('Support', WP_ULIKE_SLUG) . '</a></p>');
        }
示例#12
0
 function on_load()
 {
     $help_message = new help_message();
     $current_screen = get_current_screen();
     $this->pagehook = $current_screen->id;
     $admin_screen = WP_Screen::get($current_screen->id);
     /*Help option*/
     $admin_screen->add_help_tab(array('title' => __('help', 'WP-OliveCart'), 'id' => 'help_tab', 'content' => $help_message->message(), 'callback' => false));
     wp_enqueue_script('postbox');
     add_meta_box('show_box1', __('Other Items No1', 'WP-OliveCart'), array(&$this, 'show_box1'), $this->pagehook, 'normal', 'core');
     add_meta_box('show_box2', __('Other Items No2', 'WP-OliveCart'), array(&$this, 'show_box2'), $this->pagehook, 'normal', 'core');
     add_meta_box('show_box3', __('Other Items No3', 'WP-OliveCart'), array(&$this, 'show_box3'), $this->pagehook, 'normal', 'core');
 }
示例#13
0
 function on_load()
 {
     $help_message = new help_message();
     $current_screen = get_current_screen();
     $this->pagehook = $current_screen->id;
     $admin_screen = WP_Screen::get($current_screen->id);
     /*Help option*/
     $admin_screen->add_help_tab(array('title' => __('help', 'WP-OliveCart'), 'id' => 'help_tab', 'content' => $help_message->message(), 'callback' => false));
     wp_enqueue_script('postbox');
     #add_meta_box( 'show_box1'  ,__('Create the "Pay with PayPal" button',  'WP-OliveCart'),
     #array(&$this, 'show_box1'),   $this->pagehook, 'normal', 'core');
     add_meta_box('show_box2', __('Custom Message (HTML Tags)', 'WP-OliveCart'), array(&$this, 'show_box2'), $this->pagehook, 'normal', 'core');
 }
示例#14
0
 /**
  * Add Help Panel
  */
 function create_help_panel()
 {
     /**
      * Create the WP_Screen object against your admin page handle
      * This ensures we're working with the right admin page
      */
     $this->admin_screen = WP_Screen::get($this->admin_page);
     /**
      * Content specified inline
      */
     $this->admin_screen->add_help_tab(array('title' => __('About Plugin', 'wp-github-gist'), 'id' => 'about_tab', 'content' => '<p>' . __("WP Github Gist WordPress Plugin, provides the ability to embed gist and files from Github in your blog posts or pages. Even though Github doesn't provide a way to embed files, this Plugin still works by using the gist-it service.", 'wp-github-gist') . '</p>', 'callback' => false));
     // Add help sidebar
     $this->admin_screen->set_help_sidebar('<p><strong>' . __('More information', 'wp-github-gist') . '</strong></p>' . '<p><a href = "http://sudarmuthu.com/wordpress/wp-github-gist">' . __('Plugin Homepage/support', 'wp-github-gist') . '</a></p>' . '<p><a href = "http://sudarmuthu.com/blog">' . __("Plugin author's blog", 'wp-github-gist') . '</a></p>' . '<p><a href = "http://sudarmuthu.com/wordpress/">' . __("Other Plugin's by Author", 'wp-github-gist') . '</a></p>');
 }
示例#15
0
 function on_load()
 {
     $help_message = new help_message();
     $current_screen = get_current_screen();
     $admin_screen = WP_Screen::get($current_screen->id);
     $this->pagehook = $current_screen->id;
     /*Help option*/
     $admin_screen->add_help_tab(array('title' => __('help', 'WP-OliveCart'), 'id' => 'help_tab', 'content' => $help_message->message(), 'callback' => false));
     wp_enqueue_script('postbox');
     #if(WPLANG == 'ja'){
     #add_meta_box( 'pref_postage_setup'  ,__('Pref Postage Setup','WP-OliveCart'),
     #array(&$this, 'pref_postage_setup'),   $this->pagehook, 'normal', 'core');
     #}
     add_meta_box('total_postage_setup', __('Total Postage Setup', 'WP-OliveCart'), array(&$this, 'total_postage_setup'), $this->pagehook, 'normal', 'core');
 }
示例#16
0
 function on_load()
 {
     $help_message = new help_message();
     $current_screen = get_current_screen();
     $this->pagehook = $current_screen->id;
     $admin_screen = WP_Screen::get($current_screen->id);
     /*Help option*/
     $admin_screen->add_help_tab(array('title' => __('help', 'WP-OliveCart'), 'id' => 'help_tab', 'content' => $help_message->message(), 'callback' => false));
     wp_enqueue_script('postbox');
     add_meta_box('show_box1', __('Mobile Theme Setup', 'WP-OliveCart'), array(&$this, 'show_box1'), $this->pagehook, 'normal', 'core');
     add_meta_box('show_box2', __('Cart Security Setup', 'WP-OliveCart'), array(&$this, 'show_box2'), $this->pagehook, 'normal', 'core');
     add_meta_box('show_box3', __('Add to Cart Button Option', 'WP-OliveCart'), array(&$this, 'show_box3'), $this->pagehook, 'normal', 'core');
     #add_meta_box( 'show_box4' ,__('Consumption tax Setup',  'WP-OliveCart'),
     #	array(&$this, 'show_box4'),   $this->pagehook, 'normal', 'core');
     add_meta_box('show_box5', __('SendMail Address', 'WP-OliveCart'), array(&$this, 'show_box5'), $this->pagehook, 'normal', 'core');
 }
示例#17
0
 /**
  * Add a help tab to current screen
  *
  * @brief Add help tab
  *
  * @param string          $title    Tab title. The title is sanitize and used as id
  * @param callable|string $callback Any string content or callable function for content.
  */
 public function addTab($title, $callable_content)
 {
     // If $callable_content is empty exit
     if (empty($callable_content)) {
         return;
     }
     // Store in global
     $this->tabs[$title] = $callable_content;
     $help_tab = array('id' => sanitize_key($title), 'title' => $title);
     if (is_string($callable_content) && !is_callable($callable_content)) {
         $help_tab['content'] = $callable_content;
     }
     if (is_callable($callable_content)) {
         $help_tab['callback'] = $callable_content;
     }
     $this->currentScreen->add_help_tab($help_tab);
 }
 function aioseop_init_class()
 {
     global $aiosp;
     require_once AIOSEOP_PLUGIN_DIR . 'aioseop_functions.php';
     require_once AIOSEOP_PLUGIN_DIR . 'aioseop_class.php';
     $aiosp = new All_in_One_SEO_Pack();
     if (aioseop_option_isset('aiosp_unprotect_meta')) {
         add_filter('is_protected_meta', 'aioseop_unprotect_meta', 10, 3);
     }
     add_action('init', array($aiosp, 'add_hooks'));
     if (defined('DOING_AJAX') && !empty($_POST) && !empty($_POST['action']) && $_POST['action'] === 'aioseop_ajax_scan_header') {
         remove_action('init', array($aiosp, 'add_hooks'));
         add_action('admin_init', 'aioseop_scan_post_header');
         add_action('shutdown', 'aioseop_ajax_scan_header');
         // if the action doesn't run -- pdb
         include_once ABSPATH . 'wp-admin/includes/screen.php';
         global $current_screen;
         if (class_exists('WP_Screen')) {
             $current_screen = WP_Screen::get('front');
         }
     }
 }
示例#19
0
文件: screen.php 项目: robbenz/plugs
/**
 * Set the current screen object
 *
 * @since 3.0.0
 *
 * @param mixed $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen,
 *	                       or an existing screen object.
 */
function set_current_screen($hook_name = '')
{
    WP_Screen::get($hook_name)->set_current_screen();
}
    add_action('wp_ajax_aioseop_ajax_delete_url', 'aioseop_ajax_delete_url');
    add_action('wp_ajax_aioseop_ajax_scan_header', 'aioseop_ajax_scan_header');
    add_action('wp_ajax_aioseop_ajax_save_settings', 'aioseop_ajax_save_settings');
    add_action('wp_ajax_aioseop_ajax_get_menu_links', 'aioseop_ajax_get_menu_links');
}
if (aioseop_option_isset('aiosp_unprotect_meta')) {
    add_filter('is_protected_meta', 'aioseop_unprotect_meta', 10, 3);
}
if (!function_exists('aioseop_scan_post_header')) {
    function aioseop_scan_post_header()
    {
        require_once ABSPATH . WPINC . '/default-filters.php';
        global $wp_query;
        $wp_query->query_vars['paged'] = 0;
        query_posts('post_type=post&posts_per_page=1');
        if (have_posts()) {
            the_post();
        }
    }
}
if (defined('DOING_AJAX') && !empty($_POST) && !empty($_POST['action']) && $_POST['action'] === 'aioseop_ajax_scan_header') {
    remove_action('init', array($aiosp, 'add_hooks'));
    add_action('admin_init', 'aioseop_scan_post_header');
    add_action('shutdown', 'aioseop_ajax_scan_header');
    // if the action doesn't run -- pdb
    include_once ABSPATH . 'wp-admin/includes/screen.php';
    global $current_screen;
    if (class_exists('WP_Screen')) {
        $current_screen = WP_Screen::get('front');
    }
}
 /**
  * Constructor.
  *
  * The child class should call this constructor from its own constructor to override
  * the default $args.
  *
  * @since 3.1.0
  * @access public
  *
  * @param array|string $args {
  *     Array or string of arguments.
  *
  *     @type string $plural   Plural value used for labels and the objects being listed.
  *                            This affects things such as CSS class-names and nonces used
  *                            in the list table, e.g. 'posts'. Default empty.
  *     @type string $singular Singular label for an object being listed, e.g. 'post'.
  *                            Default empty
  *     @type bool   $ajax     Whether the list table supports AJAX. This includes loading
  *                            and sorting data, for example. If true, the class will call
  *                            the {@see _js_vars()} method in the footer to provide variables
  *                            to any scripts handling AJAX events. Default false.
  *     @type string $screen   String containing the hook name used to determine the current
  *                            screen. If left null, the current screen will be automatically set.
  *                            Default null.
  * }
  */
 public function __construct($args = array())
 {
     $args = wp_parse_args($args, array('plural' => '', 'singular' => '', 'ajax' => false, 'screen' => null));
     //$this->screen = convert_to_screen( $args['screen'] );
     $this->screen = WP_Screen::get($args['screen']);
     add_filter("manage_{$this->screen->id}_columns", array($this, 'get_columns'), 0);
     if (!$args['plural']) {
         $args['plural'] = $this->screen->base;
     }
     $args['plural'] = sanitize_key($args['plural']);
     $args['singular'] = sanitize_key($args['singular']);
     $this->_args = $args;
     if ($args['ajax']) {
         // wp_enqueue_script( 'list-table' );
         add_action('admin_footer', array($this, '_js_vars'));
     }
     if (empty($this->modes)) {
         $this->modes = array('list' => __('List View'), 'excerpt' => __('Excerpt View'));
     }
 }
示例#22
0
 /**
  * Display inline help content
  *
  * @since 1.0.0
  *
  * @param WP_Screen $screen current screen
  *
  * @return void
  */
 public static function addHelpTab($screen)
 {
     if (!$screen) {
         return;
     }
     $content = '<p>' . esc_html(__('Twitter Embedded Tweet and Timeline widgets support customization of color theme, link color, and border color inside a rendered widget.', 'twitter')) . '</p>';
     $content .= '<p>' . esc_html(__('Choose a light or dark theme to best match the background color and text color of surrounding content.', 'twitter')) . '</p>';
     $content .= '<p>' . esc_html(__('Link color is applied to linked text including URLs, #hashtags, and @mentions.', 'twitter')) . '</p>';
     $content .= '<p>' . esc_html(__('Border color applies to borders separating Tweet sections or individual Tweets.', 'twitter')) . '</p>';
     $screen->add_help_tab(array('id' => 'twitter-theme-help', 'title' => static::featureName(), 'content' => $content));
 }
示例#23
0
文件: main.php 项目: WaitButWhy/www
 function jwl_help_screen()
 {
     /** 
      * Create the WP_Screen object against your admin page handle
      * This ensures we're working with the right admin page
      */
     $this->admin_screen = WP_Screen::get($this->pagehook);
     // Content specified inline
     $this->admin_screen->add_help_tab(array('title' => __('Help Documentation', 'jwl-ultimate-tinymce'), 'id' => 'help_tab', 'content' => '<div class="help_wrapper">' . __('<ul><li class="help_tab_list_image">The best resource for expedited help is my <a target="_blank" href="http://www.forum.joshlobe.com/">Support Forum</a>.</li><li class="help_tab_list_image">Additional information on each option may be found on the <a target="_blank" href="http://docs.joshlobe.com/">Ultimate Tinymce WIKI</a>.</li><li class="help_tab_list_image">You can also visit the <a target="_blank" href="http://www.plugins.joshlobe.com/">Plugin Page</a> to read user comments.</li></ul>', 'jwl-ultimate-tinymce') . '</div>', 'callback' => false));
     /**
      * Content generated by callback
      * The callback fires when tab is rendered - args: WP_Screen object, current tab
      */
     //$this->admin_screen->add_help_tab(
     //array( 'title' => 'Info on this Page', 'id' => 'page_info', 'content' => '', 'callback' => create_function('','echo "<p>This is my generated content.</p>";' )));
     $this->admin_screen->set_help_sidebar('<p>' . __('Ultimate Tinymce Help<br /><br /><a target="_blank" href="http://www.forum.joshlobe.com/">Support Forum</a>', 'jwl-ultimate-tinymce') . '</p><p><a target="_blank" href="http://docs.joshlobe.com/">' . __('Ultimate Tinymce WIKI', 'jwl-ultimate-tinymce') . '</a></p>');
 }
 /**
  * Fetches a WP_Screen object for this page.
  *
  * @see http://codex.wordpress.org/Class_Reference/WP_Screen
  *
  * @return WP_Screen
  */
 public function getWPScreen()
 {
     if (!$this->_wpScreen) {
         $this->_wpScreen = WP_Screen::get($this->_hook_name);
     }
     return $this->_wpScreen;
 }
示例#25
0
/**
 * Convert a screen string to a screen object
 *
 * @since 3.0.0
 *
 * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.
 * @return WP_Screen Screen object.
 */
function convert_to_screen($hook_name)
{
    if (!class_exists('WP_Screen', false)) {
        _doing_it_wrong('convert_to_screen(), add_meta_box()', __("Likely direct inclusion of wp-admin/includes/template.php in order to use add_meta_box(). This is very wrong. Hook the add_meta_box() call into the add_meta_boxes action instead."), '3.3.0');
        return (object) array('id' => '_invalid', 'base' => '_are_belong_to_us');
    }
    return WP_Screen::get($hook_name);
}
示例#26
0
    /**
     * Render the screen's help section.
     *
     * This will trigger the deprecated filters for backwards compatibility.
     *
     * @since 3.3.0
     */
    public function render_screen_meta()
    {
        /**
         * Filter the legacy contextual help list.
         *
         * @since 2.7.0
         * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or
         *                   get_current_screen()->remove_help_tab() instead.
         *
         * @param array     $old_compat_help Old contextual help.
         * @param WP_Screen $this            Current WP_Screen instance.
         */
        self::$_old_compat_help = apply_filters('contextual_help_list', self::$_old_compat_help, $this);
        $old_help = isset(self::$_old_compat_help[$this->id]) ? self::$_old_compat_help[$this->id] : '';
        /**
         * Filter the legacy contextual help text.
         *
         * @since 2.7.0
         * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or
         *                   get_current_screen()->remove_help_tab() instead.
         *
         * @param string    $old_help  Help text that appears on the screen.
         * @param string    $screen_id Screen ID.
         * @param WP_Screen $this      Current WP_Screen instance.
         *
         */
        $old_help = apply_filters('contextual_help', $old_help, $this->id, $this);
        // Default help only if there is no old-style block of text and no new-style help tabs.
        if (empty($old_help) && !$this->get_help_tabs()) {
            /**
             * Filter the default legacy contextual help text.
             *
             * @since 2.8.0
             * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or
             *                   get_current_screen()->remove_help_tab() instead.
             *
             * @param string $old_help_default Default contextual help text.
             */
            $default_help = apply_filters('default_contextual_help', '');
            if ($default_help) {
                $old_help = '<p>' . $default_help . '</p>';
            }
        }
        if ($old_help) {
            $this->add_help_tab(array('id' => 'old-contextual-help', 'title' => __('Overview'), 'content' => $old_help));
        }
        $help_sidebar = $this->get_help_sidebar();
        $help_class = 'hidden';
        if (!$help_sidebar) {
            $help_class .= ' no-sidebar';
        }
        // Time to render!
        ?>
		<div id="screen-meta" class="metabox-prefs">

			<div id="contextual-help-wrap" class="<?php 
        echo esc_attr($help_class);
        ?>
" tabindex="-1" aria-label="<?php 
        esc_attr_e('Contextual Help Tab');
        ?>
">
				<div id="contextual-help-back"></div>
				<div id="contextual-help-columns">
					<div class="contextual-help-tabs">
						<ul>
						<?php 
        $class = ' class="active"';
        foreach ($this->get_help_tabs() as $tab) {
            $link_id = "tab-link-{$tab['id']}";
            $panel_id = "tab-panel-{$tab['id']}";
            ?>

							<li id="<?php 
            echo esc_attr($link_id);
            ?>
"<?php 
            echo $class;
            ?>
>
								<a href="<?php 
            echo esc_url("#{$panel_id}");
            ?>
" aria-controls="<?php 
            echo esc_attr($panel_id);
            ?>
">
									<?php 
            echo esc_html($tab['title']);
            ?>
								</a>
							</li>
						<?php 
            $class = '';
        }
        ?>
						</ul>
					</div>

					<?php 
        if ($help_sidebar) {
            ?>
					<div class="contextual-help-sidebar">
						<?php 
            echo $help_sidebar;
            ?>
					</div>
					<?php 
        }
        ?>

					<div class="contextual-help-tabs-wrap">
						<?php 
        $classes = 'help-tab-content active';
        foreach ($this->get_help_tabs() as $tab) {
            $panel_id = "tab-panel-{$tab['id']}";
            ?>

							<div id="<?php 
            echo esc_attr($panel_id);
            ?>
" class="<?php 
            echo $classes;
            ?>
">
								<?php 
            // Print tab content.
            echo $tab['content'];
            // If it exists, fire tab callback.
            if (!empty($tab['callback'])) {
                call_user_func_array($tab['callback'], array($this, $tab));
            }
            ?>
							</div>
						<?php 
            $classes = 'help-tab-content';
        }
        ?>
					</div>
				</div>
			</div>
		<?php 
        // Setup layout columns
        /**
         * Filter the array of screen layout columns.
         *
         * This hook provides back-compat for plugins using the back-compat
         * filter instead of add_screen_option().
         *
         * @since 2.8.0
         *
         * @param array     $empty_columns Empty array.
         * @param string    $screen_id     Screen ID.
         * @param WP_Screen $this          Current WP_Screen instance.
         */
        $columns = apply_filters('screen_layout_columns', array(), $this->id, $this);
        if (!empty($columns) && isset($columns[$this->id])) {
            $this->add_option('layout_columns', array('max' => $columns[$this->id]));
        }
        if ($this->get_option('layout_columns')) {
            $this->columns = (int) get_user_option("screen_layout_{$this->id}");
            if (!$this->columns && $this->get_option('layout_columns', 'default')) {
                $this->columns = $this->get_option('layout_columns', 'default');
            }
        }
        $GLOBALS['screen_layout_columns'] = $this->columns;
        // Set the global for back-compat.
        // Add screen options
        if ($this->show_screen_options()) {
            $this->render_screen_options();
        }
        ?>
		</div>
		<?php 
        if (!$this->get_help_tabs() && !$this->show_screen_options()) {
            return;
        }
        ?>
		<div id="screen-meta-links">
		<?php 
        if ($this->get_help_tabs()) {
            ?>
			<div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">
			<a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php 
            _e('Help');
            ?>
</a>
			</div>
		<?php 
        }
        if ($this->show_screen_options()) {
            ?>
			<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
			<a href="#screen-options-wrap" id="show-settings-link" class="show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php 
            _e('Screen Options');
            ?>
</a>
			</div>
		<?php 
        }
        ?>
		</div>
		<?php 
    }
示例#27
0
 function aioseop_init_class()
 {
     global $aiosp;
     load_plugin_textdomain('all-in-one-seo-pack', false, dirname(plugin_basename(__FILE__)) . '/i18n/');
     require_once AIOSEOP_PLUGIN_DIR . 'inc/aioseop_functions.php';
     require_once AIOSEOP_PLUGIN_DIR . 'aioseop_class.php';
     require_once AIOSEOP_PLUGIN_DIR . 'inc/aioseop_updates_class.php';
     require_once AIOSEOP_PLUGIN_DIR . 'inc/commonstrings.php';
     require_once AIOSEOP_PLUGIN_DIR . 'admin/display/postedit.php';
     require_once AIOSEOP_PLUGIN_DIR . 'admin/display/general-metaboxes.php';
     require_once AIOSEOP_PLUGIN_DIR . 'inc/aiosp_common.php';
     require_once AIOSEOP_PLUGIN_DIR . 'admin/meta_import.php';
     if (AIOSEOPPRO) {
         require_once AIOSEOP_PLUGIN_DIR . 'pro/functions_general.php';
         require_once AIOSEOP_PLUGIN_DIR . 'pro/functions_class.php';
         require_once AIOSEOP_PLUGIN_DIR . 'pro/aioseop_pro_updates_class.php';
     }
     aiosp_seometa_import();
     // call importer functions... this should be moved somewhere better
     $aiosp = new All_in_One_SEO_Pack();
     $aioseop_updates = new AIOSEOP_Updates();
     if (AIOSEOPPRO) {
         $aioseop_pro_updates = new AIOSEOP_Pro_Updates();
         add_action('admin_init', array($aioseop_pro_updates, 'version_updates'), 12);
     }
     if (aioseop_option_isset('aiosp_unprotect_meta')) {
         add_filter('is_protected_meta', 'aioseop_unprotect_meta', 10, 3);
     }
     add_action('init', array($aiosp, 'add_hooks'));
     add_action('admin_init', array($aioseop_updates, 'version_updates'), 11);
     if (defined('DOING_AJAX') && !empty($_POST) && !empty($_POST['action']) && $_POST['action'] === 'aioseop_ajax_scan_header') {
         remove_action('init', array($aiosp, 'add_hooks'));
         add_action('admin_init', 'aioseop_scan_post_header');
         add_action('shutdown', 'aioseop_ajax_scan_header');
         // if the action doesn't run -- pdb
         include_once ABSPATH . 'wp-admin/includes/screen.php';
         global $current_screen;
         if (class_exists('WP_Screen')) {
             $current_screen = WP_Screen::get('front');
         }
     }
 }
示例#28
0
 birch_defmulti($ns, 'enqueue_scripts_post_list', $ns->get_post_type_lookup_config, function ($arg) {
 });
 birch_defmulti($ns, 'load_post_edit', $ns->get_post_type_lookup_config, function ($arg) {
 });
 birch_defmulti($ns, 'load_post_new', $ns->get_post_type_lookup_config, function ($arg) {
 });
 birch_defmulti($ns, 'save_post', $ns->get_post_type_lookup_config, function ($post_a) {
 });
 birch_defmulti($ns, 'pre_save_post', $ns->get_post_type_lookup_config, function ($post_data, $post_attr) {
     return $post_data;
 });
 birch_defn($ns, 'get_wp_screen', function ($hook_name) use($ns) {
     if (substr($hook_name, -4) !== '.php') {
         $hook_name = $hook_name . '.php';
     }
     $screen = WP_Screen::get($hook_name);
     return $screen;
 });
 birch_defn($ns, 'register_3rd_scripts', function () use($ns) {
     global $birchpress;
     wp_register_script('underscore_string', $birchpress->get_framework_url() . '/lib/assets/js/underscore/underscore.string.min.js', array('underscore'), '2.3.0');
 });
 birch_defn($ns, 'register_core_scripts', function () use($ns) {
     global $birchpress;
     $version = $birchpress->get_version();
     wp_register_script('birchpress', $birchpress->get_framework_url() . '/assets/js/birchpress/base.js', array('underscore', 'underscore_string'), "{$version}");
     wp_register_script('birchpress_util', $birchpress->get_framework_url() . '/assets/js/birchpress/util/base.js', array('birchpress'), "{$version}");
 });
 birch_defn($ns, 'get_current_post_type', function () {
     global $current_screen;
     if ($current_screen && $current_screen->post_type) {
示例#29
0
/**
 * Add contextual help text for a page.
 *
 * Creates an 'Overview' help tab.
 *
 * @since 2.7.0
 * @deprecated 3.3.0
 * @deprecated Use get_current_screen()->add_help_tab()
 * @see WP_Screen
 *
 * @param string    $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
 * @param string    $help   The content of an 'Overview' help tab.
 */
function add_contextual_help($screen, $help)
{
    _deprecated_function(__FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()');
    if (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    WP_Screen::add_old_compat_help($screen, $help);
}
 /**
  * _add_help_tabs
  *
  * Note child classes define their help tabs within the page_config array.
  * @link http://codex.wordpress.org/Function_Reference/add_help_tab
  *
  * @access protected
  * @return void
  */
 protected function _add_help_tabs()
 {
     $tour_buttons = '';
     if (isset($this->_page_config[$this->_req_action])) {
         $config = $this->_page_config[$this->_req_action];
         //is there a help tour for the current route?  if there is let's setup the tour buttons
         if (isset($this->_help_tour[$this->_req_action])) {
             $tb = array();
             $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
             foreach ($this->_help_tour['tours'] as $tour) {
                 //if this is the end tour then we don't need to setup a button
                 if ($tour instanceof EE_Help_Tour_final_stop) {
                     continue;
                 }
                 $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
             }
             $tour_buttons .= implode('<br />', $tb);
             $tour_buttons .= '</div></div>';
         }
         // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
         if (is_array($config) && isset($config['help_sidebar'])) {
             //check that the callback given is valid
             if (!method_exists($this, $config['help_sidebar'])) {
                 throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this)));
             }
             $content = apply_filters('FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar'])));
             $content .= $tour_buttons;
             //add help tour buttons.
             //do we have any help tours setup?  Cause if we do we want to add the buttons
             $this->_current_screen->set_help_sidebar($content);
         }
         //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar.
         if (!isset($config['help_sidebar']) && !empty($tour_buttons)) {
             $this->_current_screen->set_help_sidebar($tour_buttons);
         }
         //handle if no help_tabs are set so the sidebar will still show for the help tour buttons
         if (!isset($config['help_tabs']) && !empty($tour_buttons)) {
             $_ht['id'] = $this->page_slug;
             $_ht['title'] = __('Help Tours', 'event_espresso');
             $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>';
             $this->_current_screen->add_help_tab($_ht);
         }
         /**/
         if (!isset($config['help_tabs'])) {
             return;
         }
         //no help tabs for this route
         foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
             //we're here so there ARE help tabs!
             //make sure we've got what we need
             if (!isset($cfg['title'])) {
                 throw new EE_Error(__('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso'));
             }
             if (!isset($cfg['filename']) && !isset($cfg['callback']) && !isset($cfg['content'])) {
                 throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso'));
             }
             //first priority goes to content.
             if (!empty($cfg['content'])) {
                 $content = !empty($cfg['content']) ? $cfg['content'] : NULL;
                 //second priority goes to filename
             } else {
                 if (!empty($cfg['filename'])) {
                     $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
                     //it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
                     $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path;
                     //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
                     if (!is_readable($file_path) && !isset($cfg['callback'])) {
                         EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__);
                         return;
                     }
                     $template_args['admin_page_obj'] = $this;
                     $content = EEH_Template::display_template($file_path, $template_args, true);
                 } else {
                     $content = '';
                 }
             }
             //check if callback is valid
             if (empty($content) && (!isset($cfg['callback']) || !method_exists($this, $cfg['callback']))) {
                 EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__);
                 return;
             }
             //setup config array for help tab method
             $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
             $_ht = array('id' => $id, 'title' => $cfg['title'], 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, 'content' => $content);
             $this->_current_screen->add_help_tab($_ht);
         }
     }
 }