コード例 #1
0
 /**
  * Retrieve our options from the database
  *
  * @uses Post_Content_Shortcodes::is_multinetwork()
  * @uses get_mnetwork_option() if this is multinetwork
  * @uses get_site_option() if this is network activated in multisite
  * @uses get_option() if this is active on a single site
  * @uses Post_Content_Shortcodes::$stock_settings
  * @uses Post_Content_Shortcodes::$settings
  * @return void
  */
 protected function _get_options()
 {
     $this->settings = array();
     if (isset($_REQUEST['page']) && stristr($_REQUEST['page'], 'post-content-shortcodes')) {
         if (is_network_admin()) {
             if (1 == $GLOBALS['site_id'] && isset($_REQUEST['page']) && 'mn-post-content-shortcodes' == $_REQUEST['page']) {
                 $this->settings = get_mnetwork_option('pcs-settings', array());
             } else {
                 $this->settings = get_site_option('pcs-settings', array());
             }
         } elseif (is_admin()) {
             $this->settings = get_option('pcs-settings', array());
         }
         $this->settings = array_merge($this->stock_settings, $this->settings);
         return;
     }
     if ($this->is_multinetwork()) {
         $settings = array_merge($this->stock_settings, get_mnetwork_option('pcs-settings', array()));
         if (true === $settings['enable-network-settings']) {
             $tmp = get_site_option('pcs-settings', array());
         }
         if (true === $settings['enable-site-settings']) {
             $tmp2 = get_option('pcs-settings', array());
         }
         if (!empty($tmp2)) {
             $this->settings = array_merge($this->stock_settings, $tmp2);
             return;
         }
         if (!empty($tmp)) {
             $this->settings = array_merge($this->stock_settings, $tmp);
             return;
         }
         $this->settings = $settings;
         return;
     }
     if ($this->is_plugin_active_for_network()) {
         $settings = array_merge($this->stock_settings, get_site_option('pcs-settings', array()));
         if (true === $settings['enable-site-settings']) {
             $tmp = get_option('pcs-settings', array());
         }
         if (!empty($tmp)) {
             $this->settings = array_merge($this->stock_settings, $tmp);
             return;
         }
         $this->settings = $settings;
         return;
     }
     $this->settings = get_option('pcs-settings', array());
     $this->settings = array_merge($this->stock_settings, $this->settings);
     return;
 }
 /**
  * Retrieve the email addresses of this site's reviewers
  * @param bool $fallback=true whether to retrieve the fallback values or not
  */
 function get_reviewers($fallback = true)
 {
     if (is_multisite() && $fallback) {
         if ('' == ($r = get_option('dpn_reviewers', ''))) {
             if ('' == ($r = get_site_option('dpn_reviewers', ''))) {
                 if (function_exists('get_mnetwork_option')) {
                     $r = get_mnetwork_option('dpn_reviewers', '');
                 }
             }
         }
     } elseif (!$fallback && is_network_admin()) {
         $r = get_site_option('dpn_reviewers', array());
     } else {
         $r = get_option('dpn_reviewers', array());
     }
     if (!$fallback) {
         return empty($r) ? array() : $r;
     }
     $this->reviewers = empty($r) ? get_bloginfo('admin_email') : maybe_unserialize($r);
     return $this->reviewers;
 }