當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wp_cache_replace_line函數代碼示例

本文整理匯總了PHP中wp_cache_replace_line函數的典型用法代碼示例。如果您正苦於以下問題:PHP wp_cache_replace_line函數的具體用法?PHP wp_cache_replace_line怎麽用?PHP wp_cache_replace_line使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wp_cache_replace_line函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: wp_supercache_searchengine_admin

function wp_supercache_searchengine_admin()
{
    global $cache_no_adverts_for_friends, $wp_cache_config_file, $valid_nonce;
    $cache_no_adverts_for_friends = $cache_no_adverts_for_friends == '' ? 'no' : $cache_no_adverts_for_friends;
    if (isset($_POST['cache_no_adverts_for_friends']) && $valid_nonce) {
        $cache_no_adverts_for_friends = $_POST['cache_no_adverts_for_friends'] == __('Disable', 'wp-super-cache') ? 'no' : 'yes';
        wp_cache_replace_line('^ *\\$cache_no_adverts_for_friends', "\$cache_no_adverts_for_friends = '{$cache_no_adverts_for_friends}';", $wp_cache_config_file);
    }
    $id = 'no_adverts_for_friends-section';
    ?>
		<fieldset id="<?php 
    echo $id;
    ?>
" class="options"> 
		<h4><?php 
    _e('No Adverts for Friends', 'wp-super-cache');
    ?>
</h4>
		<form name="wp_manager" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
" method="post">
		<label><input type="radio" name="cache_no_adverts_for_friends" value="1" <?php 
    if ($cache_no_adverts_for_friends == 'yes') {
        echo 'checked="checked" ';
    }
    ?>
/> <?php 
    _e('Enabled', 'wp-super-cache');
    ?>
</label>
		<label><input type="radio" name="cache_no_adverts_for_friends" value="0" <?php 
    if ($cache_no_adverts_for_friends == 'no') {
        echo 'checked="checked" ';
    }
    ?>
/> <?php 
    _e('Disabled', 'wp-super-cache');
    ?>
</label>
		<p><?php 
    _e('', 'wp-super-cache');
    ?>
</p><?php 
    echo '<p>' . __('Provides support for <a href="http://ocaoimh.ie/no-adverts-for-friends/">No Adverts for Friends</a>.', 'wp-super-cache') . '</p>';
    if (isset($changed) && $changed) {
        if ('yes' == $cache_no_adverts_for_friends) {
            $status = __("enabled");
        } else {
            $status = __("disabled");
        }
        echo "<p><strong>" . sprintf(__("No Adverts for Friends support is now %s", 'wp-super-cache'), $status) . "</strong></p>";
    }
    echo '<div class="submit"><input ' . SUBMITDISABLED . 'type="submit" value="' . __('Update', 'wp-super-cache') . '" /></div>';
    wp_nonce_field('wp-cache');
    ?>
	</form>
	</fieldset>
<?php 
}
開發者ID:adisonc,項目名稱:MaineLearning,代碼行數:60,代碼來源:searchengine.php

示例2: wp_supercache_awaitingmoderation_admin

function wp_supercache_awaitingmoderation_admin()
{
    global $cache_awaitingmoderation, $wp_cache_config_file, $valid_nonce;
    $cache_awaitingmoderation = $cache_awaitingmoderation == '' ? '0' : $cache_awaitingmoderation;
    if (isset($_POST['cache_awaitingmoderation']) && $valid_nonce) {
        $cache_awaitingmoderation = (int) $_POST['cache_awaitingmoderation'];
        wp_cache_replace_line('^ *\\$cache_awaitingmoderation', "\$cache_awaitingmoderation = '{$cache_awaitingmoderation}';", $wp_cache_config_file);
        $changed = true;
    } else {
        $changed = false;
    }
    $id = 'awaitingmoderation-section';
    ?>
		<fieldset id="<?php 
    echo $id;
    ?>
" class="options"> 
		<h4><?php 
    _e('Awaiting Moderation', 'wp-super-cache');
    ?>
</h4>
		<form name="wp_manager" action="" method="post">
		<label><input type="radio" name="cache_awaitingmoderation" value="1" <?php 
    if ($cache_awaitingmoderation) {
        echo 'checked="checked" ';
    }
    ?>
/> <?php 
    _e('Enabled', 'wp-super-cache');
    ?>
</label>
		<label><input type="radio" name="cache_awaitingmoderation" value="0" <?php 
    if (!$cache_awaitingmoderation) {
        echo 'checked="checked" ';
    }
    ?>
/> <?php 
    _e('Disabled', 'wp-super-cache');
    ?>
</label>
		<p><?php 
    _e('Enables or disables plugin to Remove the text "Your comment is awaiting moderation." when someone leaves a moderated comment.', 'wp-super-cache');
    ?>
</p>
		<?php 
    if ($changed) {
        if ($cache_awaitingmoderation) {
            $status = __("enabled");
        } else {
            $status = __("disabled");
        }
        echo "<p><strong>" . sprintf(__("Awaiting Moderation is now %s", 'wp-super-cache'), $status) . "</strong></p>";
    }
    echo '<div class="submit"><input ' . SUBMITDISABLED . 'type="submit" value="' . __('Update', 'wp-super-cache') . '" /></div>';
    wp_nonce_field('wp-cache');
    ?>
	</form>
	</fieldset>
	<?php 
}
開發者ID:jospintedjou,項目名稱:wordpress,代碼行數:60,代碼來源:awaitingmoderation.php

示例3: checkWPSuperCache

 function checkWPSuperCache()
 {
     if (!function_exists('wp_cache_replace_line')) {
         return;
     }
     global $wp_cache_config_file, $wp_cache_mobile_enabled;
     $wp_cache_mobile_enabled = 1;
     wp_cache_replace_line('^ *\\$wp_cache_mobile_enabled', "\$wp_cache_mobile_enabled = 1;", $wp_cache_config_file);
 }
開發者ID:apppressers,項目名稱:apppressers.github.io,代碼行數:9,代碼來源:compatibility.php

示例4: wp_supercache_ktaistyle_admin

 function wp_supercache_ktaistyle_admin()
 {
     global $valid_nonce, $wp_cache_config_file, $cache_ktaistyle, $wp_cache_mobile_browsers, $orig_wp_cache_mobile_browsers;
     if (!isset($cache_ktaistyle)) {
         $cache_ktaistyle = 0;
     }
     $ktaistyle_browsers = 'DoCoMo/, J-PHONE/, J-EMULATOR/, Vodafone/, MOT-, MOTEMULATOR-, SoftBank/, emulator/, DDIPOCKET;, WILLCOM;, KDDI-, UP.Browser/, emobile/, Huawei/, IAC/, Nokia, Opera Mini, Opera Mobi, Palm OS, Windows CE;, PDA; SL-, PlayStation Portable, SONY/COM, Nitro, Nintendo, mixi-mobile-converter/';
     if (function_exists('ks_option') && ks_option('ks_theme_touch')) {
         $ktaistyle_browsers .= ', iPhone;, iPod;, Android';
     }
     if (isset($_POST['cache_ktaistyle']) && $valid_nonce) {
         if (!class_exists('KtaiStyle') && !class_exists('Ktai_Style')) {
             $_POST['cache_ktaistyle'] = __('Disable', 'wp-super-cache');
             $err = __('Ktai Style not found. Please check your install.', 'wp-super-cache');
         }
         $cache_ktaistyle = $_POST['cache_ktaistyle'] == __('Disable', 'wp-super-cache') ? 0 : 1;
         wp_cache_replace_line('^ *\\$cache_ktaistyle', "\$cache_ktaistyle = '{$cache_ktaistyle}';", $wp_cache_config_file);
         if ($cache_ktaistyle) {
             if (!isset($orig_wp_cache_mobile_browsers)) {
                 wp_cache_replace_line('^ *\\$orig_wp_cache_mobile_browsers', "\$orig_wp_cache_mobile_browsers = '{$wp_cache_mobile_browsers}';", $wp_cache_config_file);
             }
             wp_cache_replace_line('^ *\\$wp_cache_mobile_browsers ', "\$wp_cache_mobile_browsers = '{$ktaistyle_browsers}';", $wp_cache_config_file);
         } elseif (isset($orig_wp_cache_mobile_browsers) && $orig_wp_cache_mobile_browsers != $ktaistyle_browsers) {
             wp_cache_replace_line('^ *\\$wp_cache_mobile_browsers ', "\$wp_cache_mobile_browsers = '{$orig_wp_cache_mobile_browsers}';", $wp_cache_config_file);
             wp_cache_replace_line('^ *\\$orig_wp_cache_mobile_browsers', '', $wp_cache_config_file);
         }
     }
     echo '<form name="wp_supercache_ktaistyle_admin" action="' . $_SERVER["REQUEST_URI"] . '" method="post">';
     wp_nonce_field('wp-cache');
     if ($cache_ktaistyle == 0) {
         $ks_status = __('disabled', 'wp-super-cache');
     } else {
         $ks_status = __('enabled', 'wp-super-cache');
         wp_super_cache_disable();
     }
     echo '<strong>' . sprintf(__('Ktai Style support is %s', 'wp-super-cache'), $ks_status);
     echo '.</strong>';
     printf(__('(Changing supporting mobile devices. Requires <a href="http://wppluginsj.sourceforge.jp/ktai_style/">Ktai Style</a>.) ', 'wp-super-cache'));
     if ($cache_ktaistyle == 0) {
         echo '<input type="submit" name="cache_ktaistyle" value="' . __('Enable', 'wp-super-cache') . '" />';
     } else {
         echo '<input type="submit" name="cache_ktaistyle" value="' . __('Disable', 'wp-super-cache') . '" />';
     }
     echo "</form>\n";
     if ($err) {
         echo "<p><strong>" . __('Warning!', 'wp-super-cache') . "</strong> {$err}</p>";
     }
 }
開發者ID:masayukiando,項目名稱:wordpress-event-search,代碼行數:48,代碼來源:supercache-plugin-ktaistyle.php

示例5: wp_supercache_badbehaviour_admin

function wp_supercache_badbehaviour_admin()
{
    global $cache_badbehaviour, $wp_cache_config_file, $valid_nonce;
    $cache_badbehaviour = $cache_badbehaviour == '' ? 'no' : $cache_badbehaviour;
    $err = false;
    if (isset($_POST['cache_badbehaviour']) && $valid_nonce) {
        $bbfile = get_bb_file_loc();
        if (!$bbfile) {
            $_POST['cache_badbehaviour'] = 'Disable';
            $err = __('Bad Behaviour not found. Please check your install.', 'wp-super-cache');
        }
        $cache_badbehaviour = $_POST['cache_badbehaviour'] == __('Disable', 'wp-super-cache') ? 0 : 1;
        wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = 0;", $wp_cache_config_file);
        wp_cache_replace_line('^ *\\$cache_badbehaviour', "\$cache_badbehaviour = {$cache_badbehaviour};", $wp_cache_config_file);
        wp_cache_replace_line('^ *\\$cache_badbehaviour_file', "\$cache_badbehaviour_file = '{$bbfile}';", $wp_cache_config_file);
    }
    echo '<form name="wp_supercache_badbehaviour_admin" action="' . $_SERVER["REQUEST_URI"] . '" method="post">';
    wp_nonce_field('wp-cache');
    if ($cache_badbehaviour == 0) {
        $bb_status = __('disabled', 'wp-super-cache');
    } else {
        $bb_status = __('enabled', 'wp-super-cache');
        wp_super_cache_disable();
    }
    echo '<strong>' . sprintf(__('Bad Behaviour support is %s', 'wp-super-cache'), $bb_status);
    echo '.</strong>';
    printf(__('(Only half-on caching supported, disabled compression and requires <a href="http://www.bad-behavior.ioerror.us/">Bad Behavior</a> in "%s/plugins/bad-behavior/") ', 'wp-super-cache'), WP_CONTENT_DIR);
    if ($cache_badbehaviour == 0) {
        echo '<input type="submit" name="cache_badbehaviour" value="' . __('Enable', 'wp-super-cache') . '" />';
    } else {
        echo '<input type="submit" name="cache_badbehaviour" value="' . __('Disable', 'wp-super-cache') . '" />';
    }
    echo "</form>\n";
    if ($err) {
        echo "<p><strong>" . __('Warning!', 'wp-super-cache') . "</strong> {$err}</p>";
    }
}
開發者ID:jeremylightsmith,項目名稱:blog,代碼行數:37,代碼來源:badbehaviour.php

示例6: wp_supercache_domain_mapping_admin

function wp_supercache_domain_mapping_admin()
{
    global $cache_domain_mapping, $wp_cache_config_file, $valid_nonce;
    $cache_domain_mapping = $cache_domain_mapping == '' ? '0' : $cache_domain_mapping;
    if (isset($_POST['cache_domain_mapping']) && $valid_nonce) {
        $cache_domain_mapping = $_POST['cache_domain_mapping'] == __('Disable', 'wp-super-cache') ? '0' : '1';
        wp_cache_replace_line('^ *\\$cache_domain_mapping', "\$cache_domain_mapping = '{$cache_domain_mapping}';", $wp_cache_config_file);
    }
    echo '<li><form name="wp_supercache_searchengine_admin" action="' . $_SERVER["REQUEST_URI"] . '" method="post">';
    wp_nonce_field('wp-cache');
    if ($cache_domain_mapping == '0') {
        $status = __('disabled', 'wp-super-cache');
    } else {
        $status = __('enabled', 'wp-super-cache');
    }
    echo '<strong>' . sprintf(__('<a href="http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/">Domain Mapping</a> support plugin is %s', 'wp-super-cache'), $status);
    echo '.</strong> ' . __('(support for multiple domains on multisite websites) ', 'wp-super-cache');
    if ($cache_domain_mapping == '0') {
        echo '<input type="submit" name="cache_domain_mapping" value="' . __('Enable', 'wp-super-cache') . '" />';
    } else {
        echo '<input type="submit" name="cache_domain_mapping" value="' . __('Disable', 'wp-super-cache') . '" />';
    }
    echo "</form></li>\n";
}
開發者ID:hacklabr,項目名稱:toquenobrasil,代碼行數:24,代碼來源:domain-mapping.php

示例7: wp_supercache_awaitingmoderation_admin

function wp_supercache_awaitingmoderation_admin()
{
    global $cache_awaitingmoderation, $wp_cache_config_file, $valid_nonce;
    $cache_awaitingmoderation = $cache_awaitingmoderation == '' ? '0' : $cache_awaitingmoderation;
    if (isset($_POST['cache_awaitingmoderation']) && $valid_nonce) {
        $cache_awaitingmoderation = $_POST['cache_awaitingmoderation'] == __('Disable', 'wp-super-cache') ? '0' : '1';
        wp_cache_replace_line('^ *\\$cache_awaitingmoderation', "\$cache_awaitingmoderation = '{$cache_awaitingmoderation}';", $wp_cache_config_file);
    }
    echo '<li><form name="wp_supercache_searchengine_admin" action="' . $_SERVER["REQUEST_URI"] . '" method="post">';
    wp_nonce_field('wp-cache');
    if ($cache_awaitingmoderation == '0') {
        $status = __('disabled', 'wp-super-cache');
    } else {
        $status = __('enabled', 'wp-super-cache');
    }
    echo '<strong>' . sprintf(__('Awaiting Moderation plugin is %s', 'wp-super-cache'), $status);
    echo '.</strong> ' . __('(Remove the text "Your comment is awaiting moderation." when someone leaves a moderated comment.) ', 'wp-super-cache');
    if ($cache_awaitingmoderation == '0') {
        echo '<input type="submit" name="cache_awaitingmoderation" value="' . __('Enable', 'wp-super-cache') . '" />';
    } else {
        echo '<input type="submit" name="cache_awaitingmoderation" value="' . __('Disable', 'wp-super-cache') . '" />';
    }
    echo "</form></li>\n";
}
開發者ID:hacklabr,項目名稱:toquenobrasil,代碼行數:24,代碼來源:awaitingmoderation.php

示例8: wp_supercache_searchengine_admin

function wp_supercache_searchengine_admin()
{
    global $cache_no_adverts_for_friends, $wp_cache_config_file, $valid_nonce;
    $cache_no_adverts_for_friends = $cache_no_adverts_for_friends == '' ? 'no' : $cache_no_adverts_for_friends;
    if (isset($_POST['cache_no_adverts_for_friends']) && $valid_nonce) {
        $cache_no_adverts_for_friends = $_POST['cache_no_adverts_for_friends'] == 'Disable' ? 'no' : 'yes';
        wp_cache_replace_line('^ *\\$cache_no_adverts_for_friends', "\$cache_no_adverts_for_friends = '{$cache_no_adverts_for_friends}';", $wp_cache_config_file);
    }
    echo '<form name="wp_supercache_searchengine_admin" action="' . $_SERVER["REQUEST_URI"] . '" method="post">';
    wp_nonce_field('wp-cache');
    echo '<strong><a href="http://ocaoimh.ie/no-adverts-for-friends/">No Adverts for Friends</a> plugin is ';
    if ($cache_no_adverts_for_friends == 'no') {
        echo 'disabled';
    } else {
        echo 'enabled';
    }
    echo '.</strong> (requires <a href="http://ocaoimh.ie/no-adverts-for-friends/">friendsadverts.php</a> too) ';
    if ($cache_no_adverts_for_friends == 'no') {
        echo '<input type="submit" name="cache_no_adverts_for_friends" value="Enable" />';
    } else {
        echo '<input type="submit" name="cache_no_adverts_for_friends" value="Disable" />';
    }
    echo "</form>\n";
}
開發者ID:enlamp,項目名稱:enlamp.cn,代碼行數:24,代碼來源:searchengine.php

示例9: scossdl_off_options

function scossdl_off_options()
{
    global $ossdlcdn, $wp_cache_config_file;
    $valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache') : false;
    if ($valid_nonce && isset($_POST['action']) && $_POST['action'] == 'update_ossdl_off') {
        update_option('ossdl_off_cdn_url', $_POST['ossdl_off_cdn_url']);
        update_option('ossdl_off_include_dirs', $_POST['ossdl_off_include_dirs'] == '' ? 'wp-content,wp-includes' : $_POST['ossdl_off_include_dirs']);
        update_option('ossdl_off_exclude', $_POST['ossdl_off_exclude']);
        update_option('ossdl_cname', $_POST['ossdl_cname']);
        update_option('ossdl_https', (int) $_POST['ossdl_https']);
        if (isset($_POST['ossdlcdn'])) {
            $ossdlcdn = 1;
        } else {
            $ossdlcdn = 0;
        }
        wp_cache_replace_line('^ *\\$ossdlcdn', "\$ossdlcdn = {$ossdlcdn};", $wp_cache_config_file);
    }
    $example_cdn_uri = str_replace('http://', 'http://cdn.', str_replace('www.', '', get_option('siteurl')));
    $example_cnames = str_replace('http://cdn.', 'http://cdn1.', $example_cdn_uri);
    $example_cnames .= ',' . str_replace('http://cdn.', 'http://cdn2.', $example_cdn_uri);
    $example_cnames .= ',' . str_replace('http://cdn.', 'http://cdn3.', $example_cdn_uri);
    $example_cdn_uri = get_option('ossdl_off_cdn_url') == get_option('siteurl') ? $example_cdn_uri : get_option('ossdl_off_cdn_url');
    $example_cdn_uri .= '/wp-includes/js/prototype.js';
    ?>
		<p><?php 
    _e('Your website probably uses lots of static files. Image, Javascript and CSS files are usually static files that could just as easily be served from another site or CDN. Therefore this plugin replaces any links in the <code>wp-content</code> and <code>wp-includes</code> directories (except for PHP files) on your site with the URL you provide below. That way you can either copy all the static content to a dedicated host or mirror the files to a CDN by <a href="http://knowledgelayer.softlayer.com/questions/365/How+does+Origin+Pull+work%3F" target="_blank">origin pull</a>.', 'wp-super-cache');
    ?>
</p>
		<p><?php 
    printf(__('The <a href="%1$s">CDN Sync Tool</a> plugin will help upload files to Amazon S3/Cloudfront if you would rather not depend on origin pull. See the <a href="%2$s">plugin support forum</a> if you have any queries about this plugin.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/cdn-sync-tool/', 'http://wordpress.org/tags/cdn-sync-tool?forum_id=10');
    ?>
</p>
		<p><?php 
    printf(__('<strong style="color: red">WARNING:</strong> Test some static urls e.g., %s  to ensure your CDN service is fully working before saving changes.', 'wp-super-cache'), '<code>' . $example_cdn_uri . '</code>');
    ?>
</p>
		<p><?php 
    _e('You can define different CDN URLs for each site on a multsite network.', 'wp-super-cache');
    ?>
</p>
		<p><form method="post" action="">
		<?php 
    wp_nonce_field('wp-cache');
    ?>
		<table class="form-table"><tbod>
			<tr valign="top">
				<td style='text-align: right'>
					<input id='ossdlcdn' type="checkbox" name="ossdlcdn" value="1" <?php 
    if ($ossdlcdn) {
        echo "checked=1";
    }
    ?>
 />
				</td>
				<th scope="row"><label for="ossdlcdn"><?php 
    _e('Enable CDN Support', 'wp-super-cache');
    ?>
</label></th>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="ossdl_off_cdn_url"><?php 
    _e('Off-site URL', 'wp-super-cache');
    ?>
</label></th>
				<td>
					<input type="text" name="ossdl_off_cdn_url" value="<?php 
    echo get_option('ossdl_off_cdn_url');
    ?>
" size="64" class="regular-text code" /><br />
					<span class="description"><?php 
    printf(__('The new URL to be used in place of %1$s for rewriting. No trailing <code>/</code> please.<br />Example: <code>%2$s</code>.', 'wp-super-cache'), get_option('siteurl'), $example_cdn_uri);
    ?>
</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="ossdl_off_include_dirs"><?php 
    _e('Include directories', 'wp-super-cache');
    ?>
</label></th>
				<td>
					<input type="text" name="ossdl_off_include_dirs" value="<?php 
    echo esc_attr(get_option('ossdl_off_include_dirs'));
    ?>
" size="64" class="regular-text code" /><br />
					<span class="description"><?php 
    _e('Directories to include in static file matching. Use a comma as the delimiter. Default is <code>wp-content, wp-includes</code>, which will be enforced if this field is left empty.', 'wp-super-cache');
    ?>
</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="ossdl_off_exclude"><?php 
    _e('Exclude if substring', 'wp-super-cache');
    ?>
</label></th>
				<td>
					<input type="text" name="ossdl_off_exclude" value="<?php 
    echo esc_attr(get_option('ossdl_off_exclude'));
    ?>
//.........這裏部分代碼省略.........
開發者ID:besimhu,項目名稱:legacy,代碼行數:101,代碼來源:ossdl-cdn.php

示例10: wp_cache_disable_plugin

function wp_cache_disable_plugin()
{
    global $wp_cache_config_file, $wp_rewrite;
    if (file_exists(ABSPATH . 'wp-config.php')) {
        $global_config_file = ABSPATH . 'wp-config.php';
    } else {
        $global_config_file = dirname(ABSPATH) . '/wp-config.php';
    }
    $line = 'define(\'WP_CACHE\', true);';
    if (strpos(file_get_contents($global_config_file), $line) && (!is_writeable_ACLSafe($global_config_file) || !wp_cache_replace_line('define *\\( *\'WP_CACHE\'', '//' . $line, $global_config_file))) {
        wp_die("Could not remove WP_CACHE define from {$global_config_file}. Please edit that file and remove the line containing the text 'WP_CACHE'. Then refresh this page.");
    }
    uninstall_supercache(WP_CONTENT_DIR . '/cache');
    $file_not_deleted = false;
    if (@file_exists(WP_CONTENT_DIR . "/advanced-cache.php")) {
        if (false == @unlink(WP_CONTENT_DIR . "/advanced-cache.php")) {
            $file_not_deleted[] = 'advanced-cache.php';
        }
    }
    if (@file_exists(WP_CONTENT_DIR . "/wp-cache-config.php")) {
        if (false == unlink(WP_CONTENT_DIR . "/wp-cache-config.php")) {
            $file_not_deleted[] = 'wp-cache-config.php';
        }
    }
    if ($file_not_deleted) {
        $msg = "<p>One or more files could not be deleted. These files and directories must be made writeable:</p>\n <ol><li>" . WP_CONTENT_DIR . "</li>\n";
        $code = "<ul>\n";
        foreach ((array) $file_not_deleted as $filename) {
            $msg .= "<li>" . WP_CONTENT_DIR . "/{$filename}</li>";
            $code .= "<li><code>chmod 666 " . WP_CONTENT_DIR . "/{$filename}</code></li>\n";
        }
        $code .= "</ul>\n";
        $msg .= "</ol>\n<p>First try fixing the directory permissions with this command and refresh this page:<br /><br /><code>chmod 777 " . WP_CONTENT_DIR . "</code><br /><br />If you still see this error, you have to fix the permissions on the files themselves and refresh this page again:</p> {$code}\n<p>Don't forgot to fix things later:<br /><code>chmod 755 " . WP_CONTENT_DIR . "</code></p><p>If you don't know what <strong>chmod</strong> is use <a href='http://www.google.ie/search?hl=en&q=ftp+chmod+777'>this Google search</a> to find out all about it.</p><p>Please refresh this page when the permissions have been modified.</p>";
        wp_die($msg);
    }
    extract(wpsc_get_htaccess_info());
    if ($scrules != '' && insert_with_markers($home_path . '.htaccess', 'WPSuperCache', array())) {
        $wp_rewrite->flush_rules();
    } elseif ($scrules != '') {
        wp_mail(get_option('admin_email'), __('Supercache Uninstall Problems', 'wp-super-cache'), sprintf(__("Dear User,\n\nWP Super Cache was removed from your blog but the mod_rewrite rules\nin your .htaccess were not.\n\nPlease edit the following file and remove the code\nbetween 'BEGIN WPSuperCache' and 'END WPSuperCache'. Please backup the file first!\n\n%s\n\nRegards,\nWP Super Cache Plugin\nhttp://wordpress.org/extend/plugins/wp-super-cache/", 'wp-super-cache'), ABSPATH . '/.htaccess'));
    }
}
開發者ID:popovdenis,項目名稱:kmst,代碼行數:42,代碼來源:wp-cache.php

示例11: wp_cache_check_global_config

function wp_cache_check_global_config()
{
    if (defined('WP_CACHE')) {
        return true;
    }
    if (file_exists(ABSPATH . 'wp-config.php')) {
        $global = ABSPATH . 'wp-config.php';
    } else {
        $global = dirname(ABSPATH) . '/wp-config.php';
    }
    $howtoenable = "Edit <code>{$global}</code> and add the following line: <code>define('WP_CACHE', true);</code>Otherwise, <strong>WP-Cache will not be executed</strong> by Wordpress core. ";
    $lines = file($global);
    foreach ($lines as $line) {
        if (preg_match('/^\\s*define\\s*\\(\\s*\'WP_CACHE\'\\s*,\\s*(?i:TRUE|1)\\s*\\)\\s*;/', $line)) {
            echo $howtoenable;
            return false;
        }
    }
    $line = 'define(\'WP_CACHE\', true);';
    if (!is_writeable_ACLSafe($global) || !wp_cache_replace_line('define *\\( *\'WP_CACHE\'', $line, $global)) {
        echo "<strong>Error: WP_CACHE is not enabled</strong> in your <code>wp-config.php</code> file and I couldn't modify it.";
        echo $howtoenable;
        return false;
    }
    return true;
}
開發者ID:emoksha,項目名稱:freefairelections,代碼行數:26,代碼來源:wp-cache.php

示例12: wp_supercache_badbehaviour_admin

function wp_supercache_badbehaviour_admin()
{
    global $cache_badbehaviour, $wp_cache_config_file, $valid_nonce;
    $cache_badbehaviour = $cache_badbehaviour == '' ? 0 : $cache_badbehaviour;
    if ($cache_badbehaviour == 'no') {
        $cache_badbehaviour = 0;
    }
    $err = false;
    if (isset($_POST['cache_badbehaviour']) && $valid_nonce) {
        $bbfile = get_bb_file_loc();
        if (!$bbfile) {
            $_POST['cache_badbehaviour'] = 0;
            $err = __('Bad Behaviour not found. Please check your install.', 'wp-super-cache');
        }
        if ($cache_badbehaviour == (int) $_POST['cache_badbehaviour']) {
            $changed = false;
        } else {
            $changed = true;
        }
        $cache_badbehaviour = (int) $_POST['cache_badbehaviour'];
        wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = 0;", $wp_cache_config_file);
        wp_cache_replace_line('^ *\\$cache_badbehaviour', "\$cache_badbehaviour = {$cache_badbehaviour};", $wp_cache_config_file);
        wp_cache_replace_line('^ *\\$cache_badbehaviour_file', "\$cache_badbehaviour_file = '{$bbfile}';", $wp_cache_config_file);
        $changed = true;
    }
    $id = 'badbehavior-section';
    ?>
		<fieldset id="<?php 
    echo $id;
    ?>
" class="options">
		<h4><?php 
    _e('Bad Behavior', 'wp-super-cache');
    ?>
</h4>
		<form name="wp_manager" action="" method="post">
		<label><input type="radio" name="cache_badbehaviour" value="1" <?php 
    if ($cache_badbehaviour) {
        echo 'checked="checked" ';
    }
    ?>
/> <?php 
    _e('Enabled', 'wp-super-cache');
    ?>
</label>
		<label><input type="radio" name="cache_badbehaviour" value="0" <?php 
    if (!$cache_badbehaviour) {
        echo 'checked="checked" ';
    }
    ?>
/> <?php 
    _e('Disabled', 'wp-super-cache');
    ?>
</label>
		<p><?php 
    _e('', 'wp-super-cache');
    ?>
</p><?php 
    echo '<p>' . sprintf(__('(Only legacy caching supported, disabled compression and requires <a href="http://www.bad-behavior.ioerror.us/">Bad Behavior</a> in "%s/plugins/bad-behavior/") ', 'wp-super-cache'), WP_CONTENT_DIR) . '</p>';
    if (isset($changed) && $changed) {
        if ($cache_badbehaviour) {
            $status = __("enabled");
        } else {
            $status = __("disabled");
        }
        echo "<p><strong>" . sprintf(__("Bad Behavior support is now %s", 'wp-super-cache'), $status) . "</strong></p>";
    }
    echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __('Update', 'wp-super-cache') . '" /></div>';
    wp_nonce_field('wp-cache');
    ?>
	</form>
	</fieldset>
	<?php 
    if ($err) {
        echo "<p><strong>" . __('Warning!', 'wp-super-cache') . "</strong> {$err}</p>";
    }
}
開發者ID:crazyyy,項目名稱:smartmagel,代碼行數:77,代碼來源:badbehaviour.php

示例13: wp_super_cache_jetpack_admin

function wp_super_cache_jetpack_admin()
{
    global $cache_jetpack, $wp_cache_config_file, $valid_nonce;
    $cache_jetpack = $cache_jetpack == '' ? '0' : $cache_jetpack;
    if (isset($_POST['cache_jetpack']) && $valid_nonce) {
        if ($cache_jetpack == (int) $_POST['cache_jetpack']) {
            $changed = false;
        } else {
            $changed = true;
        }
        $cache_jetpack = (int) $_POST['cache_jetpack'];
        wp_cache_replace_line('^ *\\$cache_jetpack', "\$cache_jetpack = '{$cache_jetpack}';", $wp_cache_config_file);
        if ($changed && $cache_jetpack) {
            wp_cache_replace_line('^ *\\$wp_cache_mobile_enabled', '$wp_cache_mobile_enabled = 1;', $wp_cache_config_file);
            wp_cache_replace_line('^ *\\$wp_cache_mod_rewrite', '$wp_cache_mod_rewrite = 0;', $wp_cache_config_file);
            wp_cache_replace_line('^ *\\$super_cache_enabled', '$super_cache_enabled = 1;', $wp_cache_config_file);
        }
    }
    $id = 'jetpack-section';
    ?>
	<fieldset id="<?php 
    echo $id;
    ?>
" class="options">
	<h4><?php 
    _e('Jetpack Mobile Theme', 'wp-super-cache');
    ?>
</h4>
	<?php 
    if (false == file_exists(dirname(WPCACHEHOME) . '/jetpack/class.jetpack-user-agent.php')) {
        echo "<strong>" . sprintf(__("Jetpack not found in %s. Install it and enable the mobile theme and this helper plugin to cache visits by mobile visitors."), dirname(WPCACHEHOME)) . "</strong>>";
    } else {
        ?>
		<form name="wp_manager" action="" method="post">
		<label><input type="radio" name="cache_jetpack" value="1" <?php 
        if ($cache_jetpack) {
            echo 'checked="checked" ';
        }
        ?>
/> <?php 
        _e('Enabled', 'wp-super-cache');
        ?>
</label>
		<label><input type="radio" name="cache_jetpack" value="0" <?php 
        if (!$cache_jetpack) {
            echo 'checked="checked" ';
        }
        ?>
/> <?php 
        _e('Disabled', 'wp-super-cache');
        ?>
</label>
		<?php 
        echo '<p>' . __('Provides support for the <a href="http://wordpress.org/extend/plugins/jetpack/">Jetpack</a> mobile theme and plugin. PHP caching mode and mobile support will be enabled too.', 'wp-super-cache') . '</p>';
        if (isset($changed) && $changed) {
            if ($cache_jetpack) {
                $status = __("enabled");
            } else {
                $status = __("disabled");
            }
            echo "<p><strong>" . sprintf(__("Jetpack Mobile Theme support is now %s", 'wp-super-cache'), $status) . "</strong></p>";
        }
        echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __('Update', 'wp-super-cache') . '" /></div>';
        wp_nonce_field('wp-cache');
        ?>
		</form>
	<?php 
    }
    ?>
	</fieldset>
	<?php 
}
開發者ID:JuiceCrawl,項目名稱:juicecrawldev,代碼行數:72,代碼來源:jetpack.php

示例14: WPCacheSaveRejectedUri

 static function WPCacheSaveRejectedUri()
 {
     global $cache_rejected_uri, $wp_cache_config_file;
     if (!isset($cache_rejected_uri) || empty($wp_cache_config_file) || !function_exists('wp_cache_replace_line')) {
         return false;
     }
     $text = var_export($cache_rejected_uri, true);
     $text = preg_replace('/[\\s]+/', ' ', $text);
     wp_cache_replace_line('^ *\\$cache_rejected_uri', "\$cache_rejected_uri = {$text};", $wp_cache_config_file);
     return true;
 }
開發者ID:parsonsc,項目名稱:dofe,代碼行數:11,代碼來源:Admin.php

示例15: wp_supercache_domain_mapping_admin

function wp_supercache_domain_mapping_admin()
{
    global $cache_domain_mapping, $wp_cache_config_file, $valid_nonce;
    $cache_domain_mapping = $cache_domain_mapping == '' ? '0' : $cache_domain_mapping;
    if (isset($_POST['cache_domain_mapping']) && $valid_nonce) {
        if ($cache_domain_mapping == (int) $_POST['cache_domain_mapping']) {
            $changed = false;
        } else {
            $changed = true;
        }
        $cache_domain_mapping = (int) $_POST['cache_domain_mapping'];
        wp_cache_replace_line('^ *\\$cache_domain_mapping', "\$cache_domain_mapping = '{$cache_domain_mapping}';", $wp_cache_config_file);
    }
    $id = 'domain_mapping-section';
    ?>
		<fieldset id="<?php 
    echo $id;
    ?>
" class="options">
		<h4><?php 
    _e('Domain Mapping', 'wp-super-cache');
    ?>
</h4>
		<form name="wp_manager" action="" method="post">
		<label><input type="radio" name="cache_domain_mapping" value="1" <?php 
    if ($cache_domain_mapping) {
        echo 'checked="checked" ';
    }
    ?>
/> <?php 
    _e('Enabled', 'wp-super-cache');
    ?>
</label>
		<label><input type="radio" name="cache_domain_mapping" value="0" <?php 
    if (!$cache_domain_mapping) {
        echo 'checked="checked" ';
    }
    ?>
/> <?php 
    _e('Disabled', 'wp-super-cache');
    ?>
</label>
		<p><?php 
    _e('', 'wp-super-cache');
    ?>
</p><?php 
    echo '<p>' . __('Provides support for <a href="http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/">Domain Mapping</a> plugin to map multiple domains to a blog.', 'wp-super-cache') . '</p>';
    if (isset($changed) && $changed) {
        if ($cache_domain_mapping) {
            $status = __("enabled");
        } else {
            $status = __("disabled");
        }
        echo "<p><strong>" . sprintf(__("Domain Mapping support is now %s", 'wp-super-cache'), $status) . "</strong></p>";
    }
    echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __('Update', 'wp-super-cache') . '" /></div>';
    wp_nonce_field('wp-cache');
    ?>
	</form>
	</fieldset>
	<?php 
}
開發者ID:jenheilemann,項目名稱:wp-super-cache,代碼行數:62,代碼來源:domain-mapping.php


注:本文中的wp_cache_replace_line函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。