本文整理汇总了PHP中got_mod_rewrite函数的典型用法代码示例。如果您正苦于以下问题:PHP got_mod_rewrite函数的具体用法?PHP got_mod_rewrite怎么用?PHP got_mod_rewrite使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了got_mod_rewrite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uncode_add_h5bp_htaccess
/**
* 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: do_analyze_page
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: structure
/**
* 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: htaccess_add_rules
/**
* 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: structure
/**
* 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: groundup_compression
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;
}
示例7: __construct
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: roots_add_h5bp_htaccess
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: structure
/**
* 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: roots_add_h5bp_htaccess
/**
* 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: __construct
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: scoper_options
//.........这里部分代码省略.........
$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) {
示例13: step_permalinks
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 & 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);
?>
/> <?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);
?>
/> <?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);
?>
/> <?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
//.........这里部分代码省略.........
示例14: save_mod_rewrite_rules
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: wp_cache_manager
//.........这里部分代码省略.........
<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’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’s globally writeable and it should be fine.', 'wp-super-cache');
?>
</p>
<?php