Beispiel #1
0
 public static function init($more = array())
 {
     if (self::$options === null) {
         self::$options = new Genesis_Club_DIY_Options(self::OPTIONS_NAME, self::$defaults);
     }
     if (count($more) > 0) {
         self::$options->add_defaults($more);
     }
 }
Beispiel #2
0
 public static function maybe_redirect()
 {
     if (is_singular()) {
         if (($post_id = Genesis_Club_Utils::get_post_id()) && ($redirect = Genesis_Club_Options::validate_options(self::redirect_defaults(), Genesis_Club_Utils::get_meta($post_id, self::REDIRECT_METAKEY))) && $redirect['url']) {
             wp_redirect($redirect['url'], $redirect['status']);
             exit;
         }
     }
     return false;
 }
Beispiel #3
0
 function save_postmeta($post_id)
 {
     $keys = array('widget' => Genesis_Club_Post_Specific_Widget::WIDGET_CONTENT_META_KEY);
     $defaults = array('widget' => Genesis_Club_Post_Specific_Widget::get_widget_defaults());
     foreach ($keys as $key => $metakey) {
         if (array_key_exists('genesis_club_' . $key, $_POST)) {
             if (is_array($_POST[$metakey])) {
                 foreach ($_POST[$metakey] as $k => $v) {
                     $_POST[$metakey][$k] = stripslashes(trim($v));
                 }
                 $val = array_key_exists($metakey, $_POST) ? @serialize(Genesis_Club_Options::validate_options($defaults[$key], $_POST[$metakey])) : false;
             } else {
                 $val = stripslashes(trim($_POST[$metakey]));
             }
             update_post_meta($post_id, $metakey, $val);
         }
     }
 }
Beispiel #4
0
 function save_dashboard()
 {
     check_admin_referer(__CLASS__);
     $modules = Genesis_Club_Plugin::get_modules_present();
     $new_options = array();
     $checked = array_key_exists('checked_modules', $_POST) ? (array) $_POST['checked_modules'] : array();
     foreach ($modules as $module => $info) {
         $key = Genesis_Club_Plugin::get_disabled_key($module);
         $new_options[$key] = !in_array($module, $checked);
     }
     $new_options['custom_post_types'] = isset($_POST['custom_post_types']) ? $_POST['custom_post_types'] : array();
     $updates = Genesis_Club_Options::save_options($new_options);
     $message = $updates ? 'Genesic Club Settings saved.' : 'No Genesis Club settings were changed since last update.';
     $redir = add_query_arg(array('message' => urlencode(__($message, GENESIS_CLUB_DOMAIN))), $_SERVER['REQUEST_URI']);
     //add the message
     wp_redirect($redir);
     exit;
 }
 function save_postmeta($post_id)
 {
     $keys = array('redirect' => Genesis_Club_Seo::REDIRECT_METAKEY);
     $defaults = array('redirect' => Genesis_Club_Seo::redirect_defaults());
     foreach ($keys as $key => $metakey) {
         if (array_key_exists('genesis_club_' . $key, $_POST)) {
             if (is_array($_POST[$metakey])) {
                 foreach ($_POST[$metakey] as $k => $v) {
                     $_POST[$metakey][$k] = stripslashes(trim($v));
                 }
                 $val = array_key_exists($metakey, $_POST) ? Genesis_Club_Options::validate_options($defaults[$key], $_POST[$metakey]) : false;
             } else {
                 $val = stripslashes(trim($_POST[$metakey]));
             }
             update_post_meta($post_id, $metakey, $val);
         }
     }
 }
Beispiel #6
0
 static function get_options()
 {
     return Genesis_Club_Options::get_option(self::OPTION_NAME);
 }
Beispiel #7
0
 static function get_options()
 {
     return Genesis_Club_Options::get_option('bar');
 }
Beispiel #8
0
 private static function save_accordions($accordions)
 {
     return Genesis_Club_Options::save_options(array('accordions' => $accordions));
 }
Beispiel #9
0
 public static function get_options()
 {
     return Genesis_Club_Options::get_option('menu');
 }
Beispiel #10
0
 public static function is_module_enabled($module)
 {
     return !Genesis_Club_Options::get_option(self::get_disabled_key($module));
 }
Beispiel #11
0
 function get_meta_form_data($metakey, $prefix, $values)
 {
     $content = array();
     if (($post_id = Genesis_Club_Utils::get_post_id()) && ($meta = Genesis_Club_Utils::get_meta($post_id, $metakey))) {
         $values = Genesis_Club_Options::validate_options($values, $meta);
     }
     foreach ($values as $key => $val) {
         $content[$key] = array();
         $content[$key]['value'] = $val;
         $content[$key]['id'] = $prefix . $key;
         $content[$key]['name'] = $metakey . '[' . $key . ']';
     }
     return $content;
 }
Beispiel #12
0
 public static function save_options($options)
 {
     return Genesis_Club_Options::save_options(array('display' => $options));
 }