コード例 #1
0
/**
 * Add HTML5 Boilerplate's .htaccess via WordPress
 */
function uncode_add_h5bp_htaccess()
{
    $options = get_option(ot_options_id());
    $theme_opt = $options['_uncode_htaccess'];
    $saved_opt = get_option("_uncode_htaccess_performace");
    if ($theme_opt === 'on' && $saved_opt !== 'on' || $theme_opt === 'off' && $saved_opt === 'on') {
        global $wp_rewrite;
        $home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;
        $htaccess_file = $home_path . '.htaccess';
        $mod_rewrite_enabled = function_exists('got_mod_rewrite') ? got_mod_rewrite() : false;
        if (!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() || is_writable($htaccess_file)) {
            if ($mod_rewrite_enabled) {
                $h5bp_rules = extract_from_markers($htaccess_file, 'HTML5 Boilerplate');
                if ($h5bp_rules === array()) {
                    $filename = dirname(__FILE__) . '/h5bp-htaccess';
                    update_option("_uncode_htaccess_performace", $theme_opt);
                    return insert_with_markers($htaccess_file, 'HTML5 Boilerplate', extract_from_markers($filename, 'HTML5 Boilerplate'));
                } else {
                    if ($theme_opt === 'off') {
                        update_option("_uncode_htaccess_performace", $theme_opt);
                        return insert_with_markers($htaccess_file, 'HTML5 Boilerplate', '');
                    }
                }
            }
        }
    }
}
コード例 #2
0
 public function do_analyze_page()
 {
     $rewrite_rules = $GLOBALS['wp_rewrite']->wp_rewrite_rules();
     $rewrite_rules_ui = array();
     $public_query_vars = apply_filters('query_vars', $GLOBALS['wp']->public_query_vars);
     $rewrite_patterns = array();
     // URL prefix
     $prefix = '';
     if (!got_mod_rewrite() && !iis7_supports_permalinks()) {
         $prefix = '/index.php';
     }
     $url_prefix = get_option('home') . $prefix . '/';
     $idx = 0;
     if ($rewrite_rules) {
         foreach ($rewrite_rules as $pattern => $substitution) {
             $idx++;
             $rewrite_patterns[$idx] = addslashes($pattern);
             $rewrite_rule_ui = array('pattern' => $pattern);
             try {
                 $regex_tree = Monkeyman_Regex::parse($pattern);
             } catch (Exception $e) {
                 $rewrite_rule_ui['error'] = $e;
             }
             $regex_groups = self::collect_groups($regex_tree);
             $rewrite_rule_ui['print'] = self::print_regex($regex_tree, $idx);
             $substitution_parts = self::parse_substitution($substitution);
             $substitution_parts_ui = array();
             foreach ($substitution_parts as $query_var => $query_value) {
                 $substitution_part_ui = array('query_var' => $query_var, 'query_value' => $query_value);
                 $query_value_ui = $query_value;
                 // Replace `$matches[DD]` with URL regex part
                 // This is so complicated to handle situations where `$query_value` contains multiple `$matches[DD]`
                 $query_value_replacements = array();
                 if (preg_match_all('/\\$matches\\[(\\d+)\\]/', $query_value, $matches, PREG_OFFSET_CAPTURE)) {
                     foreach ($matches[0] as $m_idx => $match) {
                         $regex_group_idx = $matches[1][$m_idx][0];
                         $query_value_replacements[$match[1]] = array('replacement' => self::print_regex($regex_groups[$regex_group_idx], $idx, true), 'length' => strlen($match[0]), 'offset' => $match[1]);
                     }
                 }
                 krsort($query_value_replacements);
                 foreach ($query_value_replacements as $query_value_replacement) {
                     $query_value_ui = substr_replace($query_value_ui, $query_value_replacement['replacement'], $query_value_replacement['offset'], $query_value_replacement['length']);
                 }
                 $substitution_part_ui['query_value_ui'] = $query_value_ui;
                 // Highlight non-public query vars
                 $substitution_part_ui['is_public'] = in_array($query_var, $public_query_vars);
                 $substitution_parts_ui[] = $substitution_part_ui;
             }
             $rewrite_rule_ui['substitution_parts'] = $substitution_parts_ui;
             $rewrite_rules_ui[$idx] = $rewrite_rule_ui;
         }
     }
     wp_localize_script($this->gettext_domain, 'Monkeyman_Rewrite_Analyzer_Regexes', $rewrite_patterns);
     $gettext_domain = $this->gettext_domain;
     include dirname($this->base_file) . '/ui/rewrite-analyzer.php';
 }
コード例 #3
0
ファイル: rewrite.php プロジェクト: rjagadishsingh/wp-cli
 /**
  * Update the permalink structure.
  *
  * ## DESCRIPTION
  *
  * Updates the post permalink structure.
  *
  * To regenerate a .htaccess file with WP-CLI, you'll need to add the mod_rewrite module
  * to your wp-cli.yml or config.yml. For example:
  *
  * apache_modules:
  *   - mod_rewrite
  *
  * ## OPTIONS
  *
  * <permastruct>
  * : The new permalink structure to apply.
  *
  * [--category-base=<base>]
  * : Set the base for category permalinks, i.e. '/category/'.
  *
  * [--tag-base=<base>]
  * : Set the base for tag permalinks, i.e. '/tag/'.
  *
  * [--hard]
  * : Perform a hard flush - update `.htaccess` rules as well as rewrite rules in database.
  *
  * ## EXAMPLES
  *
  *     wp rewrite structure '/%year%/%monthnum%/%postname%'
  */
 public function structure($args, $assoc_args)
 {
     global $wp_rewrite;
     // copypasta from /wp-admin/options-permalink.php
     $home_path = get_home_path();
     $iis7_permalinks = iis7_supports_permalinks();
     $prefix = $blog_prefix = '';
     if (!got_mod_rewrite() && !$iis7_permalinks) {
         $prefix = '/index.php';
     }
     if (is_multisite() && !is_subdomain_install() && is_main_site()) {
         $blog_prefix = '/blog';
     }
     $permalink_structure = $args[0] == 'default' ? '' : $args[0];
     if (!empty($permalink_structure)) {
         $permalink_structure = preg_replace('#/+#', '/', '/' . str_replace('#', '', $permalink_structure));
         if ($prefix && $blog_prefix) {
             $permalink_structure = $prefix . preg_replace('#^/?index\\.php#', '', $permalink_structure);
         } else {
             $permalink_structure = $blog_prefix . $permalink_structure;
         }
     }
     $wp_rewrite->set_permalink_structure($permalink_structure);
     // Update category or tag bases
     if (isset($assoc_args['category-base'])) {
         $category_base = $assoc_args['category-base'];
         if (!empty($category_base)) {
             $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace('#', '', $category_base));
         }
         $wp_rewrite->set_category_base($category_base);
     }
     if (isset($assoc_args['tag-base'])) {
         $tag_base = $assoc_args['tag-base'];
         if (!empty($tag_base)) {
             $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace('#', '', $tag_base));
         }
         $wp_rewrite->set_tag_base($tag_base);
     }
     // make sure we detect mod_rewrite if configured in apache_modules in config
     self::apache_modules();
     // Launch a new process to flush rewrites because core expects flush
     // to happen after rewrites are set
     $new_assoc_args = array();
     if (\WP_CLI\Utils\get_flag_value($assoc_args, 'hard')) {
         $new_assoc_args['hard'] = true;
         if (!in_array('mod_rewrite', (array) WP_CLI::get_config('apache_modules'))) {
             WP_CLI::warning("Regenerating a .htaccess file requires special configuration. See usage docs.");
         }
     }
     $process_run = WP_CLI::launch_self('rewrite flush', array(), $new_assoc_args, true, true, array('apache_modules', WP_CLI::get_config('apache_modules')));
     if (!empty($process_run->stderr)) {
         // Strip "Warning: "
         WP_CLI::warning(substr($process_run->stderr, 9));
     }
     WP_CLI::success("Rewrite structure set.");
 }
コード例 #4
0
 /**
  * Adds extra goodness whenever WP writes to .htaccess
  * 
  * @global object $wp_rewrite
  * @param string $content
  * @return boolean
  */
 function htaccess_add_rules($content)
 {
     global $wp_rewrite;
     $home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;
     $htaccess_file = $home_path . '.htaccess';
     $mod_rewrite_enabled = function_exists('got_mod_rewrite') ? got_mod_rewrite() : false;
     $firewall_rules = extract_from_markers($htaccess_file, 'Tabula Rasa');
     if ($firewall_rules === array()) {
         $filename = dirname(__FILE__) . '/TR-htaccess';
         return $this->prepend_with_markers($htaccess_file, 'Tabula Rasa', extract_from_markers($filename, 'Tabula Rasa'));
     }
     return $content;
 }
コード例 #5
0
ファイル: rewrite.php プロジェクト: nb/wp-cli
 /**
  * Update the permalink structure.
  *
  * ## OPTIONS
  *
  * <permastruct>
  * : The new permalink structure to apply.
  *
  * [--category-base=<base>]
  * : Set the base for category permalinks, i.e. '/category/'.
  *
  * [--tag-base=<base>]
  * : Set the base for tag permalinks, i.e. '/tag/'.
  *
  * [--hard]
  * : Perform a hard flush - update `.htaccess` rules as well as rewrite rules in database.
  *
  * ## EXAMPLES
  *
  *     wp rewrite structure '/%year%/%monthnum%/%postname%'
  */
 public function structure($args, $assoc_args)
 {
     global $wp_rewrite;
     // copypasta from /wp-admin/options-permalink.php
     $home_path = get_home_path();
     $iis7_permalinks = iis7_supports_permalinks();
     $prefix = $blog_prefix = '';
     if (!got_mod_rewrite() && !$iis7_permalinks) {
         $prefix = '/index.php';
     }
     if (is_multisite() && !is_subdomain_install() && is_main_site()) {
         $blog_prefix = '/blog';
     }
     $permalink_structure = $args[0] == 'default' ? '' : $args[0];
     if (!empty($permalink_structure)) {
         $permalink_structure = preg_replace('#/+#', '/', '/' . str_replace('#', '', $permalink_structure));
         if ($prefix && $blog_prefix) {
             $permalink_structure = $prefix . preg_replace('#^/?index\\.php#', '', $permalink_structure);
         } else {
             $permalink_structure = $blog_prefix . $permalink_structure;
         }
     }
     $wp_rewrite->set_permalink_structure($permalink_structure);
     // Update category or tag bases
     if (isset($assoc_args['category-base'])) {
         $category_base = $assoc_args['category-base'];
         if (!empty($category_base)) {
             $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace('#', '', $category_base));
         }
         $wp_rewrite->set_category_base($category_base);
     }
     if (isset($assoc_args['tag-base'])) {
         $tag_base = $assoc_args['tag-base'];
         if (!empty($tag_base)) {
             $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace('#', '', $tag_base));
         }
         $wp_rewrite->set_tag_base($tag_base);
     }
     // make sure we detect mod_rewrite if configured in apache_modules in config
     self::apache_modules();
     // Launch a new process to flush rewrites because core expects flush
     // to happen after rewrites are set
     $new_assoc_args = array();
     if (isset($assoc_args['hard'])) {
         $new_assoc_args['hard'] = true;
     }
     \WP_CLI::launch_self('rewrite flush', array(), $new_assoc_args);
     WP_CLI::success("Rewrite structure set.");
 }
コード例 #6
0
 function groundup_compression($rewrites)
 {
     global $wp_rewrite;
     $mod_rewrite_enabled = function_exists('got_mod_rewrite') ? got_mod_rewrite() : false;
     $home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;
     $htaccess_file = $home_path . '.htaccess';
     if (!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() || is_writable($htaccess_file)) {
         if ($mod_rewrite_enabled) {
             $gzip = "<IfModule mod_headers.c>\n\t# Make sure proxies don't deliver the wrong content\n\tHeader append Vary User-Agent env=!dont-vary\n\t</IfModule>\n\t<IfModule mod_deflate.c>\n\t# Insert filters\n\tAddOutputFilterByType DEFLATE text/plain\n\tAddOutputFilterByType DEFLATE text/html\n\tAddOutputFilterByType DEFLATE text/xml\n\tAddOutputFilterByType DEFLATE text/css\n\tAddOutputFilterByType DEFLATE text/javascript\n\tAddOutputFilterByType DEFLATE application/xml\n\tAddOutputFilterByType DEFLATE application/xhtmlxml\n\tAddOutputFilterByType DEFLATE application/rssxml\n\tAddOutputFilterByType DEFLATE application/javascript\n\tAddOutputFilterByType DEFLATE application/x-javascript\n\tAddOutputFilterByType DEFLATE application/json\n\tAddOutputFilterByType DEFLATE application/x-json\n\tAddOutputFilterByType DEFLATE application/x-httpd-php\n\tAddOutputFilterByType DEFLATE application/x-httpd-fastphp\n\tAddOutputFilterByType DEFLATE image/svgxml\n\t# Drop problematic browsers\n\tBrowserMatch ^Mozilla/4 gzip-only-text/html\n\tBrowserMatch ^Mozilla/4\\.0[678] no-gzip\n\t# IE5.x and IE6 get no gzip, but 7 should\n\tBrowserMatch \\bMSIE\\s[789] !no-gzip !gzip-only-text/html\n\t# IE 6.0 after SP2 has no gzip bugs\n\tBrowserMatch \\bMSIE.SV !no-gzip\n\t# Opera occasionally pretends to be IE with Mozilla/4.0\n\tBrowserMatch \\bOpera !no-gzip\n\t</IfModule>";
             $gzip = explode("\n", $gzip);
             return insert_with_markers($htaccess_file, 'gzip', $gzip);
         }
     }
     return $rewrites;
 }
 function __construct()
 {
     register_activation_hook(__FILE__, array($this, 'install'));
     register_uninstall_hook(__FILE__, 'Email_For_Download::uninstall');
     if (got_mod_rewrite()) {
         //	Activate Plugin Features
         add_shortcode('e4d_get_url', array($this, 'get_url'));
         add_filter('attachment_fields_to_edit', array($this, 'add_attachment_fields'), 10, 2);
         add_filter('attachment_fields_to_save', array($this, 'save_attachment_fields'), 10, 2);
         add_action('pre_get_posts', array($this, 'pre_get_posts'));
         add_action('wp', array($this, 'serve_a_file'));
         add_action('wp_head', array($this, 'add_file_refresh'));
     } else {
         //	Display Warning and activate no features
     }
 }
コード例 #8
0
 function roots_add_h5bp_htaccess($content)
 {
     global $wp_rewrite;
     $home_path = get_home_path();
     $htaccess_file = $home_path . '.htaccess';
     if (!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() || is_writable($htaccess_file)) {
         if (got_mod_rewrite()) {
             $h5bp_rules = extract_from_markers($htaccess_file, 'HTML5 Boilerplate');
             if ($h5bp_rules === array()) {
                 $filename = __DIR__ . '/h5bp-htaccess';
                 return insert_with_markers($htaccess_file, 'HTML5 Boilerplate', extract_from_markers($filename, 'HTML5 Boilerplate'));
             }
         }
     }
     return $content;
 }
コード例 #9
0
ファイル: rewrite.php プロジェクト: rpeterson/wp-cli
 /**
  * Set permalink structure
  *
  * @param array $args
  * @param array $assoc_args
  */
 public function structure($args, $assoc_args)
 {
     if (!count($args) && !count($assoc_args)) {
         WP_CLI::line("usage: wp rewrite structure <new-permalink-structure>");
         exit;
     }
     global $wp_rewrite;
     // copypasta from /wp-admin/options-permalink.php
     $home_path = get_home_path();
     $iis7_permalinks = iis7_supports_permalinks();
     $prefix = $blog_prefix = '';
     if (!got_mod_rewrite() && !$iis7_permalinks) {
         $prefix = '/index.php';
     }
     if (is_multisite() && !is_subdomain_install() && is_main_site()) {
         $blog_prefix = '/blog';
     }
     // Update base permastruct if argument is provided
     if (isset($args[0])) {
         $permalink_structure = $args[0] == 'default' ? '' : $args[0];
         if (!empty($permalink_structure)) {
             $permalink_structure = preg_replace('#/+#', '/', '/' . str_replace('#', '', $permalink_structure));
             if ($prefix && $blog_prefix) {
                 $permalink_structure = $prefix . preg_replace('#^/?index\\.php#', '', $permalink_structure);
             } else {
                 $permalink_structure = $blog_prefix . $permalink_structure;
             }
         }
         $wp_rewrite->set_permalink_structure($permalink_structure);
     }
     // Update category or tag bases
     if (isset($assoc_args['category-base'])) {
         $category_base = $assoc_args['category-base'];
         if (!empty($category_base)) {
             $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace('#', '', $category_base));
         }
         $wp_rewrite->set_category_base($category_base);
     }
     if (isset($assoc_args['tag-base'])) {
         $tag_base = $assoc_args['tag-base'];
         if (!empty($tag_base)) {
             $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace('#', '', $tag_base));
         }
         $wp_rewrite->set_tag_base($tag_base);
     }
     flush_rewrite_rules($hard);
 }
コード例 #10
0
/**
 * Add HTML5 Boilerplate's .htaccess via WordPress
 */
function roots_add_h5bp_htaccess($content)
{
    global $wp_rewrite;
    $home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;
    $htaccess_file = $home_path . '.htaccess';
    $mod_rewrite_enabled = function_exists('got_mod_rewrite') ? got_mod_rewrite() : false;
    if (!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() || is_writable($htaccess_file)) {
        if ($mod_rewrite_enabled) {
            $h5bp_rules = extract_from_markers($htaccess_file, 'HTML5 Boilerplate');
            if ($h5bp_rules === array()) {
                $filename = dirname(__FILE__) . '/h5bp-htaccess';
                return insert_with_markers($htaccess_file, 'HTML5 Boilerplate', extract_from_markers($filename, 'HTML5 Boilerplate'));
            }
        }
    }
    return $content;
}
コード例 #11
0
 protected function __construct()
 {
     require_once ABSPATH . '/wp-admin/includes/file.php';
     require_once ABSPATH . '/wp-admin/includes/misc.php';
     self::$mod_rewrite_enabled = got_mod_rewrite();
     self::$home_path = get_home_path();
     self::$wp_htaccess_file = self::$home_path . '.htaccess';
     self::$roots_htaccess_file = locate_template(['server_configs.conf', 'h5bp-htaccess.conf']);
     if (!self::$roots_htaccess_file) {
         self::$roots_htaccess_file = __DIR__ . '/h5bp-htaccess.conf';
     }
     if (!$this->verifySetup()) {
         $this->alerts();
     } else {
         self::setRulesFilters();
         $this->write();
     }
 }
コード例 #12
0
ファイル: options.php プロジェクト: Netsoro/gdnlteamgroup
function scoper_options($sitewide = false, $customize_defaults = false)
{
    if (!is_option_administrator_rs() || $sitewide && function_exists('is_super_admin') && !is_super_admin()) {
        wp_die(__awp('Cheatin&#8217; uh?'));
    }
    if ($sitewide) {
        $customize_defaults = false;
    }
    // this is intended only for storing custom default values for blog-specific options
    $ui = new ScoperOptionUI($sitewide, $customize_defaults);
    if (isset($_POST['all_otype_options'])) {
        wpp_cache_flush($sitewide);
        //global $wp_rewrite;
        //if ( ! empty($wp_rewrite) )
        //	$wp_rewrite->flush_rules();
        if (isset($_POST['rs_role_resync'])) {
            ScoperAdminLib::sync_wproles();
        }
        if (isset($_POST['rs_defaults'])) {
            $msg = __('Role Scoper options were reset to defaults.', 'scoper');
        } elseif (isset($_POST['rs_flush_cache'])) {
            $msg = __('The persistent cache was flushed.', 'scoper');
        } else {
            $msg = __('Role Scoper options were updated.', 'scoper');
        }
        // submittee_rs.php fielded this submission, but output the message here.
        echo '<div id="message" class="updated fade"><p>';
        echo $msg;
        echo '</p></div>';
    }
    global $scoper, $scoper_admin;
    define('SCOPER_REALM_ADMIN_RS', 1);
    // We need to access all config items here, even if they are normally removed due to disabling
    $scoper->load_config();
    // scoper_default_otype_options is hookable for other plugins to add pertinent items for their data sources
    scoper_refresh_default_options();
    scoper_refresh_default_otype_options();
    global $scoper_default_otype_options;
    $ui->def_otype_options = $scoper_default_otype_options;
    $ui->all_options = array();
    $ui->all_otype_options = array();
    $ui->tab_captions = array('features' => __('Features', 'scoper'), 'advanced' => __('Advanced', 'scoper'), 'realm' => __('Realm', 'scoper'), 'rs_role_definitions' => __('RS Role Definitions', 'scoper'), 'wp_role_definitions' => __('WP Role Definitions', 'scoper'), 'optscope' => __('Option Scope', 'scoper'));
    $ui->section_captions = array('features' => array('user_groups' => __('User Groups', 'scoper'), 'front_end' => __('Front End', 'scoper'), 'pages_listing' => __('Pages Listing', 'scoper'), 'categories_listing' => __('Categories Listing', 'scoper'), 'content_maintenance' => __('Content Maintenance', 'scoper'), 'role_assignment' => __('Role Assignment', 'scoper'), 'nav_menu_management' => __('Nav Menu Management', 'scoper'), 'media_library' => __('Media Library', 'scoper'), 'file_filtering' => __('File Filtering', 'scoper'), 'date_limits' => __('Role Date Limits', 'scoper'), 'internal_cache' => __('Internal Cache', 'scoper'), 'version' => __('Version', 'scoper'), 'rss_feeds' => __('RSS Feeds', 'scoper'), 'hidden_content_teaser' => __('Hidden Content Teaser', 'scoper')), 'advanced' => array('role_basis' => __('Role Basis', 'scoper'), 'page_structure' => __('Page Structure', 'scoper'), 'user_profile' => __('User Profile', 'scoper'), 'user_management' => __('User Management', 'scoper'), 'administrator_definition' => __('Administrator Definition', 'scoper'), 'limited_editing_elements' => __('Limited Editing Elements', 'scoper'), 'role_assignment_interface' => __('Role Assignment Interface', 'scoper'), 'custom_columns' => __('Custom Columns', 'scoper'), 'additional_object_roles' => __('Additional Object Roles', 'scoper')), 'realm' => array('term_object_scopes' => __('Term / Object Scope', 'scoper'), 'taxonomy_usage' => __('Taxonomy Usage', 'scoper'), 'post_type_usage' => __('Post Type Usage', 'scoper'), 'term_scope' => __('Term Scope', 'scoper'), 'object_scope' => __('Object Scope', 'scoper'), 'access_types' => __('Access Types', 'scoper')), 'rs_role_definitions' => array('' => ''), 'wp_role_definitions' => array('' => ''));
    // TODO: replace individual _e calls with these (and section, tab captions)
    $ui->option_captions = array('persistent_cache' => __('Cache roles and groups to disk', 'scoper'), 'define_usergroups' => __('Enabled', 'scoper'), 'group_ajax' => __('Use jQuery selection UI', 'scoper'), 'group_requests' => __('Enable membership requests', 'scoper'), 'group_recommendations' => __('Enable membership recommendations', 'scoper'), 'enable_group_roles' => __('Apply Group Roles', 'scoper'), 'enable_user_roles' => __('Apply User Roles', 'scoper'), 'custom_user_blogcaps' => __('Support WP Custom User Caps', 'scoper'), 'no_frontend_admin' => __('Assume No Front-end Admin', 'scoper'), 'indicate_blended_roles' => __('Indicate blended roles', 'scoper'), 'version_update_notice' => __('Notify on Version Updates', 'scoper'), 'strip_private_caption' => __('Suppress "Private:" Caption', 'scoper'), 'display_hints' => __('Display Administrative Hints', 'scoper'), 'hide_non_editor_admin_divs' => __('Specified element IDs also require the following site-wide Role:', 'scoper'), 'role_admin_blogwide_editor_only' => __('Roles and Restrictions can be set:', 'scoper'), 'feed_link_http_auth' => __('HTTP Authentication Request in RSS Feed Links', 'scoper'), 'rss_private_feed_mode' => __('Display mode for readable private posts', 'scoper'), 'rss_nonprivate_feed_mode' => __('Display mode for readable non-private posts', 'scoper'), 'feed_teaser' => __('Feed Replacement Text (use %permalink% for post URL)', 'scoper'), 'rs_page_reader_role_objscope' => $scoper->role_defs->get_display_name('rs_page_reader'), 'rs_page_author_role_objscope' => $scoper->role_defs->get_display_name('rs_page_author'), 'rs_post_reader_role_objscope' => $scoper->role_defs->get_display_name('rs_post_reader'), 'rs_post_author_role_objscope' => $scoper->role_defs->get_display_name('rs_post_author'), 'lock_top_pages' => __('Pages can be set or removed from Top Level by:', 'scoper'), 'display_user_profile_groups' => __('Display User Groups', 'scoper'), 'display_user_profile_roles' => __('Display User Roles', 'scoper'), 'user_role_assignment_csv' => __('Users CSV Entry', 'scoper'), 'admin_others_attached_files' => __('Non-editors see other users\' attached uploads', 'scoper'), 'admin_others_unattached_files' => __('Non-editors see other users\' unattached uploads', 'scoper'), 'remap_page_parents' => __('Remap pages to visible ancestor', 'scoper'), 'enforce_actual_page_depth' => __('Enforce actual page depth', 'scoper'), 'remap_thru_excluded_page_parent' => __('Remap through excluded page parent', 'scoper'), 'remap_term_parents' => __('Remap terms to visible ancestor', 'scoper'), 'enforce_actual_term_depth' => __('Enforce actual term depth', 'scoper'), 'remap_thru_excluded_term_parent' => __('Remap through excluded term parent', 'scoper'), 'limit_user_edit_by_level' => __('Limit User Edit by Level', 'scoper'), 'file_filtering' => __('Filter Uploaded File Attachments', 'scoper'), 'file_filtering_regen_key' => __('File Filtering Reset Key', 'scoper'), 'mu_sitewide_groups' => __('Share groups network-wide', 'scoper'), 'role_duration_limits' => __('Enable Role Duration Limits', 'scoper'), 'role_content_date_limits' => __('Enable Content Date Limits', 'scoper'), 'filter_users_dropdown' => __('Filter Users Dropdown', 'scoper'), 'restrictions_column' => __('Restrictions Column', 'scoper'), 'term_roles_column' => __('Term Roles Column', 'scoper'), 'object_roles_column' => __('Object Roles Column', 'scoper'), 'admin_nav_menu_filter_items' => __('List only user-editable content as available items', 'scoper'), 'do_teaser' => __('Enable', 'scoper'), 'admin_css_ids' => __('Limited Editing Elements', 'scoper'), 'limit_object_editors' => __('Limit eligible users for object-specific editing roles', 'scoper'), 'private_items_listable' => __('Include Private Pages in listing if user can read them', 'scoper'), 'use_term_roles' => __('settings', 'scoper'), 'disabled_access_types' => __('settings', 'scoper'), 'user_role_caps' => __('settings', 'scoper'), 'require_moderate_comments_cap' => __('Require moderate_comments capability', 'scoper'));
    $ui->form_options = array('features' => array('user_groups' => array('define_usergroups', 'group_ajax', 'group_requests', 'group_recommendations', 'mu_sitewide_groups'), 'front_end' => array('strip_private_caption', 'no_frontend_admin'), 'pages_listing' => array('private_items_listable', 'remap_page_parents', 'enforce_actual_page_depth', 'remap_thru_excluded_page_parent'), 'categories_listing' => array('remap_term_parents', 'enforce_actual_term_depth', 'remap_thru_excluded_term_parent'), 'content_maintenance' => array('default_private', 'sync_private', 'filter_users_dropdown', 'require_moderate_comments_cap'), 'nav_menu_management' => array('admin_nav_menu_filter_items'), 'role_assignment' => array('role_admin_blogwide_editor_only'), 'media_library' => array('admin_others_attached_files', 'admin_others_unattached_files'), 'file_filtering' => array('file_filtering', 'file_filtering_regen_key'), 'date_limits' => array('role_duration_limits', 'role_content_date_limits'), 'internal_cache' => array('persistent_cache'), 'version' => array('version_update_notice'), 'rss_feeds' => array('feed_link_http_auth', 'rss_private_feed_mode', 'rss_nonprivate_feed_mode', 'feed_teaser'), 'hidden_content_teaser' => array('do_teaser')), 'advanced' => array('role_basis' => array('enable_group_roles', 'enable_user_roles', 'custom_user_blogcaps'), 'page_structure' => array('lock_top_pages'), 'user_profile' => array('display_user_profile_groups', 'display_user_profile_roles'), 'user_management' => array('limit_user_edit_by_level'), 'limited_editing_elements' => array('admin_css_ids', 'hide_non_editor_admin_divs'), 'role_assignment_interface' => array('limit_object_editors', 'indicate_blended_roles', 'display_hints', 'user_role_assignment_csv'), 'custom_columns' => array('restrictions_column', 'term_roles_column', 'object_roles_column'), 'additional_object_roles' => array('rs_page_reader_role_objscope', 'rs_post_reader_role_objscope', 'rs_page_author_role_objscope', 'rs_post_author_role_objscope')), 'realm' => array('term_object_scopes' => array('use_term_roles'), 'access_types' => array('disabled_access_types')), 'rs_role_definitions' => array('' => array('user_role_caps')));
    if (IS_MU_RS) {
        if ($sitewide) {
            $available_form_options = $ui->form_options;
        }
        global $scoper_options_sitewide;
        global $rvy_options_sitewide;
        foreach ($ui->form_options as $tab_name => $sections) {
            foreach ($sections as $section_name => $option_names) {
                if ($sitewide) {
                    $ui->form_options[$tab_name][$section_name] = array_intersect($ui->form_options[$tab_name][$section_name], array_keys($scoper_options_sitewide));
                } else {
                    $ui->form_options[$tab_name][$section_name] = array_diff($ui->form_options[$tab_name][$section_name], array_keys($scoper_options_sitewide));
                }
            }
        }
        // WP Role Defs display follows RS Role Defs
        if (!empty($ui->form_options['rs_role_defs'][''])) {
            $ui->form_options['wp_role_defs'][''] = array('');
        }
        foreach ($ui->form_options as $tab_name => $sections) {
            foreach (array_keys($sections) as $section_name) {
                if (empty($ui->form_options[$tab_name][$section_name])) {
                    unset($ui->form_options[$tab_name][$section_name]);
                }
            }
        }
    }
    $ui->display_hints = scoper_get_option('display_hints', $sitewide, $customize_defaults);
    ?>

<div class='wrap'>
<?php 
    echo '<form action="" method="post">';
    wp_nonce_field('scoper-update-options');
    if ($sitewide) {
        echo "<input type='hidden' name='rs_options_doing_sitewide' value='1' />";
    }
    if ($customize_defaults) {
        echo "<input type='hidden' name='rs_options_customize_defaults' value='1' />";
    }
    ?>

<table width = "100%"><tr>
<td width = "90%">
<h2><?php 
    if ($sitewide) {
        _e('Role Scoper Network Options', 'scoper');
    } elseif ($customize_defaults) {
        _e('Role Scoper Default Site Options', 'scoper');
    } elseif (IS_MU_RS) {
        _e('Role Scoper Single Site Options', 'scoper');
    } else {
        _e('Role Scoper Options', 'scoper');
    }
    ?>

</h2>
</td>
<td>
<div class="submit" style="border:none;float:right;margin:0;">
<input type="submit" name="rs_submit" class="button-primary" value="<?php 
    _e('Update &raquo;', 'scoper');
    ?>
" />
</div>
</td>
</tr></table>
<?php 
    if ($sitewide) {
        $color_class = 'rs-backgreen';
        echo '<p style="margin-top:0">';
        _e('These settings will be applied to all sites.', 'scoper');
        echo '</p>';
    } elseif ($customize_defaults) {
        $color_class = 'rs-backgray';
        echo '<p style="margin-top:0">';
        _e('These are the <strong>default</strong> settings for options which can be adjusted per-site.', 'scoper');
        echo '</p>';
    } else {
        $color_class = 'rs-backtan';
    }
    $class_selected = "agp-selected_agent agp-agent {$color_class}";
    $class_unselected = "agp-unselected_agent agp-agent";
    // todo: prevent line breaks in these links
    $js_call = "agp_swap_display('rs-features', 'rs-realm', 'rs_show_features', 'rs_show_realm', '{$class_selected}', '{$class_unselected}');";
    $js_call .= "agp_swap_display('', 'rs-roledefs', '', 'rs_show_roledefs', '{$class_selected}', '{$class_unselected}');";
    $js_call .= "agp_swap_display('', 'rs-advanced', '', 'rs_show_advanced', '{$class_selected}', '{$class_unselected}');";
    $js_call .= "agp_swap_display('', 'wp-roledefs', '', 'wp_show_roledefs', '{$class_selected}', '{$class_unselected}');";
    $js_call .= "agp_swap_display('', 'rs-optscope', '', 'rs_show_optscope', '{$class_selected}', '{$class_unselected}');";
    echo "<ul class='rs-list_horiz' style='margin-bottom:-0.1em'>" . "<li class='{$class_selected}'>" . "<a id='rs_show_features' href='javascript:void(0)' onclick=\"{$js_call}\">" . $ui->tab_captions['features'] . '</a>' . '</li>';
    if (!empty($ui->form_options['advanced'])) {
        $js_call = "agp_swap_display('rs-advanced', 'rs-features', 'rs_show_advanced', 'rs_show_features', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-realm', '', 'rs_show_realm', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-roledefs', '', 'rs_show_roledefs', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'wp-roledefs', '', 'wp_show_roledefs', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-optscope', '', 'rs_show_optscope', '{$class_selected}', '{$class_unselected}');";
        echo "<li class='{$class_unselected}'>" . "<a id='rs_show_advanced' href='javascript:void(0)' onclick=\"{$js_call}\">" . $ui->tab_captions['advanced'] . '</a>' . '</li>';
    }
    if (!empty($ui->form_options['realm'])) {
        $js_call = "agp_swap_display('rs-realm', 'rs-features', 'rs_show_realm', 'rs_show_features', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-roledefs', '', 'rs_show_roledefs', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-advanced', '', 'rs_show_advanced', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'wp-roledefs', '', 'wp_show_roledefs', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-optscope', '', 'rs_show_optscope', '{$class_selected}', '{$class_unselected}');";
        echo "<li class='{$class_unselected}'>" . "<a id='rs_show_realm' href='javascript:void(0)' onclick=\"{$js_call}\">" . $ui->tab_captions['realm'] . '</a>' . '</li>';
    }
    if (!empty($ui->form_options['rs_role_definitions'])) {
        $js_call = "agp_swap_display('rs-roledefs', 'rs-features', 'rs_show_roledefs', 'rs_show_features', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-realm', '', 'rs_show_realm', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-advanced', '', 'rs_show_advanced', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'wp-roledefs', '', 'wp_show_roledefs', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-optscope', '', 'rs_show_optscope', '{$class_selected}', '{$class_unselected}');";
        echo "<li class='{$class_unselected}'>" . "<a id='rs_show_roledefs' href='javascript:void(0)' onclick=\"{$js_call}\">" . $ui->tab_captions['rs_role_definitions'] . '</a>' . '</li>';
        $js_call = "agp_swap_display('wp-roledefs', 'rs-features', 'wp_show_roledefs', 'rs_show_features', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-realm', '', 'rs_show_realm', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-advanced', '', 'rs_show_advanced', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-roledefs', '', 'rs_show_roledefs', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-optscope', '', 'rs_show_optscope', '{$class_selected}', '{$class_unselected}');";
        echo "<li class='{$class_unselected}'>" . "<a id='wp_show_roledefs' href='javascript:void(0)' onclick=\"{$js_call}\">" . $ui->tab_captions['wp_role_definitions'] . '</a>' . '</li>';
    }
    if ($sitewide) {
        $js_call = "agp_swap_display('rs-optscope', 'rs-features', 'rs_show_optscope', 'rs_show_features', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-advanced', '', 'rs_show_advanced', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-roledefs', '', 'rs_show_roledefs', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'rs-realm', '', 'rs_show_realm', '{$class_selected}', '{$class_unselected}');";
        $js_call .= "agp_swap_display('', 'wp-roledefs', '', 'wp_show_roledefs', '{$class_selected}', '{$class_unselected}');";
        echo "<li class='{$class_unselected}'>" . "<a id='rs_show_optscope' href='javascript:void(0)' onclick=\"{$js_call}\">" . $ui->tab_captions['optscope'] . '</a>' . '</li>';
    }
    echo '</ul>';
    // ------------------------- BEGIN Features tab ---------------------------------
    $tab = 'features';
    echo "<div id='rs-features' style='clear:both;margin:0' class='rs-options {$color_class}'>";
    if (scoper_get_option('display_hints', $sitewide, $customize_defaults)) {
        echo '<div class="rs-optionhint">';
        _e("This page enables <strong>optional</strong> adjustment of Role Scoper's features. For most installations, the default settings are fine.", 'scoper');
        require_once dirname(__FILE__) . '/misc/version_notice_rs.php';
        $message = scoper_pp_msg();
        echo "<br /><br /><div>{$message}</div>";
        if (IS_MU_RS && function_exists('is_super_admin') && is_super_admin()) {
            if ($sitewide) {
                if (!$customize_defaults) {
                    $link_open = "<a href='admin.php?page=rs-options'>";
                    $link_close = '</a>';
                    echo ' ';
                    if (awp_ver('3.1')) {
                        _e('Note that, depending on your configuration, site-specific options may also be available.', 'scoper');
                    } else {
                        printf(__('Note that, depending on your configuration, %1$s site-specific options%2$s may also be available.', 'scoper'), $link_open, $link_close);
                    }
                }
            } else {
                $link_open = awp_ver('3.1') ? "<a href='network/sites.php?page=rs-site_options'>" : "<a href='admin.php?page=rs-site_options'>";
                $link_close = '</a>';
                echo ' ';
                printf(__('Note that, depending on your configuration, %1$s network-wide options%2$s may also be available.', 'scoper'), $link_open, $link_close);
            }
        }
        echo '</div>';
    }
    $table_class = 'form-table rs-form-table';
    ?>


<table class="<?php 
    echo $table_class;
    ?>
" id="rs-admin_table">

<?php 
    // possible TODO: replace redundant hardcoded IDs with $id
    $section = 'user_groups';
    // --- USER GROUPS SECTION ---
    if (!empty($ui->form_options[$tab][$section])) {
        ?>

	<tr valign="top"><th scope="row">
	<?php 
        echo $ui->section_captions[$tab][$section];
        ?>

	</th><td>
	
	<?php 
        $hint = '';
        $ui->option_checkbox('define_usergroups', $tab, $section, $hint, '<br />');
        if (IS_MU_RS) {
            $hint = __('If enabled, each user group will be available for role assignment in any site.  Any existing site-specific groups will be unavailable.  Group role assignments are still site-specific.', 'scoper');
            $ui->option_checkbox('mu_sitewide_groups', $tab, $section, $hint, '');
        }
        $hint = __('Specify group membership via a search/results interface, instead of simple checkboxes.', 'scoper');
        $js_call = "agp_display_if('group_requests_div', 'group_ajax');agp_display_if('group_recommendations_div', 'group_ajax');";
        $ret = $ui->option_checkbox('group_ajax', $tab, $section, $hint, '', array('js_call' => $js_call));
        $group_ajax = $ret['val'] || !$ret['in_scope'];
        $hint = __('A general role of Group Applicant (or the request_group_membership capability) allows a user to request membership in any existing group via their user profile.', 'scoper');
        $css_display = $group_ajax ? 'block' : 'none';
        echo "<div id='group_requests_div' style='display:{$css_display}; margin-top: 1em;margin-left:2em;'>";
        $ui->option_checkbox('group_requests', $tab, $section, $hint, '');
        echo '</div>';
        $hint = __('A Group Moderator role (general or group-specific) allows a user to recommend group members, possibly in response to requests.  This can serve as a two-tier approval mechanism.', 'scoper');
        $css_display = $group_ajax ? 'block' : 'none';
        echo "<div id='group_recommendations_div' style='display:{$css_display}; margin-top: 1em;margin-left:2em;'>";
        $ui->option_checkbox('group_recommendations', $tab, $section, $hint, '');
        echo '</div>';
        ?>

	</td></tr>
<?php 
    }
    // any options accessable in this section
    // --- FRONT END SECTION ---
    $section = 'front_end';
    if (!empty($ui->form_options[$tab][$section])) {
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        echo $ui->section_captions[$tab][$section];
        ?>
</th>
	<td>

	<?php 
        $hint = __('Remove the "Private:" and "Protected" prefix from Post, Page titles', 'scoper');
        $ui->option_checkbox('strip_private_caption', $tab, $section, $hint, '<br />');
        $hint = __('Reduce memory usage for front-end access by assuming no content, categories or users will be created or edited there. Worst case scenario if you assume wrong: manually assign roles/restrictions to new content or re-sync user roles via plugin re-activation.', 'scoper');
        $ui->option_checkbox('no_frontend_admin', $tab, $section, $hint, '');
        ?>

	</td></tr>
<?php 
    }
    // any options accessable in this section
    $section = 'pages_listing';
    if (!empty($ui->form_options[$tab][$section])) {
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        // --- PAGES LISTING SECTION ---
        echo $ui->section_captions[$tab][$section];
        ?>
</th>
	<td>

	<?php 
        $otype_caption = __('Include Private %s in listing if user can read them', 'scoper');
        $hint = __('Determines whether administrators, editors and users who have been granted access to a private page will see it in their sidebar or topbar page listing.', 'scoper');
        $ui->otype_option_checkboxes('private_items_listable', $otype_caption, $tab, $section, $hint, '<br /><br />', array('caption_header' => false));
        $hint = __('If a page\'s parent is not visible to the user, it will be listed below a visible grandparent instead.', 'scoper');
        $js_call = "agp_display_if('enforce_actual_page_depth_div', 'remap_page_parents');agp_display_if('remap_thru_excluded_page_parent_div', 'remap_page_parents');";
        $ret = $ui->option_checkbox('remap_page_parents', $tab, $section, $hint, '', array('js_call' => $js_call));
        $do_remap = $ret['val'] || !$ret['in_scope'];
        $hint = __('When remapping page parents, apply any depth limits to the actual depth below the requested root page.  If disabled, depth limits apply to apparant depth following remap.', 'scoper');
        $css_display = $do_remap ? 'block' : 'none';
        echo "<div id='enforce_actual_page_depth_div' style='display:{$css_display}; margin-top: 1em;margin-left:2em;'>";
        $ui->option_checkbox('enforce_actual_page_depth', $tab, $section, $hint, '');
        echo '</div>';
        $hint = __('Remap a page to next visible ancestor even if some hidden ancestors were explicitly excluded in the get_pages / list_pages call.', 'scoper');
        $css_display = $do_remap ? 'block' : 'none';
        echo "<div id='remap_thru_excluded_page_parent_div' style='display:{$css_display}; margin-top: 1em;margin-left:2em;'>";
        $ui->option_checkbox('remap_thru_excluded_page_parent', $tab, $section, $hint, '');
        echo '</div>';
        ?>

	</td></tr>
<?php 
    }
    // any options accessable in this section
    $section = 'categories_listing';
    if (!empty($ui->form_options[$tab][$section])) {
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        // --- CATEGORIES LISTING SECTION ---
        echo $ui->section_captions[$tab][$section];
        ?>
</th>
	<td>

	<?php 
        $hint = __('If a category\'s parent is not visible to the user, it will be listed below a visible grandparent instead.', 'scoper');
        $js_call = "agp_display_if('enforce_actual_term_depth_div', 'remap_term_parents');agp_display_if('remap_thru_excluded_term_parent_div', 'remap_term_parents');";
        $ret = $ui->option_checkbox('remap_term_parents', $tab, $section, $hint, '', array('js_call' => $js_call));
        $do_remap = $ret['val'] || !$ret['in_scope'];
        $hint = __('When remapping category parents, apply any depth limits to the actual depth below the requested root category.  If disabled, depth limits apply to apparant depth following remap.', 'scoper');
        $css_display = $do_remap ? 'block' : 'none';
        echo "<div id='enforce_actual_term_depth_div' style='display:{$css_display}; margin-top: 1em;margin-left:2em;'>";
        $ret = $ui->option_checkbox('enforce_actual_term_depth', $tab, $section, $hint, '');
        echo '</div>';
        $hint = __('Remap a category to next visible ancestor even if some hidden ancestors were explicitly excluded in the get_terms / get_categories call.', 'scoper');
        $css_display = $do_remap ? 'block' : 'none';
        echo "<div id='remap_thru_excluded_term_parent_div' style='display:{$css_display}; margin-top: 1em;margin-left:2em;'>";
        $ret = $ui->option_checkbox('remap_thru_excluded_term_parent', $tab, $section, $hint, '');
        echo '</div>';
        ?>
	

	</td></tr>
<?php 
    }
    // any options accessable in this section
    $section = 'content_maintenance';
    if (!empty($ui->form_options[$tab][$section])) {
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        // --- CONTENT MAINTENANCE SECTION ---
        echo $ui->section_captions[$tab][$section];
        ?>

	</th><td>

	<?php 
        $caption = __('Default new %s to Private visibility', 'scoper');
        $hint = __('Note: this does not apply to Quickposts or XML-RPC submissions.', 'scoper');
        $ui->otype_option_checkboxes('default_private', $caption, $tab, $section, $hint, '<br /><br />');
        $caption = __('Auto-set %s to Private visibility if Reader role is restricted', 'scoper');
        $hint = __('Note: this is only done if the Reader role is restricted via Post/Page edit form.', 'scoper');
        $ui->otype_option_checkboxes('sync_private', $caption, $tab, $section, $hint, '<br /><br />');
        $hint = __('If enabled, Post Author and Page Author selection dropdowns will be filtered based on scoped roles.', 'scoper');
        $ret = $ui->option_checkbox('filter_users_dropdown', $tab, $section, $hint, '<br />');
        $hint = __('If enabled, Post Author / Editors cannot moderate comments unless their assigned role(s) include the moderate_comments capability.', 'scoper');
        $ret = $ui->option_checkbox('require_moderate_comments_cap', $tab, $section, $hint, '');
        ?>


	</td>
	</tr>
<?php 
    }
    // any options accessable in this section
    $section = 'nav_menu_management';
    if (!empty($ui->form_options[$tab][$section])) {
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        echo $ui->section_captions[$tab][$section];
        // --- NAV MENU MANAGEMENT SECTION ---
        ?>
</th><td>
	
	<?php 
        $hint = '';
        $ui->option_checkbox('admin_nav_menu_filter_items', $tab, $section, $hint, '');
        ?>

		
	</td></tr>
<?php 
    }
    // any options accessable in this section
    $section = 'role_assignment';
    if (!empty($ui->form_options[$tab][$section])) {
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        // --- ROLE ASSIGNMENT SECTION ---
        echo $ui->section_captions[$tab][$section];
        ?>

	</th><td>
<?php 
        if (in_array('role_admin_blogwide_editor_only', $ui->form_options[$tab][$section])) {
            $id = 'role_admin_blogwide_editor_only';
            $ui->all_options[] = $id;
            $current_setting = strval(scoper_get_option($id, $sitewide, $customize_defaults));
            // force setting and corresponding keys to string, to avoid quirks with integer keys
            if ($current_setting === '') {
                $current_setting = '0';
            }
            ?>

		<div class="agp-vspaced_input">
		<label for="role_admin_blogwide_editor_only">
		<?php 
            echo $ui->option_captions['role_admin_blogwide_editor_only'];
            $captions = array('0' => __('by the Author or Editor of any Post/Category/Page', 'scoper'), '1' => __('by site-wide Editors and Administrators', 'scoper'), 'admin_content' => __('by Content Administrators only', 'scoper'), 'admin' => __('by User Administrators only', 'scoper'));
            // legacy-stored 'admin' in older versions
            foreach ($captions as $key => $value) {
                $key = strval($key);
                echo "<div style='margin: 0 0 0.5em 2em;'><label for='{$id}_{$key}'>";
                $checked = $current_setting === $key ? "checked='checked'" : '';
                echo "<input name='{$id}' type='radio' id='{$id}_{$key}' value='{$key}' {$checked} />";
                echo $value;
                echo '</label></div>';
            }
            ?>

		<span class="rs-subtext">
		<?php 
            if ($ui->display_hints) {
                _e('Specify which users can assign and restrict roles <strong>for their content</strong> - via Post/Page Edit Form or Roles/Restrictions sidebar menu.  For a description of Administrator roles, see the Advanced tab.', 'scoper');
            }
            ?>

		</span>
		</div>
	<?php 
        }
        // endif role_admin_blogwide_editor_only controlled in this option scope
        ?>

	</td>
	</tr>
<?php 
    }
    // any options accessable in this section
    $section = 'media_library';
    if (!empty($ui->form_options[$tab][$section])) {
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        // --- MEDIA LIBRARY SECTION ---
        echo $ui->section_captions[$tab][$section];
        ?>

	</th><td>
<?php 
        $hint = __('For users who are not site-wide Editors, determines Media Library visibility of files uploaded by another user and now attached to a post which the logged user can edit.', 'scoper');
        $ret = $ui->option_checkbox('admin_others_attached_files', $tab, $section, $hint, '');
        $hint = __('For users who are not site-wide Editors, determines Media Library visibility of unattached files which were uploaded by another user.', 'scoper');
        $ret = $ui->option_checkbox('admin_others_unattached_files', $tab, $section, $hint, '');
        ?>

	</td>
	</tr>
<?php 
    }
    // any options accessable in this section
    $section = 'file_filtering';
    if (!empty($ui->form_options[$tab][$section])) {
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        // --- ATTACHMENTS SECTION ---
        echo $ui->section_captions[$tab][$section];
        ?>
</th>
	<td>
	
	<?php 
        if (in_array('file_filtering', $ui->form_options[$tab][$section])) {
            $ui->all_options[] = 'file_filtering';
            $site_url = untrailingslashit(get_option('siteurl'));
            if (defined('DISABLE_ATTACHMENT_FILTERING')) {
                $content_dir_notice = __('<strong>Note</strong>: Direct access to uploaded file attachments will not be filtered because DISABLE_ATTACHMENT_FILTERING is defined, perhaps in wp-config.php or role-scoper.php', 'scoper');
            } elseif (MULTISITE && defined('SCOPER_NO_HTACCESS')) {
                $content_dir_notice = __('<strong>Note</strong>: Direct access to uploaded file attachments will not be filtered because SCOPER_NO_HTACCESS is defined, perhaps in wp-config.php or role-scoper.php', 'scoper');
            } else {
                require_once SCOPER_ABSPATH . '/rewrite-rules_rs.php';
                require_once SCOPER_ABSPATH . '/uploads_rs.php';
                $uploads = scoper_get_upload_info();
                if (!got_mod_rewrite()) {
                    $content_dir_notice = __('<strong>Note</strong>: Direct access to uploaded file attachments cannot be filtered because mod_rewrite is not enabled on your server.', 'scoper');
                } elseif (false === strpos($uploads['baseurl'], $site_url)) {
                    $content_dir_notice = __('<strong>Note</strong>: Direct access to uploaded file attachments cannot be filtered because your WP_CONTENT_DIR is not in the WordPress branch.', 'scoper');
                } elseif (!ScoperRewrite::site_config_supports_rewrite()) {
                    $content_dir_notice = __('<strong>Note</strong>: Direct access to uploaded file attachments will not be filtered due to your nonstandard UPLOADS path.', 'scoper');
                } else {
                    global $wp_rewrite;
                    if (empty($wp_rewrite->permalink_structure)) {
                        $content_dir_notice = __('<strong>Note</strong>: Direct access to uploaded file attachments cannot be filtered because WordPress permalinks are set to default.', 'scoper');
                    }
                }
            }
            $disabled = !empty($content_dir_notice);
            $attachment_filtering = !$disabled && scoper_get_option('file_filtering', $sitewide, $customize_defaults);
            ?>

		<label for="file_filtering">
		<input name="file_filtering" type="checkbox" id="file_filtering" <?php 
            echo $disabled;
            ?>
 value="1" <?php 
            checked(true, $attachment_filtering);
            ?>
 />
		<?php 
            echo $ui->option_captions['file_filtering'];
            ?>
</label>
		<br />
		<div class="rs-subtext">
		<?php 
            if ($ui->display_hints) {
                _e('Block direct URL access to images and other uploaded files in the WordPress uploads folder which are attached to post(s)/page(s) that the user cannot read.  A separate RewriteRule will be added to your .htaccess file for each protected file.  Non-protected files are returned with no script execution whatsoever.', 'scoper');
            }
            if ($attachment_filtering) {
                /*
                if ( $ui->display_hints) {
                	if ( IS_MU_RS && ! defined('SCOPER_MU_FILE_PROCESSING') ) {
                		echo '</div><div class="agp-vspaced_input" style="margin-top: 1em">';
                		_e("<strong>Note:</strong> The default WP-MU file request script, <strong>wp-content/blogs.php</strong>, requires a patch for compatibility with RS file filtering.  If you need the advanced cache control provided by blogs.php, review the notes in <strong>role-scoper/mu_wp_content_optional/blogs.php</strong> and copy it into wp-content if desired.  Otherwise, files will be accessed directly via header redirect following RS filtering.  If you decide to install the patched blogs.php, add the following line to wp-config.php:<br />&nbsp;&nbsp;&nbsp; define( 'SCOPER_MU_FILE_PROCESSING', true);", 'scoper');
                		echo '</div>';
                	}
                }
                */
            } elseif (!empty($content_dir_notice)) {
                echo '<br /><span class="rs-warning">';
                echo $content_dir_notice;
                echo '</span>';
            }
            ?>

		</div><br />
		
		<?php 
            $id = 'file_filtering_regen_key';
            $ui->all_options[] = $id;
            $val = scoper_get_option($id);
            echo "<div><label for='{$id}'>";
            echo $ui->option_captions[$id];
            ?>

		<input name="<?php 
            echo $id;
            ?>
" type="text" style="vertical-align:middle; width: 8em" id="<?php 
            echo $id;
            ?>
" value="<?php 
            echo $val;
            ?>
" />
		</label>
		</div>
		
		<?php 
            if ($ui->display_hints) {
                echo '<div class="rs-subtext">';
                if ($val) {
                    if (IS_MU_RS) {
                        _e('To force regeneration of file attachment access keys (at next site access), execute the following URL:', 'scoper');
                    } else {
                        _e('To force regeneration of file attachment access keys, execute the following URL:', 'scoper');
                    }
                    $url = site_url("index.php?action=expire_file_rules&key={$val}");
                    echo "<br />&nbsp;&nbsp;<a href='{$url}'>{$url}</a>";
                } else {
                    _e('Supply a custom key which will enable a support url to regenerate file access keys.  Then execute the url regularly (using your own cron service) to prevent long-term bookmarking of protected files.', 'scoper');
                }
                echo '</div>';
            }
            ?>

		<br />

		<?php 
            //printf( _ x('<strong>Note:</strong> FTP-uploaded files will not be filtered correctly until you run the %1$sAttachments Utility%2$s.', 'arguments are link open, link close', 'scoper'), "<a href='admin.php?page=rs-attachments_utility'>", '</a>');
            printf(__('<strong>Note:</strong> FTP-uploaded files will not be filtered correctly until you run the %1$sAttachments Utility%2$s.', 'scoper'), "<a href='admin.php?page=rs-attachments_utility'>", '</a>');
            echo '<br /><br />';
            _e('If WordPress or any plugin output visible PHP warnings during filtering of a protected image request, the image will not be successfully returned.', 'scoper');
            ?>

		<br />
	<?php 
        }
        ?>

	
	</td></tr>
<?php 
    }
    // any options accessable in this section
    $section = 'date_limits';
    if (!empty($ui->form_options[$tab][$section])) {
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        echo $ui->section_captions[$tab][$section];
        // --- ROLE DATE LIMITS SECTION ---
        ?>
</th><td>
	
	<?php 
        $hint = __('Allow the delay or expiration of roles based on a specified date range.', 'scoper');
        $ret = $ui->option_checkbox('role_duration_limits', $tab, $section, $hint, '');
        $hint = __('Allow General Roles and Category Roles to be limited to content dated within in a specified range.', 'scoper');
        $ret = $ui->option_checkbox('role_content_date_limits', $tab, $section, $hint, '');
        ?>

	
	</td></tr>
<?php 
    }
    // any options accessable in this section
    $section = 'internal_cache';
    if (!empty($ui->form_options[$tab][$section])) {
        // --- PERSISTENT CACHE SECTION ---
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        echo $ui->section_captions[$tab][$section];
        ?>
</th>
	<td>
		
	<?php 
        if (in_array('persistent_cache', $ui->form_options[$tab][$section])) {
            $ui->all_options[] = 'persistent_cache';
            $cache_selected = scoper_get_option('persistent_cache', $sitewide, $customize_defaults);
            $cache_enabled = $cache_selected && !defined('DISABLE_PERSISTENT_CACHE');
            ?>

		<label for="persistent_cache">
		<input name="persistent_cache" type="checkbox" id="persistent_cache" value="1" <?php 
            checked(true, $cache_enabled);
            ?>
 />
		<?php 
            echo $ui->option_captions['persistent_cache'];
            ?>
</label>
		<br />
		<span class="rs-subtext">
		<?php 
            if ($ui->display_hints) {
                _e('Group membership, role restrictions, role assignments and some filtered results (including term listings and WP page, category and bookmark listings) will be stored to disk, on a user-specific or group-specific basis where applicable.  This does not cache content such as post listings or page views.', 'scoper');
            }
            echo '</span>';
            $cache_msg = '';
            if ($cache_selected && !wpp_cache_test($cache_msg, 'scoper')) {
                echo '<div class="agp-vspaced_input"><span class="rs-warning">';
                echo $cache_msg;
                echo '</span></div>';
            } elseif ($cache_enabled && !file_exists('../rs_cache_flush.php') && !file_exists('..\\rs_cache_flush.php')) {
                echo '<div class="agp-vspaced_input"><span class="rs-warning">';
                _e('<strong>Note:</strong> The internal caching code contains numerous safeguards against corruption.  However, if it does become corrupted your site may be inaccessable.  For optimal reliability, copy rs_cache_flush.php into your WP root directory so it can be executed directly if needed.', 'scoper');
                echo '</span></div>';
            }
            ?>

		
		<?php 
            if ($cache_enabled) {
                ?>

		<br />
		<span class="submit" style="border:none;float:left;margin-top:0">
		<input type="submit" name="rs_flush_cache" value="<?php 
                _e('Flush Cache', 'scoper');
                ?>
" />
		</span>
		<?php 
            }
            ?>

	<?php 
        }
        ?>

		
	</td></tr>
<?php 
    }
    // any options accessable in this section
    $section = 'version';
    if (!empty($ui->form_options[$tab][$section])) {
        // --- VERSION SECTION ---
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        echo $ui->section_captions[$tab][$section];
        ?>
</th>
	<td>
	
	<?php 
        if (in_array('version_update_notice', $ui->form_options[$tab][$section])) {
            $ui->all_options[] = 'version_update_notice';
            ?>

		<?php 
            printf(__("Role Scoper Version: %s", 'scoper'), SCOPER_VERSION);
            echo '<br />';
            printf(__("Database Schema Version: %s", 'scoper'), SCOPER_DB_VERSION);
            echo '<br />';
            global $wp_version;
            printf(__("WordPress Version: %s", 'scoper'), $wp_version);
            echo '<br />';
            printf(__("PHP Version: %s", 'scoper'), phpversion());
            echo '<br />';
            $hint = '';
            $ui->option_checkbox('version_update_notice', $tab, $section, $hint, '<br />');
            ?>

	<?php 
        }
        ?>

		
	</td></tr>
<?php 
    }
    // any options accessable in this section
    $section = 'rss_feeds';
    if (!empty($ui->form_options[$tab][$section])) {
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        // --- RSS FEEDS SECTION ---
        echo $ui->section_captions[$tab][$section];
        ?>
</th>
	<td>
	
	<?php 
        if (in_array('feed_link_http_auth', $ui->form_options[$tab][$section])) {
            if (!defined('HTTP_AUTH_DISABLED_RS')) {
                $id = 'feed_link_http_auth';
                $ui->all_options[] = $id;
                $current_setting = scoper_get_option($id, $sitewide, $customize_defaults);
                echo $ui->option_captions['feed_link_http_auth'];
                echo "&nbsp;<select name='{$id}' id='{$id}'>";
                $captions = array(0 => __('never', 'scoper'), 1 => __('always', 'scoper'), 'logged' => __('for logged users', 'scoper'));
                foreach ($captions as $key => $value) {
                    $selected = $current_setting == $key ? 'selected="selected"' : '';
                    echo "\n\t<option value='{$key}' " . $selected . ">{$captions[$key]}</option>";
                }
                echo '</select>&nbsp;';
                echo "<br />";
                echo '<span class="rs-subtext">';
                if ($ui->display_hints) {
                    _e('Suffix RSS feed links with an extra parameter to trigger required HTTP authentication. Note that anonymous and cookie-based RSS will still be available via the standard feed URL.', 'scoper');
                }
                echo '</span>';
            } else {
                echo '<span class="rs-warning">';
                _e('cannot use HTTP Authentication for RSS Feeds because another plugin has already defined the function "get_currentuserinfo"', 'scoper');
                echo '</span>';
            }
            echo "<br /><br />";
        }
        ?>

		
	<?php 
        if (in_array('rss_private_feed_mode', $ui->form_options[$tab][$section])) {
            $ui->all_options[] = 'rss_private_feed_mode';
            //echo ( _ x( 'Display', 'prefix to RSS content dropdown', 'scoper' ) );
            echo __('Display', 'scoper');
            echo '&nbsp;<select name="rss_private_feed_mode" id="rss_private_feed_mode">';
            $captions = array('full_content' => __("Full Content", 'scoper'), 'excerpt_only' => __("Excerpt Only", 'scoper'), 'title_only' => __("Title Only", 'scoper'));
            foreach ($captions as $key => $value) {
                $selected = scoper_get_option('rss_private_feed_mode', $sitewide, $customize_defaults) == $key ? 'selected="selected"' : '';
                echo "\n\t<option value='{$key}' " . $selected . ">{$captions[$key]}</option>";
            }
            echo '</select>&nbsp;';
            //echo ( _ x( 'for readable private posts', 'suffix to RSS content dropdown', 'scoper' ) );
            echo __('for readable private posts', 'scoper');
            echo "<br />";
        }
        ?>

	
	<?php 
        if (in_array('rss_nonprivate_feed_mode', $ui->form_options[$tab][$section])) {
            $ui->all_options[] = 'rss_nonprivate_feed_mode';
            //echo ( _ x( 'Display', 'prefix to RSS content dropdown', 'scoper' ) );
            echo __('Display', 'scoper');
            echo '&nbsp;<select name="rss_nonprivate_feed_mode" id="rss_nonprivate_feed_mode">';
            $captions = array('full_content' => __("Full Content", 'scoper'), 'excerpt_only' => __("Excerpt Only", 'scoper'), 'title_only' => __("Title Only", 'scoper'));
            foreach ($captions as $key => $value) {
                $selected = scoper_get_option('rss_nonprivate_feed_mode', $sitewide, $customize_defaults) == $key ? 'selected="selected"' : '';
                echo "\n\t<option value='{$key}' " . $selected . ">{$captions[$key]}</option>";
            }
            echo '</select>&nbsp;';
            //echo ( _ x( 'for readable non-private posts', 'suffix to RSS content dropdown', 'scoper' ) );
            echo __('for readable non-private posts', 'scoper');
            echo "<br />";
            ?>

		<span class="rs-subtext">
		<?php 
            if ($ui->display_hints) {
                _e('Since some browsers will cache feeds without regard to user login, block RSS content even for qualified users.', 'scoper');
            }
            ?>

		</span>
		<br /><br />
	<?php 
        }
        ?>

		
	<?php 
        if (in_array('feed_teaser', $ui->form_options[$tab][$section])) {
            $id = 'feed_teaser';
            $ui->all_options[] = $id;
            $val = htmlspecialchars(scoper_get_option($id, $sitewide, $customize_defaults));
            echo "<label for='{$id}'>";
            _e('Feed Replacement Text (use %permalink% for post URL)', 'scoper');
            echo "<br /><textarea name='{$id}' cols=60 rows=1 id='{$id}'>{$val}</textarea>";
            echo "</label>";
        }
        ?>

	
	</td></tr>
<?php 
    }
    // any options accessable in this section
    $section = 'hidden_content_teaser';
    if (!empty($ui->form_options[$tab][$section]) && in_array('do_teaser', $ui->form_options[$tab][$section])) {
        // for now, teaser option are all-or-nothing sitewide / blogwide
        ?>

	<tr valign="top">
	<th scope="row"><?php 
        // --- HIDDEN CONTENT TEASER SECTION ---
        echo $ui->section_captions[$tab][$section];
        ?>
</th>
	<td>
	<?php 
        // a "do teaser checkbox for each data source" that has a def_otype_options	entry
        $option_basename = 'do_teaser';
        if (isset($ui->def_otype_options[$option_basename])) {
            $ui->all_otype_options[] = $option_basename;
            $opt_vals = scoper_get_option($option_basename, $sitewide, $customize_defaults);
            if (!$opt_vals || !is_array($opt_vals)) {
                $opt_vals = array();
            }
            $do_teaser = array_merge($ui->def_otype_options[$option_basename], $opt_vals);
            $option_hide_private = 'teaser_hide_private';
            $ui->all_otype_options[] = $option_hide_private;
            $opt_vals = scoper_get_option($option_hide_private, $sitewide, $customize_defaults);
            if (!$opt_vals || !is_array($opt_vals)) {
                $opt_vals = array();
            }
            $hide_private = array_merge($ui->def_otype_options[$option_hide_private], $opt_vals);
            $option_use_teaser = 'use_teaser';
            $ui->all_otype_options[] = $option_use_teaser;
            $opt_vals = scoper_get_option($option_use_teaser, $sitewide, $customize_defaults);
            if (!$opt_vals || !is_array($opt_vals)) {
                $opt_vals = array();
            }
            $use_teaser = array_merge($ui->def_otype_options[$option_use_teaser], $opt_vals);
            $option_logged_only = 'teaser_logged_only';
            $ui->all_otype_options[] = $option_logged_only;
            $opt_vals = scoper_get_option($option_logged_only, $sitewide, $customize_defaults);
            if (!$opt_vals || !is_array($opt_vals)) {
                $opt_vals = array();
            }
            $logged_only = array_merge($ui->def_otype_options[$option_logged_only], $opt_vals);
            // loop through each source that has a default do_teaser setting defined
            foreach ($do_teaser as $src_name => $val) {
                $id = $option_basename . '-' . $src_name;
                echo '<div class="agp-vspaced_input">';
                echo "<label for='{$id}'>";
                $checked = $val ? ' checked="checked"' : '';
                $js_call = "agp_display_if('teaserdef-{$src_name}', '{$id}');agp_display_if('teaser_usage-{$src_name}', '{$id}');agp_display_if('teaser-pvt-{$src_name}', '{$id}');";
                echo "<input name='{$id}' type='checkbox' onclick=\"{$js_call}\" id='{$id}' value='1' {$checked} /> ";
                $display = scoper_display_otypes_or_source_name($src_name);
                printf(__("Enable teaser for %s", 'scoper'), $display);
                echo '</label><br />';
                $css_display = $do_teaser[$src_name] ? 'block' : 'none';
                $style = "style='margin-left: 1em;'";
                echo "<div id='teaser_usage-{$src_name}' style='display:{$css_display};'>";
                // loop through each object type (for current source) to provide a use_teaser checkbox
                foreach ($use_teaser as $src_otype => $teaser_setting) {
                    if ($src_name != scoper_src_name_from_src_otype($src_otype)) {
                        continue;
                    }
                    if (is_bool($teaser_setting)) {
                        $teaser_setting = intval($teaser_setting);
                    }
                    $id = str_replace(':', '_', $option_use_teaser . '-' . $src_otype);
                    echo '<div class="agp-vspaced_input">';
                    echo "<label for='{$id}' style='margin-left: 2em;'>";
                    $item_label_singular = $scoper_admin->interpret_src_otype($src_otype);
                    printf(__("%s:", 'scoper'), $item_label_singular);
                    echo "<select name='{$id}' id='{$id}'>";
                    $num_chars = defined('SCOPER_TEASER_NUM_CHARS') ? SCOPER_TEASER_NUM_CHARS : 50;
                    $captions = array(0 => __("no teaser", 'scoper'), 1 => __("fixed teaser (specified below)", 'scoper'), 'excerpt' => __("excerpt as teaser", 'scoper'), 'more' => __("excerpt or pre-more as teaser", 'scoper'), 'x_chars' => sprintf(__("excerpt, pre-more or first %s chars", 'scoper'), $num_chars));
                    foreach ($captions as $teaser_option_val => $teaser_caption) {
                        $selected = $teaser_setting == $teaser_option_val ? 'selected="selected"' : '';
                        echo "\n\t<option value='{$teaser_option_val}' {$selected}>{$teaser_caption}</option>";
                    }
                    echo '</select></label><br />';
                    // Checkbox option to skip teaser for anonymous users
                    $id = str_replace(':', '_', $option_logged_only . '-' . $src_otype);
                    echo "<span style='margin-left: 6em'>";
                    //echo( _ x( 'for:', 'teaser: anonymous, logged or both', 'scoper') );
                    echo __('for:', 'scoper');
                    echo "&nbsp;&nbsp;<label for='{$id}_logged'>";
                    $checked = !empty($logged_only[$src_otype]) && 'anon' == $logged_only[$src_otype] ? ' checked="checked"' : '';
                    echo "<input name='{$id}' type='radio' id='{$id}_logged' value='anon' {$checked} />";
                    echo "";
                    _e("anonymous", 'scoper');
                    echo '</label></span>';
                    // Checkbox option to skip teaser for logged users
                    echo "<span style='margin-left: 1em'><label for='{$id}_anon'>";
                    $checked = !empty($logged_only[$src_otype]) && 'anon' != $logged_only[$src_otype] ? ' checked="checked"' : '';
                    echo "<input name='{$id}' type='radio' id='{$id}_anon' value='1' {$checked} />";
                    echo "";
                    _e("logged", 'scoper');
                    echo '</label></span>';
                    // Checkbox option to do teaser for BOTH logged and anon users
                    echo "<span style='margin-left: 1em'><label for='{$id}_all'>";
                    $checked = empty($logged_only[$src_otype]) ? ' checked="checked"' : '';
                    echo "<input name='{$id}' type='radio' id='{$id}_all' value='0' {$checked} />";
                    echo "";
                    _e("both", 'scoper');
                    echo '</label></span>';
                    echo '</div>';
                }
                echo '</div>';
                if (empty($displayed_teaser_caption)) {
                    echo '<span class="rs-subtext">';
                    if ($ui->display_hints) {
                        _e('If content is blocked, display replacement text instead of hiding it completely.', 'scoper');
                        echo '<br />';
                        _e('<strong>Note:</strong> the prefix and suffix settings below will always be applied unless the teaser mode is "no teaser".', 'scoper');
                    }
                    echo '</span>';
                    $displayed_teaser_caption = true;
                }
                // provide hide private (instead of teasing) checkboxes for each pertinent object type
                echo '<br /><br />';
                $display_style = $do_teaser[$src_name] ? '' : "style='display:none;'";
                echo "<div id='teaser-pvt-{$src_name}' {$display_style}>";
                $type_caption = $scoper_admin->interpret_src_otype('post:post');
                printf(__("Hide private %s (instead of teasing)", 'scoper'), $type_caption);
                // back compat for existing translations
                echo '<br />';
                echo '<div style="margin-left: 2em">';
                foreach ($hide_private as $src_otype => $teaser_setting) {
                    if ($src_name != scoper_src_name_from_src_otype($src_otype)) {
                        continue;
                    }
                    $id = str_replace(':', '_', $option_hide_private . '-' . $src_otype);
                    echo "<label for='{$id}'>";
                    $checked = $teaser_setting ? ' checked="checked"' : '';
                    echo "<input name='{$id}' type='checkbox' id='{$id}' value='1' {$checked} /> ";
                    echo $scoper_admin->interpret_src_otype($src_otype);
                    echo '</label><br />';
                }
                echo '</div>';
                echo '<span class="rs-subtext">';
                if ($ui->display_hints) {
                    _e('Hide private content completely, while still showing a teaser for content which is published with restrictions.  <strong>Note:</strong> Private posts hidden in this way will reduce the total number of posts on their "page" of a blog listing.', 'scoper');
                }
                echo '</span>';
                echo '</div>';
            }
            // end foreach source's do_teaser setting
            ?>

	</div>
	<?php 
            // now draw the teaser replacement / prefix / suffix input boxes
            $user_suffixes = array('_anon', '');
            $item_actions = array('name' => array('prepend', 'append'), 'content' => array('replace', 'prepend', 'append'), 'excerpt' => array('replace', 'prepend', 'append'));
            $items_display = array('name' => __('name', 'scoper'), 'content' => __('content', 'scoper'), 'excerpt' => __('excerpt', 'scoper'));
            $actions_display = array('replace' => __('replace with (if using fixed teaser, or no excerpt available):', 'scoper'), 'prepend' => __('prefix with:', 'scoper'), 'append' => __('suffix with:', 'scoper'));
            // first determine all src:otype keys
            $src_otypes = array();
            foreach ($user_suffixes as $anon) {
                foreach ($item_actions as $item => $actions) {
                    foreach ($actions as $action) {
                        $ui->all_otype_options[] = "teaser_{$action}_{$item}{$anon}";
                        if (!empty($ui->def_otype_options["teaser_{$action}_{$item}{$anon}"])) {
                            $src_otypes = array_merge($src_otypes, $ui->def_otype_options["teaser_{$action}_{$item}{$anon}"]);
                        }
                    }
                }
            }
            $last_src_name = '';
            foreach (array_keys($src_otypes) as $src_otype) {
                $src_name = scoper_src_name_from_src_otype($src_otype);
                if ($src_name != $last_src_name) {
                    if ($last_src_name) {
                        echo '</div>';
                    }
                    $last_src_name = $src_name;
                    $css_display = $do_teaser[$src_name] ? 'block' : 'none';
                    echo "<div id='teaserdef-{$src_name}' style='display:{$css_display}; margin-top: 2em;'>";
                }
                $item_label_singular = $scoper_admin->interpret_src_otype($src_otype);
                // separate input boxes to specify teasers for anon users and unpermitted logged users
                foreach ($user_suffixes as $anon) {
                    $user_descript = $anon ? __('anonymous users', 'scoper') : __('logged users', 'scoper');
                    echo '<strong>';
                    printf(__('%1$s Teaser Text (%2$s):', 'scoper'), $item_label_singular, $user_descript);
                    echo '</strong>';
                    echo '<ul class="rs-textentries">';
                    // items are name, content, excerpt
                    foreach ($item_actions as $item => $actions) {
                        echo '<li>' . $items_display[$item] . ':';
                        echo '<ul>';
                        // actions are prepend / append / replace
                        foreach ($actions as $action) {
                            $option_name = "teaser_{$action}_{$item}{$anon}";
                            if (!($opt_vals = scoper_get_option($option_name, $sitewide, $customize_defaults))) {
                                $opt_vals = array();
                            }
                            $ui->all_otype_options[] = $option_name;
                            if (!empty($ui->def_otype_options["teaser_{$action}_{$item}{$anon}"])) {
                                $opt_vals = array_merge($ui->def_otype_options[$option_name], $opt_vals);
                            }
                            if (isset($opt_vals[$src_otype])) {
                                $val = htmlspecialchars($opt_vals[$src_otype]);
                                $id = str_replace(':', '_', $option_name . '-' . $src_otype);
                                echo "<li><label for='{$id}'>";
                                echo $actions_display[$action];
                                ?>

	<input name="<?php 
                                echo $id;
                                ?>
" type="text" style="width: 95%" id="<?php 
                                echo $id;
                                ?>
" value="<?php 
                                echo $val;
                                ?>
" />
	</label><br /></li>
	<?php 
                            }
                            // endif isset($opt_vals)
                        }
                        // end foreach actions
                        echo '</ul></li>';
                    }
                    // end foreach item_actions
                    echo "</ul><br />";
                }
                // end foreach user_suffixes
            }
            // end foreach src_otypes
            echo '</div>';
        }
        // endif any default otype_options for do_teaser
        ?>

	</td>
	</tr>
<?php 
    }
    // any options accessable in this section
    if (!defined('RVY_VERSION')) {
        echo '<tr><td colspan="2"><div class="rs-optionhint"><p style="margin-left:4em;text-indent:-3.5em">&nbsp;';
        printf(__('<span class="rs-green"><strong>Idea:</strong></span> For Scheduled Revisions and Pending Revisions functionality that integrates with your RS Roles and Restrictions, install %1$s Revisionary%2$s, another %3$s Agapetry&nbsp;Creations%4$s plugin.', 'scoper'), "<a href='" . awp_plugin_info_url("revisionary") . "'>", '</a>', "<a href='http://agapetry.net'>", '</a>');
        echo '</p></div></td></tr>';
    }
    ?>

	
</table>

</div>
<?php 
    // ------------------------- END Features tab ---------------------------------
    // ------------------------- BEGIN Advanced tab ---------------------------------
    $tab = 'advanced';
    if (!empty($ui->form_options[$tab])) {
        ?>


<?php 
        echo "<div id='rs-advanced' style='clear:both;margin:0' class='rs-options agp_js_hide {$color_class}'>";
        if ($ui->display_hints) {
            echo '<div class="rs-optionhint">';
            _e("<strong>Note:</strong> for most installations, the default settings are fine.", 'scoper');
            echo '</div>';
        }
        ?>

<table class="<?php 
        echo $table_class;
        ?>
" id="rs-advanced_table">
<?php 
        $section = 'role_basis';
        if (!empty($ui->form_options[$tab][$section])) {
            ?>

	<tr valign="top">
	<th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            // --- ROLE BASIS SECTION ---
            ?>

	</th><td>
	
	<?php 
            $hint = '';
            $ui->option_checkbox('enable_group_roles', $tab, $section, $hint, '');
            $hint = '';
            $ui->option_checkbox('enable_user_roles', $tab, $section, $hint, '');
            if (scoper_get_option('custom_user_blogcaps', $sitewide, $customize_defaults) || ScoperAdminLib::any_custom_caps_assigned()) {
                $hint = __('Some users created under older WP versions may have direct-assigned capabilities in addition to their blog-wide role assignment.  This setting does not enable or block that feature, but determines whether Role Scoper must account for it.  Disable when possible (capabilities unrelated to RS Role Definitions are irrelevant).', 'scoper');
                $ui->option_checkbox('custom_user_blogcaps', $tab, $section, $hint, '');
            }
            ?>

	
	</td></tr>
<?php 
        }
        // any options accessable in this section
        $section = 'page_structure';
        if (!empty($ui->form_options[$tab][$section])) {
            ?>

	<tr valign="top">
	<th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            // --- PAGE STRUCTURE SECTION ---
            ?>
</th><td>

	<?php 
            $id = 'lock_top_pages';
            $ui->all_options[] = $id;
            $current_setting = strval(scoper_get_option($id, $sitewide, $customize_defaults));
            // force setting and corresponding keys to string, to avoid quirks with integer keys
            echo $ui->option_captions['lock_top_pages'];
            $captions = array('author' => __('Page Authors, Editors and Administrators', 'scoper'), '' => __('Page Editors and Administrators', 'scoper'), '1' => __('Administrators', 'scoper'));
            foreach ($captions as $key => $value) {
                $key = strval($key);
                echo "<div style='margin: 0 0 0.5em 2em;'><label for='{$id}_{$key}'>";
                $checked = $current_setting === $key ? "checked='checked'" : '';
                echo "<input name='{$id}' type='radio' id='{$id}_{$key}' value='{$key}' {$checked} />";
                echo $value;
                echo '</label></div>';
            }
            echo '<span class="rs-subtext">';
            if ($ui->display_hints) {
                _e('Users who do not meet this site-wide role requirement may still be able to save and/or publish pages, but will not be able to publish a new page with a Page Parent setting of "Main Page".  Nor will they be able to move a currently published page from "Main Page" to a different Page Parent.', 'scoper');
            }
            echo '</span>';
            ?>


	</td></tr>
<?php 
        }
        // any options accessable in this section
        $section = 'user_profile';
        if (!empty($ui->form_options[$tab][$section])) {
            ?>

	<tr valign="top">
	<th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            // --- USER PROFILE SECTION ---
            ?>
</th><td>
	
	<?php 
            $hint = '';
            $ui->option_checkbox('display_user_profile_groups', $tab, $section, $hint, '');
            $hint = '';
            $ui->option_checkbox('display_user_profile_roles', $tab, $section, $hint, '');
            ?>

		
	</td></tr>
<?php 
        }
        // any options accessable in this section
        $section = 'user_management';
        if (!empty($ui->form_options[$tab][$section])) {
            ?>

	<tr valign="top">
	<th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            // --- USER MANAGEMENT SECTION ---
            ?>
</th><td>
	
	<?php 
            $hint = __('If enabled, prevents those with edit_users capability from editing a user with a higher level or assigning a role higher than their own.', 'scoper');
            $ui->option_checkbox('limit_user_edit_by_level', $tab, $section, $hint, '');
            ?>


	</td></tr>
<?php 
        }
        // any options accessable in this section
        $section = 'administrator_definition';
        if ($sitewide || !IS_MU_RS) {
            ?>

	<tr valign="top">
	<th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            // --- ADMINISTRATOR DEFINITION SECTION ---
            ?>
</th><td>
	<?php 
            $default_cap = array('option' => 'manage_options', 'user' => 'edit_users', 'content' => 'activate_plugins');
            $name['content'] = __('Content Administrator', 'scoper');
            $name['user'] = __('User Administrator', 'scoper');
            $name['option'] = __('Option Administrator', 'scoper');
            $descript['content'] = __('RS never applies restricting or enabling content filters', 'scoper');
            $descript['user'] = __('RS allows full editing of all user groups and scoped roles / restrictions', 'scoper');
            $descript['option'] = __('Can edit Role Scoper options', 'scoper');
            _e('Role Scoper internally checks the following capabilities for content and role administration.  By default, these capabilities are all contained in the Administrator role only.  You can use the Capability Manager plugin to split/overlap them among different roles as desired.', 'scoper');
            echo '<table id="rs-admin-info" style="max-width: 80em">' . '<tr>' . '<th style="font-weight:normal">' . __('Administrator Type', 'scoper') . '</th>' . '<th style="font-weight:normal">' . __('Required Capability', 'scoper') . '</th>' . '<th width="80%" style="font-weight:normal">' . __awp('Description') . '</th>' . '</tr>';
            foreach (array_keys($name) as $admin_type) {
                $constant_name = 'SCOPER_' . strtoupper($admin_type) . '_ADMIN_CAP';
                $cap_name = defined($constant_name) ? constant($constant_name) : $default_cap[$admin_type];
                echo '<tr>' . '<td><strong>' . $name[$admin_type] . '</strong></td>' . '<td>' . $cap_name . '</td>' . '<td width="60%" >' . $descript[$admin_type] . '</td>' . '</tr>';
                if ('content' == $admin_type && $cap_name != $default_cap['content']) {
                    $custom_content_admin_cap = true;
                }
            }
            echo '</table>';
            _e('Each administrator type\'s <strong>capability can be modified</strong> by adding any of the following define statements to your wp-config.php:', 'scoper');
            echo '<div style="margin:0 10em 2em 10em">';
            echo "<code>define( 'SCOPER_CONTENT_ADMIN_CAP', 'your_content_capname' );</code>";
            echo '<br />';
            echo "<code>define( 'SCOPER_USER_ADMIN_CAP', 'your_user_capname' );</code>";
            echo '<br />';
            echo "<code>define( 'SCOPER_OPTION_ADMIN_CAP', 'your_option_capname' );</code>";
            echo '</div>';
            _e('For example, by using Capability Manager to add a custom capability such as <strong>administer_all_content</strong> to certain WordPress roles, you could mirror that setting in the SCOPER_CONTENT_ADMIN_CAP definition to ensure that those users are never content-restricted by Role Scoper.', 'scoper');
            ?>

	</td></tr>
<?php 
        }
        // any options accessable in this section
        $section = 'limited_editing_elements';
        if (!empty($ui->form_options[$tab][$section])) {
            ?>

	<tr valign="top">
	<th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            // --- LIMITED EDITING ELEMENTS SECTION ---
            ?>
</th><td>
	
	<?php 
            if (in_array('admin_css_ids', $ui->form_options[$tab][$section])) {
                ?>

		<div class="agp-vspaced_input">
		<?php 
                if ($ui->display_hints) {
                    echo '<div class="agp-vspaced_input">';
                    _e('Remove Edit Form elements with these html IDs from users who do not have full editing capabilities for the post/page. Separate with&nbsp;;', 'scoper');
                    echo '</div>';
                }
                ?>

		</div>
		<?php 
                $option_name = 'admin_css_ids';
                if (isset($ui->def_otype_options[$option_name])) {
                    if (!($opt_vals = scoper_get_option($option_name, $sitewide, $customize_defaults))) {
                        $opt_vals = array();
                    }
                    $opt_vals = array_merge($ui->def_otype_options[$option_name], $opt_vals);
                    $ui->all_otype_options[] = $option_name;
                    $sample_ids = array();
                    // note: 'post:post' otype option is used for all non-page types
                    $sample_ids['post:post'] = '<span id="rs_sample_ids_post:post" class="rs-gray" style="display:none">' . 'rs_private_post_reader; rs_post_contributor; categorydiv; password-span; slugdiv; authordiv; commentstatusdiv; postcustom; trackbacksdiv; tagsdiv-post_tag; postexcerpt; revisionsdiv; visibility; misc-publishing-actions; edit-slug-box' . '</span>';
                    $sample_ids['post:page'] = '<span id="rs_sample_ids_post:page" class="rs-gray" style="display:none">' . 'rs_private_page_reader; rs_page_contributor; rs_page_associate; password-span; pageslugdiv; pageauthordiv; pagecommentstatusdiv; pagecustomdiv; pageparentdiv; revisionsdiv; visibility; misc-publishing-actions; edit-slug-box' . '</span>';
                    foreach ($opt_vals as $src_otype => $val) {
                        $id = str_replace(':', '_', $option_name . '-' . $src_otype);
                        $display = $scoper_admin->interpret_src_otype($src_otype, 'singular_name');
                        echo '<div class="agp-vspaced_input">';
                        echo '<span class="rs-vtight">';
                        printf(__('%s Edit Form HTML IDs:', 'scoper'), $display);
                        ?>

		<label for="<?php 
                        echo $id;
                        ?>
">
		<input name="<?php 
                        echo $id;
                        ?>
" type="text" size="45" style="width: 95%" id="<?php 
                        echo $id;
                        ?>
" value="<?php 
                        echo $val;
                        ?>
" />
		</label>
		</span>
		<br />
		<?php 
                        if (isset($sample_ids[$src_otype])) {
                            $js_call = "agp_set_display('rs_sample_ids_{$src_otype}', 'inline');";
                            printf(__('%1$s sample IDs:%2$s %3$s', 'scoper'), "<a href='javascript:void(0)' onclick=\"{$js_call}\">", '</a>', $sample_ids[$src_otype]);
                        }
                        ?>

		</div>
		<?php 
                    }
                    // end foreach optval
                }
                // endif any default admin_css_ids options
                ?>

		
		<br />
	<?php 
            }
            ?>

		
	
	<?php 
            if (in_array('hide_non_editor_admin_divs', $ui->form_options[$tab][$section])) {
                $id = 'hide_non_editor_admin_divs';
                $ui->all_options[] = $id;
                $current_setting = strval(scoper_get_option($id, $sitewide, $customize_defaults));
                // force setting and corresponding keys to string, to avoid quirks with integer keys
                ?>

		<div class="agp-vspaced_input">
		<?php 
                _e('Specified element IDs also require the following site-wide Role:', 'scoper');
                $admin_caption = !empty($custom_content_admin_cap) ? __('Content Administrator', 'scoper') : __awp('Administrator');
                $captions = array('0' => __('no requirement', 'scoper'), '1' => __('Contributor / Author / Editor', 'scoper'), 'author' => __('Author / Editor', 'scoper'), 'editor' => __awp('Editor'), 'admin_content' => __('Content Administrator', 'scoper'), 'admin_user' => __('User Administrator', 'scoper'), 'admin_option' => __('Option Administrator', 'scoper'));
                foreach ($captions as $key => $value) {
                    $key = strval($key);
                    echo "<div style='margin: 0 0 0.5em 2em;'><label for='{$id}_{$key}'>";
                    $checked = $current_setting === $key ? "checked='checked'" : '';
                    echo "<input name='{$id}' type='radio' id='{$id}_{$key}' value='{$key}' {$checked} />";
                    echo $value;
                    echo '</label></div>';
                }
                ?>

		<span class="rs-subtext">
		<?php 
                if ($ui->display_hints) {
                    _e('Note: The above roles are type-specific RS roles (for the object type involved) which must be contained in a user\'s site-wide WordPress role.', 'scoper');
                }
                ?>

		</span>
		</div>
	<?php 
            }
            ?>

		
	</td>
	</tr>
<?php 
        }
        // any options accessable in this section
        $section = 'role_assignment_interface';
        if (!empty($ui->form_options[$tab][$section])) {
            ?>

	<tr valign="top">
	<th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            // --- ROLE ASSIGNMENT INTERFACE SECTION ---
            ?>
</th><td>
	
	<?php 
            $otype_caption = __('Limit eligible users for %s-specific editing roles', 'scoper');
            $hint = __('Role Scoper can enable any user to edit a post or page you specify, regardless of their site-wide WordPress role.  If that\'s not a good thing, check above options to require basic editing capability blog-wide or category-wide.', 'scoper');
            $ui->otype_option_checkboxes('limit_object_editors', $otype_caption, $tab, $section, $hint, '<br /><br />', array('label_property' => 'singular_name'));
            $hint = __('In the Edit Post/Edit Page roles tabs, decorate user/group name with colors and symbols if they have the role implicitly via group, general role, category role, or a superior post/page role.', 'scoper');
            $ui->option_checkbox('indicate_blended_roles', $tab, $section, $hint, '<br />');
            $hint = __('Display introductory descriptions at the top of various role assignment / definition screens.', 'scoper');
            $ui->option_checkbox('display_hints', $tab, $section, $hint, '<br />');
            $hint = __('Accept entry of user names or IDs via comma-separated text instead of individual checkboxes.', 'scoper');
            $ui->option_checkbox('user_role_assignment_csv', $tab, $section, $hint, '');
            ?>

		
	</td></tr>
<?php 
        }
        // any options accessable in this section
        $section = 'custom_columns';
        if (!empty($ui->form_options[$tab][$section])) {
            ?>

	<tr valign="top">
	<th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            // --- ROLE ASSIGNMENT INTERFACE SECTION ---
            ?>
</th><td>
	
	<?php 
            $hint = '';
            $otype_caption = __('Restrictions column in Edit %s listing', 'scoper');
            $ui->otype_option_checkboxes('restrictions_column', $otype_caption, $tab, $section, $hint, '<br />');
            $otype_caption = __('Term Roles column in Edit %s listing', 'scoper');
            $ui->otype_option_checkboxes('term_roles_column', $otype_caption, $tab, $section, $hint, '<br />');
            $otype_caption = __('Object Roles column in Edit %s listing', 'scoper');
            $ui->otype_option_checkboxes('object_roles_column', $otype_caption, $tab, $section, $hint, '<br />');
            ?>

		
	</td></tr>
<?php 
        }
        // any options accessable in this section
        $section = 'additional_object_roles';
        if (!empty($ui->form_options[$tab][$section])) {
            $post_types = array_diff(get_post_types(array('public' => true)), array('attachment'));
            foreach ($post_types as $_type) {
                $objscope_equiv_roles["rs_{$_type}_reader"] = "rs_private_{$_type}_reader";
                $objscope_equiv_roles["rs_{$_type}_author"] = "rs_{$_type}_editor";
            }
            if (IS_MU_RS) {
                // apply option scope filtering for mu
                foreach (array_keys($objscope_equiv_roles) as $role_name) {
                    if (!in_array($role_name . '_role_objscope', $ui->form_options[$tab][$section])) {
                        $objscope_equiv_roles = array_diff_key($objscope_equiv_roles, array($role_name => true));
                    }
                }
            }
            if (!empty($objscope_equiv_roles)) {
                ?>

		<?php 
                foreach ($objscope_equiv_roles as $role_handle => $equiv_role_handle) {
                    $ui->all_options[] = "{$role_handle}_role_objscope";
                }
                ?>

		<tr valign="top">
		<th scope="row"><?php 
                echo $ui->section_captions[$tab][$section];
                ?>
</th>
		<td>
		<?php 
                foreach ($objscope_equiv_roles as $role_handle => $equiv_role_handle) {
                    $id = "{$role_handle}_role_objscope";
                    $checked = scoper_get_option($id, $sitewide, $customize_defaults) ? "checked='checked'" : '';
                    echo '<div class="agp-vspaced_input">';
                    echo "<label for='{$id}'>";
                    echo "<input name='{$id}' type='checkbox' id='{$id}' value='1' {$checked} /> ";
                    if (in_array($role_handle, array('rs_post_reader', 'rs_post_author'))) {
                        printf(__('%1$s (normally equivalent to %2$s)', 'scoper'), $scoper->role_defs->get_display_name($role_handle), $scoper->role_defs->get_display_name($equiv_role_handle));
                    } else {
                        echo $scoper->role_defs->get_display_name($role_handle);
                    }
                    echo '</label></div>';
                }
                ?>

		<span class="rs-subtext">
		<?php 
                if ($ui->display_hints) {
                    _e('By default, the above roles are not available for object-specific assignment because another role is usually equivalent. However, the distinctions may be useful if you propagate roles to sub-Pages, set Default Roles or customize RS Role Definitions.', 'scoper');
                    echo '<br /><br />';
                    _e('Note: Under the default configuration, the tabs labeled "Reader" in the Post/Page Edit Form actually assign the corresponding Private Reader role.', 'scoper');
                }
                ?>

		</span>
		</td></tr>
	
	<?php 
            }
            // any objscope_equiv_roles options available in this section
            ?>
	
		
<?php 
        }
        // any options accessable in this section
        ?>
	


</table>
</div>

<?php 
    }
    // any options accessable in this tab
    ?>
	


<?php 
    // ------------------------- BEGIN Realm tab ---------------------------------
    $tab = 'realm';
    if (!empty($ui->form_options[$tab])) {
        ?>

<?php 
        echo "<div id='rs-realm' style='clear:both;margin:0' class='rs-options agp_js_hide {$color_class}'>";
        if ($ui->display_hints) {
            echo '<div class="rs-optionhint">';
            _e("These <strong>optional</strong> settings allow advanced users to adjust Role Scoper's sphere of influence. For most installations, the default settings are fine.", 'scoper');
            echo '</div>';
        }
        ?>


<table class="<?php 
        echo $table_class;
        ?>
" id="rs-realm_table">

<?php 
        $section_alias = 'term_object_scopes';
        if (!empty($ui->form_options[$tab][$section_alias])) {
            ?>



	<tr valign="top">
	<th scope="row"><?php 
            // --- TAXONOMY / OBJECT TYPE USAGE SECTION ---
            $section = 'taxonomy_usage';
            echo $ui->section_captions[$tab][$section];
            echo '<br />';
            ?>
</th><td>
	<?php 
            // note: update_wp_taxonomies gets special handling in submitee.php, doesn't need to be included in $ui->all_options array
            global $wp_taxonomies;
            global $scoper_default_options;
            _e('Specify which WordPress Taxonomies can have Restrictions and Roles:', 'scoper');
            echo '<br />';
            $registered = array();
            $registered['object'] = get_post_types(array());
            $registered['term'] = get_taxonomies(array());
            $public = array();
            $public['object'] = get_post_types(array('public' => true));
            $public['term'] = get_taxonomies(array('public' => true));
            $scopes = array('term', 'object');
            foreach ($scopes as $scope) {
                if ('object' == $scope) {
                    ?>
</td></tr>
<?php 
                    $section = 'post_type_usage';
                    $option_name = 'use_post_types';
                    ?>
	<tr valign="top">
	<th scope="row">
<?php 
                    echo $ui->section_captions[$tab][$section];
                    ?>
</th><td>
<?php 
                    _e('Specify which Post Types can have Restrictions and Roles:', 'scoper');
                } else {
                    // end if loop iteration is for object scope
                    $option_name = 'use_taxonomies';
                }
                if (in_array('use_term_roles', $ui->form_options[$tab][$section_alias])) {
                    // use_object_types follow option scope of use_term_roles
                    $ui->all_options[] = $option_name;
                    if (isset($scoper_default_options[$option_name])) {
                        if (!($opt_vals = scoper_get_option($option_name, $sitewide, $customize_defaults))) {
                            $opt_vals = array();
                        }
                        $opt_vals = array_merge($scoper_default_options[$option_name], $opt_vals);
                        foreach ($opt_vals as $key => $val) {
                            if (!$key) {
                                continue;
                            }
                            $id = $option_name . '-' . $key;
                            ?>

						
						<?php 
                            // nav menu and link category are currently governed by "Term Scope" setting only, so just set a hidden enable here
                            if (in_array($key, array('nav_menu', 'link_category'))) {
                                ?>

							<input name="<?php 
                                echo $id;
                                ?>
" type="hidden" id="<?php 
                                echo $id;
                                ?>
" value="1" />
						<?php 
                            } else {
                                ?>

							<div class="agp-vspaced_input">
							<label for="<?php 
                                echo $id;
                                ?>
" title="<?php 
                                echo $key;
                                ?>
">
							
							<input name="<?php 
                                echo $id;
                                ?>
" type="checkbox" id="<?php 
                                echo $id;
                                ?>
" value="1" <?php 
                                checked('1', $val);
                                ?>
 />
							
							<?php 
                                if (TERM_SCOPE_RS == $scope) {
                                    if ($tx = get_taxonomy($key)) {
                                        $display_name = $tx->labels->name;
                                    } else {
                                        $display_name = '';
                                    }
                                } else {
                                    if ($type_obj = get_post_type_object($key)) {
                                        $display_name = $type_obj->labels->name;
                                    } else {
                                        $display_name = '';
                                    }
                                }
                                if (!$display_name) {
                                    $display_name = $key;
                                }
                                if (!isset($public[$scope][$key])) {
                                    if (isset($registered[$scope][$key])) {
                                        $display_name .= '<span class="rs-warning"> <big>*</big></span>';
                                        $any_private_types = true;
                                    } else {
                                        $display_name .= '<span class="rs-warning"> <big>**</big></span>';
                                        $any_unregistered_types = true;
                                    }
                                }
                                echo $display_name;
                                echo '</label></div>';
                            }
                            // displaying checkbox UI
                        }
                        // end foreach src_otype
                    }
                    // endif default option isset
                }
                // endif displaying this option in form
                if (MULTISITE) {
                    $link_open = $link_close = '';
                } else {
                    $link_open = "<a href='admin.php?page=rs-general_roles'>";
                    $link_close = '</a>';
                }
                if (!empty($any_private_types)) {
                    $msg = 'term' == $scope ? __('<big>*</big> = private type, filtering may not be valid', 'scoper') : __('<big>*</big> = private taxonomy, filtering may not be valid', 'scoper');
                    echo '<div class="rs-warning">' . $msg . '</div><br />';
                    $any_private_types = false;
                }
                if (!empty($any_unregistered_types)) {
                    $msg = __('<big>**</big> = currently unregistered, corresponding plugin may be deactivated', 'scoper');
                    echo '<div class="rs-warning">' . $msg . '</div><br />';
                    $any_unregistered_types = false;
                }
                if ('term' == $scope) {
                    if (get_taxonomies(array('_builtin' => false, 'public' => true))) {
                        echo '<div>';
                        printf(__('<strong>NOTE:</strong> Non-Administrators need a %1$sTaxonomy-specific Role assignment%2$s to manage Custom Taxonomies selected here.', 'scoper'), $link_open, $link_close);
                        echo '</div>';
                    }
                } else {
                    if (get_post_types(array('_builtin' => false, 'public' => true))) {
                        echo '<div>';
                        printf(__('<strong>NOTE:</strong> Non-Administrators need a %1$sType-specific Role assignment%2$s to manage Custom Post Types selected here.', 'scoper'), $link_open, $link_close);
                        echo '</div><br />';
                    }
                }
            }
            // end foreach scope
            if (!defined('SCOPER_EARLY_INIT')) {
                echo '<div>';
                _e('<strong>NOTE:</strong> Role Scoper is operating in late-initialization mode, for compatibility with plugins which register taxonomies or post types on the "init" hook without specifying early execution priority.  If other plugins internally query posts (or post editing capabilities) on the "init" action, those results will not be filtered.  In that event, find a way to register your taxonomies/post types earlier and add the following to wp-config.php:', 'scoper');
                echo '<div id="rs-type-tx-help">';
                echo "<pre>&nbsp;&nbsp;define( 'SCOPER_EARLY_INIT', true );</pre>";
                echo '</div>';
                echo '</div>';
            }
            ?>

	</td>
	</tr>


	<tr valign="top">
	<th scope="row"><?php 
            // --- TERM SCOPE SECTION ---
            $section = 'term_scope';
            echo $ui->section_captions[$tab][$section];
            echo '<br /><span style="font-size: 0.9em; font-style: normal; font-weight: normal">(&nbsp;<a href="#scoper_notes">' . __('see notes', 'scoper') . '</a>&nbsp;)</span>';
            ?>
</th><td>
	<?php 
            // note: update_wp_taxonomies gets special handling in submitee.php, doesn't need to be included in $ui->all_options array
            global $wp_taxonomies;
            _e('Specify available Term Restrictions and Roles, for each object type and taxonomy:', 'scoper');
            echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
            _e('<b>Note:</b> Taxonomy Usage must also be enabled above', 'scoper');
            echo '<br />';
            $scopes = array('term', 'object');
            foreach ($scopes as $scope) {
                if ('object' == $scope) {
                    ?>
</td></tr>
<?php 
                    $section = 'object_scope';
                    ?>
	<tr valign="top">
	<th scope="row">
<?php 
                    // --- TERM / OBJECT SCOPE SECTION ---
                    echo $ui->section_captions[$tab][$section];
                    ?>
</th><td>
<?php 
                    _e('Specify whether Restrictions and Roles can be set for individual Objects:', 'scoper');
                    echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
                    _e('<b>Note:</b> Post Type Usage must also be enabled above', 'scoper');
                } else {
                    // end if loop iteration is for object scope
                    $section = 'term_scope';
                }
                $option_name = "use_{$scope}_roles";
                if (in_array('use_term_roles', $ui->form_options[$tab][$section_alias])) {
                    // use_object_roles follow option scope of use_term_roles
                    $ui->all_otype_options[] = $option_name;
                    if (isset($ui->def_otype_options[$option_name])) {
                        if (!($opt_vals = scoper_get_option($option_name, $sitewide, $customize_defaults))) {
                            $opt_vals = array();
                        }
                        if ('use_term_roles' == $option_name) {
                            foreach (array_keys($ui->def_otype_options[$option_name]) as $src_otype) {
                                if (isset($opt_vals[$src_otype])) {
                                    $opt_vals[$src_otype] = array_merge($ui->def_otype_options[$option_name][$src_otype], $opt_vals[$src_otype]);
                                } else {
                                    $opt_vals[$src_otype] = $ui->def_otype_options[$option_name][$src_otype];
                                }
                            }
                        } else {
                            $opt_vals = array_merge($ui->def_otype_options[$option_name], $opt_vals);
                        }
                        foreach ($opt_vals as $src_otype => $val) {
                            if (TERM_SCOPE_RS == $scope) {
                                echo '<div style="margin-bottom: 2em">';
                                foreach (array_keys($opt_vals[$src_otype]) as $taxonomy) {
                                    $id = str_replace(':', '_', $option_name . '-' . $src_otype . '-' . $taxonomy);
                                    ?>

								<div class="agp-vspaced_input">
								<label for="<?php 
                                    echo $id;
                                    ?>
" title="<?php 
                                    echo $taxonomy;
                                    ?>
">
								<input name="<?php 
                                    echo $id;
                                    ?>
" type="checkbox" id="<?php 
                                    echo $id;
                                    ?>
" value="1" <?php 
                                    checked('1', $val[$taxonomy]);
                                    ?>
 />
								<?php 
                                    $tx_display = $scoper->taxonomies->member_property($taxonomy, 'labels', 'name');
                                    if (!$tx_display) {
                                        $tx_display = $taxonomy;
                                    }
                                    $display_name_plural = $scoper_admin->interpret_src_otype($src_otype);
                                    //printf( _ x('%1$s (for %2$s)', 'Category (for Posts)', 'scoper'), $tx_display, $display_name_plural );
                                    printf(__('%1$s (for %2$s)', 'scoper'), $tx_display, $display_name_plural);
                                    if (!$scoper->taxonomies->member_property($taxonomy, 'requires_term')) {
                                        echo '* ';
                                        $any_loose_taxonomy = true;
                                    }
                                    echo '</label></div>';
                                }
                                echo '</div>';
                            } else {
                                $id = str_replace(':', '_', $option_name . '-' . $src_otype);
                                ?>

							<div class="agp-vspaced_input">
							<label for="<?php 
                                echo $id;
                                ?>
" title="<?php 
                                echo $src_otype;
                                ?>
">
							<input name="<?php 
                                echo $id;
                                ?>
" type="checkbox" id="<?php 
                                echo $id;
                                ?>
" value="1" <?php 
                                checked('1', $val);
                                ?>
 />
							<?php 
                                echo $scoper_admin->interpret_src_otype($src_otype);
                                echo '</label></div>';
                            }
                        }
                        // end foreach src_otype
                    }
                    // endif default option isset
                }
                // endif displaying this option in form
                if ('term' == $scope) {
                    if (!empty($any_loose_taxonomy)) {
                        echo "<span class='rs-gray'>" . __('* = Role Assignment only (no Restrictions)', 'scoper') . '</span>';
                    }
                }
            }
            // end foreach scope
            ?>

	</td>
	</tr>
<?php 
        }
        // any options accessable in this section
        $section = 'access_types';
        if (!empty($ui->form_options[$tab][$section])) {
            ?>

	<tr valign="top">
	<th scope="row"><?php 
            // --- ACCESS TYPES SECTION ---
            echo $ui->section_captions[$tab][$section];
            ?>
</th>
	<td>
	<?php 
            // note: disabled_access_types option gets special handling in submitee.php, doesn't need to be included in $ui->all_options array
            _e('Apply Roles and Restrictions for:', 'scoper');
            echo '<br />';
            $topic = "access_types";
            $opt_vals = scoper_get_option("disabled_{$topic}", $sitewide, $customize_defaults);
            $all = implode(',', $scoper->access_types->get_all_keys());
            echo "<input type='hidden' name='all_access_types' value='{$all}' />";
            foreach ($scoper->access_types->get_all() as $access_name => $access_type) {
                $id = $topic . '-' . $access_name;
                $val = empty($opt_vals[$access_name]);
                ?>

	<div class="agp-vspaced_input">
	<label for="<?php 
                echo $id;
                ?>
">
	<input name="<?php 
                echo $id;
                ?>
[]" type="checkbox" id="<?php 
                echo $id;
                ?>
" value="<?php 
                echo $access_name;
                ?>
" <?php 
                checked('1', $val);
                ?>
 />
	<?php 
                if ('front' == $access_name) {
                    _e('Viewing content (front-end)', 'scoper');
                } elseif ('admin' == $access_name) {
                    _e('Editing and administering content (admin)', 'scoper');
                } else {
                    echo $access_type->labels->name;
                }
                echo '</label></div>';
            }
            // end foreach access types
            ?>

	<br />
	</td></tr>
<?php 
        }
        // any options accessable in this section
        ?>


<?php 
        // NOTE: Access Types section (for disabling data sources / otypes individually) was removed due to complication with hardway filtering.
        // For last source code, see 1.0.0-rc8
        ?>


</table>

<?php 
        echo '<h4 style="margin-bottom:0.1em"><a name="scoper_notes"></a>' . __("Notes", 'scoper') . ':</h4><ul class="rs-notes">';
        echo '<li>';
        _e('The &quot;Post Tag&quot; taxonomy cannot be used to define restrictions because tags are not mandatory. For most installations, categories are a better mechanism to define roles. Note that <strong>Role Scoper does not filter tag storage</strong> based on the editing user\'s access.  As with any other custom-defined taxonomy, use this option at your own discretion.', 'scoper');
        echo '</li>';
        echo '</ul>';
        echo '</div>';
    }
    // any options accessable in this tab
    // ------------------------- END Realms tab ---------------------------------
    if (!empty($ui->form_options['rs_role_definitions'])) {
        // RS Role Definitions Tab
        include dirname(__FILE__) . '/role_definition.php';
        scoper_display_rs_roledefs(array('bgcolor_class' => $color_class, 'sitewide' => $sitewide, 'customize_defaults' => $customize_defaults));
        // WP Role Definitions Tab
        include dirname(__FILE__) . '/role_definition_wp.php';
        scoper_display_wp_roledefs(array('bgcolor_class' => $color_class));
    }
    // ------------------------- BEGIN Option Scope tab ---------------------------------
    $tab = 'optscope';
    if ($sitewide) {
        ?>

<?php 
        echo "<div id='rs-optscope' style='clear:both;margin:0' class='rs-options agp_js_hide {$color_class}'>";
        if ($ui->display_hints) {
            echo '<div class="rs-optionhint">';
            _e("Specify which Role Scoper Options should be applied site-wide.", 'scoper');
            echo '</div><br />';
        }
        echo '<ul>';
        $all_movable_options = array();
        $option_scope_stamp = __('network-wide control of "%s"', 'scoper');
        foreach ($available_form_options as $tab_name => $sections) {
            echo '<li>';
            $explanatory_caption = __('Selected options will be controlled network-wide via <strong>Super Admin > Role Options</strong>; unselected options can be set per-site via <strong>Roles > Options</strong>', 'scoper');
            if (isset($ui->tab_captions[$tab_name])) {
                $tab_caption = $ui->tab_captions[$tab_name];
            } else {
                $tab_caption = $tab_name;
            }
            echo '<div style="margin:1em 0 1em 0">';
            if ($ui->display_hints) {
                printf(__('<span class="rs-h3text rs-blue">%1$s</span> (%2$s)', 'scoper'), $tab_caption, $explanatory_caption);
            } else {
                echo $tab_caption;
            }
            echo '</div>';
            echo '<ul style="margin-left:2em">';
            foreach ($sections as $section_name => $option_names) {
                if (empty($sections[$section_name])) {
                    continue;
                }
                echo '<li><strong>';
                if (isset($ui->section_captions[$tab_name][$section_name])) {
                    echo $ui->section_captions[$tab_name][$section_name];
                } else {
                    _e($section_name);
                }
                echo '</strong><ul style="margin-left:2em">';
                foreach ($option_names as $option_name) {
                    if ($option_name && $ui->option_captions[$option_name]) {
                        $all_movable_options[] = $option_name;
                        echo '<li>';
                        $disabled = in_array($option_name, array('file_filtering', 'mu_sitewide_groups')) ? "disabled='disabled'" : '';
                        $id = "{$option_name}_sitewide";
                        $val = isset($scoper_options_sitewide[$option_name]);
                        echo "<label for='{$id}'>";
                        echo "<input name='rs_options_sitewide[]' type='checkbox' id='{$id}' value='{$option_name}' {$disabled} ";
                        checked('1', $val);
                        echo " />";
                        printf($option_scope_stamp, $ui->option_captions[$option_name]);
                        echo '</label></li>';
                    }
                }
                echo '</ul>';
            }
            echo '</ul><br /><hr />';
        }
        echo '</ul>';
        echo '</div>';
        $all_movable_options = implode(',', $all_movable_options);
        echo "<input type='hidden' name='rs_all_movable_options' value='{$all_movable_options}' />";
    }
    // any options accessable in this tab
    // ------------------------- END Option Scope tab ---------------------------------
    // this was required for Access Types section, which was removed
    //$all = implode(',', $all_otypes);
    //echo "<input type='hidden' name='all_object_types' value='$all' />";
    $ui->all_options = implode(',', $ui->all_options);
    $ui->all_otype_options = implode(',', array_unique($ui->all_otype_options));
    echo "<input type='hidden' name='all_options' value='{$ui->all_options}' />";
    echo "<input type='hidden' name='all_otype_options' value='{$ui->all_otype_options}' />";
    echo "<input type='hidden' name='rs_submission_topic' value='options' />";
    ?>

<p class="submit" style="border:none;float:right">
<input type="submit" name="rs_submit" class="button-primary" value="<?php 
    _e('Update &raquo;', 'scoper');
    ?>
" />
</p>

<?php 
    $msg = __("All settings in this form (including those on undisplayed tabs) will be reset to DEFAULTS.  Are you sure?", 'scoper');
    $js_call = "javascript:if (confirm('{$msg}')) {return true;} else {return false;}";
    ?>

<p class="submit" style="border:none;float:left">

<input type="submit" name="rs_defaults" value="<?php 
    _e('Revert to Defaults', 'scoper');
    ?>
" onclick="<?php 
    echo $js_call;
    ?>
" />
</p>
</form>
<p style='clear:both'>
</p>
</div>

<?php 
}
コード例 #13
0
    function step_permalinks()
    {
        if (!current_user_can('activate_plugins')) {
            return false;
        }
        $prefix = '';
        $permalink_structure = get_option('permalink_structure');
        $using_permalinks = !empty($permalink_structure) ? true : false;
        $structures = array('', $prefix . '/%year%/%monthnum%/%day%/%postname%/', $prefix . '/%year%/%monthnum%/%postname%/', $prefix . '/archives/%post_id%');
        // If we're using permalinks already, adjust text accordingly
        if ($permalink_structure) {
            $permalink_setup_text = __('Congratulations! You are already using pretty permalinks, which BuddyPress requires. If you\'d like to change your settings, you may do so now. If you\'re happy with your current settings, click Save &amp; Next to continue.', 'buddypress');
        } else {
            $permalink_setup_text = __('To make sure the pages created in the previous step work correctly, pretty permalinks must be active on your site.', 'buddypress');
        }
        if (!got_mod_rewrite() && !iis7_supports_permalinks()) {
            $prefix = '/index.php';
        }
        ?>

		<p><?php 
        echo $permalink_setup_text;
        ?>
</p>
		<p><?php 
        printf(__('Please select the permalink setting you would like to use. For more advanced options please visit the <a href="%s">permalink settings page</a> first, and complete this setup wizard later.', 'buddypress'), admin_url('options-permalink.php'));
        ?>

		<table class="form-table">
			<tr>
				<th><label><input name="permalink_structure" type="radio"<?php 
        if (empty($permalink_structure) || false != strpos($permalink_structure, $structures[1])) {
            ?>
 checked="checked" <?php 
        }
        ?>
value="<?php 
        echo esc_attr($structures[1]);
        ?>
" class="tog" <?php 
        checked($structures[1], $permalink_structure);
        ?>
 />&nbsp;<?php 
        _e('Day and name');
        ?>
</label></th>
				<td><code><?php 
        echo get_home_url() . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/';
        ?>
</code></td>
			</tr>
			<tr>
				<th><label><input name="permalink_structure" type="radio"<?php 
        if (empty($permalink_structure) || false != strpos($permalink_structure, $structures[2])) {
            ?>
 checked="checked" <?php 
        }
        ?>
 value="<?php 
        echo esc_attr($structures[2]);
        ?>
" class="tog" <?php 
        checked($structures[2], $permalink_structure);
        ?>
 />&nbsp;<?php 
        _e('Month and name');
        ?>
</label></th>
				<td><code><?php 
        echo get_home_url() . $prefix . '/' . date('Y') . '/' . date('m') . '/sample-post/';
        ?>
</code></td>
			</tr>
			<tr>
				<th><label><input name="permalink_structure" type="radio"<?php 
        if (empty($permalink_structure) || false != strpos($permalink_structure, $structures[3])) {
            ?>
 checked="checked" <?php 
        }
        ?>
 value="<?php 
        echo esc_attr($structures[3]);
        ?>
" class="tog" <?php 
        checked($structures[3], $permalink_structure);
        ?>
 />&nbsp;<?php 
        _e('Numeric');
        ?>
</label></th>
				<td><code><?php 
        echo get_home_url() . $prefix;
        ?>
/archives/123</code></td>
			</tr>
		</table>

		<div class="submit clear">
			<input type="hidden" name="save" value="permalinks" />
			<input type="hidden" name="step" value="<?php 
        echo esc_attr($this->current_step);
        ?>
" />

			<?php 
        if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && empty($_POST['skip-htaccess'])) {
            ?>

				<input type="hidden" name="skip-htaccess" value="skip-htaccess" />

			<?php 
        }
        ?>

			<?php 
        nxt_nonce_field('bpwizard_permalinks');
        ?>

		</div>

	<?php 
    }
コード例 #14
0
function save_mod_rewrite_rules()
{
    global $is_apache, $wp_rewrite;
    $home_path = get_home_path();
    if (!$wp_rewrite->using_mod_rewrite_permalinks()) {
        return;
    }
    if (!(!file_exists($home_path . '.htaccess') && is_writable($home_path) || is_writable($home_path . '.htaccess'))) {
        return;
    }
    if (!got_mod_rewrite()) {
        return;
    }
    $rules = explode("\n", $wp_rewrite->mod_rewrite_rules());
    insert_with_markers($home_path . '.htaccess', 'WordPress', $rules);
}
コード例 #15
0
ファイル: wp-cache.php プロジェクト: jeremylightsmith/blog
function wp_cache_manager()
{
    global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
    global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_whitelist, $wp_cache_mobile_browsers;
    global $wp_cache_cron_check, $wp_cache_debug, $wp_cache_hide_donation, $wp_cache_not_logged_in, $wp_supercache_cache_list;
    global $wp_super_cache_front_page_check;
    if (function_exists('is_site_admin')) {
        if (!is_site_admin()) {
            return;
        }
    }
    $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
    if (get_option('gzipcompression') == 1) {
        update_option('gzipcompression', 0);
    }
    if (!isset($cache_rebuild_files)) {
        $cache_rebuild_files = 0;
    }
    $valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache') : false;
    /* http://www.netlobo.com/div_hiding.html */
    ?>
<script type='text/javascript'>
<!--
function toggleLayer( whichLayer ) {
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
// -->
//Clicking header opens fieldset options
jQuery(document).ready(function(){
	jQuery("fieldset h3").css("cursor","pointer").click(function(){
		jQuery(this).parent("fieldset").find("p,form,ul,blockquote").toggle("slow");
	});
});
</script>
<?php 
    echo '<div class="wrap">';
    echo "<h2><a href='?page=wpsupercache'>" . __('WP Super Cache Manager', 'wp-super-cache') . "</a></h2>\n";
    if (1 == ini_get('safe_mode') || "on" == strtolower(ini_get('safe_mode'))) {
        ?>
<h3><?php 
        _e('Warning! PHP Safe Mode Enabled!', 'wp-super-cache');
        ?>
</h3>
		<p><?php 
        _e('You may experience problems running this plugin because SAFE MODE is enabled.', 'wp-super-cache');
        if (!ini_get('safe_mode_gid')) {
            echo __('Your server is set up to check the owner of PHP scripts before allowing them to read and write files.', 'wp-super-cache') . "</p><p>";
            echo sprintf(__('You or an administrator may be able to make it work by changing the group owner of the plugin scripts to match that of the web server user. The group owner of the %s/cache/ directory must also be changed. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details.', 'wp-super-cache'), WP_CONTENT_DIR) . "</p>";
        } else {
            echo __('You or an administrator must disable this. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details. This cannot be disabled in a .htaccess file unfortunately. It must be done in the php.ini config file.', 'wp-super-cache') . "</p>";
        }
    }
    if (isset($wp_super_cache_front_page_check) && $wp_super_cache_front_page_check == 1 && !wp_next_scheduled('wp_cache_check_site_hook')) {
        wp_schedule_single_event(time() + 360, 'wp_cache_check_site_hook');
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('scheduled wp_cache_check_site_hook for 360 seconds time.', 2);
        }
    }
    if (isset($_REQUEST['wp_restore_config']) && $valid_nonce) {
        unlink($wp_cache_config_file);
        echo '<strong>' . __('Configuration file changed, some values might be wrong. Load the page again from the "Settings" menu to reset them.', 'wp-super-cache') . '</strong>';
    }
    if (!wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir()) {
        echo '<p>' . __("Cannot continue... fix previous problems and retry.", 'wp-super-cache') . '</p>';
        echo "</div>\n";
        return;
    }
    if (!wp_cache_check_global_config()) {
        echo "</div>\n";
        return;
    }
    if ($wp_cache_debug || !$wp_cache_cron_check) {
        if (function_exists("wp_remote_get") == false) {
            $hostname = str_replace('http://', '', str_replace('https://', '', get_option('siteurl')));
            if (strpos($hostname, '/')) {
                $hostname = substr($hostname, 0, strpos($hostname, '/'));
            }
            $ip = gethostbyname($hostname);
            if (substr($ip, 0, 3) == '127' || substr($ip, 0, 7) == '192.168') {
                ?>
<h3><?php 
                printf(__('Warning! Your hostname "%s" resolves to %s', 'wp-super-cache'), $hostname, $ip);
                ?>
</h3>
			<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
			<p><?php 
                printf(__('Your server thinks your hostname resolves to %s. Some services such as garbage collection by this plugin, and WordPress scheduled posts may not operate correctly.', 'wp-super-cache'), $ip);
                ?>
</p>
			<p><?php 
                printf(__('Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/faq/');
                ?>
</p>
			</div>
			<?php 
            } else {
                wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
            }
        } else {
            $cron_url = get_option('siteurl') . '/wp-cron.php?check=' . wp_hash('187425');
            $cron = wp_remote_get($cron_url, array('timeout' => 0.01, 'blocking' => true));
            if (is_array($cron)) {
                if ($cron['response']['code'] == '404') {
                    ?>
<h3>Warning! wp-cron.php not found!</h3>
				<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
				<p><?php 
                    _e('Unfortunately WordPress cannot find the file wp-cron.php. This script is required for the the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.', 'wp-super-cache');
                    ?>
</p>
				<p><?php 
                    printf(__('Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/faq/');
                    ?>
</p>
				</div>
				<?php 
                } else {
                    wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
                }
            }
        }
    }
    if ($cache_enabled == true && $super_cache_enabled == true && !got_mod_rewrite()) {
        ?>
<h4 style='color: #a00'><?php 
        _e('Mod rewrite may not be installed!', 'wp-super-cache');
        ?>
</h4>
		<p><?php 
        _e('It appears that mod_rewrite is not installed. Sometimes this check isn&#8217;t 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files. You will still be able to use half-on mode.', 'wp-super-cache');
        ?>
</p><?php 
    }
    if (!is_writeable_ACLSafe($wp_cache_config_file)) {
        define("SUBMITDISABLED", 'disabled style="color: #aaa" ');
        ?>
<h4 style='text-align:center; color: #a00'><?php 
        _e('Read Only Mode. Configuration cannot be changed.', 'wp-super-cache');
        ?>
 <a href="javascript:toggleLayer('readonlywarning');" title="<?php 
        _e('Why your configuration may not be changed', 'wp-super-cache');
        ?>
"><?php 
        _e('Why', 'wp-super-cache');
        ?>
</a></h4>
		<div id='readonlywarning' style='border: 1px solid #aaa; margin: 2px; padding: 2px; display: none;'>
		<p><?php 
        printf(__('The WP Super Cache configuration file is <code>%s/wp-cache-config.php</code> and cannot be modified. That file must be writeable by the webserver to make any changes.', 'wp-super-cache'), WP_CONTENT_DIR);
        ?>
		<?php 
        _e('A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it&#8217;s globally writeable and it should be fine.', 'wp-super-cache');
        ?>
</p>
		<?php 
        _e('Writeable:', 'wp-super-cache');
        ?>
 <code>chmod 666 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code>
		<?php 
        _e('Readonly:', 'wp-super-cache');
        ?>
 <code>chmod 644 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code></p>
		</div><?php 
    } else {
        define("SUBMITDISABLED", ' ');
    }
    // Server could be running as the owner of the wp-content directory.  Therefore, if it's
    // writable, issue a warning only if the permissions aren't 755.
    if (is_writeable_ACLSafe(WP_CONTENT_DIR . '/')) {
        $wp_content_stat = stat(WP_CONTENT_DIR . '/');
        $wp_content_mode = $wp_content_stat['mode'] & 0777;
        if ($wp_content_mode != 0755) {
            ?>
<h4 style='text-align:center; color: #a00'><?php 
            printf(__('Warning! %s is writeable!', 'wp-super-cache'), WP_CONTENT_DIR);
            ?>
</h4>
			<p><?php 
            printf(__('You should change the permissions on %s and make it more restrictive. Use your ftp client, or the following command to fix things:', 'wp-super-cache'), WP_CONTENT_DIR);
            ?>
<code>chmod 755 <?php 
            echo WP_CONTENT_DIR;
            ?>
/</code></p><?php 
        }
    }
    if ($valid_nonce) {
        if (isset($_POST['wp_cache_status'])) {
            if (isset($_POST['wp_cache_mobile_enabled'])) {
                $wp_cache_mobile_enabled = 1;
            } else {
                $wp_cache_mobile_enabled = 0;
            }
            if ($wp_cache_mobile_enabled == 1) {
                if (!isset($wp_cache_mobile_whitelist)) {
                    wp_cache_replace_line('^ *\\$wp_cache_mobile_whitelist', "\$wp_cache_mobile_whitelist = 'Stand Alone/QNws';", $wp_cache_config_file);
                }
                if (false == isset($wp_cache_mobile_browsers)) {
                    wp_cache_replace_line('^ *\\$wp_cache_mobile_browsers', "\$wp_cache_mobile_browsers = 'Android, 2.0 MMP, 240x320, AvantGo, BlackBerry, Blazer, Cellphone, Danger, DoCoMo, Elaine/3.0, EudoraWeb, hiptop, IEMobile, iPhone, iPod, KYOCERA/WX310K, LG/U990, MIDP-2.0, MMEF20, MOT-V, NetFront, Newt, Nintendo Wii, Nitro, Nokia, Opera Mini, Palm, Playstation Portable, portalmmm, Proxinet, ProxiNet, SHARP-TQ-GX10, Small, SonyEricsson, Symbian OS, SymbianOS, TS21i-10, UP.Browser, UP.Link, Windows CE, WinWAP';", $wp_cache_config_file);
                }
            }
            wp_cache_replace_line('^ *\\$wp_cache_mobile_enabled', "\$wp_cache_mobile_enabled = " . $wp_cache_mobile_enabled . ";", $wp_cache_config_file);
            $wp_supercache_cache_list = $_POST['wp_supercache_cache_list'] == 1 ? 1 : 0;
            wp_cache_replace_line('^ *\\$wp_supercache_cache_list', "\$wp_supercache_cache_list = " . $wp_supercache_cache_list . ";", $wp_cache_config_file);
            switch ($_POST['wp_cache_status']) {
                case 'all':
                    wp_cache_enable();
                    break;
                case 'none':
                    wp_cache_disable();
                    break;
                case 'wpcache':
                    wp_cache_enable();
                    wp_super_cache_disable();
                    break;
            }
            if (isset($_POST['wp_cache_hello_world'])) {
                $wp_cache_hello_world = 1;
            } else {
                $wp_cache_hello_world = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_hello_world', '$wp_cache_hello_world = ' . (int) $wp_cache_hello_world . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_clear_on_post_edit'])) {
                $wp_cache_clear_on_post_edit = 1;
            } else {
                $wp_cache_clear_on_post_edit = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_clear_on_post_edit', "\$wp_cache_clear_on_post_edit = " . $wp_cache_clear_on_post_edit . ";", $wp_cache_config_file);
            if (isset($_POST['cache_rebuild_files'])) {
                $cache_rebuild_files = 1;
            } else {
                $cache_rebuild_files = 0;
            }
            wp_cache_replace_line('^ *\\$cache_rebuild_files', "\$cache_rebuild_files = " . $cache_rebuild_files . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_mutex_disabled'])) {
                $wp_cache_mutex_disabled = 0;
            } else {
                $wp_cache_mutex_disabled = 1;
            }
            if (defined('WPSC_DISABLE_LOCKING')) {
                $wp_cache_mutex_disabled = 1;
            }
            wp_cache_replace_line('^ *\\$wp_cache_mutex_disabled', "\$wp_cache_mutex_disabled = " . $wp_cache_mutex_disabled . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_not_logged_in'])) {
                if ($wp_cache_not_logged_in == 0 && function_exists('prune_super_cache')) {
                    prune_super_cache($cache_path, true);
                }
                $wp_cache_not_logged_in = 1;
            } else {
                $wp_cache_not_logged_in = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_not_logged_in', "\$wp_cache_not_logged_in = " . $wp_cache_not_logged_in . ";", $wp_cache_config_file);
        }
        if (defined('WPSC_DISABLE_COMPRESSION')) {
            $cache_compression_changed = false;
            $cache_compression = 0;
            wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
        } elseif (isset($_POST['cache_compression']) && $_POST['cache_compression'] != $cache_compression) {
            $cache_compression_changed = true;
            $cache_compression = intval($_POST['cache_compression']);
            wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
            if (function_exists('prune_super_cache')) {
                prune_super_cache($cache_path, true);
            }
            delete_option('super_cache_meta');
        }
        if (isset($_POST['wp_cache_hide_donation']) && $_POST['wp_cache_hide_donation'] != $wp_cache_hide_donation) {
            $wp_cache_hide_donation = intval($_POST['wp_cache_hide_donation']);
            wp_cache_replace_line('^ *\\$wp_cache_hide_donation', "\$wp_cache_hide_donation = " . $wp_cache_hide_donation . ";", $wp_cache_config_file);
        }
    }
    echo '<a name="top"></a>';
    ?>
	<table><td><fieldset class="options" id="show-this-fieldset"> 
	<h3><?php 
    _e('WP Super Cache Status', 'wp-super-cache');
    ?>
</h3><?php 
    echo '<form name="wp_manager" action="#top" method="post">';
    ?>
	<label><input type='radio' name='wp_cache_status' value='all' <?php 
    if ($cache_enabled == true && $super_cache_enabled == true) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('ON', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('WP Cache and Super Cache enabled', 'wp-super-cache');
    ?>
</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='wpcache' <?php 
    if ($cache_enabled == true && $super_cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('HALF ON', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('Super Cache Disabled, only legacy WP-Cache caching.', 'wp-super-cache');
    ?>
</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='none' <?php 
    if ($cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('OFF', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('WP Cache and Super Cache disabled', 'wp-super-cache');
    ?>
</span></label><br />
	<p><label><input type='checkbox' name='wp_cache_not_logged_in' <?php 
    if ($wp_cache_not_logged_in) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Don&#8217;t cache pages for logged in users.', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='wp_cache_hello_world' <?php 
    if ($wp_cache_hello_world) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Proudly tell the world your server is Digg proof! (places a message in your blog&#8217;s footer)', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php 
    if ($wp_cache_clear_on_post_edit) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Clear all cache files when a post or page is published. (This may significantly slow down saving of posts.)', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='cache_rebuild_files' <?php 
    if ($cache_rebuild_files) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated. Recommended for <em>very</em> busy websites with lots of comments. Makes "directly cached pages" and "Lockdown mode" obsolete.', 'wp-super-cache');
    ?>
</label></p>
	<?php 
    if (false == defined('WPSC_DISABLE_LOCKING')) {
        ?>
		<p><label><input type='checkbox' name='wp_cache_mutex_disabled' <?php 
        if (!$wp_cache_mutex_disabled) {
            echo "checked";
        }
        ?>
 value='0'> <?php 
        _e('Coarse file locking. You probably don&#8217;t need this but it may help if your server is underpowered. Warning! <em>May cause your server to lock up in very rare cases!</em>', 'wp-super-cache');
        ?>
</label></p>
	<?php 
    }
    ?>
	<p><label><input type='checkbox' name='wp_supercache_cache_list' <?php 
    if ($wp_supercache_cache_list) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('List the newest cached pages (may be expensive to run on busy sites, use with caution.)', 'wp-super-cache');
    ?>
</label>
	<p><label><input type='checkbox' name='wp_cache_mobile_enabled' <?php 
    if ($wp_cache_mobile_enabled) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Mobile device support.', 'wp-super-cache');
    ?>
</label>
	<?php 
    $home_path = trailingslashit(get_home_path());
    $scrules = implode("\n", extract_from_markers($home_path . '.htaccess', 'WPSuperCache'));
    if (!$wp_cache_mobile_enabled && strpos($scrules, '240x320|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo')) {
        echo "<blockquote style='background-color:#feefb3; padding: 5px; margin: 5px;'><h4>" . __('Mobile rewrite rules detected', 'wp-super-cache') . "</h4>";
        echo "<p>" . __('For best performance you should enable "Mobile device support" or delete the mobile rewrite rules in your .htaccess. Look for the 2 lines with the text "Android|2.0\\ MMP|240x320|AvantGo|BlackBerry|Blazer|Cellphone" and delete those.', 'wp-super-cache') . "</p><p>" . __('This will have no affect on ordinary users but mobile users will see uncached pages.', 'wp-super-cache') . "</p></blockquote>";
    } elseif ($wp_cache_mobile_enabled && $scrules != '' && false === strpos($scrules, '240x320|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo')) {
        ?>
	<blockquote style='background-color:#fefeb3; padding: 5px; margin: 5px;'><p><?php 
        _e('Mobile support requires extra rules in your .htaccess file, or you can set the plugin to half-on mode. Here are your options (in order of difficulty):', 'wp-super-cache');
        ?>
	<ol><li> 1. <?php 
        _e('Set the plugin to half on mode and enable mobile support.', 'wp-super-cache');
        ?>
</li>
	<li> 2. <?php 
        printf(__('Delete the plugin mod_rewrite rules in %s.htaccess enclosed by <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code> and let the plugin regenerate them by reloading this page.', 'wp-super-cache'), $home_path);
        ?>
</li>
	<li> 3. <?php 
        printf(__('Add the rules yourself. Edit %s.htaccess and find the block of code enclosed by the lines <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code>. There are two sections that look very similar. Just below the line <code>%{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$</code> add this line: (do it twice, once for each section)', 'wp-super-cache'), $home_path);
        ?>
</p>
	<div style='padding: 2px; margin: 2px; border: 1px solid #333; width:400px; overflow: scroll'><pre>RewriteCond %{HTTP_user_agent} !^.*(Android|2.0\ MMP|240x320|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|hiptop|IEMobile|iPhone|iPod|KYOCERA/WX310K|LG/U990|MIDP-2.0|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|Playstation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|Windows\ CE|WinWAP).*</pre></div></li></ol></blockquote>
	<?php 
    }
    ?>
	<p><strong><?php 
    _e('Note:', 'wp-super-cache');
    ?>
</strong> <?php 
    printf(__('If uninstalling this plugin, make sure the directory <em>%s</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable too is probably a good idea!)', 'wp-super-cache'), WP_CONTENT_DIR);
    ?>
</p>
	<p><?php 
    printf(__('Uninstall using the <a href="%1$s/wp-super-cache/uninstall.php">uninstall script</a> to remove files and directories created by the plugin. (Please see <a href="%1$s/wp-super-cache/readme.txt">readme.txt</a> for instructions on uninstalling this script.)', 'wp-super-cache'), WP_PLUGIN_URL);
    ?>
</p>
	<?php 
    echo "<div class='submit'><input type='submit' " . SUBMITDISABLED . " value='" . __('Update Status', 'wp-super-cache') . " &raquo;' /></div>";
    wp_nonce_field('wp-cache');
    ?>
	</form>
	<?php 
    if ($super_cache_enabled && function_exists('apache_get_modules')) {
        $mods = apache_get_modules();
        $required_modules = array('mod_mime' => __('Required to serve compressed supercache files properly.', 'wp-super-cache'), 'mod_headers' => __('Required to set caching information on supercache pages. IE7 users will see old pages without this module.', 'wp-super-cache'), 'mod_expires' => __('Set the expiry date on supercached pages. Visitors may not see new pages when they refresh or leave comments without this module.', 'wp-super-cache'));
        foreach ($required_modules as $req => $desc) {
            if (!in_array($req, $mods)) {
                $missing_mods[$req] = $desc;
            }
        }
        if (isset($missing_mods) && is_array($missing_mods)) {
            echo "<h3>" . __('Missing Apache Modules', 'wp-super-cache') . "</h3>";
            echo "<p>" . __('The following Apache modules are missing. The plugin will work in half-on mode without them. In full Supercache mode, your visitors may see corrupted pages or out of date content however.', 'wp-super-cache') . "</p>";
            echo "<ul>";
            foreach ($missing_mods as $req => $desc) {
                echo "<li> {$req} - {$desc}</li>";
            }
            echo "</ul>";
        }
    }
    ?>
	</fieldset>
	</td><td valign='top'>
	<div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 5px'>
	<h3 align='center'><?php 
    _e('Make WordPress Faster', 'wp-super-cache');
    ?>
</h3>
	<?php 
    if ($wp_cache_hide_donation != 1) {
        ?>
	<p><?php 
        printf(__('%1$s really makes your blog go faster. Make it go faster<sup>*</sup> by buying me an <a href="%2$s">Amazon gift card</a>! Make it out to "%3$s" for whatever amount you want. Every penny helps!', 'wp-super-cache'), '<a href="http://ocaoimh.ie/wp-super-cache/?r=wpsc">WP Super Cache</a>', 'http://ocaoimh.ie/agc', '*****@*****.**');
        ?>
;</p>
	<p><?php 
        printf(__('If Amazon isn&#8217;t your thing, there&#8217;s also PayPal. Click the "Donate" button below or take a quick peek at my <a href="%s">wishlist</a>.', 'wp-super-cache'), 'http://ocaoimh.ie/wish');
        ?>
</p>
	<p><?php 
        _e('Thanks in advance!', 'wp-super-cache');
        ?>
<br />Donncha<br />
	<small>* <?php 
        _e('Ok, it won&#8217;t go any faster but you&#8217;ll make this plugin author very happy!', 'wp-super-cache');
        ?>
</small></p>
	<div align='center'>
	<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
	<input type="hidden" name="cmd" value="_s-xclick"/>
	<input type="hidden" name="hosted_button_id" value="3244504"/>
	<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt=""/>
	<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/><br />
	</form>
	<p><?php 
        _e('Don&#8217;t show me this again.', 'wp-super-cache');
        ?>
 <form action="#top" method="post"><input type='hidden' name='wp_cache_hide_donation' value='1' /><input type='submit' value='<?php 
        _e('Hide', 'wp-super-cache');
        ?>
' /><?php 
        wp_nonce_field('wp-cache');
        ?>
</form></p>
	</div>
	<?php 
    } else {
        ?>
	<p><?php 
        printf(__('%1$s is maintained and developed by %2$s with contributions from many others.', 'wp-super-cache'), '<a href="http://ocaoimh.ie/wp-super-cache/?r=supercache">WP Super Cache</a>', '<a href="http://ocaoimh.ie/?r=supercache">Donncha O Caoimh</a>');
        ?>
</p>
	<p><?php 
        printf(__('He blogs at %1$s, posts photos at %2$s and <a href="%3$s">wishes</a> he had more time to read and relax.', 'wp-super-cache'), '<a href="http://ocaoimh.ie/?r=supercache">Holy Shmoly</a>', '<a href="http://inphotos.org/?r=supercache">In Photos.org</a>', 'http://ocaoimh.ie/gad');
        ?>
</p>
	<p><?php 
        printf(__('Please say hi to him on %s too!', 'wp-super-cache'), '<a href="http://twitter.com/donncha/">Twitter</a>');
        ?>
</p>
	<?php 
    }
    if (isset($wp_supercache_cache_list) && $wp_supercache_cache_list) {
        $start_date = get_option('wpsupercache_start');
        if (!$start_date) {
            $start_date = time();
        }
        ?>
		<p><?php 
        printf(__('Cached pages since %1$s : <strong>%2$s</strong>', 'wp-super-cache'), date('M j, Y', $start_date), number_format(get_option('wpsupercache_count')));
        ?>
</p>
		<p><?php 
        _e('Newest Cached Pages:', 'wp-super-cache');
        ?>
<ol>
		<?php 
        foreach (array_reverse((array) get_option('supercache_last_cached')) as $url) {
            $since = time() - strtotime($url['date']);
            echo "<li><a title='" . sprintf(__('Cached %s seconds ago', 'wp-super-cache'), $since) . "' href='" . site_url($url['url']) . "'>{$url['url']}</a></li>\n";
        }
        ?>
</ol>
		<small><?php 
        _e('(may not always be accurate on busy sites)', 'wp-super-cache');
        ?>
</small>
		</p><?php 
    } else {
        $start_date = get_option('wpsupercache_start');
        if ($start_date) {
            update_option('wpsupercache_start', $start_date);
            update_option('wpsupercache_count', 0);
        }
    }
    ?>
	</div>

	</td></table>
	<?php 
    wp_cache_files();
    wsc_mod_rewrite();
    wp_cache_edit_max_time();
    echo '<a name="files"></a><fieldset class="options"><h3>' . __('Accepted Filenames &amp; Rejected URIs', 'wp-super-cache') . '</h3>';
    wp_cache_edit_rejected_pages();
    echo "\n";
    wp_cache_edit_rejected();
    echo "\n";
    wp_cache_edit_accepted();
    echo '</fieldset>';
    wp_cache_edit_rejected_ua();
    wp_cache_debug_settings();
    wp_lock_down();
    wp_cache_restore();
    ob_start();
    if (defined('WP_CACHE')) {
        if (function_exists('do_cacheaction')) {
            do_cacheaction('cache_admin_page');
        }
    }
    $out = ob_get_contents();
    ob_end_clean();
    if (SUBMITDISABLED == ' ' && $out != '') {
        echo '<fieldset class="options"><h3>' . __('Cache Plugins', 'wp-super-cache') . '</h3>';
        echo $out;
        echo '</fieldset>';
    }
    echo "</div>\n";
}
コード例 #16
0
<form name="form" action="options-permalink.php" method="post">
<?php 
wp_nonce_field('update-permalink');
?>
<p class="submit"><input type="submit" name="submit" value="<?php 
_e('Update Permalink Structure &raquo;');
?>
" /></p>
  <p><?php 
_e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.');
?>
</p>

<?php 
$prefix = '';
if (!got_mod_rewrite()) {
    $prefix = '/index.php';
}
$structures = array('', $prefix . '/%year%/%monthnum%/%day%/%postname%/', $prefix . '/archives/%post_id%');
?>
<h3><?php 
_e('Common options:');
?>
</h3>
<p>
	<label>
<input name="selection" type="radio" value="" class="tog" <?php 
checked('', $permalink_structure);
?>
 />
<?php 
コード例 #17
0
/**
 * Remove directives from .htaccess file to enable Shibboleth Lazy Sessions.
 */
function shibboleth_remove_htaccess()
{
    if (got_mod_rewrite()) {
        $htaccess = get_home_path() . '.htaccess';
        insert_with_markers($htaccess, 'Shibboleth', array());
    }
}
コード例 #18
0
ファイル: wp-cache.php プロジェクト: hoonio/wordpress
function wp_cache_manager()
{
    global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
    global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_browsers;
    global $wp_cache_cron_check, $wp_cache_debug, $wp_cache_hide_donation, $wp_cache_not_logged_in, $wp_supercache_cache_list;
    global $wp_super_cache_front_page_check, $wp_cache_object_cache, $_wp_using_ext_object_cache, $wp_cache_refresh_single_only, $wp_cache_mobile_prefixes;
    if (function_exists('is_site_admin')) {
        if (!is_site_admin()) {
            return;
        }
    }
    $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
    if (get_option('gzipcompression') == 1) {
        update_option('gzipcompression', 0);
    }
    if (!isset($cache_rebuild_files)) {
        $cache_rebuild_files = 0;
    }
    $valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache') : false;
    /* http://www.netlobo.com/div_hiding.html */
    ?>
<script type='text/javascript'>
<!--
function toggleLayer( whichLayer ) {
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
// -->
//Clicking header opens fieldset options
jQuery(document).ready(function(){
	jQuery("fieldset h3").css("cursor","pointer").click(function(){
		jQuery(this).parent("fieldset").find("p,form,ul,blockquote").toggle("slow");
	});
});
</script>
<?php 
    echo '<div class="wrap">';
    echo "<h2><a href='?page=wpsupercache'>" . __('WP Super Cache Manager', 'wp-super-cache') . "</a></h2>\n";
    if (1 == ini_get('safe_mode') || "on" == strtolower(ini_get('safe_mode'))) {
        ?>
<h3><?php 
        _e('Warning! PHP Safe Mode Enabled!', 'wp-super-cache');
        ?>
</h3>
		<p><?php 
        _e('You may experience problems running this plugin because SAFE MODE is enabled.', 'wp-super-cache');
        if (!ini_get('safe_mode_gid')) {
            echo __('Your server is set up to check the owner of PHP scripts before allowing them to read and write files.', 'wp-super-cache') . "</p><p>";
            echo sprintf(__('You or an administrator may be able to make it work by changing the group owner of the plugin scripts to match that of the web server user. The group owner of the %s/cache/ directory must also be changed. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details.', 'wp-super-cache'), WP_CONTENT_DIR) . "</p>";
        } else {
            echo __('You or an administrator must disable this. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details. This cannot be disabled in a .htaccess file unfortunately. It must be done in the php.ini config file.', 'wp-super-cache') . "</p>";
        }
    }
    if ('' == get_option('permalink_structure')) {
        echo "<h3>" . __('Permlink Structure Error', 'wp-super-cache') . "</h3>";
        echo "<p>" . __('A custom url or permalink structure is required for this plugin to work correctly. Please go to the <a href="options-permalink.php">Permalinks Options Page</a> to configure your permalinks.') . "</p>";
    }
    if (isset($wp_super_cache_front_page_check) && $wp_super_cache_front_page_check == 1 && !wp_next_scheduled('wp_cache_check_site_hook')) {
        wp_schedule_single_event(time() + 360, 'wp_cache_check_site_hook');
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('scheduled wp_cache_check_site_hook for 360 seconds time.', 2);
        }
    }
    if (isset($_REQUEST['wp_restore_config']) && $valid_nonce) {
        unlink($wp_cache_config_file);
        echo '<strong>' . __('Configuration file changed, some values might be wrong. Load the page again from the "Settings" menu to reset them.', 'wp-super-cache') . '</strong>';
    }
    if (!wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir()) {
        echo '<p>' . __("Cannot continue... fix previous problems and retry.", 'wp-super-cache') . '</p>';
        echo "</div>\n";
        return;
    }
    if (!wp_cache_check_global_config()) {
        echo "</div>\n";
        return;
    }
    if ($wp_cache_debug || !$wp_cache_cron_check) {
        if (function_exists("wp_remote_get") == false) {
            $hostname = str_replace('http://', '', str_replace('https://', '', get_option('siteurl')));
            if (strpos($hostname, '/')) {
                $hostname = substr($hostname, 0, strpos($hostname, '/'));
            }
            $ip = gethostbyname($hostname);
            if (substr($ip, 0, 3) == '127' || substr($ip, 0, 7) == '192.168') {
                ?>
<h3><?php 
                printf(__('Warning! Your hostname "%s" resolves to %s', 'wp-super-cache'), $hostname, $ip);
                ?>
</h3>
			<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
			<p><?php 
                printf(__('Your server thinks your hostname resolves to %s. Some services such as garbage collection by this plugin, and WordPress scheduled posts may not operate correctly.', 'wp-super-cache'), $ip);
                ?>
</p>
			<p><?php 
                printf(__('Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/faq/');
                ?>
</p>
			</div>
			<?php 
            } else {
                wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
            }
        } else {
            $cron_url = get_option('siteurl') . '/wp-cron.php?check=' . wp_hash('187425');
            $cron = wp_remote_get($cron_url, array('timeout' => 0.01, 'blocking' => true));
            if (is_array($cron)) {
                if ($cron['response']['code'] == '404') {
                    ?>
<h3>Warning! wp-cron.php not found!</h3>
				<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
				<p><?php 
                    _e('Unfortunately WordPress cannot find the file wp-cron.php. This script is required for the the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.', 'wp-super-cache');
                    ?>
</p>
				<p><?php 
                    printf(__('Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/faq/');
                    ?>
</p>
				</div>
				<?php 
                } else {
                    wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
                }
            }
        }
    }
    if (substr(get_option('permalink_structure'), -1) == '/') {
        wp_cache_replace_line('^ *\\$wp_cache_slash_check', "\$wp_cache_slash_check = 1;", $wp_cache_config_file);
    } else {
        wp_cache_replace_line('^ *\\$wp_cache_slash_check', "\$wp_cache_slash_check = 0;", $wp_cache_config_file);
    }
    if (1 == ini_get('zlib.output_compression') || "on" == strtolower(ini_get('zlib.output_compression'))) {
        ?>
<h4 style='color: #a00'><?php 
        _e('Zlib Output Compression Enabled!', 'wp-super-cache');
        ?>
</h4>
		<p><?php 
        _e('PHP is compressing the data sent to the visitors of your site. Disabling this is recommended as the plugin caches the compressed output once instead of compressing the same page over and over again. Also see #21 in the Troubleshooting section. See <a href="http://php.net/manual/en/zlib.configuration.php">this page</a> for instructions on modifying your php.ini.', 'wp-super-cache');
        ?>
</p><?php 
    }
    if ($cache_enabled == true && $super_cache_enabled == true && !got_mod_rewrite()) {
        ?>
<h4 style='color: #a00'><?php 
        _e('Mod rewrite may not be installed!', 'wp-super-cache');
        ?>
</h4>
		<p><?php 
        _e('It appears that mod_rewrite is not installed. Sometimes this check isn&#8217;t 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files. You will still be able to use half-on mode.', 'wp-super-cache');
        ?>
</p><?php 
    }
    if (!is_writeable_ACLSafe($wp_cache_config_file)) {
        define("SUBMITDISABLED", 'disabled style="color: #aaa" ');
        ?>
<h4 style='text-align:center; color: #a00'><?php 
        _e('Read Only Mode. Configuration cannot be changed.', 'wp-super-cache');
        ?>
 <a href="javascript:toggleLayer('readonlywarning');" title="<?php 
        _e('Why your configuration may not be changed', 'wp-super-cache');
        ?>
"><?php 
        _e('Why', 'wp-super-cache');
        ?>
</a></h4>
		<div id='readonlywarning' style='border: 1px solid #aaa; margin: 2px; padding: 2px; display: none;'>
		<p><?php 
        printf(__('The WP Super Cache configuration file is <code>%s/wp-cache-config.php</code> and cannot be modified. That file must be writeable by the webserver to make any changes.', 'wp-super-cache'), WP_CONTENT_DIR);
        ?>
		<?php 
        _e('A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it&#8217;s globally writeable and it should be fine.', 'wp-super-cache');
        ?>
</p>
		<?php 
        _e('Writeable:', 'wp-super-cache');
        ?>
 <code>chmod 666 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code>
		<?php 
        _e('Readonly:', 'wp-super-cache');
        ?>
 <code>chmod 644 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code></p>
		</div><?php 
    } else {
        define("SUBMITDISABLED", ' ');
    }
    // Server could be running as the owner of the wp-content directory.  Therefore, if it's
    // writable, issue a warning only if the permissions aren't 755.
    if (is_writeable_ACLSafe(WP_CONTENT_DIR . '/')) {
        $wp_content_stat = stat(WP_CONTENT_DIR . '/');
        $wp_content_mode = $wp_content_stat['mode'] & 0777;
        if ($wp_content_mode != 0755) {
            ?>
<h4 style='text-align:center; color: #a00'><?php 
            printf(__('Warning! %s is writeable!', 'wp-super-cache'), WP_CONTENT_DIR);
            ?>
</h4>
			<p><?php 
            printf(__('You should change the permissions on %s and make it more restrictive. Use your ftp client, or the following command to fix things:', 'wp-super-cache'), WP_CONTENT_DIR);
            ?>
<code>chmod 755 <?php 
            echo WP_CONTENT_DIR;
            ?>
/</code></p><?php 
        }
    }
    // used by mod_rewrite rules and config file
    if (function_exists("cfmobi_default_browsers")) {
        $wp_cache_mobile_browsers = cfmobi_default_browsers("mobile");
        $wp_cache_mobile_browsers = array_merge($wp_cache_mobile_browsers, cfmobi_default_browsers("touch"));
    } else {
        $wp_cache_mobile_browsers = array('2.0 MMP', '240x320', '400X240', 'AvantGo', 'BlackBerry', 'Blazer', 'Cellphone', 'Danger', 'DoCoMo', 'Elaine/3.0', 'EudoraWeb', 'Googlebot-Mobile', 'hiptop', 'IEMobile', 'KYOCERA/WX310K', 'LG/U990', 'MIDP-2.', 'MMEF20', 'MOT-V', 'NetFront', 'Newt', 'Nintendo Wii', 'Nitro', 'Nokia', 'Opera Mini', 'Palm', 'PlayStation Portable', 'portalmmm', 'Proxinet', 'ProxiNet', 'SHARP-TQ-GX10', 'SHG-i900', 'Small', 'SonyEricsson', 'Symbian OS', 'SymbianOS', 'TS21i-10', 'UP.Browser', 'UP.Link', 'webOS', 'Windows CE', 'WinWAP', 'YahooSeeker/M1A1-R2D2', 'iPhone', 'iPod', 'Android', 'BlackBerry9530', 'LG-TU915 Obigo', 'LGE VX', 'webOS', 'Nokia5800');
    }
    $wp_cache_mobile_prefixes = array('w3c ', 'w3c-', 'acs-', 'alav', 'alca', 'amoi', 'audi', 'avan', 'benq', 'bird', 'blac', 'blaz', 'brew', 'cell', 'cldc', 'cmd-', 'dang', 'doco', 'eric', 'hipt', 'htc_', 'inno', 'ipaq', 'ipod', 'jigs', 'kddi', 'keji', 'leno', 'lg-c', 'lg-d', 'lg-g', 'lge-', 'lg/u', 'maui', 'maxo', 'midp', 'mits', 'mmef', 'mobi', 'mot-', 'moto', 'mwbp', 'nec-', 'newt', 'noki', 'palm', 'pana', 'pant', 'phil', 'play', 'port', 'prox', 'qwap', 'sage', 'sams', 'sany', 'sch-', 'sec-', 'send', 'seri', 'sgh-', 'shar', 'sie-', 'siem', 'smal', 'smar', 'sony', 'sph-', 'symb', 't-mo', 'teli', 'tim-', 'tosh', 'tsm-', 'upg1', 'upsi', 'vk-v', 'voda', 'wap-', 'wapa', 'wapi', 'wapp', 'wapr', 'webc', 'winw', 'winw', 'xda ', 'xda-');
    // from http://svn.wp-plugins.org/wordpress-mobile-pack/trunk/plugins/wpmp_switcher/lite_detection.php
    $wp_cache_mobile_browsers = apply_filters('cached_mobile_browsers', $wp_cache_mobile_browsers);
    // Allow mobile plugins access to modify the mobile UA list
    $wp_cache_mobile_prefixes = apply_filters('cached_mobile_prefixes', $wp_cache_mobile_prefixes);
    // Allow mobile plugins access to modify the mobile UA prefix list
    $mobile_groups = apply_filters('cached_mobile_groups', array());
    // Group mobile user agents by capabilities. Lump them all together by default
    // mobile_groups = array( 'apple' => array( 'ipod', 'iphone' ), 'nokia' => array( 'nokia5800', 'symbianos' ) );
    if ($valid_nonce) {
        if (isset($_POST['wp_cache_status'])) {
            if (isset($_POST['wp_cache_mobile_enabled'])) {
                $wp_cache_mobile_enabled = 1;
            } else {
                $wp_cache_mobile_enabled = 0;
            }
            if ($wp_cache_mobile_enabled == 1) {
                update_cached_mobile_ua_list($wp_cache_mobile_browsers, $wp_cache_mobile_prefixes, $mobile_groups);
            }
            wp_cache_replace_line('^ *\\$wp_cache_mobile_enabled', "\$wp_cache_mobile_enabled = " . $wp_cache_mobile_enabled . ";", $wp_cache_config_file);
            $wp_supercache_cache_list = $_POST['wp_supercache_cache_list'] == 1 ? 1 : 0;
            wp_cache_replace_line('^ *\\$wp_supercache_cache_list', "\$wp_supercache_cache_list = " . $wp_supercache_cache_list . ";", $wp_cache_config_file);
            switch ($_POST['wp_cache_status']) {
                case 'all':
                    wp_cache_enable();
                    break;
                case 'none':
                    wp_cache_disable();
                    break;
                case 'wpcache':
                    wp_cache_enable();
                    wp_super_cache_disable();
                    break;
            }
            if (isset($_POST['wp_cache_hello_world'])) {
                $wp_cache_hello_world = 1;
            } else {
                $wp_cache_hello_world = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_hello_world', '$wp_cache_hello_world = ' . (int) $wp_cache_hello_world . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_clear_on_post_edit'])) {
                $wp_cache_clear_on_post_edit = 1;
            } else {
                $wp_cache_clear_on_post_edit = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_clear_on_post_edit', "\$wp_cache_clear_on_post_edit = " . $wp_cache_clear_on_post_edit . ";", $wp_cache_config_file);
            if (isset($_POST['cache_rebuild_files'])) {
                $cache_rebuild_files = 1;
            } else {
                $cache_rebuild_files = 0;
            }
            wp_cache_replace_line('^ *\\$cache_rebuild_files', "\$cache_rebuild_files = " . $cache_rebuild_files . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_mutex_disabled'])) {
                $wp_cache_mutex_disabled = 0;
            } else {
                $wp_cache_mutex_disabled = 1;
            }
            if (defined('WPSC_DISABLE_LOCKING')) {
                $wp_cache_mutex_disabled = 1;
            }
            wp_cache_replace_line('^ *\\$wp_cache_mutex_disabled', "\$wp_cache_mutex_disabled = " . $wp_cache_mutex_disabled . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_not_logged_in'])) {
                if ($wp_cache_not_logged_in == 0 && function_exists('prune_super_cache')) {
                    prune_super_cache($cache_path, true);
                }
                $wp_cache_not_logged_in = 1;
            } else {
                $wp_cache_not_logged_in = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_not_logged_in', "\$wp_cache_not_logged_in = " . $wp_cache_not_logged_in . ";", $wp_cache_config_file);
            if ($_wp_using_ext_object_cache && isset($_POST['wp_cache_object_cache'])) {
                if ($wp_cache_object_cache == 0 && function_exists('prune_super_cache')) {
                    prune_super_cache($cache_path, true);
                }
                $wp_cache_object_cache = 1;
            } else {
                $wp_cache_object_cache = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_object_cache', "\$wp_cache_object_cache = " . $wp_cache_object_cache . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_refresh_single_only'])) {
                $wp_cache_refresh_single_only = 1;
            } else {
                $wp_cache_refresh_single_only = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_refresh_single_only', "\$wp_cache_refresh_single_only = '" . $wp_cache_refresh_single_only . "';", $wp_cache_config_file);
        }
        if (defined('WPSC_DISABLE_COMPRESSION')) {
            $cache_compression_changed = false;
            $cache_compression = 0;
            wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
        } elseif (isset($_POST['cache_compression']) && $_POST['cache_compression'] != $cache_compression) {
            if ($_POST['cache_compression'] && 1 == ini_get('zlib.output_compression') || "on" == strtolower(ini_get('zlib.output_compression'))) {
                _e("<strong>Warning!</strong> You attempted to enable compression but <code>zlib.output_compression</code> is enabled. See #21 in the Troubleshooting section of the readme file.", 'wp-super-cache');
            } else {
                $cache_compression = intval($_POST['cache_compression']);
                $cache_compression_changed = true;
                wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
                if (function_exists('prune_super_cache')) {
                    prune_super_cache($cache_path, true);
                }
                delete_option('super_cache_meta');
            }
        }
        if (isset($_POST['wp_cache_hide_donation']) && $_POST['wp_cache_hide_donation'] != $wp_cache_hide_donation) {
            $wp_cache_hide_donation = intval($_POST['wp_cache_hide_donation']);
            wp_cache_replace_line('^ *\\$wp_cache_hide_donation', "\$wp_cache_hide_donation = " . $wp_cache_hide_donation . ";", $wp_cache_config_file);
        }
    }
    echo '<a name="top"></a>';
    ?>
	<table><td><fieldset class="options" id="show-this-fieldset"> 
	<h3><?php 
    _e('WP Super Cache Status', 'wp-super-cache');
    ?>
</h3><?php 
    echo '<form name="wp_manager" action="#top" method="post">';
    ?>
	<label><input type='radio' name='wp_cache_status' value='all' <?php 
    if ($cache_enabled == true && $super_cache_enabled == true) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('ON', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('WP Cache and Super Cache enabled', 'wp-super-cache');
    ?>
</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='wpcache' <?php 
    if ($cache_enabled == true && $super_cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('HALF ON', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('Super Cache Disabled, only legacy WP-Cache caching.', 'wp-super-cache');
    ?>
</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='none' <?php 
    if ($cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('OFF', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('WP Cache and Super Cache disabled', 'wp-super-cache');
    ?>
</span></label><br />
	<p><label><input type='checkbox' name='wp_cache_not_logged_in' <?php 
    if ($wp_cache_not_logged_in) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Don&#8217;t cache pages for known users. (Logged in users and those that comment)', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='wp_cache_hello_world' <?php 
    if ($wp_cache_hello_world) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Proudly tell the world your server is Digg proof! (places a message in your blog&#8217;s footer)', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php 
    if ($wp_cache_clear_on_post_edit) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Clear all cache files when a post or page is published. (This may significantly slow down saving of posts.)', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='cache_rebuild_files' <?php 
    if ($cache_rebuild_files) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated. Recommended for <em>very</em> busy websites with lots of comments. Makes "directly cached pages" and "Lockdown mode" obsolete.', 'wp-super-cache');
    ?>
</label></p>
	<?php 
    if (false == defined('WPSC_DISABLE_LOCKING')) {
        ?>
		<p><label><input type='checkbox' name='wp_cache_mutex_disabled' <?php 
        if (!$wp_cache_mutex_disabled) {
            echo "checked";
        }
        ?>
 value='0'> <?php 
        _e('Coarse file locking. You probably don&#8217;t need this but it may help if your server is underpowered. Warning! <em>May cause your server to lock up in very rare cases!</em>', 'wp-super-cache');
        ?>
</label></p>
	<?php 
    }
    ?>
	<p><label><input type='checkbox' name='wp_supercache_cache_list' <?php 
    if ($wp_supercache_cache_list) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('List the newest cached pages (may be expensive to run on busy sites, use with caution.)', 'wp-super-cache');
    ?>
</label>
	<p><label><input type='checkbox' name='wp_cache_mobile_enabled' <?php 
    if ($wp_cache_mobile_enabled) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    printf(__('Mobile device support.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wordpress-mobile-edition/');
    ?>
</label>
	<?php 
    $home_path = trailingslashit(get_home_path());
    $scrules = implode("\n", extract_from_markers($home_path . '.htaccess', 'WPSuperCache'));
    if (!$wp_cache_mobile_enabled && strpos($scrules, addcslashes(implode('|', $wp_cache_mobile_browsers), ' '))) {
        echo "<blockquote style='background-color:#feefb3; padding: 5px; margin: 5px;'><h4>" . __('Mobile rewrite rules detected', 'wp-super-cache') . "</h4>";
        echo "<p>" . __('For best performance you should enable "Mobile device support" or delete the mobile rewrite rules in your .htaccess. Look for the 2 lines with the text "2.0\\ MMP|240x320" and delete those.', 'wp-super-cache') . "</p><p>" . __('This will have no affect on ordinary users but mobile users will see uncached pages.', 'wp-super-cache') . "</p></blockquote>";
    } elseif ($wp_cache_mobile_enabled && $scrules != '' && (false === strpos($scrules, addcslashes(implode('|', $wp_cache_mobile_prefixes), ' ')) || false === strpos($scrules, addcslashes(implode('|', $wp_cache_mobile_browsers), ' ')))) {
        ?>
	<blockquote style='background-color:#fefeb3; padding: 5px; margin: 5px;'><h4><?php 
        _e('Rewrite rules must be updated', 'wp-super-cache');
        ?>
</h4>
	<p><?php 
        _e('The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache');
        ?>
	<?php 
        _e('Mobile support requires extra rules in your .htaccess file, or you can set the plugin to half-on mode. Here are your options (in order of difficulty):', 'wp-super-cache');
        ?>
	<ol><li> <?php 
        _e('Set the plugin to half on mode and enable mobile support.', 'wp-super-cache');
        ?>
</li>
	<li> <?php 
        _e('Scroll down this page and click the <strong>Update Mod_Rewrite Rules</strong> button.', 'wp-super-cache');
        ?>
</li>
	<li> <?php 
        printf(__('Delete the plugin mod_rewrite rules in %s.htaccess enclosed by <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code> and let the plugin regenerate them by reloading this page.', 'wp-super-cache'), $home_path);
        ?>
</li>
	<li> <?php 
        printf(__('Add the rules yourself. Edit %s.htaccess and find the block of code enclosed by the lines <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code>. There are two sections that look very similar. Just below the line <code>%%{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$</code> add these lines: (do it twice, once for each section)', 'wp-super-cache'), $home_path);
        ?>
</p>
	<div style='padding: 2px; margin: 2px; border: 1px solid #333; width:400px; overflow: scroll'><pre>RewriteCond %{HTTP_user_agent} !^.*(<?php 
        echo addcslashes(implode('|', $wp_cache_mobile_browsers), ' ');
        ?>
).*
RewriteCond %{HTTP_user_agent} !^(<?php 
        echo addcslashes(implode('|', $wp_cache_mobile_prefixes), ' ');
        ?>
).*</pre></div></li></ol></blockquote>
	<?php 
    }
    ?>
	<?php 
    if ($_wp_using_ext_object_cache) {
        ?>
<p><label><input type='checkbox' name='wp_cache_object_cache' <?php 
        if ($wp_cache_object_cache) {
            echo "checked";
        }
        ?>
 value='1'> <?php 
        echo __('Use object cache to store cached files.', 'wp-super-cache') . ' ' . __('(Experimental)', 'wp-super-cache');
        ?>
</label></p><?php 
    }
    ?>
<p><label><input type='checkbox' name='wp_cache_refresh_single_only' <?php 
    if ($wp_cache_refresh_single_only) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    echo __('Only refresh current page when comments made.', 'wp-super-cache');
    ?>
</label></p> 
	<p><strong><?php 
    _e('Note:', 'wp-super-cache');
    ?>
</strong> <?php 
    printf(__('If uninstalling this plugin, make sure the directory <em>%s</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable too is probably a good idea!)', 'wp-super-cache'), WP_CONTENT_DIR);
    ?>
</p>
	<p><?php 
    printf(__('Please see the <a href="%1$s/wp-super-cache/readme.txt">readme.txt</a> for instructions on uninstalling this script. Look for the heading, "How to uninstall WP Super Cache".', 'wp-super-cache'), WP_PLUGIN_URL);
    ?>
</p><?php 
    echo "<p><em>" . sprintf(__('Need help? Check the <a href="%1$s">Super Cache readme file</a>. It includes installation documentation, a FAQ and Troubleshooting tips. The <a href="%2$s">support forum</a> is also available. Your question may already have been answered.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/', 'http://wordpress.org/tags/wp-super-cache?forum_id=10') . "</em></p>";
    echo "<div class='submit'><input type='submit' " . SUBMITDISABLED . " value='" . __('Update Status', 'wp-super-cache') . " &raquo;' /></div>";
    wp_nonce_field('wp-cache');
    ?>
	</form>
	<?php 
    if ($cache_enabled) {
        echo '<a name="test"></a>';
        echo "<h3>" . __('Cache Tester', 'wp-super-cache') . "</h3>";
        echo '<p>' . __('Test your cached website by clicking the test button below.', 'wp-super-cache') . '</p>';
        if ($_POST['action'] == 'test' && $valid_nonce) {
            // Prime the cache
            echo "<p>";
            printf(__('Fetching %s to prime cache: ', 'wp-super-cache'), site_url());
            $page = wp_remote_get(site_url(), array('timeout' => 60, 'blocking' => true));
            echo '<strong>' . __('OK', 'wp-super-cache') . '</strong>';
            echo "</p>";
            sleep(1);
            // Get the first copy
            echo "<p>";
            printf(__('Fetching first copy of %s: ', 'wp-super-cache'), site_url());
            $page = wp_remote_get(site_url(), array('timeout' => 60, 'blocking' => true));
            echo '<strong>' . __('OK', 'wp-super-cache') . '</strong>';
            echo "</p>";
            sleep(1);
            // Get the second copy
            echo "<p>";
            printf(__('Fetching second copy of %s: ', 'wp-super-cache'), site_url());
            $page2 = wp_remote_get(site_url(), array('timeout' => 60, 'blocking' => true));
            echo '<strong>' . __('OK', 'wp-super-cache') . '</strong>';
            echo "</p>";
            if (preg_match('/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page['body'], $matches1) && preg_match('/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page2['body'], $matches2) && $matches1[2] == $matches2[2]) {
                echo '<p>' . sprintf(__('Page 1: %s', 'wp-super-cache'), $matches1[2]) . '</p>';
                echo '<p>' . sprintf(__('Page 2: %s', 'wp-super-cache'), $matches2[2]) . '</p>';
                echo '<p><strong>' . __('The timestamps on both pages match!', 'wp-super-cache') . '</strong></p>';
            } else {
                echo '<p><strong>' . __('The pages do not match! Timestamps differ or were not found!', 'wp-super-cache') . '</strong></p>';
            }
        }
        echo '<form name="cache_tester" action="#test" method="post">';
        echo '<input type="hidden" name="action" value="test" />';
        echo '<div class="submit"><input type="submit" name="test" value="' . __('Test Cache', 'wp-super-cache') . '" /></div>';
        wp_nonce_field('wp-cache');
        echo '</form>';
        echo '<a name="preload"></a>';
        echo "<h3>" . __('Preload Cache', 'wp-super-cache') . "</h3>";
        if ($super_cache_enabled == true && false == defined('DISABLESUPERCACHEPRELOADING')) {
            global $wp_cache_preload_interval, $wp_cache_preload_on, $wp_cache_preload_email_me, $wp_cache_preload_email_volume, $wp_cache_preload_posts, $wpdb;
            $count = $wpdb->get_var("SELECT count(*) FROM {$wpdb->posts} WHERE post_status = 'publish'");
            if ($count > 1000) {
                $min_refresh_interval = 720;
            } else {
                $min_refresh_interval = 30;
            }
            if ($_POST['action'] == 'preload' && $valid_nonce) {
                if ($_POST['posts_to_cache'] == 'all') {
                    $wp_cache_preload_posts = 'all';
                } else {
                    $wp_cache_preload_posts = (int) $_POST['posts_to_cache'];
                }
                wp_cache_replace_line('^ *\\$wp_cache_preload_posts', "\$wp_cache_preload_posts = '{$wp_cache_preload_posts}';", $wp_cache_config_file);
                if (isset($_POST['preload']) && $_POST['preload'] == __('Cancel Cache Preload', 'wp-super-cache')) {
                    $next_preload = wp_next_scheduled('wp_cache_preload_hook');
                    if ($next_preload) {
                        update_option('preload_cache_counter', 0);
                        wp_unschedule_event($next_preload, 'wp_cache_preload_hook');
                    }
                    echo "<p><strong>" . __('Scheduled preloading of cache cancelled. If a job is currently running it will not shutdown until the current 100 pages are complete.', 'wp-super-cache') . "</strong></p>";
                } elseif (isset($_POST['custom_preload_interval']) && ($_POST['custom_preload_interval'] == 0 || $_POST['custom_preload_interval'] >= $min_refresh_interval)) {
                    // if preload interval changes than unschedule any preload jobs and schedule any new one.
                    $_POST['custom_preload_interval'] = (int) $_POST['custom_preload_interval'];
                    if ($wp_cache_preload_interval != $_POST['custom_preload_interval']) {
                        $next_preload = wp_next_scheduled('wp_cache_full_preload_hook');
                        if ($next_preload) {
                            update_option('preload_cache_counter', 0);
                            add_option('preload_cache_stop', 1);
                            wp_unschedule_event($next_preload, 'wp_cache_full_preload_hook');
                            if ($wp_cache_preload_interval == 0) {
                                echo "<p><strong>" . __('Scheduled preloading of cache cancelled.', 'wp-super-cache') . "</strong></p>";
                            }
                        }
                        if ($_POST['custom_preload_interval'] != 0) {
                            wp_schedule_single_event(time() + $_POST['custom_preload_interval'] * 60, 'wp_cache_full_preload_hook');
                        }
                    }
                    $wp_cache_preload_interval = (int) $_POST['custom_preload_interval'];
                    wp_cache_replace_line('^ *\\$wp_cache_preload_interval', "\$wp_cache_preload_interval = {$wp_cache_preload_interval};", $wp_cache_config_file);
                    if (isset($_POST['preload_email_me'])) {
                        $wp_cache_preload_email_me = 1;
                    } else {
                        $wp_cache_preload_email_me = 0;
                    }
                    wp_cache_replace_line('^ *\\$wp_cache_preload_email_me', "\$wp_cache_preload_email_me = {$wp_cache_preload_email_me};", $wp_cache_config_file);
                    if (isset($_POST['wp_cache_preload_email_volume']) && in_array($_POST['wp_cache_preload_email_volume'], array('less', 'medium', 'many'))) {
                        $wp_cache_preload_email_volume = $_POST['wp_cache_preload_email_volume'];
                    } else {
                        $wp_cache_preload_email_volume = 'medium';
                    }
                    wp_cache_replace_line('^ *\\$wp_cache_preload_email_volume', "\$wp_cache_preload_email_volume = '{$wp_cache_preload_email_volume}';", $wp_cache_config_file);
                    if (isset($_POST['preload_on'])) {
                        $wp_cache_preload_on = 1;
                    } else {
                        $wp_cache_preload_on = 0;
                    }
                    wp_cache_replace_line('^ *\\$wp_cache_preload_on', "\$wp_cache_preload_on = {$wp_cache_preload_on};", $wp_cache_config_file);
                    if (isset($_POST['preload']) && $_POST['preload'] == __('Preload Cache Now', 'wp-super-cache')) {
                        update_option('preload_cache_counter', 0);
                        wp_schedule_single_event(time() + 10, 'wp_cache_preload_hook');
                        echo "<p><strong>" . __('Scheduled preloading of cache in 10 seconds.') . "</strong></p>";
                    } elseif ((int) $_POST['custom_preload_interval']) {
                        update_option('preload_cache_counter', 0);
                        wp_schedule_single_event(time() + (int) $_POST['custom_preload_interval'] * 60, 'wp_cache_full_preload_hook');
                        echo "<p><strong>" . sprintf(__('Scheduled preloading of cache in %d minutes', 'wp-super-cache'), (int) $_POST['custom_preload_interval']) . "</strong></p>";
                    }
                }
            }
            echo '<p>' . __('This will cache every published post and page on your site. It will create supercache static files so unknown visitors (including bots) will hit a cached page. This will probably help your Google ranking as they are using speed as a metric when judging websites now.', 'wp-super-cache') . '</p>';
            echo '<p>' . __('Preloading creates lots of files however. Caching is done from the newest post to the oldest so please consider only caching the newest if you have lots (10,000+) of posts. This is especially important on shared hosting.', 'wp-super-cache') . '</p>';
            echo '<p>' . __('In &#8217;Preload Mode&#8217; regular garbage collection will only clean out old half-on files for known users, not the preloaded supercache files. This is a recommended setting when the cache is preloaded.', 'wp-super-cache') . '</p>';
            echo '<form name="cache_filler" action="#preload" method="POST">';
            echo '<input type="hidden" name="action" value="preload" />';
            echo '<input type="hidden" name="page" value="wpsupercache" />';
            echo '<p>' . sprintf(__('Refresh preloaded cache files every %s minutes. (0 to disable, minimum %d minutes.)', 'wp-super-cache'), "<input type='text' size=4 name='custom_preload_interval' value='" . (int) $wp_cache_preload_interval . "' />", $min_refresh_interval) . '</p>';
            if ($count > 1000) {
                $step = (int) ($count / 5);
                $select = "<select name='posts_to_cache' size=1>";
                $select .= "<option value='all' ";
                if (!isset($wp_cache_preload_posts) || $wp_cache_preload_posts == 'all') {
                    $checked = 'selectect=1 ';
                    $best = 'all';
                } else {
                    $checked = ' ';
                    $best = $wp_cache_preload_posts;
                }
                $select .= "{$checked}>" . __('all', 'wp-super-cache') . "</option>";
                for ($c = $step; $c < $count; $c += $step) {
                    $checked = ' ';
                    if ($best == $c) {
                        $checked = 'selected=1 ';
                    }
                    $select .= "<option value='{$c}'{$checked}>{$c}</option>";
                }
                $checked = ' ';
                if ($best == $count) {
                    $checked = 'selected=1 ';
                }
                $select .= "<option value='{$count}'{$checked}>{$count}</option>";
                $select .= "</select>";
                echo '<p>' . sprintf(__('Preload %s posts.', 'wp-super-cache'), $select) . '</p>';
            } else {
                echo '<input type="hidden" name="posts_to_cache" value="' . $count . '" />';
            }
            echo '<input type="checkbox" name="preload_on" value="1" ';
            echo $wp_cache_preload_on == 1 ? 'checked=1' : '';
            echo ' /> ' . __('Preload mode (garbage collection only on half-on cache files. Recommended.)', 'wp-super-cache') . '<br />';
            echo '<input type="checkbox" name="preload_email_me" value="1" ';
            echo $wp_cache_preload_email_me == 1 ? 'checked=1' : '';
            echo ' /> ' . __('Send me status emails when files are refreshed.', 'wp-super-cache') . '<br />';
            if (!isset($wp_cache_preload_email_volume)) {
                $wp_cache_preload_email_volume = 'many';
            }
            echo '&nbsp;&nbsp;&nbsp;&nbsp;<input name="wp_cache_preload_email_volume" type="radio" value="many" class="tog" ';
            checked('many', $wp_cache_preload_email_volume);
            echo '/> ' . __('Many emails, 2 emails per 100 posts.') . '<br >';
            echo '&nbsp;&nbsp;&nbsp;&nbsp;<input name="wp_cache_preload_email_volume" type="radio" value="medium" class="tog" ';
            checked('medium', $wp_cache_preload_email_volume);
            echo '/> ' . __('Medium, 1 email per 100 posts.') . '<br >';
            echo '&nbsp;&nbsp;&nbsp;&nbsp;<input name="wp_cache_preload_email_volume" type="radio" value="less" class="tog" ';
            checked('less', $wp_cache_preload_email_volume);
            echo '/> ' . __('Less emails, 1 at the start and 1 at the end of preloading all posts.', 'wp-super-cache') . '<br >';
            $currently_preloading = false;
            next_preload_message('wp_cache_preload_hook', 'Refresh of cache in %d hours %d minutes and %d seconds.', 60);
            next_preload_message('wp_cache_full_preload_hook', 'Full refresh of cache in %d hours %d minutes and %d seconds.');
            if ($preload_counter = get_option('preload_cache_counter')) {
                echo '<p><strong>' . sprintf(__('Currently caching from post %d to %d.', 'wp-super-cache'), $preload_counter, $preload_counter + 100) . '</strong></p>';
                $currently_preloading = true;
            }
            echo '<div class="submit"><input type="submit" name="preload" value="' . __('Update Settings', 'wp-super-cache') . '" />&nbsp;<input type="submit" name="preload" value="' . __('Preload Cache Now', 'wp-super-cache') . '" />';
            if ($currently_preloading) {
                echo '&nbsp;<input type="submit" name="preload" value="' . __('Cancel Cache Preload', 'wp-super-cache') . '" />';
            }
            echo '</div>';
            wp_nonce_field('wp-cache');
            echo '</form>';
        } else {
            echo '<p>' . __('Preloading of cache disabled. Please enable supercaching or talk to your host administrator.', 'wp-super-cache') . '</p>';
        }
    }
    if ($super_cache_enabled && function_exists('apache_get_modules')) {
        $mods = apache_get_modules();
        $required_modules = array('mod_mime' => __('Required to serve compressed supercache files properly.', 'wp-super-cache'), 'mod_headers' => __('Required to set caching information on supercache pages. IE7 users will see old pages without this module.', 'wp-super-cache'), 'mod_expires' => __('Set the expiry date on supercached pages. Visitors may not see new pages when they refresh or leave comments without this module.', 'wp-super-cache'));
        foreach ($required_modules as $req => $desc) {
            if (!in_array($req, $mods)) {
                $missing_mods[$req] = $desc;
            }
        }
        if (isset($missing_mods) && is_array($missing_mods)) {
            echo "<h3>" . __('Missing Apache Modules', 'wp-super-cache') . "</h3>";
            echo "<p>" . __('The following Apache modules are missing. The plugin will work in half-on mode without them. In full Supercache mode, your visitors may see corrupted pages or out of date content however.', 'wp-super-cache') . "</p>";
            echo "<ul>";
            foreach ($missing_mods as $req => $desc) {
                echo "<li> {$req} - {$desc}</li>";
            }
            echo "</ul>";
        }
    }
    ?>
	</fieldset>
	</td><td valign='top'>
	<div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 5px'>
	<h3 align='center'><?php 
    _e('Make WordPress Faster', 'wp-super-cache');
    ?>
</h3>
	<?php 
    if ($wp_cache_hide_donation != 1) {
        ?>
	<p><?php 
        printf(__('%1$s really makes your blog go faster. Make it go faster<sup>*</sup> by buying me an <a href="%2$s">Amazon gift card</a>! Make it out to "%3$s" for whatever amount you want. Every penny helps!', 'wp-super-cache'), '<a href="http://ocaoimh.ie/wp-super-cache/?r=wpsc">WP Super Cache</a>', 'http://ocaoimh.ie/agc', '*****@*****.**');
        ?>
;</p>
	<p><?php 
        printf(__('If Amazon isn&#8217;t your thing, there&#8217;s also PayPal. Click the "Donate" button below or take a quick peek at my <a href="%s">wishlist</a>.', 'wp-super-cache'), 'http://ocaoimh.ie/wish');
        ?>
</p>
	<p><?php 
        _e('Thanks in advance!', 'wp-super-cache');
        ?>
<br />Donncha<br />
	<small>* <?php 
        _e('Ok, it won&#8217;t go any faster but you&#8217;ll make this plugin author very happy!', 'wp-super-cache');
        ?>
</small></p>
	<div align='center'>
	<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
	<input type="hidden" name="cmd" value="_s-xclick"/>
	<input type="hidden" name="hosted_button_id" value="3244504"/>
	<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt=""/>
	<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/><br />
	</form>
	<p><?php 
        _e('Don&#8217;t show me this again.', 'wp-super-cache');
        ?>
 <form action="#top" method="post"><input type='hidden' name='wp_cache_hide_donation' value='1' /><input type='submit' value='<?php 
        _e('Hide', 'wp-super-cache');
        ?>
' /><?php 
        wp_nonce_field('wp-cache');
        ?>
</form></p>
	</div>
	<?php 
    } else {
        ?>
	<p><?php 
        printf(__('%1$s is maintained and developed by %2$s with contributions from many others.', 'wp-super-cache'), '<a href="http://ocaoimh.ie/wp-super-cache/?r=supercache">WP Super Cache</a>', '<a href="http://ocaoimh.ie/?r=supercache">Donncha O Caoimh</a>');
        ?>
</p>
	<p><?php 
        printf(__('He blogs at %1$s and posts photos at %2$s. He would really appreciate a <a href="%3$s">donation</a> to encourage development of this plugin.<br />Even a penny will help.', 'wp-super-cache'), '<a href="http://ocaoimh.ie/?r=supercache">Holy Shmoly</a>', '<a href="http://inphotos.org/?r=supercache">In Photos.org</a>', 'http://ocaoimh.ie/gad');
        ?>
</p>
	<p><?php 
        printf(__('Please say hi to him on %s too!', 'wp-super-cache'), '<a href="http://twitter.com/donncha/">Twitter</a>');
        ?>
</p>
	<?php 
    }
    if (isset($wp_supercache_cache_list) && $wp_supercache_cache_list) {
        $start_date = get_option('wpsupercache_start');
        if (!$start_date) {
            $start_date = time();
        }
        ?>
		<p><?php 
        printf(__('Cached pages since %1$s : <strong>%2$s</strong>', 'wp-super-cache'), date('M j, Y', $start_date), number_format(get_option('wpsupercache_count')));
        ?>
</p>
		<p><?php 
        _e('Newest Cached Pages:', 'wp-super-cache');
        ?>
<ol>
		<?php 
        foreach (array_reverse((array) get_option('supercache_last_cached')) as $url) {
            $since = time() - strtotime($url['date']);
            echo "<li><a title='" . sprintf(__('Cached %s seconds ago', 'wp-super-cache'), $since) . "' href='" . site_url($url['url']) . "'>{$url['url']}</a></li>\n";
        }
        ?>
</ol>
		<small><?php 
        _e('(may not always be accurate on busy sites)', 'wp-super-cache');
        ?>
</small>
		</p><?php 
    } else {
        $start_date = get_option('wpsupercache_start');
        if ($start_date) {
            update_option('wpsupercache_start', $start_date);
            update_option('wpsupercache_count', 0);
        }
    }
    ?>
	</div>

	</td></table>
	<?php 
    wp_cache_files();
    wsc_mod_rewrite();
    wp_cache_edit_max_time();
    echo '<a name="files"></a><fieldset class="options"><h3>' . __('Accepted Filenames &amp; Rejected URIs', 'wp-super-cache') . '</h3>';
    wp_cache_edit_rejected_pages();
    echo "\n";
    wp_cache_edit_rejected();
    echo "\n";
    wp_cache_edit_accepted();
    echo '</fieldset>';
    wp_cache_edit_rejected_ua();
    wp_cache_debug_settings();
    wp_lock_down();
    wp_cache_restore();
    ob_start();
    if (defined('WP_CACHE')) {
        if (function_exists('do_cacheaction')) {
            do_cacheaction('cache_admin_page');
        }
    }
    $out = ob_get_contents();
    ob_end_clean();
    if (SUBMITDISABLED == ' ' && $out != '') {
        echo '<fieldset class="options"><h3>' . __('Cache Plugins', 'wp-super-cache') . '</h3>';
        echo $out;
        echo '</fieldset>';
    }
    echo "</div>\n";
}
コード例 #19
0
ファイル: wp-cache.php プロジェクト: alx/alexgirard.com-blog
function wp_cache_manager()
{
    global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world, $wp_cache_clear_on_post_edit, $cache_rebuild_files;
    if (function_exists('is_site_admin')) {
        if (!is_site_admin()) {
            return;
        }
    }
    $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
    if (get_option('gzipcompression') == 1) {
        update_option('gzipcompression', 0);
    }
    if (!isset($cache_rebuild_files)) {
        $cache_rebuild_files = 0;
    }
    $valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache');
    /* http://www.netlobo.com/div_hiding.html */
    ?>
<script type='text/javascript'>
<!--
function toggleLayer( whichLayer ) {
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
// -->
</script>
<style type="text/css">
/* Taken from http://sw-guide.de/wordpress/plugins/simple-trackback-validation/ */
.wrap h3 { color: black; background-color: #e5f3ff; padding: 4px 8px; }
</style>
<?php 
    echo '<div class="wrap">';
    echo "<h2>WP Super Cache Manager</h2>\n";
    if (ini_get('safe_mode')) {
        ?>
<h3>Warning! PHP safe mode enabled!</h3>
		<p>You may experience problems running this plugin because SAFE MODE is enabled. <?php 
        if (!ini_get('safe_mode_gid')) {
            ?>
Your server is set up to check the owner of PHP scripts before allowing them to read and write files.</p><p>You or an administrator may be able to make it work by changing the group owner of the plugin scripts to match that of the web server user. The group owner of the <?php 
            echo WP_CONTENT_DIR;
            ?>
/cache/ directory must also be changed. See the <a href='http://php.net/features.safe-mode'>safe mode manual page</a> for further details.</p><?php 
        } else {
            ?>
You or an administrator must disable this. See the <a href='http://php.net/features.safe-mode'>safe mode manual page</a> for further details. This cannot be disabled in a .htaccess file unfortunately. It must be done in the php.ini config file.</p><?php 
        }
    }
    if (isset($_REQUEST['wp_restore_config']) && $valid_nonce) {
        unlink($wp_cache_config_file);
        echo '<strong>Configuration file changed, some values might be wrong. Load the page again from the "Settings" menu to reset them.</strong>';
    }
    if (!wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir()) {
        echo "<br>Cannot continue... fix previous problems and retry.<br />";
        echo "</div>\n";
        return;
    }
    if (!wp_cache_check_global_config()) {
        echo "</div>\n";
        return;
    }
    if ($cache_enabled == true && $super_cache_enabled == true && !got_mod_rewrite()) {
        ?>
<h4 style='color: #a00'>Mod rewrite may not be installed!</h4>
		<p>It appears that mod_rewrite is not installed. Sometimes this check isn't 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files. You will still be able to use WP-Cache.</p><?php 
    }
    if (!is_writeable_ACLSafe($wp_cache_config_file)) {
        define("SUBMITDISABLED", 'disabled style="color: #aaa" ');
        ?>
<h4 style='text-align:center; color: #a00'>Read Only Mode. Configuration cannot be changed. <a href="javascript:toggleLayer('readonlywarning');" title="Why your configuration may not be changed">Why</a></h4>
		<div id='readonlywarning' style='border: 1px solid #aaa; margin: 2px; padding: 2px; display: none;'>
		<p>The WP Super Cache configuration file is <code><?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code> and cannot be modified. The file <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php must be writeable by the webserver to make any changes.<br />
		A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it's globally writeable and it should be fine.<br />
		Writeable: <code>chmod 666 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code><br />
		Readonly: <code>chmod 644 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code></p>
		</div><?php 
    } else {
        define("SUBMITDISABLED", ' ');
    }
    // Server could be running as the owner of the wp-content directory.  Therefore, if it's
    // writable, issue a warning only if the permissions aren't 755.
    if (is_writeable_ACLSafe(WP_CONTENT_DIR . '/')) {
        $wp_content_stat = stat(WP_CONTENT_DIR . '/');
        $wp_content_mode = $wp_content_stat['mode'] & 0777;
        if ($wp_content_mode != 0755) {
            ?>
<h4 style='text-align:center; color: #a00'>Warning! <?php 
            echo WP_CONTENT_DIR;
            ?>
 is writeable!</h4>
			<p>You should change the permissions on <?php 
            echo WP_CONTENT_DIR;
            ?>
 and make it more restrictive. Use your ftp client, or the following command to fix things:<br /><code>chmod 755 <?php 
            echo WP_CONTENT_DIR;
            ?>
/</code></p><?php 
        }
    }
    if ($valid_nonce) {
        if (isset($_POST['wp_cache_status'])) {
            switch ($_POST['wp_cache_status']) {
                case 'all':
                    wp_cache_enable();
                    break;
                case 'none':
                    wp_cache_disable();
                    break;
                case 'wpcache':
                    wp_cache_enable();
                    wp_super_cache_disable();
                    break;
            }
            if (isset($_POST['wp_cache_hello_world'])) {
                $wp_cache_hello_world = 1;
            } else {
                $wp_cache_hello_world = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_hello_world', '$wp_cache_hello_world = ' . (int) $wp_cache_hello_world . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_clear_on_post_edit'])) {
                $wp_cache_clear_on_post_edit = 1;
            } else {
                $wp_cache_clear_on_post_edit = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_clear_on_post_edit', "\$wp_cache_clear_on_post_edit = " . $wp_cache_clear_on_post_edit . ";", $wp_cache_config_file);
        }
        if (isset($_POST['cache_compression']) && $_POST['cache_compression'] != $cache_compression) {
            $cache_compression_changed = true;
            $cache_compression = intval($_POST['cache_compression']);
            wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
            if (function_exists('prune_super_cache')) {
                prune_super_cache($cache_path, true);
            }
            delete_option('super_cache_meta');
        }
    }
    ?>
<fieldset class="options"> 
	<h3>WP Super Cache Status</h3><?php 
    echo '<form name="wp_manager" action="' . $_SERVER["REQUEST_URI"] . '" method="post">';
    ?>
	<label><input type='radio' name='wp_cache_status' value='all' <?php 
    if ($cache_enabled == true && $super_cache_enabled == true) {
        echo 'checked=checked';
    }
    ?>
> <strong>ON</strong> (WP Cache and Super Cache enabled)</label><br />
	<label><input type='radio' name='wp_cache_status' value='wpcache' <?php 
    if ($cache_enabled == true && $super_cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong>HALF ON</strong> (Super Cache Disabled, only legacy WP-Cache caching.)</label><br />
	<label><input type='radio' name='wp_cache_status' value='none' <?php 
    if ($cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong>OFF</strong> (WP Cache and Super Cache disabled)</label><br />
	<p><label><input type='checkbox' name='wp_cache_hello_world' <?php 
    if ($wp_cache_hello_world) {
        echo "checked";
    }
    ?>
 value='1'> Proudly tell the world your server is Digg proof! (places a message in your blog's footer)</label></p>
	<p><label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php 
    if ($wp_cache_clear_on_post_edit) {
        echo "checked";
    }
    ?>
 value='1'> Clear all cache files when a post or page is published. (This may significantly slow down saving of posts.)</label></p>
	<p>Note: if uninstalling this plugin, make sure the directory <em><?php 
    echo WP_CONTENT_DIR;
    ?>
</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable too is probably a good idea!)</p>
	<?php 
    echo "<div><input type='submit' " . SUBMITDISABLED . " value='Update Status &raquo;' /></div>";
    wp_nonce_field('wp-cache');
    ?>
	</form>
	</fieldset>
	<?php 
    wsc_mod_rewrite();
    wp_cache_edit_max_time();
    echo '<br /><a name="files"></a><fieldset class="options"><h3>Accepted filenames, rejected URIs</h3>';
    wp_cache_edit_rejected();
    echo "<br />\n";
    wp_cache_edit_accepted();
    echo '</fieldset>';
    wp_cache_edit_rejected_ua();
    wp_cache_files();
    wp_lock_down();
    wp_cache_restore();
    ob_start();
    if (defined('WP_CACHE')) {
        if (function_exists('do_cacheaction')) {
            do_cacheaction('cache_admin_page');
        }
    }
    $out = ob_get_contents();
    ob_end_clean();
    if (SUBMITDISABLED == ' ' && $out != '') {
        echo '<fieldset class="options"><h3>Cache Plugins</h3>';
        echo $out;
        echo '</fieldset>';
    }
    echo "</div>\n";
}
コード例 #20
0
/**
 * On plugin activation
 *
 * @since 0.1
 *
 * @uses _mgjp_mv_activate_local()
 */
function mgjp_mv_activate($network_activating)
{
    global $is_apache;
    if ($is_apache && !is_multisite() && get_option('permalink_structure') && got_mod_rewrite() && is_writable(get_home_path() . '.htaccess')) {
        // register plugin enabled option
        update_site_option('mgjp_mv_enabled', true);
        // Flush rewrite rules to add Media Vault rewrite rules to the
        // site's .htaccess file on plugin activation
        add_filter('mod_rewrite_rules', 'mgjp_mv_add_plugin_rewrite_rules');
        flush_rewrite_rules();
    }
    // register Media Vault's other network-wide options
    add_site_option('mgjp_mv_version', MGJP_MV_VERSION, '', 'yes');
    delete_site_option('mgjp_mv_deactivation');
    if (!is_multisite()) {
        // run the activation function for the single site
        _mgjp_mv_activate_local();
    } else {
        if (!wp_is_large_network()) {
            global $wpdb;
            $blog_ids = $wpdb->get_col("SELECT `blog_id` FROM `{$wpdb->blogs}`");
            // run the activation function for each site in the network
            foreach ($blog_ids as $blog_id) {
                switch_to_blog($blog_id);
                _mgjp_mv_activate_local($blog_id);
                restore_current_blog();
            }
        }
    }
}
コード例 #21
0
    public function init()
    {
        // always flush rewrite rules here for custom_episode_slug setting
        if ($this->is_active()) {
            set_transient('podlove_needs_to_flush_rewrite_rules', true);
        }
        add_settings_section('podlove_settings_general', __('', 'podlove'), function () {
            echo '<h3>' . __('Website Settings', 'podlove') . '</h3>';
        }, Settings::$pagehook);
        add_settings_section('podlove_settings_files', __('', 'podlove'), function () {
            echo '<h3>' . __('Files & Downloads', 'podlove') . '</h3>';
        }, Settings::$pagehook);
        add_settings_section('podlove_settings_feeds', __('', 'podlove'), function () {
            echo '<h3>' . __('Feeds', 'podlove') . '</h3>';
        }, Settings::$pagehook);
        add_settings_field('podlove_setting_merge_episodes', sprintf('<label for="merge_episodes">%s</label>', __('Combine blog & podcast', 'podlove')), function () {
            ?>
				<input name="podlove_website[merge_episodes]" id="merge_episodes" type="checkbox" <?php 
            checked(\Podlove\get_setting('website', 'merge_episodes'), 'on');
            ?>
>
				<?php 
            echo __('Include episode posts on the front page and in the blog feed', 'podlove');
        }, Settings::$pagehook, 'podlove_settings_general');
        add_settings_field('podlove_setting_hide_wp_feed_discovery', sprintf('<label for="hide_wp_feed_discovery">%s</label>', __('Hide blog feeds', 'podlove')), function () {
            ?>
				<input name="podlove_website[hide_wp_feed_discovery]" id="hide_wp_feed_discovery" type="checkbox" <?php 
            checked(\Podlove\get_setting('website', 'hide_wp_feed_discovery'), 'on');
            ?>
>
				<?php 
            echo __('Hide default WordPress feeds for blog and comments (no auto-discovery).', 'podlove');
        }, Settings::$pagehook, 'podlove_settings_general');
        add_settings_field('podlove_setting_custom_episode_slug', sprintf('<label for="custom_episode_slug">%s</label>', __('Permalink structure for episodes', 'podlove')), function () {
            $use_post_permastruct = \Podlove\get_setting('website', 'use_post_permastruct');
            $custom_episode_slug = \Podlove\get_setting('website', 'custom_episode_slug');
            if ($blog_prefix = \Podlove\get_blog_prefix()) {
                $custom_episode_slug = preg_replace('|^/?blog|', '', $custom_episode_slug);
            }
            ?>
				<input name="podlove_website[use_post_permastruct]" id="use_post_permastruct" type="checkbox" <?php 
            checked($use_post_permastruct, 'on');
            ?>
> <?php 
            _e('Use the same permalink structure as posts', 'podlove');
            ?>
				<div id="custom_podcast_permastruct"<?php 
            if ($use_post_permastruct) {
                echo ' style="display:none;"';
            }
            ?>
>
					<code><?php 
            echo get_option('home');
            ?>
</code>
					<input name="podlove_website[custom_episode_slug]" id="custom_episode_slug" type="text" value="<?php 
            echo $custom_episode_slug;
            ?>
">
					<p><span class="description">
						<?php 
            echo __('
							Placeholders: %podcast% (post name slug), %post_id%, %year%, %monthnum%, %day%, %hour%, %minute%, %second%, %category%, %author%<br>
							Example schemes: <code>/%podcast%</code>, <code>/episode/%podcast%</code>, <code>/%year%/%monthnum%/%podcast%</code>', 'podlove');
            ?>
					</span></p>
				</div>
				
				<script type="text/javascript">
				jQuery(function($) {
					$(document).ready(function() {

						function handle_permastruct_settings() {
							if ( $("#use_post_permastruct").is( ':checked' ) ) {
								$("#custom_podcast_permastruct").slideUp();
							} else {
								$("#custom_podcast_permastruct").slideDown();
							}
						}

						$("#use_post_permastruct").on("click", function(e) {
							handle_permastruct_settings();
						});

						handle_permastruct_settings();
					});
				});
				</script>

				<style type="text/css">
				#custom_podcast_permastruct {
					margin-top: 10px;
				}
				</style>
				<?php 
        }, Settings::$pagehook, 'podlove_settings_general');
        add_settings_field('podlove_setting_episode_archive', sprintf('<label for="episode_archive">%s</label>', __('Episode pages', 'podlove')), function () {
            $enable_episode_archive = \Podlove\get_setting('website', 'episode_archive');
            $episode_archive_slug = \Podlove\get_setting('website', 'episode_archive_slug');
            if ($blog_prefix = \Podlove\get_blog_prefix()) {
                $episode_archive_slug = preg_replace('|^/?blog|', '', $episode_archive_slug);
            }
            ?>
				<input name="podlove_website[episode_archive]" id="episode_archive" type="checkbox" <?php 
            checked($enable_episode_archive, 'on');
            ?>
> <?php 
            _e('Enable episode pages: a complete, paginated list of episodes, sorted by publishing date.', 'podlove');
            ?>
				<div id="episode_archive_slug_edit"<?php 
            if (!$enable_episode_archive) {
                echo ' style="display:none;"';
            }
            ?>
>
					<code><?php 
            echo get_option('home') . $blog_prefix;
            ?>
</code>
					<input class="podlove-check-input" name="podlove_website[episode_archive_slug]" id="episode_archive_slug" type="text" value="<?php 
            echo $episode_archive_slug;
            ?>
">
				</div>
				
				<script type="text/javascript">
				jQuery(function($) {
					$(document).ready(function() {
						$("#episode_archive").on("click", function(e) {
							if ( $(this).is( ':checked' ) ) {
								$("#episode_archive_slug_edit").slideDown();
							} else {
								$("#episode_archive_slug_edit").slideUp();
							}
						});
					});
				});
				</script>

				<style type="text/css">
				#episode_archive_slug_edit {
					margin-top: 10px;
				}
				</style>
				<?php 
        }, Settings::$pagehook, 'podlove_settings_general');
        add_settings_field('podlove_setting_landing_page', sprintf('<label for="landing_page">%s</label>', __('Podcast landing page', 'podlove')), function () {
            $landing_page = \Podlove\get_setting('website', 'landing_page');
            $landing_page_options = array(array('value' => 'homepage', 'text' => __('Front page', 'podlove')), array('value' => 'archive', 'text' => __('Episode pages', 'podlove')), array('text' => '––––––––––', 'disabled' => true));
            $pages_query = new \WP_Query(array('post_type' => 'page', 'nopaging' => true));
            if ($pages_query->have_posts()) {
                while ($pages_query->have_posts()) {
                    $pages_query->the_post();
                    $landing_page_options[] = array('value' => get_the_ID(), 'text' => get_the_title());
                }
            }
            wp_reset_postdata();
            ?>
				<select name="podlove_website[landing_page]" id="landing_page">
					<?php 
            foreach ($landing_page_options as $option) {
                ?>
						<option
							<?php 
                if (isset($option['value'])) {
                    ?>
								value="<?php 
                    echo $option['value'];
                    ?>
"
								<?php 
                    if ($landing_page == $option['value']) {
                        ?>
 selected<?php 
                    }
                    ?>
							<?php 
                }
                ?>
							<?php 
                if (isset($option['disabled']) && $option['disabled']) {
                    ?>
 disabled<?php 
                }
                ?>
						>
							<?php 
                echo $option['text'];
                ?>
						</option>
					<?php 
            }
            ?>
				</select>

				<script type="text/javascript">
				jQuery(function($) {
					$(document).ready(function() {
						var maybe_toggle_episode_archive_option = function() {
							var $archive = $("#episode_archive"),
								$archive_option = $("#landing_page option:eq(1)"),
								$home_option = $("#landing_page option:eq(0)");

							if ($archive.is(':checked')) {
								$archive_option.attr('disabled', false);
							} else {
								$archive_option.attr('disabled', 'disabled');
								// if it was selected before, unselect it
								if ($archive_option.attr('selected') == 'selected') {
									$archive_option.attr('selected', false);
									$home_option.attr('selected', 'selected');
								}
							}

						};

						$("#episode_archive").on("click", function(e) {
							maybe_toggle_episode_archive_option();
						});

						maybe_toggle_episode_archive_option();
					});
				});
				</script>
				<?php 
            echo __('This defines the landing page to your podcast. It is the site that the your podcast feeds link to.', 'podlove');
            ?>
				<?php 
        }, Settings::$pagehook, 'podlove_settings_general');
        add_settings_field('podlove_setting_url_template', sprintf('<label for="url_template">%s</label>', __('Episode Asset URL Template.', 'podlove')), function () {
            ?>
				<input name="podlove_website[url_template]" id="url_template" type="text" value="<?php 
            echo \Podlove\get_setting('website', 'url_template');
            ?>
" class="large-text podlove-check-input">
				<p>
					<span class="description">
						<?php 
            echo __('Is used to generate URLs. You probably don\'t want to change this.', 'podlove');
            ?>
					</span>
				</p>
				<?php 
        }, Settings::$pagehook, 'podlove_settings_files');
        add_settings_field('podlove_setting_ssl_verify_peer', sprintf('<label for="ssl_verify_peer">%s</label>', __('Check for Assets with SSL-peer-verification.', 'podlove')), function () {
            ?>
				<input name="podlove_website[ssl_verify_peer]" id="ssl_verify_peer" type="checkbox" <?php 
            checked(\Podlove\get_setting('website', 'ssl_verify_peer'), 'on');
            ?>
>
				<?php 
            echo __('If you provide your assets via https with a self-signed or not verifiable SSL-certificate, podlove should display your assets as non exiting. You might solve this by deactivating the ssl peer verification for asset checking. (Detailed: This sets "CURLOPT_SSL_VERIFYPEER" to FALSE.)', 'podlove');
            ?>
				<?php 
        }, Settings::$pagehook, 'podlove_settings_files');
        add_settings_field('podlove_setting_feeds_skip_redirect', sprintf('<label for="feeds_skip_redirect">%s</label>', __('Allow to skip feed redirects', 'podlove')), function () {
            ?>
				<input name="podlove_website[feeds_skip_redirect]" id="feeds_skip_redirect" type="checkbox" <?php 
            checked(\Podlove\get_setting('website', 'feeds_skip_redirect'), 'on');
            ?>
>
				<?php 
            echo __('If you need to debug you feeds while using a feed proxy, add <code>?redirect=no</code> to the feed URL to skip the redirect.', 'podlove');
            ?>
				<?php 
        }, Settings::$pagehook, 'podlove_settings_feeds');
        register_setting(Settings::$pagehook, 'podlove_website', function ($options) {
            /**
             * handle checkboxes
             */
            $checkboxes = array('merge_episodes', 'hide_wp_feed_discovery', 'use_post_permastruct', 'episode_archive', 'ssl_verify_peer', 'feeds_skip_redirect');
            foreach ($checkboxes as $checkbox_key) {
                if (!isset($options[$checkbox_key])) {
                    $options[$checkbox_key] = 'off';
                }
            }
            /**
             * handle permastructs
             */
            $prefix = $blog_prefix = '';
            $iis7_permalinks = iis7_supports_permalinks();
            if (!got_mod_rewrite() && !$iis7_permalinks) {
                $prefix = '/index.php';
            }
            if (is_multisite() && !is_subdomain_install() && is_main_site()) {
                $blog_prefix = '';
            }
            // Episode permastruct
            if (array_key_exists('custom_episode_slug', $options)) {
                $options['custom_episode_slug'] = preg_replace('#/+#', '/', '/' . str_replace('#', '', $options['custom_episode_slug']));
                if ($prefix && $blog_prefix) {
                    $options['custom_episode_slug'] = $prefix . preg_replace('#^/?index\\.php#', '', $options['custom_episode_slug']);
                } else {
                    $options['custom_episode_slug'] = $blog_prefix . $options['custom_episode_slug'];
                }
            }
            // Archive slug
            if (array_key_exists('episode_archive_slug', $options)) {
                $options['episode_archive_slug'] = preg_replace('#/+#', '/', '/' . str_replace('#', '', $options['episode_archive_slug']));
                if ($prefix && $blog_prefix) {
                    $options['episode_archive_slug'] = $prefix . preg_replace('#^/?index\\.php#', '', $options['episode_archive_slug']);
                } else {
                    $options['episode_archive_slug'] = $blog_prefix . $options['episode_archive_slug'];
                }
            }
            return $options;
        });
    }
コード例 #22
0
ファイル: network.php プロジェクト: beaucollins/wp
/**
 * Prints step 1 for Network installation process.
 *
 * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network
 * 	should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo.
 *
 * @since 3.0.0
 */
function network_step1($errors = false)
{
    if (get_option('siteurl') != get_option('home')) {
        echo '<div class="error"><p><strong>' . __('Error:') . '</strong> ' . sprintf(__('Your <strong>WordPress address</strong> must match your <strong>Site address</strong> before creating a Network. See <a href="%s">General Settings</a>.'), esc_url(admin_url('options-general.php'))) . '</strong></p></div>';
        include './admin-footer.php';
        die;
    }
    $active_plugins = get_option('active_plugins');
    if (!empty($active_plugins)) {
        echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf(__('Please <a href="%s">deactivate</a> your plugins before enabling the Network feature.'), admin_url('plugins.php')) . '</p></div><p>' . __(' Once the network is created, you may reactivate your plugins.') . '</p>';
        include './admin-footer.php';
        die;
    }
    $hostname = get_clean_basedomain();
    $has_ports = strstr($hostname, ':');
    if (false !== $has_ports && !in_array($has_ports, array(':80', ':443')) || ($no_ip = preg_match('|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+|', $hostname))) {
        echo '<div class="error"><p><strong>' . __('Error:') . '</strong> ' . __('You cannot install a network of sites with your server address.') . '</strong></p></div>';
        if ($no_ip) {
            echo '<p>' . __('You cannot use an IP address such as <code>127.0.0.1</code>.') . '</p>';
        } else {
            echo '<p>' . sprintf(__('You cannot use port numbers such as <code>%s</code>.'), $has_ports) . '</p>';
        }
        echo '<a href="' . esc_url(admin_url()) . '">' . __('Return to Dashboard') . '</a>';
        include './admin-footer.php';
        die;
    }
    wp_nonce_field('install-network-1');
    $error_codes = array();
    if (is_wp_error($errors)) {
        echo '<div class="error"><p><strong>' . __('ERROR: The network could not be created.') . '</strong></p>';
        foreach ($errors->get_error_messages() as $error) {
            echo "<p>{$error}</p>";
        }
        echo '</div>';
        $error_codes = $errors->get_error_codes();
    }
    $site_name = !empty($_POST['sitename']) && !in_array('empty_sitename', $error_codes) ? $_POST['sitename'] : sprintf(_x('%s Sites', 'Default network name'), get_option('blogname'));
    $admin_email = !empty($_POST['email']) && !in_array('invalid_email', $error_codes) ? $_POST['email'] : get_option('admin_email');
    ?>
	<p><?php 
    _e('Welcome to the Network installation process!');
    ?>
</p>
	<p><?php 
    _e('Fill in the information below and you&#8217;ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.');
    ?>
</p>
	<?php 
    // @todo IIS and ! $is_apache
    if (isset($_POST['subdomain_install'])) {
        $subdomain_install = (bool) $_POST['subdomain_install'];
    } elseif (apache_mod_loaded('mod_rewrite')) {
        // assume nothing
        $subdomain_install = true;
    } else {
        $subdomain_install = false;
        if (got_mod_rewrite()) {
            // dangerous assumptions
            echo '<div class="updated inline"><p><strong>' . __('Note:') . '</strong> ' . __('Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.') . '</p>';
        } else {
            echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __('It looks like the Apache <code>mod_rewrite</code> module is not installed.') . '</p>';
        }
        echo '<p>' . __('If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.') . '</p></div>';
    }
    if (allow_subdomain_install()) {
        ?>
		<h3><?php 
        esc_html_e('Addresses of Sites in your Network');
        ?>
</h3>
		<p><?php 
        _e('Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>');
        ?>
</p>
		<p><?php 
        _e('You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.');
        ?>
</p>
		<?php 
        // @todo: Link to an MS readme?
        ?>
		<table class="form-table">
			<tr>
				<th><label><input type='radio' name='subdomain_install' value='1'<?php 
        checked($subdomain_install);
        ?>
 /> Sub-domains</label></th>
				<td><?php 
        printf(_x('like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples'), $hostname);
        ?>
</td>
			</tr>
			<tr>
				<th><label><input type='radio' name='subdomain_install' value='0'<?php 
        checked(!$subdomain_install);
        ?>
 /> Sub-directories</label></th>
				<td><?php 
        printf(_x('like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples'), $hostname);
        ?>
</td>
			</tr>
		</table>

<?php 
    }
    $is_www = 0 === strpos($hostname, 'www.');
    if ($is_www) {
        ?>
		<h3><?php 
        esc_html_e('Server Address');
        ?>
</h3>
		<p><?php 
        printf(__('We recommend you change your siteurl to <code>%1$s</code> before enabling the network feature. It will still be possible to visit your site using the <code>www</code> prefix with an address like <code>%2$s</code> but any links will not have the <code>www</code> prefix.'), substr($hostname, 4), $hostname);
        ?>
</h3>
		<table class="form-table">
			<tr>
				<th scope='row'><?php 
        esc_html_e('Server Address');
        ?>
</th>
				<td>
					<?php 
        printf(__('The internet address of your network will be <code>%s</code>.'), $hostname);
        ?>
				</td>
			</tr>
		</table>
		<?php 
    }
    ?>

		<h3><?php 
    esc_html_e('Network Details');
    ?>
</h3>
		<table class="form-table">
		<?php 
    if ('localhost' == $hostname) {
        ?>
			<tr>
				<th scope="row"><?php 
        esc_html_e('Sub-directory Install');
        ?>
</th>
				<td><?php 
        _e('Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.');
        ?>
</td>
			</tr>
		<?php 
    } elseif (!allow_subdomain_install()) {
        ?>
			<tr>
				<th scope="row"><?php 
        esc_html_e('Sub-directory Install');
        ?>
</th>
				<td><?php 
        _e('Because your install is in a directory, the sites in your WordPress network must use sub-directories.');
        ?>
</td>
			</tr>
		<?php 
    }
    ?>
		<?php 
    if (!$is_www) {
        ?>
			<tr>
				<th scope='row'><?php 
        esc_html_e('Server Address');
        ?>
</th>
				<td>
					<?php 
        printf(__('The internet address of your network will be <code>%s</code>.'), $hostname);
        ?>
				</td>
			</tr>
		<?php 
    }
    ?>
			<tr>
				<th scope='row'><?php 
    esc_html_e('Network Title');
    ?>
</th>
				<td>
					<input name='sitename' type='text' size='45' value='<?php 
    echo esc_attr($site_name);
    ?>
' />
					<br /><?php 
    _e('What would you like to call your network?');
    ?>
				</td>
			</tr>
			<tr>
				<th scope='row'><?php 
    esc_html_e('Admin E-mail Address');
    ?>
</th>
				<td>
					<input name='email' type='text' size='45' value='<?php 
    echo esc_attr($admin_email);
    ?>
' />
					<br /><?php 
    _e('Your email address.');
    ?>
				</td>
			</tr>
		</table>
		<p class='submit'><input class="button-primary" name='submit' type='submit' value='<?php 
    esc_attr_e('Install');
    ?>
' /></p>
		<?php 
}
コード例 #23
0
/**
 * Render the page
 *
 * @since 0.8.5
 */
function mgjp_mv_render_extra_activation_steps_page()
{
    wp_enqueue_style('mgjp-mv-eas-page', plugins_url('css/mv-eas-page.css', __FILE__), 'all', null);
    global $is_apache;
    $home_path = get_home_path();
    $rewrite_rules_enabled = mgjp_mv_check_rewrite_rules();
    $eas_supported = $is_apache;
    if (isset($_POST['enable_mediavault'])) {
        if ($rewrite_rules_enabled) {
            check_admin_referer('mgjp_mv_enable_media_vault');
            ?>
        <div class="updated">
          <p>
            <?php 
            printf(esc_html__('Media Vault was successfully enabled! Congrats! Now go protect some %s!', 'media-vault'), '<a href="upload.php">' . esc_html__('files', 'media-vault') . '</a>');
            ?>
          </p>
        </div>
      <?php 
            update_site_option('mgjp_mv_enabled', true);
        } else {
            ?>
        <div class="error">
          <p>
            <?php 
            esc_html_e('Media Vault could not be enabled because the rewrite rules have not been set up correctly. Please verify that you have gone through and correctly completed each of the steps below and try again.', 'media-vault');
            ?>
          </p>
        </div>
      <?php 
        }
    }
    ?>

    <div class="wrap">

      <h2>
        <img class="mgjp-mv-icon" alt="Media Vault Logo" src="<?php 
    echo plugins_url('imgs/media-vault-logo.png', __FILE__);
    ?>
">
        <?php 
    _e('Media Vault Activation Helper', 'media-vault');
    ?>
      </h2>

      <?php 
    if ($rewrite_rules_enabled && get_site_option('mgjp_mv_enabled')) {
        ?>

        <p>
          <?php 
        printf(esc_html__('This page and the Media Vault Activation Helper will now no longer appear in your WordPress admin as you don\'t need them anymore! Congratulations, your setup is currently fully configured for Media Vault to function. You can now go and protect any of your %s or try %s to the Media Vault protected folder. Also don\'t forget to check out the plugin\'s %s. Thank you for using Media Vault.', 'media-vault'), '<a href="upload.php">' . esc_html__('Media files', 'media-vault') . '</a>', '<a href="media-new.php">' . esc_html__('uploading new files', 'media-vault') . '</a>', '<a href="options-media.php#mgjp_mv_settings_section">' . esc_html__('settings', 'media-vault') . '</a>');
        ?>
        </p>

        <?php 
        if (!$eas_supported) {
            ?>
          <p>
            <em>
              <?php 
            printf(esc_html__('Note: You have clearly successfully ported the Apache rewrite rules to run on your server technology, which was not supported by the Media Vault Activation Helper. If you are certain about your configuration, please consider posting the full method you used on the Media Vault %s. If such a post does not already exist of course! Thank you!', 'media-vault'), '<a href="http://wordpress.org/support/plugin/media-vault" target="_blank">' . esc_html__('support forum', 'media-vault') . '</a>');
            ?>
            </em>
          </p>
        <?php 
        }
        ?>

      <?php 
    } else {
        ?>

        <p>
          <?php 
        esc_html_e('Normally, Media Vault would automatically set up the necessary rewrite rules for the plugin to protect your files.', 'media-vault');
        echo ' ';
        if (!$is_apache) {
            $errors['Notapache'] = sprintf(esc_html_x('you are not on an %s', 'as in: "you are not on an Apache webserver"', 'media-vault'), '<b>Apache Server</b>');
        }
        if (is_multisite()) {
            $errors['Multisite'] = sprintf(esc_html_x('you are running a %s installation', 'as in: "you are on a WordPress Multisite installation"', 'media-vault'), '<b>WordPress MultiSite</b>');
        }
        if (!isset($errors) && !get_option('permalink_structure')) {
            $errors['Nopretty'] = sprintf(esc_html_x('you do not have %s enabled', 'as in: "you do not have Pretty Permalinks enabled"', 'media-vault'), '<a href="http://codex.wordpress.org/Introduction_to_Blogging#Pretty_Permalinks" target="_blank">' . esc_html__('Pretty Permalinks') . '</a>');
        }
        if (!isset($errors) && !is_writable($home_path . '.htaccess')) {
            $errors['Nonwritable'] = sprintf(esc_html__('the site\'s %s file is not writable', 'as in: "the site\'s .htaccess file is not writable "', 'media-vault'), '<code>.htaccess</code>');
        }
        if (isset($errors)) {
            $error_txt = '';
            $last_error = array_pop($errors);
            if (count($errors) > 0) {
                $error_txt .= implode(', ', $errors) . ' ' . esc_html__('and', 'media-vault') . ' ';
            }
            $error_txt .= $last_error . ',';
            printf(esc_html_x('However, because %s the plugin was unable to successfully update the rewrite rules for this site programmatically.', 'as in: "Because *you are running WordPress MultiSite* Media Vault cannot do it automatically"', 'media-vault'), $error_txt);
        } else {
            esc_html_e('However for some reason the plugin was unable to successfully update the rewrite rules for this site.', 'media-vault');
        }
        echo ' ';
        echo wp_kses(__('In order to manually fully activate Media Vault on your setup please <strong>carefully</strong> follow the instructions below:', 'media-vault'), array('strong' => array()), false);
        ?>
        </p>

        <ol>

          <?php 
        if ($is_apache && !got_mod_rewrite()) {
            ?>
            <li>
              <p>
                <strong><?php 
            esc_html_e('Important', 'media-vault');
            ?>
!:</strong> <?php 
            printf(esc_html__('Media Vault %s the %s module to be installed and enabled on your %s server.', 'media-vault'), '<strong>' . esc_html__('requires') . '</strong>', '<code>mod_rewrite</code>', '<strong>Apache</strong>');
            ?>
              </p>
            </li>
          <?php 
        }
        ?>

          <li>

            <?php 
        if ($eas_supported) {
            ?>
              <p>
                <?php 
            $rewrite_file_type = '<code>.htaccess</code>';
            $rewrite_file_loc = '<code>' . $home_path . '</code>';
            $rewrite_rule_loc = sprintf(wp_kses(__('<strong>in the WordPress rewrite block</strong> (the WordPress block usually starts with %s and ends with %s), <strong>just below</strong> the line reading %s', 'media-vault'), array('strong' => array()), false), '<code># BEGIN WordPress</code>', '<code># END WordPress</code>', '<code>RewriteRule ^index\\.php$ - [L]</code>');
            if (!is_multisite() && !get_option('permalink_structure')) {
                $rewrite_rule_loc = __('<strong>above</strong> any other rewrite rules in the file.', 'media-vault');
                printf(wp_kses(__('Media Vault works best with %s enabled, so it is strongly recommended that you %s! If, however, you really <i>really</i> want to use ugly permalinks, then...', 'media-vault'), array('i' => array()), false), '<a href="http://codex.wordpress.org/Introduction_to_Blogging#Pretty_Permalinks" target="_blank">' . esc_html__('Pretty Permalinks', 'media-vault') . '</a>', '<a href="http://codex.wordpress.org/Using_Permalinks" target="_blank">' . esc_html__('enable them', 'media-vault') . '</a>');
                echo "\n";
            }
            printf(esc_html__('Add the following to your %s file in %s', 'media-vault'), $rewrite_file_type, $rewrite_file_loc);
            echo ' ', $rewrite_rule_loc;
            ?>
              </p>
            <?php 
        } else {
            ?>
              <p>
                <?php 
            esc_html_e('Sorry, the Media Vault Activation Helper does not currently support your server setup. This does not necessarily mean that Media Vault cannot work with your setup, just that, for now, there are no simple steps to follow. Currently Apache is the only server software that is supported by the Activation Helper. Support for more is being added in future updates of the plugin. You can try the plugin\'s support forum for more help.', 'media-vault');
            ?>
              </p>
              <p>
                <?php 
            esc_html_e('Below are what the rewrite rules would look like if you were running WordPress on an Apache server. Feel free to try and port these to your own server technology. If you believe you have correctly set up the necessary rewrites to emulate the behaviour of the below rules, then click on the "Enable Media Vault" button below. If Media Vault verifies that the rules you implemented are functioning correctly it will enable the rest of the plugin.', 'media-vault');
            ?>
              </p>
            <?php 
        }
        ?>

            <?php 
        $rewrite_rules = mgjp_mv_get_the_rewrite_rules();
        ?>
            <textarea class="code" readonly="readonly" cols="125" rows="<?php 
        echo count($rewrite_rules);
        ?>
"><?php 
        echo esc_textarea(implode("\n", $rewrite_rules));
        ?>
</textarea>

          </li>

          <li>
            <p>
              <?php 
        esc_html_e('Once you have completed the above steps, press the "Enable Media Vault" button below.', 'media-vault');
        ?>
            </p>
            <form method="post" action="plugins.php?page=mgjp-mv-eas">
              <?php 
        wp_nonce_field('mgjp_mv_enable_media_vault');
        ?>
              <?php 
        submit_button(__('Enable Media Vault', 'media-vault'), 'primary', 'enable_mediavault', false);
        ?>
            </form>
          </li>

        </ol>

      <?php 
    }
    ?>

    </div>

  <?php 
}
コード例 #24
0
ファイル: index.php プロジェクト: rolexmessi/101
function hs_action_cleanup()
{
    $hs_set_newalert = $_POST['hs_set_newalert'];
    $hs_set_moderatealert = $_POST['hs_set_moderatealert'];
    $hs_set_permalinks = $_POST['hs_set_permalinks'];
    if ($hs_set_permalinks == 1) {
        if (get_option('permalink_structure') != '/%postname%/') {
            global $wp_rewrite;
            $prefix = $blog_prefix = '';
            if (!got_mod_rewrite() && !$iis7_permalinks) {
                $prefix = '/index.php';
            }
            if (is_multisite() && !is_subdomain_install() && is_main_site()) {
                $blog_prefix = '/blog';
            }
            if (isset($_POST['hs_set_permalinks'])) {
                $permalink_structure = '/%postname%/';
                if (!empty($permalink_structure)) {
                    $permalink_structure = preg_replace('#/+#', '/', '/' . str_replace('#', '', $permalink_structure));
                    if ($prefix && $blog_prefix) {
                        $permalink_structure = $prefix . preg_replace('#^/?index\\.php#', '', $permalink_structure);
                    } else {
                        $permalink_structure = $blog_prefix . $permalink_structure;
                    }
                }
                $wp_rewrite->set_permalink_structure($permalink_structure);
                flush_rewrite_rules();
            }
            echo "done8";
        }
    }
    if ($_POST['hs_set_newalert'] == 0) {
        if (get_option('comments_notify') != $hs_set_newalert) {
            update_option('comments_notify', $hs_set_newalert);
            echo "done9";
        }
    }
    if ($_POST['hs_set_moderatealert'] == 0) {
        if (get_option('moderation_notify') != $hs_set_moderatealert) {
            update_option('moderation_notify', $hs_set_moderatealert);
            echo "done10";
        }
    }
    die;
}
コード例 #25
0
		jQuery('#permalink_structure').val( this.value );
	});
	jQuery('#permalink_structure').focus(function() {
		jQuery("#custom_selection").attr('checked', 'checked');
	});
});
//]]>
</script>
<?php 
}
add_filter('admin_head', 'add_js');
include './admin-header.php';
$home_path = get_home_path();
$iis7_permalinks = iis7_supports_permalinks();
$prefix = $blog_prefix = '';
if (!got_mod_rewrite() && !$iis7_permalinks) {
    $prefix = '/index.php';
}
if (is_multisite() && !is_subdomain_install() && is_main_site()) {
    $blog_prefix = '/blog';
}
if (isset($_POST['permalink_structure']) || isset($_POST['category_base'])) {
    check_admin_referer('update-permalink');
    if (isset($_POST['permalink_structure'])) {
        if (isset($_POST['selection']) && 'custom' != $_POST['selection']) {
            $permalink_structure = $_POST['selection'];
        } else {
            $permalink_structure = $_POST['permalink_structure'];
        }
        if (!empty($permalink_structure)) {
            $permalink_structure = preg_replace('#/+#', '/', '/' . str_replace('#', '', $permalink_structure));
コード例 #26
0
	 function cets_blog_defaults_management_page(){
	 	// Display the defaults that can be set by site admins
	 
	 	global $wpdb;
		
		// only allow site admins to come here.
		if( is_super_admin() == false ) {
			wp_die( __('You do not have permission to access this page.') );
		}
		
		/* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */
		$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
		
		
		// process form submission    	
    	if (isset($_POST['action']) && $_POST['action'] == 'update') {
			$this->update_defaults($_POST);
			$updated = true;
    	}
		
		// make sure we're using latest data
		$opt = get_site_option('cets_blog_defaults_options');
		
    	if (isset($updated) && $updated) { ?>
        <div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div>
        <?php	} ?>
        
        <h1>New Blog Defaults</h1>
        <form name="blogdefaultsform" action="" method="post">
        <p>Set the defaults for new blog creation. Note that these defaults can still be over-ridden by blog owners.</p>
        <div class="wrap">
        <h2><?php _e('General Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Blog Title') ?></th>
        <td><input name="blogname" type="text" id="blogname" value="<?php echo($opt['blogname']); ?>" size="40" /><br/>
        <input type="checkbox" name="blogname_flag" value="1" <?php checked('1', $opt[blogname_flag]) ?> /> <?php _e("I understand this will overwrite the user's chosen blog name from the setup page.") ?></td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Tagline') ?></th>
        <td><input name="blogdescription" type="text" id="blogdescription" style="width: 95%" value="<?php echo($opt['blogdescription']); ?>" size="45" />
        <br />
        <?php _e('In a few words, explain what this blog is about.') ?></td>
        </tr>
		
<!-- Begin Time Zone -->
		<tr>
		<?php
		$current_offset = $opt['gmt_offset'];
		$tzstring = $opt['timezone_string'];
		
		$check_zone_info = true;
		
		// Remove old Etc mappings.  Fallback to gmt_offset.
		if ( false !== strpos($tzstring,'Etc/GMT') )
			$tzstring = '';
		
		if (empty($tzstring)) { // set the Etc zone if no timezone string exists
			$check_zone_info = false;
			if ( 0 == $current_offset )
				$tzstring = 'UTC+0';
			elseif ($current_offset < 0)
				$tzstring = 'UTC' . $current_offset;
			else
				$tzstring = 'UTC+' . $current_offset;
		}
		
		?>
		<th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
		<td>
		
		<select id="timezone_string" name="timezone_string">
		<?php echo wp_timezone_choice($tzstring); ?>
		</select>
		
		    <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span>
		<?php if ($opt['timezone_string']) : ?>
			<span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>
		<?php endif; ?>
		<br />
		<span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
		<br />
		<span>
		<?php if ($check_zone_info && $tzstring) : ?>
			<?php
			$now = localtime(time(),true);
			if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');
			else _e('This timezone is currently in standard time.');
			?>
			<br />
			<?php
			
			if (function_exists('timezone_transitions_get')) {
				$dateTimeZoneSelected = new DateTimeZone($tzstring);
				foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
					if ($tr['ts'] > time()) {
					    $found = true;
						break;
					}
				}
		
				if ( isset($found) && $found === true ) {
					echo ' ';
					$message = $tr['isdst'] ?
						__('Daylight savings time begins on: <code>%s</code>.') :
						__('Standard time begins  on: <code>%s</code>.');
					printf( $message, date_i18n($opt['date_format'].' '. $opt['time_format'], $tr['ts'] ) );
				} else {
					_e('This timezone does not observe daylight savings time.');
				}
			}
			
			?>
			</span>
		<?php endif; ?>
		</td>
		
		
		</tr>

<!-- End Time Zone -->
	
	
	
		
        <tr>
        <th scope="row"><?php _e('Date Format') ?></th>
        <td>
			<fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>
<?php

	$date_formats = apply_filters( 'date_formats', array(
		__('F j, Y'),
		'Y/m/d',
		'm/d/Y',
		'd/m/Y',
	) );

	$custom = TRUE;

	foreach ( $date_formats as $format ) {
		echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";
		if ( $opt['date_format'] === $format ) { // checked() uses "==" rather than "==="
			echo " checked='checked'";
			$custom = FALSE;
		}
		echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
	}

	echo '	<label><input type="radio" name="date_format" id="date_format_custom_radio" value="custom"';
	checked( $custom );
	echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . esc_attr( $opt['date_format'] ) . '" class="small-text" /> ' . date_i18n( $opt['date_format'] ) . "\n";
	

	echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click &#8220;Save Changes&#8221; to update sample output.') . "</p>\n";
?>
	</fieldset>


		</td>
        </tr>
        <tr>
        <th scope="row"><?php _e('Time Format') ?></th>
        <td>
		<fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>
		<?php
		 
			$time_formats = apply_filters( 'time_formats', array(
				__('g:i a'),
				'g:i A',
				'H:i',
			) );
		
			$custom = TRUE;
		
			foreach ( $time_formats as $format ) {
				echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";
				if ( $opt['time_format'] === $format ) { // checked() uses "==" rather than "==="
					echo " checked='checked'";
					$custom = FALSE;
				}
				echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
			}
		
			echo '	<label><input type="radio" name="time_format" id="time_format_custom_radio" value="custom"';
			checked( $custom );
			echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . esc_attr( $opt['time_format'] ) . '" class="small-text" /> ' . date_i18n( $opt['time_format'] ) . "\n";
		?>
			</fieldset>



		</td>
        </tr>
        <tr>
        <th scope="row"><?php _e('Week Starts On') ?></th>
        <td>
        
        <select name="start_of_week" id="start_of_week">
        <?php
		global $wp_locale;
        for ($day_index = 0; $day_index <= 6; $day_index++) :
            $selected = ($opt['start_of_week'] == $day_index) ? 'selected="selected"' : '';
			
            echo "\n\t<option value='$day_index' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
        endfor;
        ?>
        </select></td>
        </tr>
        </table>
        </div>
        <p>&nbsp;</p>
        <div class="wrap">
        <h2><?php _e('Writing Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"> <?php _e('Size of the post box') ?></th>
        <td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php echo($opt['default_post_edit_rows']); ?>" size="3" />
        <?php _e('lines') ?></td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Formatting') ?></th>
        <td>
        <label for="use_smilies">
        <input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', $opt['use_smilies']); ?> />
        <?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br />
        <label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', $opt['use_balanceTags']); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label>
        </td>
        </tr>
        
        </table>
		
		<h3><?php _e('Remote Publishing') ?></h3>
		<p><?php printf(__('To post to WordPress from a desktop blogging client or remote website that uses the Atom Publishing Protocol or one of the XML-RPC publishing interfaces you must enable them below.')) ?></p>
		<table class="form-table">
		<tr valign="top">
		<th scope="row"><?php _e('Atom Publishing Protocol') ?></th>
		<td><fieldset><legend class="screen-reader-text"><span><?php _e('Atom Publishing Protocol') ?></span></legend>
		<label for="enable_app">
		<input name="enable_app" type="checkbox" id="enable_app" value="1" <?php checked('1', $opt['enable_app']); ?> />
		<?php _e('Enable the Atom Publishing Protocol.') ?></label><br />
		</fieldset></td>
		</tr>
		<tr valign="top">
		<th scope="row"><?php _e('XML-RPC') ?></th>
		<td><fieldset><legend class="screen-reader-text"><span><?php _e('XML-RPC') ?></span></legend>
		<label for="enable_xmlrpc">
		<input name="enable_xmlrpc" type="checkbox" id="enable_xmlrpc" value="1" <?php checked('1', $opt['enable_xmlrpc']); ?> />
		<?php _e('Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.') ?></label><br />
		</fieldset></td>
		</tr>
		</table>
      </div>
      
      <p>&nbsp;</p>
      <div class="wrap">
        <h2><?php _e('Reading Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Blog pages show at most') ?></th>
        <td>
        <input name="posts_per_page" type="text" id="posts_per_page" value="<?php echo($opt['posts_per_page']); ?>" size="3" /> <?php _e('posts') ?>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Syndication feeds show the most recent') ?></th>
        <td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php echo($opt['posts_per_rss']); ?>" size="3" /> <?php _e('posts') ?></td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('For each article in a feed, show') ?> </th>
        <td>
        <p><label><input name="rss_use_excerpt"  type="radio" value="0" <?php checked(0, $opt['rss_use_excerpt']); ?>	/> <?php _e('Full text') ?></label><br />
        <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, $opt['rss_use_excerpt']); ?> /> <?php _e('Summary') ?></label></p>
        </td>
        </tr>
        
        <tr valign="top">
        <th scope="row"><?php _e('Encoding for pages and feeds') ?></th>
        <td><input name="blog_charset" type="text" id="blog_charset" value="<?php echo($opt['blog_charset']); ?>" size="20" class="code" /><br />
        <?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></td>
        </tr>
        </table>
        
        </div>
        
        
        <p>&nbsp;</p>
        <div class="wrap">     
    	<h2>Discussion Settings</h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Default article settings') ?></th>
        <td>
         <label for="default_pingback_flag">
		 
       <input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php  if ($opt['default_pingback_flag'] == 1) echo('checked="checked"'); ?> /> <?php _e('Attempt to notify any blogs linked to from the article (slows down posting.)') ?> </label>
       
        <br /> 
		<label for="default_ping_status">
		
        <input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php if ($opt['default_ping_status'] == 'open') echo('checked="checked"'); ?> /> <?php _e('Allow link notifications from other blogs (pingbacks and trackbacks.)') ?></label>
       
        <br />
        <label for="default_comment_status">
		
        <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php if ($opt['default_comment_status'] == 'open') echo('checked="checked"'); ?> /> <?php _e('Allow people to post comments on the article') ?></label>
    
        <br />
        <small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small>
        </td>
        </tr>
		<tr valign="top">
		<th scope="row"><?php _e('Other comment settings') ?></th>
		<td><fieldset><legend class="hidden"><?php _e('Other comment settings') ?></legend>
		
		<label for="require_name_email">
		
        <input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php if ($opt['require_name_email'] == 1) echo('checked="checked"'); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label>
		<br />
		<label for="comment_registration">
		<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', $opt['comment_registration']); ?> />
		<?php _e('Users must be registered and logged in to comment') ?>
		</label>
		<br />
		
		<label for="close_comments_for_old_posts">
		<input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked('1', $opt['close_comments_for_old_posts']); ?> />
		<?php printf( __('Automatically close comments on articles older than %s days'), '</label><input name="close_comments_days_old" type="text" id="close_comments_days_old" value="' . esc_attr($opt['close_comments_days_old']) . '" class="small-text" />') ?>
		<br />
		<label for="thread_comments">
		<input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked('1', $opt['thread_comments']); ?> />
		<?php
		
		$maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
		
		
		
		$thread_comments_depth = '</label><select name="thread_comments_depth" id="thread_comments_depth">';
		for ( $i = 1; $i <= $maxdeep; $i++ ) {
			$thread_comments_depth .= "<option value='$i'";
			if (isset($opt['thread_comments_depth']) && $opt['thread_comments_depth'] == $i ) $thread_comments_depth .= " selected='selected'";
			$thread_comments_depth .= ">$i</option>";
		}
		$thread_comments_depth .= '</select>';
		
		printf( __('Enable threaded (nested) comments %s levels deep'), $thread_comments_depth );
		
		?><br />
		<label for="page_comments">
		<input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked('1', $opt['page_comments']); ?> />
		<?php
		
		
		$default_comments_page = '</label><label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
		if ( isset($opt['default_comments_page']) && 'newest' == $opt['default_comments_page'] ) $default_comments_page .= ' selected="selected"';
		$default_comments_page .= '>' . __('last') . '</option><option value="oldest"';
		if ( 'oldest' == $opt['default_comments_page'] ) $default_comments_page .= ' selected="selected"';
		$default_comments_page .= '>' . __('first') . '</option></select>';
		
		printf( __('Break comments into pages with %1$s comments per page and the %2$s page displayed by default'), '</label><label for="comments_per_page"><input name="comments_per_page" type="text" id="comments_per_page" value="' . esc_attr($opt['comments_per_page']) . '" class="small-text" />', $default_comments_page );
		
		?></label>
		<br />
		<label for="comment_order"><?php
		
		$comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
		if ( 'asc' == $opt['comment_order'] ) $comment_order .= ' selected="selected"';
		$comment_order .= '>' . __('older') . '</option><option value="desc"';
		if ( 'desc' == $opt['comment_order'] ) $comment_order .= ' selected="selected"';
		$comment_order .= '>' . __('newer') . '</option></select>';
		
		printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order );
		
		?></label>
		</fieldset></td>
		</tr>
		
		
		
		
        <tr valign="top">
        <th scope="row"><?php _e('E-mail me whenever') ?></th>
        <td>
		<label for="comments_notify">
		
        <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php if ($opt['comments_notify'] == 1 ) echo('checked="checked"'); ?> /> <?php _e('Anyone posts a comment') ?> </label>
         
        <br />
		<label for="moderation_notify">
		
        <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php if ($opt['moderation_notify'] == 1) echo('checked="checked"'); ?> /> <?php _e('A comment is held for moderation') ?></label>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Before a comment appears') ?></th>
        <td>
		<label for="comment_moderation">
		
        <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php if ($opt['comment_moderation'] == 1) echo('checked="checked"'); ?> /> <?php _e('An administrator must always approve the comment') ?></label>
    
        
        
        <br />
		<label for="comment_whitelist">
        <input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php if ($opt['comment_whitelist'] == 1) echo('checked="checked"'); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label>
       
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Comment Moderation') ?></th>
        <td>
        <p><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . $opt['comment_max_links']. '" />' ) ?></p>
        
        <p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
        <p>
        <textarea name="moderation_keys" cols="60" rows="10" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php echo($opt['moderation_keys']); ?></textarea>
        </p>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Comment Blacklist') ?></th>
        <td>
        <p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
        <p>
        <textarea name="blacklist_keys" cols="60" rows="10" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php echo($opt['blacklist_keys']); ?></textarea>
        </p>
        </td>
        </tr>
        </table>
        
        <h3><?php _e('Avatars') ?></h3>

        <p><?php _e('By default WordPress uses <a href="http://gravatar.com/">Gravatars</a> &#8212; short for Globally Recognized Avatars &#8212; for the pictures that show up next to comments. Plugins may override this.'); ?></p>
        
        <?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?>
        
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Avatar display') ?></th>
        <td>
        <?php
            $yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars'));
            foreach ( $yesorno as $key => $value) {
                $selected = ($opt['show_avatars'] == $key) ? 'checked="checked"' : '';
                echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected> $value</label><br />";
            }
        ?>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Maximum Rating') ?></th>
        <td>
        
        <?php
        $ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above'));
        foreach ($ratings as $key => $rating) :
          	$selected = ($opt['avatar_rating'] == $key) ? 'checked="checked"' : '';
            echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected> $rating</label><br />";
        endforeach;
        ?>
        
        </td>
        </tr>
		
		
		
		<tr valign="top">
		<th scope="row"><?php _e('Default Avatar') ?></th>
		<td class="defaultavatarpicker"><fieldset><legend class="hidden"><?php _e('Default Avatar') ?></legend>
		
		<?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br />
		
		<?php
		$avatar_defaults = array(
			'mystery' => __('Mystery Man'),
			'blank' => __('Blank'),
			'gravatar_default' => __('Gravatar Logo'),
			'identicon' => __('Identicon (Generated)'),
			'wavatar' => __('Wavatar (Generated)'),
			'monsterid' => __('MonsterID (Generated)')
		);
		$avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults);
		$default = $opt['avatar_default'];
		if ( empty($default) )
			$default = 'mystery';
		$size = 32;
		$avatar_list = '';
		foreach ( $avatar_defaults as $default_key => $default_name ) {
			$selected = ($default == $default_key) ? 'checked="checked" ' : '';
			$avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='{$default_key}' {$selected}/> ";
		
			//$avatar = get_avatar( $user_email, $size, $default_key );
			//$avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);
		
			$avatar_list .= ' ' . $default_name . '</label>';
			$avatar_list .= '<br />';
		}
		echo apply_filters('default_avatar_select', $avatar_list);
		?>
		
		</fieldset></td>
		</tr>
		
		
        
        </table>

        </div>
        <p>&nbsp;</p>
        <div class="wrap">
        <h2><?php _e('Privacy Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Blog Visibility') ?> </th>
        <td>
        <p>Warning: It can be confusing for users to have these settings override the setting they choose on the sign up form. If you do not want to override user settings, select "Allow User Choice".</p>
		
		<p><input id="blog-public-reset" type="radio" name="blog_public" value="" <?php checked('', $opt['blog_public']); ?> />
        <label for="blog-public-reset"><?php _e('Allow User Choice'); ?></label></p>
        <p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', $opt['blog_public']); ?> />
        <label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers and in public listings around this site.') ?></label></p>
        <p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', $opt['blog_public']); ?> />
        <label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p>
        <?php do_action('blog_privacy_selector'); ?>
        </td>
        </tr>
        </table>
        
       
        </div>
        <p>&nbsp;</p>
		<div class="wrap">
        <h2><?php _e('Customize Permalink Structure') ?></h2>
        <p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
        
        <?php
        $prefix = '';
        
        if ( ! got_mod_rewrite() )
            $prefix = '/index.php';
        
        $structures = array(
            '',
            $prefix . '/%year%/%monthnum%/%day%/%postname%/',
            $prefix . '/%year%/%monthnum%/%postname%/',
            $prefix . '/archives/%post_id%'
            );
        ?>
        <h3><?php _e('Common settings'); ?></h3>
        
        <table class="form-table">
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="" class="tog" <?php checked('', $opt['permalink_structure']); ?> /> <?php _e('Default'); ?></label></th>
                <td>&nbsp;</td>
             </tr>
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $opt['permalink_structure']); ?> /> <?php _e('Day and name'); ?></label></th>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $opt['permalink_structure']); ?> /> <?php _e('Month and name'); ?></label></th>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="<?php echo $structures[3]; ?>" class="tog" <?php checked($structures[3], $opt['permalink_structure']); ?> /> <?php _e('Numeric'); ?></label></th>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <th>
                    <label><input name="permalink_choice" id="custom_selection" type="radio" value="custom" class="tog"
                    <?php if ( !in_array($opt['permalink_structure'], $structures) ) { ?>
                    checked="checked"
                    <?php } ?>
                     />
                    <?php _e('Custom Structure'); ?>
                    </label>
                </th>
                <td>
                    <?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $permalink_structure = str_replace( "/blog", "", $opt['permalink_structure'] ); }?>
                    <input name="permalink_structure" id="permalink_structure" type="text" class="code" style="width: 60%;" value="<?php echo esc_attr($opt['permalink_structure']); ?>" size="50" />
                </td>
            </tr>
        </table>
        
        <h3><?php _e('Optional'); ?></h3>
        <?php if ($is_apache) : ?>
            <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
        <?php else : ?>
            <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
        <?php endif; ?>
        
        <table class="form-table">
            <tr>
                <th><?php _e('Category base'); ?></th>
                <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $opt['category_base'] = str_replace( "/blog", "", $opt['category_base'] ); }?> <input name="category_base" type="text" class="code"  value="<?php echo esc_attr( $opt['category_base'] ); ?>" size="30" /></td>
            </tr>
            <tr>
                <th><?php _e('Tag base'); ?></th>
                <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $opt['tag_base'] = str_replace( "/blog", "", $opt['tag_base'] ); }?> <input name="tag_base" id="tag_base" type="text" class="code"  value="<?php echo esc_attr($opt['tag_base']); ?>" size="30" /></td>
            </tr>
        </table>
        
        </div>
                
        
        <p>&nbsp;</p>
        
        <div class="wrap">
        <h2><?php _e('Media Settings'); ?></h2>
        <h3><?php _e('Image sizes') ?></h3>
        <p><?php _e('The sizes listed below determine the maximum dimensions to use when inserting an image into the body of a post.'); ?></p>
        
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Thumbnail size') ?></th>
        <td>
        <label for="thumbnail_size_w"><?php _e('Width'); ?></label>
        <input name="thumbnail_size_w" type="text" id="thumbnail_size_w" value="<?php echo($opt['thumbnail_size_w']); ?>" size="6" />
        <label for="thumbnail_size_h"><?php _e('Height'); ?></label>
        <input name="thumbnail_size_h" type="text" id="thumbnail_size_h" value="<?php echo($opt['thumbnail_size_h']); ?>" size="6" /><br />
        <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', $opt['thumbnail_crop']); ?>/>
        <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Medium size') ?></th>
        <td>
        <label for="medium_size_w"><?php _e('Max Width'); ?></label>
        <input name="medium_size_w" type="text" id="medium_size_w" value="<?php echo($opt['medium_size_w']); ?>" size="6" />
        <label for="medium_size_h"><?php _e('Max Height'); ?></label>
        <input name="medium_size_h" type="text" id="medium_size_h" value="<?php echo($opt['medium_size_h']); ?>" size="6" />
        </td>
        </tr>
			<tr valign="top">
		<th scope="row"><?php _e('Large size') ?></th>
		<td><fieldset><legend class="hidden"><?php _e('Large size') ?></legend>
		<label for="large_size_w"><?php _e('Max Width'); ?></label>
		<input name="large_size_w" type="text" id="large_size_w" value="<?php echo($opt['large_size_w']); ?>" class="small-text" />
		<label for="large_size_h"><?php _e('Max Height'); ?></label>
		<input name="large_size_h" type="text" id="large_size_h" value="<?php echo($opt['large_size_h']); ?>" class="small-text" />
		</fieldset></td>
		</tr>
		</table>
        <h3><?php _e('Embeds') ?></h3>

		<table class="form-table">
		
		<tr valign="top">
		<th scope="row"><?php _e('Auto-embeds'); ?></th>
		<td><fieldset><legend class="screen-reader-text"><span><?php _e('Attempt to automatically embed all plain text URLs'); ?></span></legend>
		<label for="embed_autourls"><input name="embed_autourls" type="checkbox" id="embed_autourls" value="1" <?php checked( '1', $opt['embed_autourls'] ); ?>/> <?php _e('Attempt to automatically embed all plain text URLs'); ?></label>
		</fieldset></td>
		</tr>
		
		<tr valign="top">
		<th scope="row"><?php _e('Maximum embed size') ?></th>
		<td>
		<label for="embed_size_w"><?php _e('Width'); ?></label>
		<input name="embed_size_w" type="text" id="embed_size_w" value="<?php echo $opt['embed_size_w']; ?>" class="small-text" />
		<label for="embed_size_h"><?php _e('Height'); ?></label>
		<input name="embed_size_h" type="text" id="embed_size_h" value="<?php echo $opt['embed_size_h']; ?>" class="small-text" />
		<?php if ( !empty($content_width) ) echo '<br />' . __("If the width value is left blank, embeds will default to the max width of your theme."); ?>
		</td>
		</tr>
		
		
		</table>
        </div>
        <p>&nbsp;</p>
        <div class="wrap">
        <h2>Default Theme</h2>
        <?php 
		$themes = get_themes();
		$ct = current_theme_info();
		$allowed_themes = get_site_allowed_themes();
		if( $allowed_themes == false )
			$allowed_themes = array();
		
		$blog_allowed_themes = wpmu_get_blog_allowedthemes();
		if( is_array( $blog_allowed_themes ) )
			$allowed_themes = array_merge( $allowed_themes, $blog_allowed_themes );
		
		if( $blog_id != 1 ) {
			unset( $allowed_themes[ "h3" ] );
		}
		
		if( isset( $allowed_themes[ esc_html( $ct->stylesheet ) ] ) == false )
			$allowed_themes[ esc_html( $ct->stylesheet ) ] = true;
		
		reset( $themes );
		foreach( $themes as $key => $theme ) {
			if( isset( $allowed_themes[ esc_html( $theme[ 'Stylesheet' ] ) ] ) == false ) {
				unset( $themes[ $key ] );
			}
		}
		reset( $themes );
		
		// get the names of the themes & sort them
		$theme_names = array_keys($themes);
		natcasesort($theme_names);
		?>
        <table class="form-table">
        <tr valign="top">
        <th>Select the default theme:</th>
        <td><select name="theme" size="1">
        <?php
		foreach ($theme_names as $theme_name) {
		$template = $themes[$theme_name]['Template'];
		$stylesheet = $themes[$theme_name]['Stylesheet'];
		$title = $themes[$theme_name]['Title'];
		$selected = "";
		if($opt[theme] == $template . "|" . $stylesheet) {
			$selected = "selected = 'selected' ";
		}
		echo('<option value="' . $template . "|" . $stylesheet .  '"' . $selected . '>' . $title . "</option>");
		}
		?>
        </select>
        </td>
        </tr>
        </table>
        </div>
        
        <div class="wrap">
        <h2>Bonus Settings</h2>
		<table class="form-table">
        <tr valign="top">
        <th>From Email:</th>
		<td><input name="from_email" type="text" id="from_email" size="30" value="<?php echo($opt['from_email']); ?>"  /></td>
		</tr>
		  <tr valign="top">
        <th>From Email Name:<br/>(defaults to site name if left blank)</th>
		<td><input name="from_email_name" type="text" id="from_email_name" size="30" value="<?php echo($opt['from_email_name']); ?>"  /></td>
		</tr>
		<tr>
			<th>Delete Standard WordPress Blogroll Links</th>
			<td>
		<label for="delete_blogroll_links">
		
        <input name="delete_blogroll_links" type="checkbox" id="delete_blogroll_links" value="1" <?php if ($opt['delete_blogroll_links'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr valign="top">
        <th>Default Link Category:<br/> (Overwrites "Blogroll")</th>
		<td><input name="default_link_cat" type="text" id="default_link_cat" size="30" value="<?php echo($opt['default_link_cat']); ?>"  /></td>
		</tr>
		<tr valign="top">
        <th scope="row"><?php _e('Additional Links') ?></th>
        <td>
        <p><?php _e('Enter links one per line with the name followed by an equals sign and a greater than sign and then the fully qualified link. Example: Google=>http://www.google.com') ?></p>
        <p>
        <textarea name="default_links" cols="60" rows="10" id="default_links" style="width: 98%; font-size: 12px;" class="code"><?php echo(str_replace('|+', "\n", $opt['default_links'])); ?></textarea>
        </p>
        </td>
        </tr>
		
		<tr valign="top">
        <th>Default Category:<br/> (Overwrites "Uncategorized")</th>
		<td><input name="default_cat_name" type="text" id="default_cat_name" size="30" value="<?php echo($opt['default_cat_name']); ?>"  /></td>
		</tr>
		<tr valign="top">
        <th scope="row"><?php _e('Additional Categories') ?></th>
        <td>
        <p><?php _e('Enter categories one per line with the name followed by an equals sign and a greater than sign and then the description => Nice Name => parent name. Example: Plugins=>Find out out about my plugins=>plugins=>code') ?></p>
        <p>
        <textarea name="default_categories" cols="60" rows="10" id="default_categories" style="width: 98%; font-size: 12px;" class="code"><?php echo(str_replace('|+', "\n", $opt['default_categories'])); ?></textarea>
        </p>
        </td>
        </tr>
		
    	<tr>
			<th>Delete Initial Comment</th>
			<td>
		<label for="delete_first_comment">
		
        <input name="delete_first_comment" type="checkbox" id="delete_first_comment" value="1" <?php if ($opt['delete_first_comment'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr>
			<th>Close Comments on Hello World Post</th>
			<td>
		<label for="close_comments_on_hello_world">
		
        <input name="close_comments_on_hello_world" type="checkbox" id="close_comments_on_hello_world" value="1" <?php if ($opt['close_comments_on_hello_world'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr>
			<th>Close Comments on About Page</th>
			<td>
		<label for="close_comments_on_about_page">
		
        <input name="close_comments_on_about_page" type="checkbox" id="close_comments_on_about_page" value="1" <?php if ($opt['close_comments_on_about_page'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr>
			<th>Make First Post a Draft ("Hello World")</th>
			<td>
		<label for="delete_first_post">
		
        <input name="delete_first_post" type="checkbox" id="delete_first_post" value="1" <?php if ($opt['delete_first_post'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		
		<tr>
			<th>Delete Initial Widgets</th>
			<td>
			<input name="delete_initial_widgets" type="checkbox" id="delete_initial_widgets" value="1" <?php if ($opt['delete_initial_widgets'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?>
			</td>
		</tr>
		
		<tr>
			<th colspan="2">
				Sites that use a combination of BBPress and BuddyPress need all users to be subscribed to the blog on which BBPress is installed. The following section lets you do that. Note that you may add people to a comma-delimited list of blogs, but they will have the same role on each blog. 
			</td>
		</tr>
		<tr valign="top">
        <th>Add User to Other Blog(s):</th>
		<td><input name="add_user_to_blog" type="checkbox" id="add_user_to_blog" value="1" <?php if ($opt['add_user_to_blog'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr valign="top">
        <th>Role on Other Blog (s)</th>
		<td>
			<select name="add_user_to_blog_role" id="add_user_to_blog_role">
			<option value="administrator"<?php if($opt['add_user_to_blog_role'] == 'administrator') echo ' selected="selected"';?>>Administator</option>
			<option value="editor"<?php if($opt['add_user_to_blog_role'] == 'editor') echo ' selected="selected"';?>>Editor</option>
			<option value="author"<?php if($opt['add_user_to_blog_role'] == 'author') echo ' selected="selected"';?>>Author</option>
			<option value="contributor"<?php if($opt['add_user_to_blog_role'] == 'contributor') echo ' selected="selected"';?>>Contributor</option>
			<option value="subscriber"<?php if($opt['add_user_to_blog_role'] == 'subscriber') echo ' selected="selected"';?>>Subscriber</option>				
		</select></td>
		</tr>
		<tr valign="top">
        <th>Blog ID's to add User To:</th>
		<td><input name="add_user_to_blog_id" type="text" id="add_user_to_blog_id" size="30" value="<?php echo($opt['add_user_to_blog_id']); ?>"  /><br/>Use Blog ID or comma-delimited list of ID's.</td>
		</tr>
		</table>
		</div>
        
        
         <p>  
         <input type="hidden" name="action" value="update" />
        <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
          </p> 
        
        <?php
	 }
コード例 #27
0
ファイル: misc.php プロジェクト: akalipetis/WordPress
/**
 * Updates the htaccess file with the current rules if it is writable.
 *
 * Always writes to the file if it exists and is writable to ensure that we
 * blank out old rules.
 *
 * @since 1.5.0
 *
 * @global WP_Rewrite $wp_rewrite
 */
function save_mod_rewrite_rules()
{
    if (is_multisite()) {
        return;
    }
    global $wp_rewrite;
    $home_path = get_home_path();
    $htaccess_file = $home_path . '.htaccess';
    /*
     * If the file doesn't already exist check for write access to the directory
     * and whether we have some rules. Else check for write access to the file.
     */
    if (!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() || is_writable($htaccess_file)) {
        if (got_mod_rewrite()) {
            $rules = explode("\n", $wp_rewrite->mod_rewrite_rules());
            return insert_with_markers($htaccess_file, 'WordPress', $rules);
        }
    }
    return false;
}
コード例 #28
0
function wp_cache_manager()
{
    global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
    global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_whitelist, $wp_cache_mobile_browsers;
    global $wp_cache_cron_check, $wp_cache_debug, $wp_cache_hide_donation;
    if (function_exists('is_site_admin')) {
        if (!is_site_admin()) {
            return;
        }
    }
    $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
    if (get_option('gzipcompression') == 1) {
        update_option('gzipcompression', 0);
    }
    if (!isset($cache_rebuild_files)) {
        $cache_rebuild_files = 0;
    }
    $valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache');
    /* http://www.netlobo.com/div_hiding.html */
    ?>
<script type='text/javascript'>
<!--
function toggleLayer( whichLayer ) {
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
// -->
//Clicking header opens fieldset options
jQuery(document).ready(function(){
	jQuery("fieldset h3").css("cursor","pointer").click(function(){
		jQuery(this).parent("fieldset").find("p,form,ul,blockquote").toggle("slow");
	});
});
</script>
<?php 
    echo '<div class="wrap">';
    echo "<h2>WP Super Cache Manager</h2>\n";
    if (ini_get('safe_mode')) {
        ?>
<h3>Warning! PHP Safe Mode Enabled!</h3>
		<p>You may experience problems running this plugin because SAFE MODE is enabled. <?php 
        if (!ini_get('safe_mode_gid')) {
            ?>
Your server is set up to check the owner of PHP scripts before allowing them to read and write files.</p><p>You or an administrator may be able to make it work by changing the group owner of the plugin scripts to match that of the web server user. The group owner of the <?php 
            echo WP_CONTENT_DIR;
            ?>
/cache/ directory must also be changed. See the <a href='http://php.net/features.safe-mode'>safe mode manual page</a> for further details.</p><?php 
        } else {
            ?>
You or an administrator must disable this. See the <a href='http://php.net/features.safe-mode'>safe mode manual page</a> for further details. This cannot be disabled in a .htaccess file unfortunately. It must be done in the php.ini config file.</p><?php 
        }
    }
    if (isset($_REQUEST['wp_restore_config']) && $valid_nonce) {
        unlink($wp_cache_config_file);
        echo '<strong>Configuration file changed, some values might be wrong. Load the page again from the "Settings" menu to reset them.</strong>';
    }
    if (!wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir()) {
        echo "Cannot continue... fix previous problems and retry.";
        echo "</div>\n";
        return;
    }
    if (!wp_cache_check_global_config()) {
        echo "</div>\n";
        return;
    }
    if ($wp_cache_debug || !$wp_cache_cron_check) {
        if (function_exists("wp_remote_get") == false) {
            $hostname = str_replace('http://', '', str_replace('https://', '', get_option('siteurl')));
            if (strpos($hostname, '/')) {
                $hostname = substr($hostname, 0, strpos($hostname, '/'));
            }
            $ip = gethostbyname($hostname);
            if (substr($ip, 0, 3) == '127' || substr($ip, 0, 7) == '192.168') {
                ?>
<h3>Warning! Your hostname "<?php 
                echo $hostname;
                ?>
" resolves to <?php 
                echo $ip;
                ?>
</h3>
			<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
			<p>Your server thinks your hostname resolves to <?php 
                echo $ip;
                ?>
. Some services such as garbage collection by this plugin, and WordPress scheduled posts may not operate correctly.</p>
			<p>Please see entry 16 in the <a href="http://wordpress.org/extend/plugins/wp-super-cache/faq/">Troubleshooting section</a> of the readme.txt</p>
			</div>
			<?php 
            } else {
                wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
            }
        } else {
            $cron_url = get_option('siteurl') . '/wp-cron.php?check=' . wp_hash('187425');
            $cron = wp_remote_get($cron_url, array('timeout' => 0.01, 'blocking' => true));
            if (is_array($cron)) {
                if ($cron['response']['code'] == '404') {
                    ?>
<h3>Warning! wp-cron.php not found!</h3>
				<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
				<p>Unfortunately WordPress cannot find the file wp-cron.php. This script is required for the the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.</p>
				<p>Please see entry 16 in the <a href="http://wordpress.org/extend/plugins/wp-super-cache/faq/">Troubleshooting section</a> of the readme.txt</p>
				</div>
				<?php 
                } else {
                    wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
                }
            }
        }
    }
    if ($cache_enabled == true && $super_cache_enabled == true && !got_mod_rewrite()) {
        ?>
<h4 style='color: #a00'>Mod rewrite may not be installed!</h4>
		<p>It appears that mod_rewrite is not installed. Sometimes this check isn't 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files. You will still be able to use WP-Cache.</p><?php 
    }
    if (!is_writeable_ACLSafe($wp_cache_config_file)) {
        define("SUBMITDISABLED", 'disabled style="color: #aaa" ');
        ?>
<h4 style='text-align:center; color: #a00'>Read Only Mode. Configuration cannot be changed. <a href="javascript:toggleLayer('readonlywarning');" title="Why your configuration may not be changed">Why</a></h4>
		<div id='readonlywarning' style='border: 1px solid #aaa; margin: 2px; padding: 2px; display: none;'>
		<p>The WP Super Cache configuration file is <code><?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code> and cannot be modified. The file <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php must be writeable by the webserver to make any changes.
		A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it's globally writeable and it should be fine.
		Writeable: <code>chmod 666 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code>
		Readonly: <code>chmod 644 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code></p>
		</div><?php 
    } else {
        define("SUBMITDISABLED", ' ');
    }
    // Server could be running as the owner of the wp-content directory.  Therefore, if it's
    // writable, issue a warning only if the permissions aren't 755.
    if (is_writeable_ACLSafe(WP_CONTENT_DIR . '/')) {
        $wp_content_stat = stat(WP_CONTENT_DIR . '/');
        $wp_content_mode = $wp_content_stat['mode'] & 0777;
        if ($wp_content_mode != 0755) {
            ?>
<h4 style='text-align:center; color: #a00'>Warning! <?php 
            echo WP_CONTENT_DIR;
            ?>
 is writeable!</h4>
			<p>You should change the permissions on <?php 
            echo WP_CONTENT_DIR;
            ?>
 and make it more restrictive. Use your ftp client, or the following command to fix things:<code>chmod 755 <?php 
            echo WP_CONTENT_DIR;
            ?>
/</code></p><?php 
        }
    }
    if ($valid_nonce) {
        if (isset($_POST['wp_cache_status'])) {
            if (isset($_POST['wp_cache_mobile_enabled'])) {
                $wp_cache_mobile_enabled = 1;
            } else {
                $wp_cache_mobile_enabled = 0;
            }
            if ($wp_cache_mobile_enabled == 1) {
                if (!isset($wp_cache_mobile_whitelist)) {
                    wp_cache_replace_line('^ *\\$wp_cache_mobile_whitelist', "\$wp_cache_mobile_whitelist = 'Stand Alone/QNws';", $wp_cache_config_file);
                }
                if (false == isset($wp_cache_mobile_browsers)) {
                    wp_cache_replace_line('^ *\\$wp_cache_mobile_browsers', "\$wp_cache_mobile_browsers = '2.0 MMP, 240x320, AvantGo, BlackBerry, Blazer, Cellphone, Danger, DoCoMo, Elaine/3.0, EudoraWeb, hiptop, IEMobile, iPhone, iPod, KYOCERA/WX310K, LG/U990, MIDP-2.0, MMEF20, MOT-V, NetFront, Newt, Nintendo Wii, Nitro, Nokia, Opera Mini, Palm, Playstation Portable, portalmmm, Proxinet, ProxiNet, SHARP-TQ-GX10, Small, SonyEricsson, Symbian OS, SymbianOS, TS21i-10, UP.Browser, UP.Link, Windows CE, WinWAP';", $wp_cache_config_file);
                }
                $_POST['wp_cache_status'] = 'wpcache';
            }
            wp_cache_replace_line('^ *\\$wp_cache_mobile_enabled', "\$wp_cache_mobile_enabled = " . $wp_cache_mobile_enabled . ";", $wp_cache_config_file);
            switch ($_POST['wp_cache_status']) {
                case 'all':
                    wp_cache_enable();
                    break;
                case 'none':
                    wp_cache_disable();
                    break;
                case 'wpcache':
                    wp_cache_enable();
                    wp_super_cache_disable();
                    break;
            }
            if (isset($_POST['wp_cache_hello_world'])) {
                $wp_cache_hello_world = 1;
            } else {
                $wp_cache_hello_world = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_hello_world', '$wp_cache_hello_world = ' . (int) $wp_cache_hello_world . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_clear_on_post_edit'])) {
                $wp_cache_clear_on_post_edit = 1;
            } else {
                $wp_cache_clear_on_post_edit = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_clear_on_post_edit', "\$wp_cache_clear_on_post_edit = " . $wp_cache_clear_on_post_edit . ";", $wp_cache_config_file);
            if (isset($_POST['cache_rebuild_files'])) {
                $cache_rebuild_files = 1;
            } else {
                $cache_rebuild_files = 0;
            }
            wp_cache_replace_line('^ *\\$cache_rebuild_files', "\$cache_rebuild_files = " . $cache_rebuild_files . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_mutex_disabled'])) {
                $wp_cache_mutex_disabled = 0;
            } else {
                $wp_cache_mutex_disabled = 1;
            }
            wp_cache_replace_line('^ *\\$wp_cache_mutex_disabled', "\$wp_cache_mutex_disabled = " . $wp_cache_mutex_disabled . ";", $wp_cache_config_file);
        }
        if (isset($_POST['cache_compression']) && $_POST['cache_compression'] != $cache_compression) {
            $cache_compression_changed = true;
            $cache_compression = intval($_POST['cache_compression']);
            wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
            if (function_exists('prune_super_cache')) {
                prune_super_cache($cache_path, true);
            }
            delete_option('super_cache_meta');
        }
        if (isset($_POST['wp_cache_hide_donation']) && $_POST['wp_cache_hide_donation'] != $wp_cache_hide_donation) {
            $wp_cache_hide_donation = intval($_POST['wp_cache_hide_donation']);
            wp_cache_replace_line('^ *\\$wp_cache_hide_donation', "\$wp_cache_hide_donation = " . $wp_cache_hide_donation . ";", $wp_cache_config_file);
        }
    }
    ?>
	<table><td><fieldset class="options" id="show-this-fieldset"> 
	<h3>WP Super Cache Status</h3><?php 
    echo '<form name="wp_manager" action="' . $_SERVER["REQUEST_URI"] . '" method="post">';
    ?>
	<label><input type='radio' name='wp_cache_status' value='all' <?php 
    if ($cache_enabled == true && $super_cache_enabled == true) {
        echo 'checked=checked';
    }
    ?>
> <strong>ON</strong> <span class="setting-description">WP Cache and Super Cache enabled</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='wpcache' <?php 
    if ($cache_enabled == true && $super_cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong>HALF ON</strong> <span class="setting-description">Super Cache Disabled, only legacy WP-Cache caching.</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='none' <?php 
    if ($cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong>OFF</strong> <span class="setting-description">WP Cache and Super Cache disabled</span></label><br />
	<p><label><input type='checkbox' name='wp_cache_hello_world' <?php 
    if ($wp_cache_hello_world) {
        echo "checked";
    }
    ?>
 value='1'> Proudly tell the world your server is Digg proof! (places a message in your blog's footer)</label></p>
	<p><label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php 
    if ($wp_cache_clear_on_post_edit) {
        echo "checked";
    }
    ?>
 value='1'> Clear all cache files when a post or page is published. (This may significantly slow down saving of posts.)</label></p>
	<p><label><input type='checkbox' name='cache_rebuild_files' <?php 
    if ($cache_rebuild_files) {
        echo "checked";
    }
    ?>
 value='1'> Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated. Recommended for <em>very</em> busy websites with lots of comments. Makes "directly cached pages" and "Lockdown mode" obsolete.</label></p>
	<p><label><input type='checkbox' name='wp_cache_mutex_disabled' <?php 
    if (!$wp_cache_mutex_disabled) {
        echo "checked";
    }
    ?>
 value='0'> Coarse file locking. You probably don't need this but it may help if your server is underpowered. Warning! <em>May cause your server to lock up in very rare cases!</em></label></p>
	<p><label><input type='checkbox' name='wp_cache_mobile_enabled' <?php 
    if ($wp_cache_mobile_enabled) {
        echo "checked";
    }
    ?>
 value='1'> Mobile device support. Plugin will enter "Half-On" mode.</label></p>
	<p><strong>Note:</strong> If uninstalling this plugin, make sure the directory <em><?php 
    echo WP_CONTENT_DIR;
    ?>
</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable too is probably a good idea!)</p>
	<?php 
    echo "<div class='submit'><input type='submit' " . SUBMITDISABLED . " value='Update Status &raquo;' /></div>";
    wp_nonce_field('wp-cache');
    ?>
	</form>
	<?php 
    if ($super_cache_enabled && function_exists('apache_get_modules')) {
        $mods = apache_get_modules();
        $required_modules = array('mod_mime' => 'Required to serve compressed supercache files properly.', 'mod_headers' => 'Required to set caching information on supercache pages. IE7 users will see old pages without this module.', 'mod_expires' => 'Set the expiry date on supercached pages. Visitors may not see new pages when they refresh or leave comments without this module.');
        foreach ($required_modules as $req => $desc) {
            if (!in_array($req, $mods)) {
                $missing_mods[$req] = $desc;
            }
        }
        if (is_array($missing_mods)) {
            echo "<h3>Missing Apache Modules</h3>";
            echo "<p>The following Apache modules are missing. The plugin will work in half-on mode without them. In full Supercache mode, your visitors may see corrupted pages or out of date content however.</p>";
            echo "<ul>";
            foreach ($missing_mods as $req => $desc) {
                echo "<li> {$req} - {$desc}</li>";
            }
            echo "</ul>";
        }
    }
    ?>
	</fieldset>
	</td><td valign='top'>
	<div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 5px'>
	<h3 align='center'>Make WordPress Faster</h3>
	<?php 
    if ($wp_cache_hide_donation != 1) {
        ?>
	<p><a href="http://ocaoimh.ie/wp-super-cache/?r=wpsc">WP Super Cache</a> makes your blog go faster. Think that's worth $10? Click the "Donate" button below.</p>
	<p>Thanks!<br />Donncha O Caoimh.<br /></p>
	<div align='center'>
	<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
	<input type="hidden" name="cmd" value="_s-xclick"/>
	<input type="hidden" name="hosted_button_id" value="3244504"/>
	<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt=""/>
	<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/><br />
	</form>
	<p>Don't show me this again. <form action="<?php 
        echo $_SERVER["REQUEST_URI"];
        ?>
" method="post"><input type='hidden' name='wp_cache_hide_donation' value='1' /><input type='submit' value='Hide' /><?php 
        wp_nonce_field('wp-cache');
        ?>
</form></p>
	</div>
	<?php 
    } else {
        ?>
	<p><a href="http://ocaoimh.ie/wp-super-cache/?r=supercache">WP Super Cache</a> is maintained and developed by <a href="http://ocaoimh.ie/?r=supercache">Donncha O Caoimh</a> with contributions from many others thanks to the GPL.</p>
	<p>He blogs at <a href="http://ocaoimh.ie/?r=supercache">Holy Shmoly</a> and posts photos at <a href="http://inphotos.org/?r=supercache">In Photos.org</a>. You can say hi to him on <a href="http://twitter.com/donncha/">Twitter</a> too!</p>
	<?php 
    }
    ?>
	</div>

	</td></table>
	<?php 
    wp_cache_files();
    wsc_mod_rewrite();
    wp_cache_edit_max_time();
    echo '<a name="files"></a><fieldset class="options"><h3>Accepted Filenames &amp; Rejected URIs</h3>';
    wp_cache_edit_rejected();
    echo "\n";
    wp_cache_edit_accepted();
    echo '</fieldset>';
    wp_cache_edit_rejected_ua();
    wp_lock_down();
    wp_cache_restore();
    ob_start();
    if (defined('WP_CACHE')) {
        if (function_exists('do_cacheaction')) {
            do_cacheaction('cache_admin_page');
        }
    }
    $out = ob_get_contents();
    ob_end_clean();
    if (SUBMITDISABLED == ' ' && $out != '') {
        echo '<fieldset class="options"><h3>Cache Plugins</h3>';
        echo $out;
        echo '</fieldset>';
    }
    echo "</div>\n";
}
コード例 #29
0
/**
 * Prints step 1 for Network installation process.
 *
 * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network
 * 	should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo.
 *
 * @since 3.0.0
 */
function network_step1($errors = false)
{
    global $is_apache;
    if (defined('DO_NOT_UPGRADE_GLOBAL_TABLES')) {
        echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __('The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.') . '</p></div>';
        echo '</div>';
        include ABSPATH . 'wp-admin/admin-footer.php';
        die;
    }
    $active_plugins = get_option('active_plugins');
    if (!empty($active_plugins)) {
        echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf(__('Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.'), admin_url('plugins.php?plugin_status=active')) . '</p></div><p>' . __('Once the network is created, you may reactivate your plugins.') . '</p>';
        echo '</div>';
        include ABSPATH . 'wp-admin/admin-footer.php';
        die;
    }
    $hostname = get_clean_basedomain();
    $has_ports = strstr($hostname, ':');
    if (false !== $has_ports && !in_array($has_ports, array(':80', ':443'))) {
        echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __('You cannot install a network of sites with your server address.') . '</p></div>';
        echo '<p>' . sprintf(__('You cannot use port numbers such as <code>%s</code>.'), $has_ports) . '</p>';
        echo '<a href="' . esc_url(admin_url()) . '">' . __('Return to Dashboard') . '</a>';
        echo '</div>';
        include ABSPATH . 'wp-admin/admin-footer.php';
        die;
    }
    echo '<form method="post" action="">';
    wp_nonce_field('install-network-1');
    $error_codes = array();
    if (is_wp_error($errors)) {
        echo '<div class="error"><p><strong>' . __('ERROR: The network could not be created.') . '</strong></p>';
        foreach ($errors->get_error_messages() as $error) {
            echo "<p>{$error}</p>";
        }
        echo '</div>';
        $error_codes = $errors->get_error_codes();
    }
    $site_name = !empty($_POST['sitename']) && !in_array('empty_sitename', $error_codes) ? $_POST['sitename'] : sprintf(_x('%s Sites', 'Default network name'), get_option('blogname'));
    $admin_email = !empty($_POST['email']) && !in_array('invalid_email', $error_codes) ? $_POST['email'] : get_option('admin_email');
    ?>
	<p><?php 
    _e('Welcome to the Network installation process!');
    ?>
</p>
	<p><?php 
    _e('Fill in the information below and you&#8217;ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.');
    ?>
</p>
	<?php 
    if (isset($_POST['subdomain_install'])) {
        $subdomain_install = (bool) $_POST['subdomain_install'];
    } elseif (apache_mod_loaded('mod_rewrite')) {
        // assume nothing
        $subdomain_install = true;
    } elseif (!allow_subdirectory_install()) {
        $subdomain_install = true;
    } else {
        $subdomain_install = false;
        if ($got_mod_rewrite = got_mod_rewrite()) {
            // dangerous assumptions
            echo '<div class="updated inline"><p><strong>' . __('Note:') . '</strong> ' . __('Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.') . '</p>';
        } elseif ($is_apache) {
            echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __('It looks like the Apache <code>mod_rewrite</code> module is not installed.') . '</p>';
        }
        if ($got_mod_rewrite || $is_apache) {
            // Protect against mod_rewrite mimicry (but ! Apache)
            echo '<p>' . __('If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.') . '</p></div>';
        }
    }
    if (allow_subdomain_install() && allow_subdirectory_install()) {
        ?>
		<h3><?php 
        esc_html_e('Addresses of Sites in your Network');
        ?>
</h3>
		<p><?php 
        _e('Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>');
        ?>
</p>
		<p><?php 
        _e('You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.');
        ?>
</p>
		<?php 
        // @todo: Link to an MS readme?
        ?>
		<table class="form-table">
			<tr>
				<th><label><input type='radio' name='subdomain_install' value='1'<?php 
        checked($subdomain_install);
        ?>
 /> <?php 
        _e('Sub-domains');
        ?>
</label></th>
				<td><?php 
        printf(_x('like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples'), $hostname);
        ?>
</td>
			</tr>
			<tr>
				<th><label><input type='radio' name='subdomain_install' value='0'<?php 
        checked(!$subdomain_install);
        ?>
 /> <?php 
        _e('Sub-directories');
        ?>
</label></th>
				<td><?php 
        printf(_x('like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples'), $hostname);
        ?>
</td>
			</tr>
		</table>

<?php 
    }
    if (WP_CONTENT_DIR != ABSPATH . 'wp-content' && (allow_subdirectory_install() || !allow_subdomain_install())) {
        echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __('Subdirectory networks may not be fully compatible with custom wp-content directories.') . '</p></div>';
    }
    $is_www = 0 === strpos($hostname, 'www.');
    if ($is_www) {
        ?>
		<h3><?php 
        esc_html_e('Server Address');
        ?>
</h3>
		<p><?php 
        printf(__('We recommend you change your siteurl to <code>%1$s</code> before enabling the network feature. It will still be possible to visit your site using the <code>www</code> prefix with an address like <code>%2$s</code> but any links will not have the <code>www</code> prefix.'), substr($hostname, 4), $hostname);
        ?>
</p>
		<table class="form-table">
			<tr>
				<th scope='row'><?php 
        esc_html_e('Server Address');
        ?>
</th>
				<td>
					<?php 
        printf(__('The internet address of your network will be <code>%s</code>.'), $hostname);
        ?>
				</td>
			</tr>
		</table>
		<?php 
    }
    ?>

		<h3><?php 
    esc_html_e('Network Details');
    ?>
</h3>
		<table class="form-table">
		<?php 
    if ('localhost' == $hostname) {
        ?>
			<tr>
				<th scope="row"><?php 
        esc_html_e('Sub-directory Install');
        ?>
</th>
				<td><?php 
        _e('Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.');
        // Uh oh:
        if (!allow_subdirectory_install()) {
            echo ' <strong>' . __('Warning!') . ' ' . __('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.') . '</strong>';
        }
        ?>
</td>
			</tr>
		<?php 
    } elseif (!allow_subdomain_install()) {
        ?>
			<tr>
				<th scope="row"><?php 
        esc_html_e('Sub-directory Install');
        ?>
</th>
				<td><?php 
        _e('Because your install is in a directory, the sites in your WordPress network must use sub-directories.');
        // Uh oh:
        if (!allow_subdirectory_install()) {
            echo ' <strong>' . __('Warning!') . ' ' . __('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.') . '</strong>';
        }
        ?>
</td>
			</tr>
		<?php 
    } elseif (!allow_subdirectory_install()) {
        ?>
			<tr>
				<th scope="row"><?php 
        esc_html_e('Sub-domain Install');
        ?>
</th>
				<td><?php 
        _e('Because your install is not new, the sites in your WordPress network must use sub-domains.');
        echo ' <strong>' . __('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.') . '</strong>';
        ?>
</td>
			</tr>
		<?php 
    }
    ?>
		<?php 
    if (!$is_www) {
        ?>
			<tr>
				<th scope='row'><?php 
        esc_html_e('Server Address');
        ?>
</th>
				<td>
					<?php 
        printf(__('The internet address of your network will be <code>%s</code>.'), $hostname);
        ?>
				</td>
			</tr>
		<?php 
    }
    ?>
			<tr>
				<th scope='row'><?php 
    esc_html_e('Network Title');
    ?>
</th>
				<td>
					<input name='sitename' type='text' size='45' value='<?php 
    echo esc_attr($site_name);
    ?>
' />
					<p class="description">
						<?php 
    _e('What would you like to call your network?');
    ?>
					</p>
				</td>
			</tr>
			<tr>
				<th scope='row'><?php 
    esc_html_e('Network Admin Email');
    ?>
</th>
				<td>
					<input name='email' type='text' size='45' value='<?php 
    echo esc_attr($admin_email);
    ?>
' />
					<p class="description">
						<?php 
    _e('Your email address.');
    ?>
					</p>
				</td>
			</tr>
		</table>
		<?php 
    submit_button(__('Install'), 'primary', 'submit');
    ?>
	</form>
	<?php 
}
コード例 #30
0
ファイル: wp-cache.php プロジェクト: popovdenis/kmst
function wp_cache_manager_error_checks()
{
    global $wpmu_version, $wp_cache_debug, $wp_cache_cron_check, $cache_enabled, $super_cache_enabled, $wp_cache_config_file, $wp_cache_mobile_browsers, $wp_cache_mobile_prefixes, $wp_cache_mobile_browsers, $wp_cache_mobile_enabled, $wp_cache_mod_rewrite, $cache_path;
    if (!wpsupercache_site_admin()) {
        return false;
    }
    if (1 == ini_get('safe_mode') || "on" == strtolower(ini_get('safe_mode'))) {
        echo '<div id="message" class="updated fade"><h3>' . __('Warning! PHP Safe Mode Enabled!', 'wp-super-cache') . '</h3><p>' . __('You may experience problems running this plugin because SAFE MODE is enabled.', 'wp-super-cache') . ' ';
        if (!ini_get('safe_mode_gid')) {
            _e('Your server is set up to check the owner of PHP scripts before allowing them to read and write files.', 'wp-super-cache') . " ";
            printf(__('You or an administrator may be able to make it work by changing the group owner of the plugin scripts to match that of the web server user. The group owner of the %s/cache/ directory must also be changed. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details.', 'wp-super-cache'), WP_CONTENT_DIR);
        } else {
            _e('You or an administrator must disable this. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details. This cannot be disabled in a .htaccess file unfortunately. It must be done in the php.ini config file.', 'wp-super-cache');
        }
        echo '</p></div>';
    }
    if ('' == get_option('permalink_structure')) {
        echo '<div id="message" class="updated fade"><h3>' . __('Permlink Structure Error', 'wp-super-cache') . '</h3>';
        echo "<p>" . __('A custom url or permalink structure is required for this plugin to work correctly. Please go to the <a href="options-permalink.php">Permalinks Options Page</a> to configure your permalinks.') . "</p>";
        echo '</div>';
        return false;
    }
    if ($wp_cache_debug || !$wp_cache_cron_check) {
        if (function_exists("wp_remote_get") == false) {
            $hostname = str_replace('http://', '', str_replace('https://', '', get_option('siteurl')));
            if (strpos($hostname, '/')) {
                $hostname = substr($hostname, 0, strpos($hostname, '/'));
            }
            $ip = gethostbyname($hostname);
            if (substr($ip, 0, 3) == '127' || substr($ip, 0, 7) == '192.168') {
                ?>
<div id="message" class="updated fade"><h3><?php 
                printf(__('Warning! Your hostname "%s" resolves to %s', 'wp-super-cache'), $hostname, $ip);
                ?>
</h3>
					<p><?php 
                printf(__('Your server thinks your hostname resolves to %s. Some services such as garbage collection by this plugin, and WordPress scheduled posts may not operate correctly.', 'wp-super-cache'), $ip);
                ?>
</p>
					<p><?php 
                printf(__('Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/faq/');
                ?>
</p>
					</div>
					<?php 
                return false;
            } else {
                wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
            }
        } else {
            $cron_url = get_option('siteurl') . '/wp-cron.php?check=' . wp_hash('187425');
            $cron = wp_remote_get($cron_url, array('timeout' => 0.01, 'blocking' => true));
            if (is_array($cron)) {
                if ($cron['response']['code'] == '404') {
                    ?>
<div id="message" class="updated fade"><h3>Warning! wp-cron.php not found!</h3>
					<p><?php 
                    _e('Unfortunately WordPress cannot find the file wp-cron.php. This script is required for the the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.', 'wp-super-cache');
                    ?>
</p>
					<p><?php 
                    printf(__('Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/faq/');
                    ?>
</p>
					</div>
					<?php 
                    return true;
                } else {
                    wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
                }
            }
        }
    }
    if (!wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir()) {
        echo '<p>' . __("Cannot continue... fix previous problems and retry.", 'wp-super-cache') . '</p>';
        return false;
    }
    if (!wp_cache_check_global_config()) {
        return false;
    }
    if (1 == ini_get('zlib.output_compression') || "on" == strtolower(ini_get('zlib.output_compression'))) {
        ?>
<div id="message" class="updated fade"><h3><?php 
        _e('Zlib Output Compression Enabled!', 'wp-super-cache');
        ?>
</h3>
		<p><?php 
        _e('PHP is compressing the data sent to the visitors of your site. Disabling this is recommended as the plugin caches the compressed output once instead of compressing the same page over and over again. Also see #21 in the Troubleshooting section. See <a href="http://php.net/manual/en/zlib.configuration.php">this page</a> for instructions on modifying your php.ini.', 'wp-super-cache');
        ?>
</p></div><?php 
    }
    if ($cache_enabled == true && $super_cache_enabled == true && $wp_cache_mod_rewrite && !got_mod_rewrite()) {
        ?>
<div id="message" class="updated fade"><h3><?php 
        _e('Mod rewrite may not be installed!', 'wp-super-cache');
        ?>
</h3>
		<p><?php 
        _e('It appears that mod_rewrite is not installed. Sometimes this check isn&#8217;t 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files. You will still be able to use legacy or PHP modes.', 'wp-super-cache');
        ?>
</p></div><?php 
    }
    if (!is_writeable_ACLSafe($wp_cache_config_file)) {
        define("SUBMITDISABLED", 'disabled style="color: #aaa" ');
        ?>
<div id="message" class="updated fade"><h3><?php 
        _e('Read Only Mode. Configuration cannot be changed.', 'wp-super-cache');
        ?>
</h3>
		<p><?php 
        printf(__('The WP Super Cache configuration file is <code>%s/wp-cache-config.php</code> and cannot be modified. That file must be writeable by the webserver to make any changes.', 'wp-super-cache'), WP_CONTENT_DIR);
        ?>
		<?php 
        _e('A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it&#8217;s globally writeable and it should be fine.', 'wp-super-cache');
        ?>
</p>
		<p><?php 
        _e('<a href="http://codex.wordpress.org/Changing_File_Permissions">This page</a> explains how to change file permissions.', 'wp-super-cache');
        ?>
</p>
		<?php 
        _e('Writeable:', 'wp-super-cache');
        ?>
 <code>chmod 666 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code>
		<?php 
        _e('Readonly:', 'wp-super-cache');
        ?>
 <code>chmod 644 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code></p>
		</div><?php 
    } else {
        define("SUBMITDISABLED", ' ');
    }
    // Server could be running as the owner of the wp-content directory.  Therefore, if it's
    // writable, issue a warning only if the permissions aren't 755.
    if (is_writeable_ACLSafe(WP_CONTENT_DIR . '/')) {
        $wp_content_stat = stat(WP_CONTENT_DIR . '/');
        $wp_content_mode = decoct($wp_content_stat['mode'] & 0777);
        if (substr($wp_content_mode, -2) == '77') {
            ?>
<div id="message" class="updated fade"><h3><?php 
            printf(__('Warning! %s is writeable!', 'wp-super-cache'), WP_CONTENT_DIR);
            ?>
</h3>
			<p><?php 
            printf(__('You should change the permissions on %s and make it more restrictive. Use your ftp client, or the following command to fix things:', 'wp-super-cache'), WP_CONTENT_DIR);
            ?>
 <code>chmod 755 <?php 
            echo WP_CONTENT_DIR;
            ?>
/</code></p>
			<p><?php 
            _e('<a href="http://codex.wordpress.org/Changing_File_Permissions">This page</a> explains how to change file permissions.', 'wp-super-cache');
            ?>
</p></div>
			<?php 
        }
    }
    if (function_exists("is_main_site") && true == is_main_site() || function_exists('is_main_blog') && true == is_main_blog()) {
        $home_path = trailingslashit(get_home_path());
        $scrules = implode("\n", extract_from_markers($home_path . '.htaccess', 'WPSuperCache'));
        if ($cache_enabled && $wp_cache_mod_rewrite && !$wp_cache_mobile_enabled && strpos($scrules, addcslashes(implode('|', $wp_cache_mobile_browsers), ' '))) {
            echo '<div id="message" class="updated fade"><h3>' . __('Mobile rewrite rules detected', 'wp-super-cache') . "</h3>";
            echo "<p>" . __('For best performance you should enable "Mobile device support" or delete the mobile rewrite rules in your .htaccess. Look for the 2 lines with the text "2.0\\ MMP|240x320" and delete those.', 'wp-super-cache') . "</p><p>" . __('This will have no affect on ordinary users but mobile users will see uncached pages.', 'wp-super-cache') . "</p></div>";
        } elseif ($wp_cache_mod_rewrite && $cache_enabled && $wp_cache_mobile_enabled && $scrules != '' && (false === strpos($scrules, addcslashes(implode('|', $wp_cache_mobile_prefixes), ' ')) || false === strpos($scrules, addcslashes(implode('|', $wp_cache_mobile_browsers), ' ')))) {
            ?>
			<div id="message" class="updated fade"><h3><?php 
            _e('Rewrite rules must be updated', 'wp-super-cache');
            ?>
</h3>
			<p><?php 
            _e('The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache');
            ?>
			<?php 
            _e('Mobile support requires extra rules in your .htaccess file, or you can set the plugin to legacy mode. Here are your options (in order of difficulty):', 'wp-super-cache');
            ?>
			<ol><li> <?php 
            _e('Set the plugin to legacy mode and enable mobile support.', 'wp-super-cache');
            ?>
</li>
			<li> <?php 
            _e('Scroll down the Advanced Settings page and click the <strong>Update Mod_Rewrite Rules</strong> button.', 'wp-super-cache');
            ?>
</li>
			<li> <?php 
            printf(__('Delete the plugin mod_rewrite rules in %s.htaccess enclosed by <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code> and let the plugin regenerate them by reloading this page.', 'wp-super-cache'), $home_path);
            ?>
</li>
			<li> <?php 
            printf(__('Add the rules yourself. Edit %s.htaccess and find the block of code enclosed by the lines <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code>. There are two sections that look very similar. Just below the line <code>%%{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$</code> add these lines: (do it twice, once for each section)', 'wp-super-cache'), $home_path);
            ?>
</p>
			<div style='padding: 2px; margin: 2px; border: 1px solid #333; width:400px; overflow: scroll'><pre><?php 
            echo "RewriteCond %{HTTP_user_agent} !^.*(" . addcslashes(implode('|', $wp_cache_mobile_browsers), ' ') . ").*\nRewriteCond %{HTTP_user_agent} !^(" . addcslashes(implode('|', $wp_cache_mobile_prefixes), ' ') . ").*";
            ?>
</pre></div></li></ol></div><?php 
        }
        if ($cache_enabled && $super_cache_enabled && $wp_cache_mod_rewrite && $scrules == '') {
            ?>
<div id="message" class="updated fade"><h3><?php 
            _e('Rewrite rules must be updated', 'wp-super-cache');
            ?>
</h3>
		<p><?php 
            _e('The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache');
            ?>
		<?php 
            _e('Scroll down the Advanced Settings page and click the <strong>Update Mod_Rewrite Rules</strong> button.', 'wp-super-cache');
            ?>
</p></div><?php 
        }
    }
    if ($wp_cache_mod_rewrite && $super_cache_enabled && function_exists('apache_get_modules')) {
        $mods = apache_get_modules();
        $required_modules = array('mod_mime' => __('Required to serve compressed supercache files properly.', 'wp-super-cache'), 'mod_headers' => __('Required to set caching information on supercache pages. IE7 users will see old pages without this module.', 'wp-super-cache'), 'mod_expires' => __('Set the expiry date on supercached pages. Visitors may not see new pages when they refresh or leave comments without this module.', 'wp-super-cache'));
        foreach ($required_modules as $req => $desc) {
            if (!in_array($req, $mods)) {
                $missing_mods[$req] = $desc;
            }
        }
        if (isset($missing_mods) && is_array($missing_mods)) {
            ?>
<div id="message" class="updated fade"><h3><?php 
            _e('Missing Apache Modules', 'wp-super-cache');
            ?>
</h3>
			<p><?php 
            __('The following Apache modules are missing. The plugin will work in legacy mode without them. In full Supercache mode, your visitors may see corrupted pages or out of date content however.', 'wp-super-cache');
            ?>
</p><?php 
            echo "<ul>";
            foreach ($missing_mods as $req => $desc) {
                echo "<li> {$req} - {$desc}</li>";
            }
            echo "</ul>";
            echo "</div>";
        }
    }
    return true;
}