當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WP_Screen::add_help_tab方法代碼示例

本文整理匯總了PHP中WP_Screen::add_help_tab方法的典型用法代碼示例。如果您正苦於以下問題:PHP WP_Screen::add_help_tab方法的具體用法?PHP WP_Screen::add_help_tab怎麽用?PHP WP_Screen::add_help_tab使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WP_Screen的用法示例。


在下文中一共展示了WP_Screen::add_help_tab方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: load_import_help

 /**
  * 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>'));
 }
開發者ID:shwetadubey,項目名稱:upfit,代碼行數:10,代碼來源:class-contextual-help.php

示例2: render_help

 /**
  * 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']);
     }
 }
開發者ID:felixarntz,項目名稱:options-definitely,代碼行數:17,代碼來源:Utility.php

示例3: applyTabs

 /**
  * Applies the new sidebar contents based on loaded files.
  *
  * This should be called during WordPress's `load-{$pagenow}` hook.
  *
  * @link https://developer.wordpress.org/reference/hooks/load-pagenow/
  *
  * @todo Allow for file types/extensions other than markdown.
  *
  * @uses Parsedown::text()
  * @uses WP_Screen::add_help_tab()
  *
  * @return @void
  */
 public function applyTabs()
 {
     foreach ($this->_tab_files as $file) {
         $lines = is_readable($file) ? file($file) : false;
         if ($lines) {
             $hash = hash('sha256', $file);
             $args = array('title' => sanitize_text_field($this->get_parsedown()->text(array_shift($lines))), 'id' => esc_attr("{$this->_screen->id}-help-tab-{$hash}"), 'content' => $this->get_parsedown()->text(implode("\n", $lines)));
             preg_match('/-([0-9]+)\\.md$/i', $file, $m);
             if ($m) {
                 $args['priority'] = absint($m[1]);
             }
             $this->_screen->add_help_tab($args);
         }
     }
 }
開發者ID:meitar,項目名稱:wordpress-plugin-skeleton,代碼行數:29,代碼來源:class-wp-screen-help-loader.php

示例4: addTab

 /**
  * 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);
 }
開發者ID:wpxtreme,項目名稱:wpdk,代碼行數:25,代碼來源:wpdk-screen-help.php

示例5: _add_help_tabs

 /**
  * _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);
         }
     }
 }
開發者ID:robert-osborne,項目名稱:event-espresso-core-1,代碼行數:97,代碼來源:EE_Admin_Page.core.php

示例6: addHelpTab

 /**
  * 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));
 }
開發者ID:cemoulto,項目名稱:wordpress,代碼行數:20,代碼來源:Theme.php

示例7: addHelpTab

 /**
  * 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>' . sprintf(esc_html(__('Site attribution is used to attribute site content to a Twitter account in %1$s and %2$s.', 'twitter')), '<a href="' . esc_url('https://dev.twitter.com/cards/overview', array('https', 'http')) . '">' . esc_html(__('Twitter Cards', 'twitter')) . '</a>', '<a href="' . esc_url('https://support.twitter.com/articles/20170934-twitter-card-analytics-dashboard', array('https', 'http')) . '">' . esc_html(__('Twitter Analytics', 'twitter')) . '</a>') . '</p>';
     $content .= '<p>' . esc_html(__('The account may also be used to note a Tweet originated from a Tweet Button on your site.', 'twitter')) . '</p>';
     $screen->add_help_tab(array('id' => 'twitter-site-attribution-help', 'title' => static::featureName(), 'content' => $content));
 }
開發者ID:cemoulto,項目名稱:wordpress,代碼行數:18,代碼來源:SiteAttribution.php

示例8: _renderContextualHelp

 /**
  * Render contextual help menu for an admin page
  *
  * @param WP_Screen $screen
  * @return string
  */
 protected function _renderContextualHelp(WP_Screen $screen)
 {
     $screen->add_help_tab(array('id' => 'overview', 'title' => __('Overview', $this->textDomain()), 'content' => $this->render('help:overview', array(), false)));
     $screen->add_help_tab(array('id' => 'visibility', 'title' => __('Visibility', $this->textDomain()), 'content' => $this->render('help:visibility', array(), false)));
     $screen->add_help_tab(array('id' => 'appearance', 'title' => __('Button Appearance', $this->textDomain()), 'content' => $this->render('help:appearance', array(), false)));
     $screen->add_help_tab(array('id' => 'location', 'title' => __('Button Location', $this->textDomain()), 'content' => $this->render('help:location', array(), false)));
     $screen->add_help_tab(array('id' => 'label', 'title' => __('Button Label', $this->textDomain()), 'content' => $this->render('help:label', array(), false)));
     $screen->add_help_tab(array('id' => 'animation', 'title' => __('Animation Options', $this->textDomain()), 'content' => $this->render('help:animation', array(), false)));
     $screen->add_help_tab(array('id' => 'advanced', 'title' => __('Advanced Options', $this->textDomain()), 'content' => $this->render('help:advanced', array(), false)));
     $screen->add_help_tab(array('id' => 'troubleshooting', 'title' => __('Troubleshooting', $this->textDomain()), 'content' => $this->render('help:troubleshooting', array(), false)));
     return '';
 }
開發者ID:masahisazumi,項目名稱:unitedmarine,代碼行數:18,代碼來源:SBTT_AdminMenuController.php


注:本文中的WP_Screen::add_help_tab方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。