get_option() публичный статический Метод

public static get_option ( $key, $default = false )
Пример #1
0
 public static function parse_to($address)
 {
     $template = Falcon::get_option('bbsub_replyto');
     // No plus address in saved, parse via splitting
     $has_match = preg_match('/\\+(\\w+)-(\\d+)-(\\d+)-(\\w+)\\@.*/i', $address, $matches);
     if (!$has_match) {
         throw new Exception(__('Reply-to not formatted correctly', 'bbsub'));
     }
     return array($matches[1], $matches[2], $matches[3], $matches[4]);
 }
Пример #2
0
    /**
     * Print field for new topic notification
     *
     * @see self::init()
     */
    public static function settings_field_topic_notification()
    {
        global $wp_roles;
        if (!$wp_roles) {
            $wp_roles = new WP_Roles();
        }
        $options = Falcon::get_option('bbsub_topic_notification', array());
        foreach ($wp_roles->get_names() as $key => $role_name) {
            $current = in_array($key, $options) ? $key : '0';
            ?>
			<label>
				<input type="checkbox" value="<?php 
            echo esc_attr($key);
            ?>
" name="bbsub_topic_notification[]" <?php 
            checked($current, $key);
            ?>
 />
				<?php 
            echo $role_name;
            ?>
			</label>
			<br />
			<?php 
        }
        echo '<span class="description">' . __('Sends new topic email and auto subscribe the users from these role to the new topic', 'bbsub') . '</span>';
    }
Пример #3
0
 /**
  * Get default notification settings
  *
  * @return array Map of type => pref value
  */
 protected function get_default_settings()
 {
     $keys = array('post' => 'all', 'comment' => 'all');
     $defaults = array();
     foreach ($keys as $key => $hardcoded_default) {
         $option_key = $this->key_for_setting('notifications.' . $key);
         $value = Falcon::get_option($option_key, null);
         $defaults[$key] = isset($value) ? $value : $hardcoded_default;
     }
     return $defaults;
 }
Пример #4
0
 /**
  * Should notifications be sent asynchronously?
  *
  * @return boolean
  */
 public static function should_send_async()
 {
     return (bool) Falcon::get_option('bbsub_send_async', false);
 }
Пример #5
0
 public static function settings_field_sites()
 {
     $sites = self::available_sites();
     $current = Falcon::get_option('falcon_enabled_sites', array());
     foreach ($sites as $site) {
         $details = get_blog_details($site['blog_id']);
         $value = absint($site['blog_id']);
         $enabled = in_array($value, $current);
         printf('<label><input type="checkbox" name="%s[]" value="%s" %s /> %s</label><br />', 'falcon_enabled_sites', esc_attr($value), checked($enabled, true, false), esc_html($details->blogname));
     }
     echo '<p class="description">' . esc_html__('Select which sites to activate Falcon on.', 'falcon') . '</p>';
 }
Пример #6
0
 /**
  * Notify the handler to register handler-specific options
  *
  * @see self::init()
  */
 public static function register_handler_settings_fields($group, $section, $handler_type = null, $current = null)
 {
     if ($current === null) {
         $current = Falcon::get_option('bbsub_handler_options', array());
     }
     try {
         $handler = Falcon::get_handler_class($handler_type);
     } catch (Exception $e) {
         return false;
     }
     $handler::register_option_fields($group, $section, $current);
 }