Exemplo n.º 1
0
/**
 * Create advanced-cache.php file
 *
 * @since 2.0
 *
 * @return void
 */
function rocket_generate_advanced_cache_file()
{
    $buffer = get_rocket_advanced_cache_file();
    rocket_put_content(WP_CONTENT_DIR . '/advanced-cache.php', $buffer);
}
Exemplo n.º 2
0
function rocket_warning_advanced_cache_permissions()
{
    $advanced_cache_file = WP_CONTENT_DIR . '/advanced-cache.php';
    /** This filter is documented in inc/admin-bar.php */
    if (current_user_can(apply_filters('rocket_capacity', 'manage_options')) && !is_writable($advanced_cache_file) && (!defined('WP_ROCKET_ADVANCED_CACHE') || !WP_ROCKET_ADVANCED_CACHE) && rocket_valid_key()) {
        $boxes = get_user_meta($GLOBALS['current_user']->ID, 'rocket_boxes', true);
        if (!in_array(__FUNCTION__, (array) $boxes)) {
            ?>

			<div class="error">
				<a href="<?php 
            echo wp_nonce_url(admin_url('admin-post.php?action=rocket_ignore&box=' . __FUNCTION__), 'rocket_ignore_' . __FUNCTION__);
            ?>
" class="rkt-cross"><div class="dashicons dashicons-no"></div></a>
				<p><b><?php 
            echo WP_ROCKET_PLUGIN_NAME;
            ?>
</b>: <?php 
            printf(__('If you had <a href="%1$s" target="_blank">writing permissions</a> on <code>%2$s</code> file, <b>%3$s</b> could do this automatically. This is not the case, here is the code you should add in your <code>%2$s</code> file for <b>%3$s</b> to work properly.', 'rocket'), 'http://codex.wordpress.org/Changing_File_Permissions', basename(WP_CONTENT_DIR) . '/advanced-cache.php', WP_ROCKET_PLUGIN_NAME);
            ?>
</p>

				<?php 
            // Get the content of advanced-cache.php file added by WP Rocket
            $content = get_rocket_advanced_cache_file();
            ?>

				<p><textarea readonly="readonly" id="rules" name="rules" class="large-text readonly" rows="8"><?php 
            echo esc_textarea($content);
            ?>
</textarea></p>
			</div>

		<?php 
        }
    }
}