当前位置: 首页>>代码示例>>PHP>>正文


PHP TribeEvents::getNetworkOption方法代码示例

本文整理汇总了PHP中TribeEvents::getNetworkOption方法的典型用法代码示例。如果您正苦于以下问题:PHP TribeEvents::getNetworkOption方法的具体用法?PHP TribeEvents::getNetworkOption怎么用?PHP TribeEvents::getNetworkOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TribeEvents的用法示例。


在下文中一共展示了TribeEvents::getNetworkOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doContent

 /**
  * displays the content for the tab
  *
  * @since 2.0.5
  * @author jkudish
  * @return void
  */
 public function doContent()
 {
     if ($this->display_callback && function_exists($this->display_callback)) {
         call_user_func($this->display_callback);
         return;
     }
     $sent_data = get_option('tribe_settings_sent_data', array());
     if (is_array($this->fields) && !empty($this->fields)) {
         foreach ($this->fields as $key => $field) {
             if (isset($sent_data[$key])) {
                 // if we just saved [or attempted to], get the value that was inputed
                 $value = $sent_data[$key];
             } else {
                 if (is_network_admin()) {
                     $parent_option = isset($field['parent_option']) ? $field['parent_option'] : TribeEvents::OPTIONNAMENETWORK;
                 }
                 if (!is_network_admin()) {
                     $parent_option = isset($field['parent_option']) ? $field['parent_option'] : TribeEvents::OPTIONNAME;
                 }
                 // get the field's parent_option in order to later get the field's value
                 $parent_option = apply_filters('tribe_settings_do_content_parent_option', $parent_option, $key);
                 $default = isset($field['default']) ? $field['default'] : null;
                 $default = apply_filters('tribe_settings_field_default', $default, $field);
                 if (!$parent_option) {
                     // no parent option, get the straight up value
                     if (is_network_admin()) {
                         $value = get_site_option($key, $default);
                     } else {
                         $value = get_option($key, $default);
                     }
                 } else {
                     // there's a parent option
                     if ($parent_option == TribeEvents::OPTIONNAME) {
                         // get the options from TribeEvents if we're getting the main array
                         $value = TribeEvents::getOption($key, $default);
                     } elseif ($parent_option == TribeEvents::OPTIONNAMENETWORK) {
                         $value = TribeEvents::getNetworkOption($key, $default);
                     } else {
                         // else, get the parent option normally
                         if (is_network_admin()) {
                             $options = (array) get_site_option($parent_option);
                         } else {
                             $options = (array) get_option($parent_option);
                         }
                         $value = isset($options[$key]) ? $options[$key] : $default;
                     }
                 }
             }
             // escape the value for display
             if (!empty($field['esc_display']) && function_exists($field['esc_display'])) {
                 $value = $field['esc_display']($value);
             } elseif (is_string($value)) {
                 $value = esc_attr(stripslashes($value));
             }
             // filter the value
             $value = apply_filters('tribe_settings_get_option_value_pre_display', $value, $key, $field);
             // create the field
             new TribeField($key, $field, $value);
         }
     } else {
         // no fields setup for this tab yet
         echo '<p>' . __('There are no fields setup for this tab yet.', 'tribe-events-calendar') . '</p>';
     }
 }
开发者ID:scttrgd,项目名称:scottish-piping,代码行数:71,代码来源:tribe-settings-tab.class.php

示例2: addPage

 /**
  * create the main option page
  *
  * @since 2.0.5
  * @author jkudish
  * @return void
  */
 public function addPage()
 {
     if (!is_multisite() || is_multisite() && TribeEvents::getNetworkOption('allSettingsTabsHidden', '0') == '0') {
         $this->admin_page = add_submenu_page('edit.php?post_type=' . TribeEvents::POSTTYPE, __('The Events Calendar Settings', 'tribe-events-calendar'), __('Settings', 'tribe-events-calendar'), $this->requiredCap, $this->adminSlug, array($this, 'generatePage'));
     }
 }
开发者ID:scttrgd,项目名称:scottish-piping,代码行数:13,代码来源:tribe-settings.class.php


注:本文中的TribeEvents::getNetworkOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。