/** * */ public function setup() { @(include __DIR__ . '/vendor/autoload.php'); $voce_settings_api = Voce_Settings_API::GetInstance(); if (is_admin()) { $voce_settings_api->add_page('Secure Media', 'Secure Media', 'nginx-secure-media', 'manage_options', '', 'options-general.php')->add_group('Settings', 'http_secure_link')->add_setting('Expire Time', 'expiry', array('description' => 'Minimum time in seconds that a link should be valid. If you have output caching on, this should be greater than the time set for output caching.', 'sanitize_callbacks' => array('vs_sanitize_int'))); } if (defined('HTTP_SECURE_LINK_SECRET')) { $this->secret = HTTP_SECURE_LINK_SECRET; $expiry = $voce_settings_api->get_setting('expiry', 'http_secure_link'); $this->expiry = $expiry > 30 ? $expiry : 30; $this->start_buffer(); } elseif (is_admin() && current_user_can('install_plugins')) { add_action('admin_notices', array($this, 'admin_notice')); if (isset($_GET['nsm_ignore_notice'])) { update_user_meta(get_current_user_id(), 'nsm_ignore_notice', true); } } }
public function display() { $value = Voce_Settings_API::GetInstance()->get_setting($this->setting_key, $this->group->group_key, $this->default_value); if (!empty($this->args['display_callback'])) { call_user_func_array($this->args['display_callback'], array($value, $this, $this->args)); } else { // default to text field vs_display_text_field($value, $this, $this->args); } }
public static function sanitize_image_select_callback($value, $setting, $args) { return Voce_Settings_API::GetInstance()->get_setting($setting->setting_key, $setting->group->group_key); }
/** * Set default settings on plugin activation. * */ public function activation() { if (!current_user_can('activate_plugins')) { return; } delete_transient('mprt_remote_content'); $MPRT = new Multipart_Robotstxt(); $MPRT->settings(); Voce_Settings_API::GetInstance()->set_defaults('mp-robotstxt'); // force? Voce_Settings_API::GetInstance()->set_defaults( 'mp-robotstxt', true ); }
/** * add Theme Options settings specific to this theme */ function eventbrite_venue_page_settings() { if (class_exists('Voce_Eventbrite_API') && Voce_Eventbrite_API::get_auth_service()) { $settings = Voce_Settings_API::GetInstance()->add_page(__('Eventbrite', 'eventbrite-parent'), __('Eventbrite', 'eventbrite-parent'), 'eventbrite', 'edit_theme_options', '')->add_group('', Eventbrite_Settings::eventbrite_group_key())->add_setting('<h3 id="eb-pages">' . __('Recommended Page Settings for This Theme', 'eventbrite-venue') . '</h3>', 'eventbrite-page-settings', array('display_callback' => 'eventbrite_venue_page_settings_description_cb'))->group->add_setting(__('Events List', 'eventbrite-venue'), 'events-page-id', array('description' => __('This page will be used to show a list of your upcoming Eventbrite events.', 'eventbrite-venue'), 'display_callback' => 'eventbrite_venue_page_settings_cb', 'sanitize_callbacks' => array('absint')))->group->add_setting(__('Featured Events List', 'eventbrite-venue'), 'upcoming-events-page-id', array('description' => __('This page will be used to display a carousel of the selected featured Eventbrite events along with a listing of upcoming Eventbrite events.', 'eventbrite-venue'), 'display_callback' => 'eventbrite_venue_page_settings_cb', 'sanitize_callbacks' => array('absint')))->group->add_setting(__('Calendar Page', 'eventbrite-venue'), 'calendar-page-id', array('description' => __('This page will show a calendar (monthly) view of your Eventbrite events.', 'eventbrite-venue'), 'display_callback' => 'eventbrite_venue_page_settings_cb', 'sanitize_callbacks' => array('absint')))->group->add_setting(__('Additional Suggested Pages', 'eventbrite-venue'), 'suggested-pages', array('display_callback' => 'eventbrite_venue_page_suggested_cb')); } }
private static function robots_meta() { global $wp_query; $queried_object = get_queried_object(); $robots_defaults = array('index' => 'index', 'follow' => 'follow', 'other' => array()); //use this to replace the defaults, these values will be overwritten by post meta if set $robots = apply_filters('vseo_robots_defaults', $robots_defaults); if (isset($queried_object->post_type)) { if ($follow = self::get_seo_meta('robots-nofollow', get_queried_object_id())) { $robots['follow'] = $follow; } if ($index = self::get_seo_meta('robots-noindex', get_queried_object_id())) { $robots['index'] = $index; } } else { if (is_search() || is_archive()) { $robots['index'] = 'noindex'; } } foreach (array('nodp', 'noydir') as $robot) { if (Voce_Settings_API::GetInstance()->get_setting($robot, 'vseo-general')) { $robots['other'][] = $robot; } } //final filter to force values $robots = apply_filters('vseo_robots', $robots); $robots = array_intersect_key($robots, $robots_defaults); if (isset($robots['other']) && is_array($robots['other'])) { $other = array_unique($robots['other']); unset($robots['other']); $robots = array_merge($robots, $other); } $robotsstr = implode(',', $robots); if ($robotsstr !== '') { return self::create_meta_object('robots', 'meta', array('name' => 'robots', 'content' => esc_attr($robotsstr))); } else { return array(); } }
/** * adds the options page * * @return void */ public function add_options_page() { Voce_Settings_API::GetInstance()->add_page('CDN Rewrite', 'CDN Rewrite', self::OPTION_GENERAL, 'manage_options', '', 'options-general.php')->add_group('CDN Rewrite Settings', 'cdn_general')->add_setting('CDN Root URL (required)', 'root_url', array('description' => 'The base URL of the CDN.'))->group->add_setting('File Extensions (required)', 'file_extensions')->group->add_setting('CDN Root URL for CSS Files (optional)', 'css_root_url', array('description' => 'The base URL of the CDN for CSS Files.'))->group->add_setting('File Extensions for CSS Files (optional)', 'css_file_extensions')->group->add_setting('CDN Root URL for JS Files (optional, defaults to Root URL)', 'js_root_url', array('description' => 'The base URL of the CDN for JS Files.'))->group->add_setting('File Extensions for JS Files (optional, defaults to Root URL)', 'js_file_extensions'); }