Compare commits
35 commits
haroldkyle
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
b894610cb1 | ||
|
eac45ed95e | ||
|
705afd1535 | ||
|
b19e446e0f | ||
|
24430be27a | ||
|
4b5bce6cc4 | ||
|
87b2f986a1 | ||
|
dade9fe586 | ||
|
03f393950f | ||
|
c48d971ddf | ||
|
ee76a2a9d8 | ||
|
d09fa5828b | ||
|
8ab0a0d99a | ||
|
32bd2f7b0e | ||
|
9de0ad8f30 | ||
|
18ad72f799 | ||
|
62f3d0ab00 | ||
|
06bee4b178 | ||
|
c09ebac154 | ||
|
9f029e2414 | ||
|
c84498d069 | ||
|
fedcdfc278 | ||
|
457ad184c4 | ||
|
7b16741af8 | ||
|
f0c71ec396 | ||
|
d715c6fbaf | ||
|
f64c17a8f9 | ||
|
0da7a83f0e | ||
|
2df573d955 | ||
|
098f05985c | ||
|
65325033fa | ||
|
42bc1771fa | ||
|
6f19008509 | ||
|
525fc33839 | ||
|
a4c870cc0c |
20 changed files with 4098 additions and 1528 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
vendor
|
||||
composer.lock
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +0,0 @@
|
|||
[submodule "wp-common"]
|
||||
path = wp-common
|
||||
url = https://github.com/petermolnar/wp-common.git
|
92
backends/apc.php
Normal file
92
backends/apc.php
Normal file
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
if (!class_exists('WP_FFPC_Backend_apc')):
|
||||
|
||||
class WP_FFPC_Backend_apc extends WP_FFPC_Backend {
|
||||
|
||||
/**
|
||||
* init apc backend: test APC availability and set alive status
|
||||
*/
|
||||
protected function _init () {
|
||||
/* verify apc functions exist, apc extension is loaded */
|
||||
if ( ! function_exists( 'apc_cache_info' ) ) {
|
||||
$this->log ( 'APC extension missing' );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* verify apc is working */
|
||||
if ( apc_cache_info("user",true) ) {
|
||||
$this->log ( 'backend OK' );
|
||||
$this->alive = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* health checker for APC
|
||||
*
|
||||
* @return boolean Aliveness status
|
||||
*
|
||||
*/
|
||||
protected function _status () {
|
||||
$this->status = true;
|
||||
return $this->alive;
|
||||
}
|
||||
|
||||
/**
|
||||
* get function for APC backend
|
||||
*
|
||||
* @param string $key Key to get values for
|
||||
*
|
||||
* @return mixed Fetched data based on key
|
||||
*
|
||||
*/
|
||||
protected function _get ( &$key ) {
|
||||
return apc_fetch( $key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set function for APC backend
|
||||
*
|
||||
* @param string $key Key to set with
|
||||
* @param mixed $data Data to set
|
||||
*
|
||||
* @return boolean APC store outcome
|
||||
*/
|
||||
protected function _set ( &$key, &$data, &$expire ) {
|
||||
return apc_store( $key , $data , $expire );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flushes APC user entry storage
|
||||
*
|
||||
* @return boolean APC flush outcome status
|
||||
*
|
||||
*/
|
||||
protected function _flush ( ) {
|
||||
return apc_clear_cache('user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes entry from APC or flushes APC user entry storage
|
||||
*
|
||||
* @param mixed $keys Keys to clear, string or array
|
||||
*/
|
||||
protected function _clear ( &$keys ) {
|
||||
/* make an array if only one string is present, easier processing */
|
||||
if ( !is_array ( $keys ) )
|
||||
$keys = array ( $keys => true );
|
||||
|
||||
foreach ( $keys as $key => $dummy ) {
|
||||
if ( ! apc_delete ( $key ) ) {
|
||||
$this->log ( sprintf( 'Failed to delete APC entry: %s', $key ), LOG_WARNING );
|
||||
//throw new Exception ( __translate__('Deleting APC entry failed with key ', $this->plugin_constant ) . $key );
|
||||
}
|
||||
else {
|
||||
$this->log ( sprintf( 'APC entry delete: %s', $key ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
92
backends/apcu.php
Normal file
92
backends/apcu.php
Normal file
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
if (!class_exists('WP_FFPC_Backend_apcu')):
|
||||
|
||||
class WP_FFPC_Backend_apcu extends WP_FFPC_Backend {
|
||||
|
||||
/**
|
||||
* init apcu backend: test APCu availability and set alive status
|
||||
*/
|
||||
protected function _init () {
|
||||
/* verify apcu functions exist, apcu extension is loaded */
|
||||
if ( ! function_exists( 'apcu_cache_info' ) ) {
|
||||
$this->log ( 'APCu extension missing' );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* verify apcu is working */
|
||||
if ( @apcu_cache_info("user") != false ) {
|
||||
$this->log ( 'backend OK' );
|
||||
$this->alive = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* health checker for APC
|
||||
*
|
||||
* @return boolean Aliveness status
|
||||
*
|
||||
*/
|
||||
protected function _status () {
|
||||
$this->status = true;
|
||||
return $this->alive;
|
||||
}
|
||||
|
||||
/**
|
||||
* get function for APC backend
|
||||
*
|
||||
* @param string $key Key to get values for
|
||||
*
|
||||
* @return mixed Fetched data based on key
|
||||
*
|
||||
*/
|
||||
protected function _get ( &$key ) {
|
||||
return apcu_fetch( $key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set function for APC backend
|
||||
*
|
||||
* @param string $key Key to set with
|
||||
* @param mixed $data Data to set
|
||||
*
|
||||
* @return boolean APC store outcome
|
||||
*/
|
||||
protected function _set ( &$key, &$data, &$expire ) {
|
||||
return apcu_store( $key , $data , $expire );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flushes APC user entry storage
|
||||
*
|
||||
* @return boolean APC flush outcome status
|
||||
*
|
||||
*/
|
||||
protected function _flush ( ) {
|
||||
return apcu_clear_cache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes entry from APC or flushes APC user entry storage
|
||||
*
|
||||
* @param mixed $keys Keys to clear, string or array
|
||||
*/
|
||||
protected function _clear ( &$keys ) {
|
||||
/* make an array if only one string is present, easier processing */
|
||||
if ( !is_array ( $keys ) )
|
||||
$keys = array ( $keys => true );
|
||||
|
||||
foreach ( $keys as $key => $dummy ) {
|
||||
if ( ! apcu_delete ( $key ) ) {
|
||||
$this->log ( sprintf( 'Failed to delete APC entry: %s', $key ), LOG_WARNING );
|
||||
//throw new Exception ( __translate__('Deleting APC entry failed with key ', 'wp-ffpc' ) . $key );
|
||||
}
|
||||
else {
|
||||
$this->log ( sprintf( 'APC entry delete: %s', $key ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
122
backends/memcache.php
Normal file
122
backends/memcache.php
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
|
||||
if (!class_exists('WP_FFPC_Backend_memcache')):
|
||||
|
||||
class WP_FFPC_Backend_memcache extends WP_FFPC_Backend {
|
||||
/**
|
||||
* init memcache backend
|
||||
*/
|
||||
protected function _init () {
|
||||
/* Memcached class does not exist, Memcache extension is not available */
|
||||
if (!class_exists('Memcache')) {
|
||||
$this->log ( 'PHP Memcache extension missing', LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check for existing server list, otherwise we cannot add backends */
|
||||
if ( empty ( $this->options['servers'] ) && ! $this->alive ) {
|
||||
$this->log ( "servers list is empty, init failed", LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check is there's no backend connection yet */
|
||||
if ( $this->connection === NULL )
|
||||
$this->connection = new Memcache();
|
||||
|
||||
/* check if initialization was success or not */
|
||||
if ( $this->connection === NULL ) {
|
||||
$this->log ( 'error initializing Memcache PHP extension, exiting' );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* adding servers */
|
||||
foreach ( $this->options['servers'] as $server_id => $server ) {
|
||||
/* in case of unix socket */
|
||||
if ( $server['port'] === 0 )
|
||||
$this->status[$server_id] = $this->connection->connect ( 'unix:/' . $server['host'] );
|
||||
else
|
||||
$this->status[$server_id] = $this->connection->connect ( $server['host'] , $server['port'] );
|
||||
|
||||
$this->log ( sprintf( '%s added', $server_id ) );
|
||||
}
|
||||
|
||||
/* backend is now alive */
|
||||
$this->alive = true;
|
||||
$this->_status();
|
||||
}
|
||||
|
||||
/**
|
||||
* check current backend alive status for Memcached
|
||||
*
|
||||
*/
|
||||
protected function _status () {
|
||||
/* server status will be calculated by getting server stats */
|
||||
$this->log ( "checking server statuses" );
|
||||
/* get servers statistic from connection */
|
||||
foreach ( $this->options['servers'] as $server_id => $server ) {
|
||||
if ( $server['port'] === 0 )
|
||||
$this->status[$server_id] = $this->connection->getServerStatus( $server['host'], 11211 );
|
||||
else
|
||||
$this->status[$server_id] = $this->connection->getServerStatus( $server['host'], $server['port'] );
|
||||
if ( $this->status[$server_id] == 0 )
|
||||
$this->log ( sprintf( '%s server is down', $server_id ) );
|
||||
else
|
||||
$this->log ( sprintf( '%s server is up & running', $server_id ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get function for Memcached backend
|
||||
*
|
||||
* @param string $key Key to get values for
|
||||
*
|
||||
*/
|
||||
protected function _get ( &$key ) {
|
||||
return $this->connection->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set function for Memcached backend
|
||||
*
|
||||
* @param string $key Key to set with
|
||||
* @param mixed $data Data to set
|
||||
*
|
||||
*/
|
||||
protected function _set ( &$key, &$data, &$expire ) {
|
||||
$result = $this->connection->set ( $key, $data , 0 , $expire );
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Flush memcached entries
|
||||
*/
|
||||
protected function _flush ( ) {
|
||||
return $this->connection->flush();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes entry from Memcached or flushes Memcached storage
|
||||
*
|
||||
* @param mixed $keys String / array of string of keys to delete entries with
|
||||
*/
|
||||
protected function _clear ( &$keys ) {
|
||||
/* make an array if only one string is present, easier processing */
|
||||
if ( !is_array ( $keys ) )
|
||||
$keys = array ( $keys => true );
|
||||
|
||||
foreach ( $keys as $key => $dummy ) {
|
||||
$kresult = $this->connection->delete( $key );
|
||||
|
||||
if ( $kresult === false ) {
|
||||
$this->log ( sprintf( 'unable to delete entry: %s', $key ) );
|
||||
}
|
||||
else {
|
||||
$this->log ( sprintf( 'entry deleted: %s', $key ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
159
backends/memcached.php
Normal file
159
backends/memcached.php
Normal file
|
@ -0,0 +1,159 @@
|
|||
<?php
|
||||
|
||||
if (!class_exists('WP_FFPC_Backend_memcached')):
|
||||
|
||||
class WP_FFPC_Backend_memcached extends WP_FFPC_Backend {
|
||||
|
||||
protected function _init () {
|
||||
/* Memcached class does not exist, Memcached extension is not available */
|
||||
if (!class_exists('Memcached')) {
|
||||
$this->log ( ' Memcached extension missing, wp-ffpc will not be able to function correctly!', LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check for existing server list, otherwise we cannot add backends */
|
||||
if ( empty ( $this->options['servers'] ) && ! $this->alive ) {
|
||||
$this->log ( "Memcached servers list is empty, init failed", LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check is there's no backend connection yet */
|
||||
if ( $this->connection === NULL ) {
|
||||
$this->connection = new Memcached();
|
||||
|
||||
/* use binary and not compressed format, good for nginx and still fast */
|
||||
$this->connection->setOption( Memcached::OPT_COMPRESSION , false );
|
||||
if ($this->options['memcached_binary']){
|
||||
$this->connection->setOption( Memcached::OPT_BINARY_PROTOCOL , true );
|
||||
}
|
||||
|
||||
if ( version_compare( phpversion( 'memcached' ) , '2.0.0', '>=' ) && ini_get( 'memcached.use_sasl' ) == 1 && isset($this->options['authpass']) && !empty($this->options['authpass']) && isset($this->options['authuser']) && !empty($this->options['authuser']) ) {
|
||||
$this->connection->setSaslAuthData ( $this->options['authuser'], $this->options['authpass']);
|
||||
}
|
||||
}
|
||||
|
||||
/* check if initialization was success or not */
|
||||
if ( $this->connection === NULL ) {
|
||||
$this->log ( 'error initializing Memcached PHP extension, exiting' );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check if we already have list of servers, only add server(s) if it's not already connected */
|
||||
$servers_alive = array();
|
||||
if ( !empty ( $this->status ) ) {
|
||||
$servers_alive = $this->connection->getServerList();
|
||||
/* create check array if backend servers are already connected */
|
||||
if ( !empty ( $servers ) ) {
|
||||
foreach ( $servers_alive as $skey => $server ) {
|
||||
$skey = $server['host'] . ":" . $server['port'];
|
||||
$servers_alive[ $skey ] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* adding servers */
|
||||
foreach ( $this->options['servers'] as $server_id => $server ) {
|
||||
/* reset server status to unknown */
|
||||
//$this->status[$server_id] = -1;
|
||||
|
||||
/* only add servers that does not exists already in connection pool */
|
||||
if ( !@array_key_exists($server_id , $servers_alive ) ) {
|
||||
$this->connection->addServer( $server['host'], $server['port'] );
|
||||
$this->log ( sprintf( '%s added', $server_id ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* backend is now alive */
|
||||
$this->alive = true;
|
||||
$this->_status();
|
||||
}
|
||||
|
||||
/**
|
||||
* sets current backend alive status for Memcached servers
|
||||
*
|
||||
*/
|
||||
protected function _status () {
|
||||
/* server status will be calculated by getting server stats */
|
||||
$this->log ( "checking server statuses");
|
||||
/* get server list from connection */
|
||||
$servers = $this->connection->getServerList();
|
||||
|
||||
foreach ( $servers as $server ) {
|
||||
$server_id = $server['host'] . self::port_separator . $server['port'];
|
||||
/* reset server status to offline */
|
||||
$this->status[$server_id] = 0;
|
||||
if ($this->connection->set('wp-ffpc', time())) {
|
||||
$this->log ( sprintf( '%s server is up & running', $server_id ) );
|
||||
$this->status[$server_id] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* get function for Memcached backend
|
||||
*
|
||||
* @param string $key Key to get values for
|
||||
*
|
||||
*/
|
||||
protected function _get ( &$key ) {
|
||||
return $this->connection->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set function for Memcached backend
|
||||
*
|
||||
* @param string $key Key to set with
|
||||
* @param mixed $data Data to set
|
||||
*
|
||||
*/
|
||||
protected function _set ( &$key, &$data, &$expire ) {
|
||||
$result = $this->connection->set ( $key, $data , $expire );
|
||||
|
||||
/* if storing failed, log the error code */
|
||||
if ( $result === false ) {
|
||||
$code = $this->connection->getResultCode();
|
||||
$this->log ( sprintf( 'unable to set entry: %s', $key ) );
|
||||
$this->log ( sprintf( 'Memcached error code: %s', $code ) );
|
||||
//throw new Exception ( 'Unable to store Memcached entry ' . $key . ', error code: ' . $code );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Flush memcached entries
|
||||
*/
|
||||
protected function _flush ( ) {
|
||||
return $this->connection->flush();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes entry from Memcached or flushes Memcached storage
|
||||
*
|
||||
* @param mixed $keys String / array of string of keys to delete entries with
|
||||
*/
|
||||
protected function _clear ( &$keys ) {
|
||||
|
||||
/* make an array if only one string is present, easier processing */
|
||||
if ( !is_array ( $keys ) )
|
||||
$keys = array ( $keys => true );
|
||||
|
||||
foreach ( $keys as $key => $dummy ) {
|
||||
$kresult = $this->connection->delete( $key );
|
||||
|
||||
if ( $kresult === false ) {
|
||||
$code = $this->connection->getResultCode();
|
||||
$this->log ( sprintf( 'unable to delete entry: %s', $key ) );
|
||||
$this->log ( sprintf( 'Memcached error code: %s', $code ) );
|
||||
}
|
||||
else {
|
||||
$this->log ( sprintf( 'entry deleted: %s', $key ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
11
composer.json
Normal file
11
composer.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "petermolnar/wp-ffpc",
|
||||
"type": "wordpress-plugin",
|
||||
"homepage": "https://github.com/petermolnar/wp-ffpc",
|
||||
"license": "GPLv3",
|
||||
"description": "WordPress Plugin WP-FFPC",
|
||||
"keywords": ["plugin", "cache", "page cache", "full page cache", "nginx", "memcached", "apc", "speed"],
|
||||
"require": {
|
||||
"composer/installers": "~1.0.0"
|
||||
}
|
||||
}
|
BIN
languages/wp-ffpc-it_IT.mo
Normal file
BIN
languages/wp-ffpc-it_IT.mo
Normal file
Binary file not shown.
759
languages/wp-ffpc-it_IT.po
Normal file
759
languages/wp-ffpc-it_IT.po
Normal file
|
@ -0,0 +1,759 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WP-FFPC\n"
|
||||
"POT-Creation-Date: 2016-04-21 17:14+0200\n"
|
||||
"PO-Revision-Date: 2016-04-21 17:14+0200\n"
|
||||
"Last-Translator: Gabriele Lauricella <gab.lau@gmail.com>\n"
|
||||
"Language-Team: Gabriele Lauricella <gab.lau@gmail.com>\n"
|
||||
"Language: it_IT\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Poedit 1.8.4\n"
|
||||
"X-Poedit-Basepath: ..\n"
|
||||
"X-Poedit-WPHeader: wp-ffpc.php\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
||||
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
||||
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
||||
"X-Poedit-SearchPath-0: .\n"
|
||||
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
||||
|
||||
#: wp-ffpc-abstract.php:381
|
||||
msgid "Default : "
|
||||
msgstr "Predefinito :"
|
||||
|
||||
#: wp-ffpc-abstract.php:464
|
||||
msgid ""
|
||||
"This plugin helped your business? I'd appreciate a coffee in return :) "
|
||||
"Please!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-abstract.php:479
|
||||
msgid "Donation for "
|
||||
msgstr "Donazione per"
|
||||
|
||||
#: wp-ffpc-abstract.php:481
|
||||
msgid "Donate via PayPal"
|
||||
msgstr "Dona con PayPal"
|
||||
|
||||
#: wp-ffpc-abstract.php:501
|
||||
#, fuzzy, php-format
|
||||
msgid " – updating network option %s"
|
||||
msgstr "Aggiornamento tema: %s"
|
||||
|
||||
#: wp-ffpc-abstract.php:505
|
||||
#, fuzzy, php-format
|
||||
msgid "- updating option %s"
|
||||
msgstr "Aggiornamento in corso"
|
||||
|
||||
#: wp-ffpc-abstract.php:516
|
||||
#, fuzzy, php-format
|
||||
msgid "- getting network option %s"
|
||||
msgstr "Errore nell'ottenere la struttura della tabella %s"
|
||||
|
||||
#: wp-ffpc-abstract.php:520
|
||||
#, fuzzy, php-format
|
||||
msgid " – getting option %s"
|
||||
msgstr "Errore nell'ottenere la struttura della tabella %s"
|
||||
|
||||
#: wp-ffpc-abstract.php:533
|
||||
#, fuzzy, php-format
|
||||
msgid " – deleting network option %s"
|
||||
msgstr "Amministratore del network: %s"
|
||||
|
||||
#: wp-ffpc-abstract.php:537
|
||||
#, fuzzy, php-format
|
||||
msgid " – deleting option %s"
|
||||
msgstr "eliminazione del file allegato..."
|
||||
|
||||
#: wp-ffpc-abstract.php:614
|
||||
#, php-format
|
||||
msgid "%s"
|
||||
msgstr "%s"
|
||||
|
||||
#: wp-ffpc-class.php:126
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Domain mismatch: the site domain configuration (%s) does not match the "
|
||||
"HTTP_HOST (%s) variable in PHP. Please fix the incorrect one, otherwise the "
|
||||
"plugin may not work as expected."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:134
|
||||
msgid "APC"
|
||||
msgstr "APC"
|
||||
|
||||
#: wp-ffpc-class.php:135
|
||||
msgid "APCu"
|
||||
msgstr "APCu"
|
||||
|
||||
#: wp-ffpc-class.php:136
|
||||
msgid "PHP Memcache"
|
||||
msgstr "PHP Memcache"
|
||||
|
||||
#: wp-ffpc-class.php:137
|
||||
msgid "PHP Memcached"
|
||||
msgstr "PHP Memcached"
|
||||
|
||||
#: wp-ffpc-class.php:138
|
||||
msgid "Redis (experimental, it will break!)"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:152
|
||||
#, fuzzy
|
||||
msgid "flush cache"
|
||||
msgstr ""
|
||||
"Importante: Non dimenticare di svuotare la cache usando WP Super Cache "
|
||||
"quando attivi o disattivi la modalità di manutenzione."
|
||||
|
||||
#: wp-ffpc-class.php:153
|
||||
#, fuzzy
|
||||
msgid "only modified post"
|
||||
msgstr "Può essere modificato solo dall'admin o se vuoto"
|
||||
|
||||
#: wp-ffpc-class.php:154
|
||||
msgid "modified post and all related taxonomies"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:159
|
||||
msgid "The HTTP scheme (i.e. http, https)."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:160
|
||||
msgid ""
|
||||
"Host in the header of request or name of the server processing the request "
|
||||
"if the Host header is not available."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:161
|
||||
msgid ""
|
||||
"The *original* request URI as received from the client including the args"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:162
|
||||
msgid "Name of user, authenticated by the Auth Basic Module"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:163
|
||||
msgid "PHP Session Cookie ID, if set ( empty if not )"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:164
|
||||
msgid "First HTTP Accept Lang set in the HTTP request"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:174
|
||||
msgid "do not use timed precache"
|
||||
msgstr "non utilizzare il precache temporizzato"
|
||||
|
||||
#: wp-ffpc-class.php:221
|
||||
msgid "WP-FFPC Settings"
|
||||
msgstr "WP-FFPC Impostazioni"
|
||||
|
||||
#: wp-ffpc-class.php:226
|
||||
msgid ""
|
||||
"WP_CACHE is disabled. Without that, cache plugins, like this, will not work. "
|
||||
"Please add `define ( 'WP_CACHE', true );` to the beginning of wp-config.php."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:230
|
||||
#, php-format
|
||||
msgid ""
|
||||
"This site was reached as %s ( according to PHP HTTP_HOST ) and there are no "
|
||||
"settings present for this domain in the WP-FFPC configuration yet. Please "
|
||||
"save the %s for the domain or fix the webserver configuration!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:234
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Advanced cache file (%s) is not writeable!<br />Please change the "
|
||||
"permissions on the file."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:238
|
||||
#, php-format
|
||||
msgid "Advanced cache file is yet to be generated, please save %s"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:243
|
||||
#, php-format
|
||||
msgid ""
|
||||
"%s cache backend activated but no PHP %s extension was found.<br />Please "
|
||||
"either use different backend or activate the module!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:254
|
||||
msgid ""
|
||||
"WARNING: Memcache extension is configured to use binary mode. This is very "
|
||||
"buggy and the plugin will most probably not work correctly. <br />Please "
|
||||
"consider to change either to ASCII mode or to Memcached extension."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:307
|
||||
msgid ""
|
||||
"WP-FFPC settings were upgraded; please double check if everything is still "
|
||||
"working correctly."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:362
|
||||
msgid ""
|
||||
"<p>Please visit <a href=\"http://wordpress.org/support/plugin/wp-ffpc\">the "
|
||||
"official support forum of the plugin</a> for help.</p>"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:386
|
||||
msgid "<h3>Sample config for nginx to utilize the data entries</h3>"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:387
|
||||
msgid ""
|
||||
"<div class=\"update-nag\">This is not meant to be a copy-paste "
|
||||
"configuration; you most probably have to tailor it to your needs.</div>"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:388
|
||||
msgid ""
|
||||
"<div class=\"update-nag\"><strong>In case you are about to use nginx to "
|
||||
"fetch memcached entries directly and to use SHA1 hash keys, you will need an "
|
||||
"nginx version compiled with <a href=\"http://wiki.nginx.org/HttpSetMiscModule"
|
||||
"\">HttpSetMiscModule</a>. Otherwise set_sha1 function is not available in "
|
||||
"nginx.</strong></div>"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:393
|
||||
msgid "nginx example"
|
||||
msgstr "esempio nginx"
|
||||
|
||||
#: wp-ffpc-class.php:443
|
||||
msgid "Settings saved."
|
||||
msgstr "Impostazioni salvate."
|
||||
|
||||
#: wp-ffpc-class.php:450
|
||||
#, fuzzy
|
||||
msgid "Plugin options deleted."
|
||||
msgstr "OPZIONI CANCELLATE!"
|
||||
|
||||
#: wp-ffpc-class.php:457
|
||||
msgid "Cache flushed."
|
||||
msgstr "Cache svuotata."
|
||||
|
||||
#: wp-ffpc-class.php:464
|
||||
msgid ""
|
||||
"Precache process was started, it is now running in the background, please be "
|
||||
"patient, it may take a very long time to finish."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:472
|
||||
msgid " settings"
|
||||
msgstr " impostazioni"
|
||||
|
||||
#: wp-ffpc-class.php:475
|
||||
msgid "Driver: "
|
||||
msgstr "Driver: "
|
||||
|
||||
#: wp-ffpc-class.php:480
|
||||
msgid "<strong>Backend status:</strong><br />"
|
||||
msgstr "<strong>Stato Backend:</strong><br />"
|
||||
|
||||
#: wp-ffpc-class.php:490
|
||||
msgid "<span class=\"error-msg\">down</span><br />"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:492
|
||||
msgid "<span class=\"ok-msg\">up & running</span><br />"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:494
|
||||
msgid ""
|
||||
"<span class=\"error-msg\">unknown, please try re-saving settings!</span><br /"
|
||||
">"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:513
|
||||
#, fuzzy
|
||||
msgid "Set cache type"
|
||||
msgstr "Tipo di cache:"
|
||||
|
||||
#: wp-ffpc-class.php:516
|
||||
msgid "Select backend"
|
||||
msgstr "Selezionare un backend:"
|
||||
|
||||
#: wp-ffpc-class.php:522
|
||||
msgid "Select backend storage driver"
|
||||
msgstr "Selezionare il driver di backend"
|
||||
|
||||
#: wp-ffpc-class.php:526
|
||||
msgid "Expiration time for posts"
|
||||
msgstr "Tempo di scadenza per Articoli e Pagine"
|
||||
|
||||
#: wp-ffpc-class.php:530
|
||||
msgid ""
|
||||
"Sets validity time of post entry in seconds, including custom post types and "
|
||||
"pages."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:534
|
||||
#, fuzzy
|
||||
msgid "Browser cache expiration time of posts"
|
||||
msgstr "Tempo di scadenza cache (secondi)"
|
||||
|
||||
#: wp-ffpc-class.php:538
|
||||
msgid "Sets validity time of posts/pages/singles for the browser cache."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:542
|
||||
#, fuzzy
|
||||
msgid "Expiration time for taxonomy"
|
||||
msgstr "Tempo di scadenza cache (secondi)"
|
||||
|
||||
#: wp-ffpc-class.php:546
|
||||
msgid ""
|
||||
"Sets validity time of taxonomy entry in seconds, including custom taxonomy."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:550
|
||||
#, fuzzy
|
||||
msgid "Browser cache expiration time of taxonomy"
|
||||
msgstr "Tempo di scadenza cache (secondi)"
|
||||
|
||||
#: wp-ffpc-class.php:554
|
||||
msgid "Sets validity time of taxonomy for the browser cache."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:558
|
||||
msgid "Expiration time for home"
|
||||
msgstr "Tempo di scadenza per Homepage"
|
||||
|
||||
#: wp-ffpc-class.php:562
|
||||
msgid "Sets validity time of home on server side."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:566
|
||||
#, fuzzy
|
||||
msgid "Browser cache expiration time of home"
|
||||
msgstr "Tempo di scadenza cache (secondi)"
|
||||
|
||||
#: wp-ffpc-class.php:570
|
||||
msgid "Sets validity time of home for the browser cache."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:574
|
||||
msgid "Charset"
|
||||
msgstr "Codifica di caratteri"
|
||||
|
||||
#: wp-ffpc-class.php:578
|
||||
msgid "Charset of HTML and XML (pages and feeds) data."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:582
|
||||
#, fuzzy
|
||||
msgid "Cache invalidation method"
|
||||
msgstr "Metodo di spedizione:"
|
||||
|
||||
#: wp-ffpc-class.php:588
|
||||
msgid "Select cache invalidation method."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:604
|
||||
#, fuzzy
|
||||
msgid "Invalidate on comment actions"
|
||||
msgstr "Azioni Multiple"
|
||||
|
||||
#: wp-ffpc-class.php:608
|
||||
msgid "Trigger cache invalidation when a comments is posted, edited, trashed. "
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:612
|
||||
msgid "Data prefix"
|
||||
msgstr "Prefisso dati"
|
||||
|
||||
#: wp-ffpc-class.php:616
|
||||
msgid ""
|
||||
"Prefix for HTML content keys, can be used in nginx.<br /><strong>WARNING</"
|
||||
"strong>: changing this will result the previous cache to becomes invalid!"
|
||||
"<br />If you are caching with nginx, you should update your nginx "
|
||||
"configuration and reload nginx after changing this value."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:620
|
||||
msgid "Meta prefix"
|
||||
msgstr "Prefisso meta"
|
||||
|
||||
#: wp-ffpc-class.php:624
|
||||
msgid ""
|
||||
"Prefix for meta content keys, used only with PHP processing.<br /"
|
||||
"><strong>WARNING</strong>: changing this will result the previous cache to "
|
||||
"becomes invalid!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:628
|
||||
msgid "Key scheme"
|
||||
msgstr "Schema Chiave"
|
||||
|
||||
#: wp-ffpc-class.php:632
|
||||
msgid ""
|
||||
"Key layout; <strong>use the guide below to change it</strong>.<br /"
|
||||
"><strong>WARNING</strong>: changing this will result the previous cache to "
|
||||
"becomes invalid!<br />If you are caching with nginx, you should update your "
|
||||
"nginx configuration and reload nginx after changing this value."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:641
|
||||
msgid "SHA1 hash key"
|
||||
msgstr "Hash Chiavi in SHA1"
|
||||
|
||||
#: wp-ffpc-class.php:645
|
||||
msgid ""
|
||||
"Occasionally URL can be too long to be used as key for the backend storage, "
|
||||
"especially with memcached. Turn on this feature to use SHA1 hash of the URL "
|
||||
"as key instead. Please be aware that you have to add ( or uncomment ) a line "
|
||||
"and a <strong>module</strong> in nginx if you want nginx to fetch the data "
|
||||
"directly; for details, please see the nginx example tab."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:654
|
||||
msgid "Debug & in-depth settings"
|
||||
msgstr "Debug & Impostazioni Avanzate"
|
||||
|
||||
#: wp-ffpc-class.php:655
|
||||
msgid "Notes"
|
||||
msgstr "Note"
|
||||
|
||||
#: wp-ffpc-class.php:656
|
||||
msgid ""
|
||||
"The former method of debug logging flag has been removed. In case you need "
|
||||
"debug log from WP-FFPC please set both the <a href=\"http://codex.wordpress."
|
||||
"org/WP_DEBUG\">WP_DEBUG</a> and the WP_FFPC__DEBUG_MODE constants `true` in "
|
||||
"wp-config.php.<br /> This will enable NOTICE level messages apart from the "
|
||||
"WARNING level ones which are always displayed."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:660
|
||||
msgid "Enable X-Pingback header preservation"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:664
|
||||
msgid "Preserve X-Pingback URL in response header."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:668
|
||||
msgid "Add X-Cache-Engine header"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:672
|
||||
msgid "Add X-Cache-Engine HTTP header to HTTP responses."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:676
|
||||
#, fuzzy
|
||||
msgid "Add HTML debug comment"
|
||||
msgstr "Aggiungere un nuovo commento"
|
||||
|
||||
#: wp-ffpc-class.php:680
|
||||
msgid ""
|
||||
"Adds comment string including plugin name, cache engine and page generation "
|
||||
"time to every generated entry before closing <body> tag."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:688
|
||||
msgid "Set cache additions/excepions"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:691
|
||||
msgid "Enable cache for logged in users"
|
||||
msgstr "Abilitare la cache per gli utenti registrati"
|
||||
|
||||
#: wp-ffpc-class.php:695
|
||||
msgid "Cache pages even if user is logged in."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:699
|
||||
msgid "Excludes"
|
||||
msgstr "Esclusioni"
|
||||
|
||||
#: wp-ffpc-class.php:704
|
||||
msgid "Exclude home"
|
||||
msgstr "Escludi Homepage"
|
||||
|
||||
#: wp-ffpc-class.php:705
|
||||
msgid "Exclude feeds"
|
||||
msgstr "Escludi Feed"
|
||||
|
||||
#: wp-ffpc-class.php:706
|
||||
msgid "Exclude archives"
|
||||
msgstr "Escludi Archivi"
|
||||
|
||||
#: wp-ffpc-class.php:707
|
||||
msgid "Exclude pages"
|
||||
msgstr "Escludi Pagine"
|
||||
|
||||
#: wp-ffpc-class.php:708
|
||||
#, fuzzy
|
||||
msgid "Exclude singulars"
|
||||
msgstr "Escludi"
|
||||
|
||||
#: wp-ffpc-class.php:709
|
||||
msgid "Dynamic requests"
|
||||
msgstr "Richieste dinamiche"
|
||||
|
||||
#: wp-ffpc-class.php:710
|
||||
msgid "WooCommerce"
|
||||
msgstr "WooCommerce"
|
||||
|
||||
#: wp-ffpc-class.php:717
|
||||
msgid "Never cache home."
|
||||
msgstr "Nessuna cache per la homepage."
|
||||
|
||||
#: wp-ffpc-class.php:721
|
||||
msgid "Never cache feeds."
|
||||
msgstr "Nessuna cache per i Feed."
|
||||
|
||||
#: wp-ffpc-class.php:725
|
||||
msgid "Never cache archives."
|
||||
msgstr "Nessuna cache per gli Archivi."
|
||||
|
||||
#: wp-ffpc-class.php:729
|
||||
msgid "Never cache pages."
|
||||
msgstr "Nessuna cache per le Pagine."
|
||||
|
||||
#: wp-ffpc-class.php:733
|
||||
#, fuzzy
|
||||
msgid "Never cache singulars."
|
||||
msgstr "Cache"
|
||||
|
||||
#: wp-ffpc-class.php:737
|
||||
#, fuzzy
|
||||
msgid "Exclude every URL with \"?\" in it."
|
||||
msgstr "Escludi"
|
||||
|
||||
#: wp-ffpc-class.php:742
|
||||
msgid "Exclude dynamic WooCommerce page."
|
||||
msgstr "Escludere la pagine dinamiche di WooCommerce."
|
||||
|
||||
#: wp-ffpc-class.php:750
|
||||
#, fuzzy
|
||||
msgid "Exclude based on cookies"
|
||||
msgstr "Escludi"
|
||||
|
||||
#: wp-ffpc-class.php:754
|
||||
msgid ""
|
||||
"Exclude content based on cookies names starting with this from caching. "
|
||||
"Separate multiple cookies names with commas.<br />If you are caching with "
|
||||
"nginx, you should update your nginx configuration and reload nginx after "
|
||||
"changing this value."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:758
|
||||
msgid "Don't cache following URL paths - use with caution!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:766
|
||||
msgid "Regular expressions use you must! e.g. <em>pattern1|pattern2|etc</em>"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:770
|
||||
msgid "Exclude from cache based on content"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:774
|
||||
msgid ""
|
||||
"Enter a regex pattern that will trigger excluding content from caching. Eg. "
|
||||
"<!--nocache-->. Regular expressions use you must! e.g. <em>pattern1|pattern2|"
|
||||
"etc</em><br />\n"
|
||||
"\t\t\t\t\t<strong>WARNING:</strong> be careful where you display this, "
|
||||
"because it will apply to any content, including archives, collection pages, "
|
||||
"singles, anything. If empty, this setting will be ignored."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:782
|
||||
#, fuzzy
|
||||
msgid "Backend server settings"
|
||||
msgstr "Impostazioni di backend"
|
||||
|
||||
#: wp-ffpc-class.php:785
|
||||
msgid "Hosts"
|
||||
msgstr "Host"
|
||||
|
||||
#: wp-ffpc-class.php:790
|
||||
msgid ""
|
||||
"List of backends, with the following syntax: <br />- in case of TCP based "
|
||||
"connections, list the servers as host1:port1,host2:port2,... . Do not add "
|
||||
"trailing , and always separate host and port with : .<br />- for a unix "
|
||||
"socket enter: unix://[socket_path]"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:793
|
||||
msgid "Authentication ( only for SASL enabled Memcached or Redis)"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:796
|
||||
msgid ""
|
||||
"WARNING: you've entered username and/or password for memcached "
|
||||
"authentication ( or your browser's autocomplete did ) which will not work "
|
||||
"unless you enable memcached sasl in the PHP settings: add `memcached."
|
||||
"use_sasl=1` to php.ini"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:799
|
||||
#, fuzzy
|
||||
msgid "Authentication: username"
|
||||
msgstr "Autenticazione non riuscita"
|
||||
|
||||
#: wp-ffpc-class.php:804
|
||||
#, fuzzy
|
||||
msgid "Username for authentication with backends"
|
||||
msgstr "Nome utente"
|
||||
|
||||
#: wp-ffpc-class.php:808
|
||||
#, fuzzy
|
||||
msgid "Authentication: password"
|
||||
msgstr "Autenticazione non riuscita"
|
||||
|
||||
#: wp-ffpc-class.php:813
|
||||
msgid ""
|
||||
"Password for authentication with for backends - WARNING, the password will "
|
||||
"be stored in an unsecure format!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:816
|
||||
msgid "Memcached specific settings"
|
||||
msgstr "Impostazioni specifiche Memcached"
|
||||
|
||||
#: wp-ffpc-class.php:818
|
||||
#, fuzzy
|
||||
msgid "Enable memcached binary mode"
|
||||
msgstr "Abilita la modalità assistita"
|
||||
|
||||
#: wp-ffpc-class.php:822
|
||||
msgid ""
|
||||
"Some memcached proxies and implementations only support the ASCII protocol."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:830
|
||||
msgid "Precache settings & log from previous pre-cache generation"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:833
|
||||
msgid "Precache schedule"
|
||||
msgstr "Pianificazione precache"
|
||||
|
||||
#: wp-ffpc-class.php:839
|
||||
msgid "Schedule autorun for precache with WP-Cron"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:860
|
||||
msgid "No precache log was found!"
|
||||
msgstr "Non è stato trovato alcun registro precache!"
|
||||
|
||||
#: wp-ffpc-class.php:863
|
||||
msgid "Time of run: "
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:887
|
||||
msgid "Save Changes"
|
||||
msgstr "Salva modifiche"
|
||||
|
||||
#: wp-ffpc-class.php:897 wp-ffpc-class.php:903 wp-ffpc-class.php:919
|
||||
#: wp-ffpc-class.php:930
|
||||
msgid "Precache"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:898
|
||||
msgid "Empty cache"
|
||||
msgstr "Svuota la cache"
|
||||
|
||||
#: wp-ffpc-class.php:899
|
||||
msgid "Reset settings"
|
||||
msgstr "Azzerare impostazioni"
|
||||
|
||||
#: wp-ffpc-class.php:907
|
||||
msgid ""
|
||||
"Precache functionality is disabled due to unavailable system call function. "
|
||||
"<br />Since precaching may take a very long time, it's done through a "
|
||||
"background CLI process in order not to run out of max execution time of PHP. "
|
||||
"Please enable one of the following functions if you whish to use precaching: "
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:910
|
||||
msgid "Pre-cache"
|
||||
msgstr "Pre-cache"
|
||||
|
||||
#: wp-ffpc-class.php:914
|
||||
msgid ""
|
||||
"Start a background process that visits all permalinks of all blogs it can "
|
||||
"found thus forces WordPress to generate cached version of all the pages.<br /"
|
||||
">The plugin tries to visit links of taxonomy terms without the taxonomy name "
|
||||
"as well. This may generate 404 hits, please be prepared for these in your "
|
||||
"logfiles if you plan to pre-cache."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:922
|
||||
msgid "Clear cache"
|
||||
msgstr "Elimina Cache"
|
||||
|
||||
#: wp-ffpc-class.php:925
|
||||
msgid ""
|
||||
"Clear all entries in the storage, including the ones that were set by other "
|
||||
"processes."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:933
|
||||
msgid "Reset options"
|
||||
msgstr "Ripristina le opzioni"
|
||||
|
||||
#: wp-ffpc-class.php:936
|
||||
#, fuzzy
|
||||
msgid "Reset settings to defaults."
|
||||
msgstr "Reimposta impostazioni"
|
||||
|
||||
#: wp-ffpc-class.php:947
|
||||
msgid "Cache type"
|
||||
msgstr "Tipo di cache:"
|
||||
|
||||
#: wp-ffpc-class.php:948
|
||||
msgid "Debug & in-depth"
|
||||
msgstr "Debug & Avanzate"
|
||||
|
||||
#: wp-ffpc-class.php:949
|
||||
msgid "Cache exceptions"
|
||||
msgstr "Eccezioni della cache"
|
||||
|
||||
#: wp-ffpc-class.php:950
|
||||
msgid "Backend settings"
|
||||
msgstr "Impostazioni di backend"
|
||||
|
||||
#: wp-ffpc-class.php:951
|
||||
msgid "Precache & precache log"
|
||||
msgstr "Pre-cache & Registro"
|
||||
|
||||
#: wp-ffpc-class.php:968
|
||||
#, fuzzy
|
||||
msgid "Scheduling WP-CRON event"
|
||||
msgstr "Ultima esecuzione giornaliera di WP-Cron: %s"
|
||||
|
||||
#: wp-ffpc-class.php:972
|
||||
msgid "Clearing WP-CRON scheduled hook "
|
||||
msgstr ""
|
||||
|
||||
#. Plugin Name of the plugin/theme
|
||||
msgid "WP-FFPC"
|
||||
msgstr "WP-FFPC"
|
||||
|
||||
#. Plugin URI of the plugin/theme
|
||||
msgid "https://github.com/petermolnar/wp-ffpc"
|
||||
msgstr "https://github.com/petermolnar/wp-ffpc"
|
||||
|
||||
#. Description of the plugin/theme
|
||||
msgid "WordPress in-memory full page cache plugin"
|
||||
msgstr ""
|
||||
|
||||
#. Author of the plugin/theme
|
||||
msgid "Peter Molnar <hello@petermolnar.eu>"
|
||||
msgstr "Peter Molnar <hello@petermolnar.eu>"
|
||||
|
||||
#. Author URI of the plugin/theme
|
||||
msgid "http://petermolnar.eu/"
|
||||
msgstr "http://petermolnar.eu/"
|
735
languages/wp-ffpc.pot
Normal file
735
languages/wp-ffpc.pot
Normal file
|
@ -0,0 +1,735 @@
|
|||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
||||
"Project-Id-Version: WP-FFPC\n"
|
||||
"POT-Creation-Date: 2016-04-21 17:14+0200\n"
|
||||
"PO-Revision-Date: 2016-04-21 15:44+0200\n"
|
||||
"Last-Translator: Gabriele Lauricella <gab.lau@gmail.com>\n"
|
||||
"Language-Team: Gabriele Lauricella <gab.lau@gmail.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.4\n"
|
||||
"X-Poedit-Basepath: ..\n"
|
||||
"X-Poedit-WPHeader: wp-ffpc.php\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
||||
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
||||
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
||||
"X-Poedit-SearchPath-0: .\n"
|
||||
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
||||
|
||||
#: wp-ffpc-abstract.php:381
|
||||
msgid "Default : "
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-abstract.php:464
|
||||
msgid ""
|
||||
"This plugin helped your business? I'd appreciate a coffee in return :) "
|
||||
"Please!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-abstract.php:479
|
||||
msgid "Donation for "
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-abstract.php:481
|
||||
msgid "Donate via PayPal"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-abstract.php:501
|
||||
#, php-format
|
||||
msgid " – updating network option %s"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-abstract.php:505
|
||||
#, php-format
|
||||
msgid "- updating option %s"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-abstract.php:516
|
||||
#, php-format
|
||||
msgid "- getting network option %s"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-abstract.php:520
|
||||
#, php-format
|
||||
msgid " – getting option %s"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-abstract.php:533
|
||||
#, php-format
|
||||
msgid " – deleting network option %s"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-abstract.php:537
|
||||
#, php-format
|
||||
msgid " – deleting option %s"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-abstract.php:614
|
||||
#, php-format
|
||||
msgid "%s"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:126
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Domain mismatch: the site domain configuration (%s) does not match the "
|
||||
"HTTP_HOST (%s) variable in PHP. Please fix the incorrect one, otherwise the "
|
||||
"plugin may not work as expected."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:134
|
||||
msgid "APC"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:135
|
||||
msgid "APCu"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:136
|
||||
msgid "PHP Memcache"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:137
|
||||
msgid "PHP Memcached"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:138
|
||||
msgid "Redis (experimental, it will break!)"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:152
|
||||
msgid "flush cache"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:153
|
||||
msgid "only modified post"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:154
|
||||
msgid "modified post and all related taxonomies"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:159
|
||||
msgid "The HTTP scheme (i.e. http, https)."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:160
|
||||
msgid ""
|
||||
"Host in the header of request or name of the server processing the request "
|
||||
"if the Host header is not available."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:161
|
||||
msgid ""
|
||||
"The *original* request URI as received from the client including the args"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:162
|
||||
msgid "Name of user, authenticated by the Auth Basic Module"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:163
|
||||
msgid "PHP Session Cookie ID, if set ( empty if not )"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:164
|
||||
msgid "First HTTP Accept Lang set in the HTTP request"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:174
|
||||
msgid "do not use timed precache"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:221
|
||||
msgid "WP-FFPC Settings"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:226
|
||||
msgid ""
|
||||
"WP_CACHE is disabled. Without that, cache plugins, like this, will not work. "
|
||||
"Please add `define ( 'WP_CACHE', true );` to the beginning of wp-config.php."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:230
|
||||
#, php-format
|
||||
msgid ""
|
||||
"This site was reached as %s ( according to PHP HTTP_HOST ) and there are no "
|
||||
"settings present for this domain in the WP-FFPC configuration yet. Please "
|
||||
"save the %s for the domain or fix the webserver configuration!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:234
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Advanced cache file (%s) is not writeable!<br />Please change the "
|
||||
"permissions on the file."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:238
|
||||
#, php-format
|
||||
msgid "Advanced cache file is yet to be generated, please save %s"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:243
|
||||
#, php-format
|
||||
msgid ""
|
||||
"%s cache backend activated but no PHP %s extension was found.<br />Please "
|
||||
"either use different backend or activate the module!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:254
|
||||
msgid ""
|
||||
"WARNING: Memcache extension is configured to use binary mode. This is very "
|
||||
"buggy and the plugin will most probably not work correctly. <br />Please "
|
||||
"consider to change either to ASCII mode or to Memcached extension."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:307
|
||||
msgid ""
|
||||
"WP-FFPC settings were upgraded; please double check if everything is still "
|
||||
"working correctly."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:362
|
||||
msgid ""
|
||||
"<p>Please visit <a href=\"http://wordpress.org/support/plugin/wp-ffpc\">the "
|
||||
"official support forum of the plugin</a> for help.</p>"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:386
|
||||
msgid "<h3>Sample config for nginx to utilize the data entries</h3>"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:387
|
||||
msgid ""
|
||||
"<div class=\"update-nag\">This is not meant to be a copy-paste "
|
||||
"configuration; you most probably have to tailor it to your needs.</div>"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:388
|
||||
msgid ""
|
||||
"<div class=\"update-nag\"><strong>In case you are about to use nginx to "
|
||||
"fetch memcached entries directly and to use SHA1 hash keys, you will need an "
|
||||
"nginx version compiled with <a href=\"http://wiki.nginx.org/HttpSetMiscModule"
|
||||
"\">HttpSetMiscModule</a>. Otherwise set_sha1 function is not available in "
|
||||
"nginx.</strong></div>"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:393
|
||||
msgid "nginx example"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:443
|
||||
msgid "Settings saved."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:450
|
||||
msgid "Plugin options deleted."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:457
|
||||
msgid "Cache flushed."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:464
|
||||
msgid ""
|
||||
"Precache process was started, it is now running in the background, please be "
|
||||
"patient, it may take a very long time to finish."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:472
|
||||
msgid " settings"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:475
|
||||
msgid "Driver: "
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:480
|
||||
msgid "<strong>Backend status:</strong><br />"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:490
|
||||
msgid "<span class=\"error-msg\">down</span><br />"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:492
|
||||
msgid "<span class=\"ok-msg\">up & running</span><br />"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:494
|
||||
msgid ""
|
||||
"<span class=\"error-msg\">unknown, please try re-saving settings!</span><br /"
|
||||
">"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:513
|
||||
msgid "Set cache type"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:516
|
||||
msgid "Select backend"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:522
|
||||
msgid "Select backend storage driver"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:526
|
||||
msgid "Expiration time for posts"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:530
|
||||
msgid ""
|
||||
"Sets validity time of post entry in seconds, including custom post types and "
|
||||
"pages."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:534
|
||||
msgid "Browser cache expiration time of posts"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:538
|
||||
msgid "Sets validity time of posts/pages/singles for the browser cache."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:542
|
||||
msgid "Expiration time for taxonomy"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:546
|
||||
msgid ""
|
||||
"Sets validity time of taxonomy entry in seconds, including custom taxonomy."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:550
|
||||
msgid "Browser cache expiration time of taxonomy"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:554
|
||||
msgid "Sets validity time of taxonomy for the browser cache."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:558
|
||||
msgid "Expiration time for home"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:562
|
||||
msgid "Sets validity time of home on server side."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:566
|
||||
msgid "Browser cache expiration time of home"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:570
|
||||
msgid "Sets validity time of home for the browser cache."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:574
|
||||
msgid "Charset"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:578
|
||||
msgid "Charset of HTML and XML (pages and feeds) data."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:582
|
||||
msgid "Cache invalidation method"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:588
|
||||
msgid "Select cache invalidation method."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:604
|
||||
msgid "Invalidate on comment actions"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:608
|
||||
msgid "Trigger cache invalidation when a comments is posted, edited, trashed. "
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:612
|
||||
msgid "Data prefix"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:616
|
||||
msgid ""
|
||||
"Prefix for HTML content keys, can be used in nginx.<br /><strong>WARNING</"
|
||||
"strong>: changing this will result the previous cache to becomes invalid!"
|
||||
"<br />If you are caching with nginx, you should update your nginx "
|
||||
"configuration and reload nginx after changing this value."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:620
|
||||
msgid "Meta prefix"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:624
|
||||
msgid ""
|
||||
"Prefix for meta content keys, used only with PHP processing.<br /"
|
||||
"><strong>WARNING</strong>: changing this will result the previous cache to "
|
||||
"becomes invalid!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:628
|
||||
msgid "Key scheme"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:632
|
||||
msgid ""
|
||||
"Key layout; <strong>use the guide below to change it</strong>.<br /"
|
||||
"><strong>WARNING</strong>: changing this will result the previous cache to "
|
||||
"becomes invalid!<br />If you are caching with nginx, you should update your "
|
||||
"nginx configuration and reload nginx after changing this value."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:641
|
||||
msgid "SHA1 hash key"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:645
|
||||
msgid ""
|
||||
"Occasionally URL can be too long to be used as key for the backend storage, "
|
||||
"especially with memcached. Turn on this feature to use SHA1 hash of the URL "
|
||||
"as key instead. Please be aware that you have to add ( or uncomment ) a line "
|
||||
"and a <strong>module</strong> in nginx if you want nginx to fetch the data "
|
||||
"directly; for details, please see the nginx example tab."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:654
|
||||
msgid "Debug & in-depth settings"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:655
|
||||
msgid "Notes"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:656
|
||||
msgid ""
|
||||
"The former method of debug logging flag has been removed. In case you need "
|
||||
"debug log from WP-FFPC please set both the <a href=\"http://codex.wordpress."
|
||||
"org/WP_DEBUG\">WP_DEBUG</a> and the WP_FFPC__DEBUG_MODE constants `true` in "
|
||||
"wp-config.php.<br /> This will enable NOTICE level messages apart from the "
|
||||
"WARNING level ones which are always displayed."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:660
|
||||
msgid "Enable X-Pingback header preservation"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:664
|
||||
msgid "Preserve X-Pingback URL in response header."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:668
|
||||
msgid "Add X-Cache-Engine header"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:672
|
||||
msgid "Add X-Cache-Engine HTTP header to HTTP responses."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:676
|
||||
msgid "Add HTML debug comment"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:680
|
||||
msgid ""
|
||||
"Adds comment string including plugin name, cache engine and page generation "
|
||||
"time to every generated entry before closing <body> tag."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:688
|
||||
msgid "Set cache additions/excepions"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:691
|
||||
msgid "Enable cache for logged in users"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:695
|
||||
msgid "Cache pages even if user is logged in."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:699
|
||||
msgid "Excludes"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:704
|
||||
msgid "Exclude home"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:705
|
||||
msgid "Exclude feeds"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:706
|
||||
msgid "Exclude archives"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:707
|
||||
msgid "Exclude pages"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:708
|
||||
msgid "Exclude singulars"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:709
|
||||
msgid "Dynamic requests"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:710
|
||||
msgid "WooCommerce"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:717
|
||||
msgid "Never cache home."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:721
|
||||
msgid "Never cache feeds."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:725
|
||||
msgid "Never cache archives."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:729
|
||||
msgid "Never cache pages."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:733
|
||||
msgid "Never cache singulars."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:737
|
||||
msgid "Exclude every URL with \"?\" in it."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:742
|
||||
msgid "Exclude dynamic WooCommerce page."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:750
|
||||
msgid "Exclude based on cookies"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:754
|
||||
msgid ""
|
||||
"Exclude content based on cookies names starting with this from caching. "
|
||||
"Separate multiple cookies names with commas.<br />If you are caching with "
|
||||
"nginx, you should update your nginx configuration and reload nginx after "
|
||||
"changing this value."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:758
|
||||
msgid "Don't cache following URL paths - use with caution!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:766
|
||||
msgid "Regular expressions use you must! e.g. <em>pattern1|pattern2|etc</em>"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:770
|
||||
msgid "Exclude from cache based on content"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:774
|
||||
msgid ""
|
||||
"Enter a regex pattern that will trigger excluding content from caching. Eg. "
|
||||
"<!--nocache-->. Regular expressions use you must! e.g. <em>pattern1|pattern2|"
|
||||
"etc</em><br />\n"
|
||||
"\t\t\t\t\t<strong>WARNING:</strong> be careful where you display this, "
|
||||
"because it will apply to any content, including archives, collection pages, "
|
||||
"singles, anything. If empty, this setting will be ignored."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:782
|
||||
msgid "Backend server settings"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:785
|
||||
msgid "Hosts"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:790
|
||||
msgid ""
|
||||
"List of backends, with the following syntax: <br />- in case of TCP based "
|
||||
"connections, list the servers as host1:port1,host2:port2,... . Do not add "
|
||||
"trailing , and always separate host and port with : .<br />- for a unix "
|
||||
"socket enter: unix://[socket_path]"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:793
|
||||
msgid "Authentication ( only for SASL enabled Memcached or Redis)"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:796
|
||||
msgid ""
|
||||
"WARNING: you've entered username and/or password for memcached "
|
||||
"authentication ( or your browser's autocomplete did ) which will not work "
|
||||
"unless you enable memcached sasl in the PHP settings: add `memcached."
|
||||
"use_sasl=1` to php.ini"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:799
|
||||
msgid "Authentication: username"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:804
|
||||
msgid "Username for authentication with backends"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:808
|
||||
msgid "Authentication: password"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:813
|
||||
msgid ""
|
||||
"Password for authentication with for backends - WARNING, the password will "
|
||||
"be stored in an unsecure format!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:816
|
||||
msgid "Memcached specific settings"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:818
|
||||
msgid "Enable memcached binary mode"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:822
|
||||
msgid ""
|
||||
"Some memcached proxies and implementations only support the ASCII protocol."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:830
|
||||
msgid "Precache settings & log from previous pre-cache generation"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:833
|
||||
msgid "Precache schedule"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:839
|
||||
msgid "Schedule autorun for precache with WP-Cron"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:860
|
||||
msgid "No precache log was found!"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:863
|
||||
msgid "Time of run: "
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:887
|
||||
msgid "Save Changes"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:897 wp-ffpc-class.php:903 wp-ffpc-class.php:919
|
||||
#: wp-ffpc-class.php:930
|
||||
msgid "Precache"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:898
|
||||
msgid "Empty cache"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:899
|
||||
msgid "Reset settings"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:907
|
||||
msgid ""
|
||||
"Precache functionality is disabled due to unavailable system call function. "
|
||||
"<br />Since precaching may take a very long time, it's done through a "
|
||||
"background CLI process in order not to run out of max execution time of PHP. "
|
||||
"Please enable one of the following functions if you whish to use precaching: "
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:910
|
||||
msgid "Pre-cache"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:914
|
||||
msgid ""
|
||||
"Start a background process that visits all permalinks of all blogs it can "
|
||||
"found thus forces WordPress to generate cached version of all the pages.<br /"
|
||||
">The plugin tries to visit links of taxonomy terms without the taxonomy name "
|
||||
"as well. This may generate 404 hits, please be prepared for these in your "
|
||||
"logfiles if you plan to pre-cache."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:922
|
||||
msgid "Clear cache"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:925
|
||||
msgid ""
|
||||
"Clear all entries in the storage, including the ones that were set by other "
|
||||
"processes."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:933
|
||||
msgid "Reset options"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:936
|
||||
msgid "Reset settings to defaults."
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:947
|
||||
msgid "Cache type"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:948
|
||||
msgid "Debug & in-depth"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:949
|
||||
msgid "Cache exceptions"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:950
|
||||
msgid "Backend settings"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:951
|
||||
msgid "Precache & precache log"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:968
|
||||
msgid "Scheduling WP-CRON event"
|
||||
msgstr ""
|
||||
|
||||
#: wp-ffpc-class.php:972
|
||||
msgid "Clearing WP-CRON scheduled hook "
|
||||
msgstr ""
|
||||
|
||||
#. Plugin Name of the plugin/theme
|
||||
msgid "WP-FFPC"
|
||||
msgstr ""
|
||||
|
||||
#. Plugin URI of the plugin/theme
|
||||
msgid "https://github.com/petermolnar/wp-ffpc"
|
||||
msgstr ""
|
||||
|
||||
#. Description of the plugin/theme
|
||||
msgid "WordPress in-memory full page cache plugin"
|
||||
msgstr ""
|
||||
|
||||
#. Author of the plugin/theme
|
||||
msgid "Peter Molnar <hello@petermolnar.eu>"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of the plugin/theme
|
||||
msgid "http://petermolnar.eu/"
|
||||
msgstr ""
|
179
readme.txt
179
readme.txt
|
@ -1,23 +1,31 @@
|
|||
=== WP-FFPC ===
|
||||
Contributors: cadeyrn, ameir, haroldkyle, plescheff, dkcwd, IgorCode
|
||||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC
|
||||
Tags: cache, page cache, full page cache, nginx, memcached, apc, speed
|
||||
Contributors: cadeyrn
|
||||
Tags: cache, nginx, memcached, apc
|
||||
Requires at least: 3.0
|
||||
Tested up to: 4.1
|
||||
Stable tag: 1.7.9
|
||||
Tested up to: 4.7.2
|
||||
Stable tag: 1.11.2
|
||||
License: GPLv3
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
The fastest way to cache: use the memory!
|
||||
A fast, memory based full page cache plugin supporting APC or memcached.
|
||||
|
||||
== Description ==
|
||||
|
||||
WP-FFPC ( WordPress Fast Full Page Cache ) is a cache plugin for [WordPress](http://wordpress.org/ "WordPress"). It works with any webserver, including apache2, lighttpd, nginx.
|
||||
It can be configured to join forces with [NGiNX](http://NGiNX.org "NGiNX")'s built-in [memcached plugin](http://nginx.org/en/docs/http/ngx_http_memcached_module.html "memcached plugin") for unbeatable speed.
|
||||
**WARNING** The development of WP-FFPC had been put on hold.
|
||||
If you need new features, please send code and pull requests to [WP FFPC @ Github](https://github.com/petermolnar/wp-ffpc).
|
||||
|
||||
= IMPORTANT NOTES, PLEASE READ THIS LIST =
|
||||
*A short why: I developed this plugin in 2010 to support my own site. Right now, as it is, it's working on a few sites I still maintain for friends and since I don't need any additional features, I'm not planning to extend it with things I have no real use of. During the past years I've received some heartwarming donations - unfortunately the amount never came close to consider the project financially beneficial. I removed the donation links and put it on hold for now.*
|
||||
|
||||
|
||||
WP-FFPC is a cache plugin for [WordPress](http://wordpress.org/ "WordPress").
|
||||
It works with any webserver, including, but not limited to, apache2, lighttpd, nginx.
|
||||
|
||||
It can be configured together with [NGiNX](http://NGiNX.org "NGiNX") but use [memcached plugin](http://nginx.org/en/docs/http/ngx_http_memcached_module.html "memcached plugin") directly from the webserver, bypassing PHP.
|
||||
|
||||
= Requirements =
|
||||
|
||||
**This plugin does not kick in right after activation**. You have to adjust the setting in Settings -> WP-FFPC and save the settings.*
|
||||
|
||||
* Requirements:
|
||||
* WordPress >= 3.0
|
||||
* **at least one** of the following for storage backend:
|
||||
* memcached with [PHP Memcached](http://php.net/manual/en/book.memcached.php "Memcached") > 0.1.0
|
||||
|
@ -25,26 +33,22 @@ It can be configured to join forces with [NGiNX](http://NGiNX.org "NGiNX")'s bui
|
|||
* [APC](http://php.net/manual/en/book.apc.php "APC")
|
||||
* [APCu](http://pecl.php.net/package/APCu "APC User Cache")
|
||||
* PHP 5.3+ is really highly recommended, see "Known issues"
|
||||
* This plugin does kick in right after activation. You have to adjust the setting in Settings -> WP-FFPC.*
|
||||
|
||||
|
||||
= Known issues =
|
||||
|
||||
* errors will not be displayed on the admin section if PHP < 5.3, only in the logs. This is due to the limitations of displaying the errors ( admin_notices is a hook, not a filter ) and due to the lack of proper anonymus functions in older PHP. PHP 5.3 is 5 years old, so it's time to upgrade.
|
||||
* APC with PHP 5.4 is buggy; the plugin with that setup can even make your site slower. Please use APCu or memcached if you're using PHP >= 5.4
|
||||
* errors will not be displayed on the admin section if PHP < 5.3, only in the logs. This is due to the limitations of displaying the errors ( admin_notices is a hook, not a filter ) and due to the lack of proper anonymus functions in older PHP.
|
||||
* **If you're using PHP 5.4+ avoid the APC backend: the plugin with that setup can even make your site slower.** Please use APCu or memcached in this case.
|
||||
|
||||
= Features: =
|
||||
|
||||
* Wordpress Network support
|
||||
* fully supported domain/subdomain based WordPress Networks on per site setup as well
|
||||
* will work in Network Enabled mode only for subdirectory based Multisites ( per site settings will not work in this case )
|
||||
* supports various backends
|
||||
* various backends
|
||||
* memcached with [PHP Memcached](http://php.net/manual/en/book.memcached.php "Memcached")
|
||||
* memcached with [PHP Memcache](http://php.net/manual/en/book.memcache.php "Memcache")
|
||||
* [APC](http://php.net/manual/en/book.apc.php "APC")
|
||||
* [APCu](http://pecl.php.net/package/APCu "APC User Cache")
|
||||
* [Xcache](http://xcache.lighttpd.net/ "Xcache") - not stable yet, volunteer testers required!
|
||||
* cache exclude options ( home, feeds, archieves, pages, singles; regex based url exclusion )
|
||||
* cache exclude options ( home, feeds, archives, pages, singles; regex based url exclusion )
|
||||
* minor Woocommerce support
|
||||
* (optional) cache for logged-in users
|
||||
* 404 caching
|
||||
* canonical redirects caching
|
||||
|
@ -55,27 +59,14 @@ It can be configured to join forces with [NGiNX](http://NGiNX.org "NGiNX")'s bui
|
|||
* multiple memcached upstream support
|
||||
* precache ( manually or by timed by wp-cron )
|
||||
* varying expiration time for posts, taxonomies and home
|
||||
* (**warning**: untested since WordPress 3.8) Wordpress Network support
|
||||
* fully supported domain/subdomain based WordPress Networks on per site setup as well
|
||||
* will work in Network Enabled mode only for subdirectory based Multisites ( per site settings will not work in this case )
|
||||
|
||||
|
||||
Many thanks for donations, contributors, supporters, testers & bug reporters:
|
||||
|
||||
* [Harold Kyle](https://github.com/haroldkyle)
|
||||
* [Eric Gilette](http://www.ericgillette.com/)
|
||||
* [doconeill](http://wordpress.org/support/profile/doconeill)
|
||||
* Mark Costlow
|
||||
* Jason Miller
|
||||
* [Dave Clark](https://github.com/dkcwd)
|
||||
* Miguel Clara
|
||||
* [Anton Pelešev](https://github.com/plescheff)
|
||||
* Firas Dib
|
||||
* [CotswoldPhoto](http://wordpress.org/support/profile/cotswoldphoto)
|
||||
* [tamagokun](https://github.com/tamagokun)
|
||||
* Many Ayromlou
|
||||
* mailgarant.nl
|
||||
* Christian Rößner
|
||||
* [Ameir Abdeldayem](https://github.com/ameir)
|
||||
* [Alvaro Gonzalez](https://github.com/andor-pierdelacabeza)
|
||||
* Meint Post
|
||||
Harold Kyle, Eric Gilette, doconeill, Mark Costlow, Jason Miller, Dave Clark, Miguel Clara, Anton Pelešev, Firas Dib, CotswoldPhoto, tamagokun, Many Ayromlou, mailgarant.nl, Christian Rößner, Ameir Abdeldayem, Alvaro Gonzalez, Meint Post, Knut Sparhell, Christian Kernbeis, Gausden Barry, Maksim Bukreyeu, Lissome Hong Kong Limited, Gabriele Lauricella, 7th Veil, LLC, Julia Harsch, Grant Berntsen, Jorgen Ilstad, Cinema Minima for Movie Makers Worldwide
|
||||
|
||||
== Installation ==
|
||||
|
||||
|
@ -92,22 +83,27 @@ A short configuration example is generated on the plugin settings page, under `N
|
|||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= How to use the plugin on Amazon Linux? =
|
||||
You have to remove the default yum package, named `php-pecl-memcache` and install `Memcached` through PECL.
|
||||
= The plugin is not working! =
|
||||
|
||||
= How to use the plugin in a WordPress Network =
|
||||
From version 1.0, the plugin supports subdomain based WordPress Network with possible different per site cache settings. If the plugin is network active, obviously the network wide settings will be used for all of the sites. If it's activated only on some of the sites, the other will not be affected and even the cache storage backend can be different from site to site.
|
||||
Did you save the settings as mentioned in this document?
|
||||
Do you have at lest one supported backend?
|
||||
|
||||
= How logging works in the plugin? =
|
||||
Log levels by default ( if logging enabled ) includes warning and error level standard PHP messages.
|
||||
Additional info level log is available when [WP_DEBUG](http://codex.wordpress.org/WP_DEBUG "WP_DEBUG") is enabled.
|
||||
= It's making my site slower than it was! =
|
||||
|
||||
= How can I contribute? =
|
||||
In order to make contributions a lot easier, I've moved the plugin development to [GitHub](https://github.com/petermolnar/wp-ffpc "GitHub"), feel free to fork and put shiny, new things in it and get in touch with me [hello@petermolnar.eu](mailto:hello@petermolnar.eu "hello@petermolnar.eu") when you have it ready.
|
||||
So far this only happened if PHP 5.4 or higher was used with APC.
|
||||
Please avoid this setup; PHP 5.4 shipped opcache and APC is full of bugs since then. Use APCu with PHP 5.4+.
|
||||
|
||||
= Does it support mobile theme switching? =
|
||||
|
||||
No, it doesn't, and with the way it's currently working, it never will.
|
||||
WP-FFPC is using the URL as key for caching, so it can't differentiate if there is no change in the URL.
|
||||
*(I personally also disagree with separation of mobile and non-mobile theme; you need to support a plethora of screen sizes and resolutions, so just use responsive designs instead of splitted logics.)*
|
||||
|
||||
= Can you please add '(insert shiny new feature here)'? =
|
||||
|
||||
Sure. Send me a code and a pull request on [WP FFPC @ Github](https://github.com/petermolnar/wp-ffpc).
|
||||
Unfortunately I don't have the resources to code it myself, but there are plenty of WordPress developers who would probably do it for a minor fee.
|
||||
|
||||
= Where can I turn for support? =
|
||||
I provide support for the plugin as best as I can, but it comes without guarantee.
|
||||
Please post feature requests to [WP-FFPC feature request topic](http://wordpress.org/support/topic/feature-requests-14 "WP-FFPC feature request topic") and any questions on the forum.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
|
@ -125,6 +121,93 @@ Version numbering logic:
|
|||
* every .B version indicates new features.
|
||||
* every ..C indicates bugfixes for A.B version.
|
||||
|
||||
= 1.11.2 =
|
||||
*2017-02-08*
|
||||
|
||||
* annoying typos in text
|
||||
|
||||
= 1.11.1 =
|
||||
*2017-02-08*
|
||||
|
||||
* exclude cache for WooCommerce
|
||||
* fix load textdomain
|
||||
* add Italian (it_IT) translation
|
||||
* nonexistent redis support removed (it never got to a usable stable state, mostly due to the chaos with the redis php modules)
|
||||
* readme cleaned up for development hibernation
|
||||
* donation link removed
|
||||
* WP version compatibility bumped
|
||||
|
||||
= 1.11.0 =
|
||||
*2016-01-15*
|
||||
|
||||
* merged filter for HTML before it hits the cache
|
||||
* refactored logging
|
||||
|
||||
= 1.10.1 =
|
||||
*2015-10-30*
|
||||
|
||||
* fixed nginx configuration sample snippets
|
||||
* nginx configuration moved from Settings tab to Help tab, so if you're looking for the "nginx" tab, you need to look under "Help" on the WP-FFPC Settings page.
|
||||
|
||||
= 1.10.0 =
|
||||
*2015-10-23*
|
||||
|
||||
*IMPORTANT, READ THIS*
|
||||
|
||||
* Proper browser cache support:
|
||||
* new options to set real browser cache expiry for singles, taxonomy and home
|
||||
* added Etag support based on browser cache expiry
|
||||
* added proper Expires header according to cache entry generation time + browser cache expiry
|
||||
* added support for Last Modified header for home & taxonomy ( singles already had it) based on the last post modified date within the taxonomy
|
||||
|
||||
= 1.9.1 =
|
||||
*2015-10-18*
|
||||
|
||||
* bugfix for is_writable check failures ( see: https://wordpress.org/support/topic/settings-saved-but-getting-not-saved-error-message)
|
||||
* bugfix for memcached.protocol notice
|
||||
* typo fixes
|
||||
* replace variable with string constant in translatable messages
|
||||
|
||||
= 1.9.0 =
|
||||
*2015-10-14*
|
||||
|
||||
* adding exclude option based on text entry matching ( regex )
|
||||
|
||||
= 1.8.4 =
|
||||
*2015-10-13*
|
||||
|
||||
* changes in HTML debug comment: instead of the former, single comment, now 2 comments are added. The first is added when the cache entry is generated; the second only appears if the page was served from the cached entry. Please note that this last bit will - should - change with every single refresh.
|
||||
* backend code is now split into separate files
|
||||
* more debug code
|
||||
|
||||
= 1.8.3 =
|
||||
*2015-05-07*
|
||||
|
||||
* small change in key creation: prefix is kept in front of sha1 hashes for debugging purposes
|
||||
|
||||
= 1.8.2 =
|
||||
*2015-04-30*
|
||||
|
||||
* sha1 key hashing made to be optional
|
||||
* added additional debug condition of WP_FFPC__DEBUG_MODE constant to be `true`
|
||||
|
||||
|
||||
= 1.8.1 =
|
||||
*2015-04-29*
|
||||
|
||||
* fixing the wrong release of 1.8.0
|
||||
|
||||
= 1.8.0 =
|
||||
*2015-04-29*
|
||||
|
||||
What's new:
|
||||
|
||||
* backend keys are now sha1 hashes instead of full url; this is to prevent too long key error with memcached
|
||||
|
||||
Under the hood:
|
||||
* wp-common is removed; no more git submodules
|
||||
* logging method changed
|
||||
|
||||
= 1.7.9 =
|
||||
*2015-02-02*
|
||||
|
||||
|
|
|
@ -13,5 +13,3 @@ include_once ( 'wp-ffpc.php' );
|
|||
|
||||
/* run uninstall function */
|
||||
$wp_ffpc->plugin_uninstall();
|
||||
|
||||
?>
|
||||
|
|
194
wp-admin.css
Normal file
194
wp-admin.css
Normal file
|
@ -0,0 +1,194 @@
|
|||
.plugin-admin dt {
|
||||
margin-top: 2em;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.plugin-admin fieldset {
|
||||
display:block;
|
||||
margin: 0;
|
||||
padding: 0 1em 0 1em;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.plugin-admin legend {
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.plugin-admin .description {
|
||||
display: block;
|
||||
padding-top: 0.3em;
|
||||
}
|
||||
|
||||
.plugin-admin .tabs {
|
||||
padding:0;
|
||||
margin: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.plugin-admin .tabs li {
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 1px 1px;
|
||||
border-color: #ccc;
|
||||
border-bottom-color: #ccc;
|
||||
line-height: 120%;
|
||||
display: inline-block;
|
||||
padding: 0.5em 2em 0.5em 2em;
|
||||
text-decoration: none;
|
||||
margin-bottom: -1px;
|
||||
-webkit-border-top-left-radius: 3px;
|
||||
-webkit-border-top-right-radius: 3px;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
background: #f1f1f1;
|
||||
background-image: -webkit-gradient(linear,left bottom,left top,from(#ececec),to(#f9f9f9));
|
||||
background-image: -webkit-linear-gradient(bottom,#ececec,#f9f9f9);
|
||||
background-image: -moz-linear-gradient(bottom,#ececec,#f9f9f9);
|
||||
background-image: -o-linear-gradient(bottom,#ececec,#f9f9f9);
|
||||
background-image: linear-gradient(to top,#ececec,#f9f9f9);
|
||||
}
|
||||
|
||||
.plugin-admin .tabs li a {
|
||||
outline: none;
|
||||
text-decoration: none;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
.plugin-admin .tabs li.ui-state-active {
|
||||
background: #fff;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
.error p {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.error-msg {
|
||||
color: #990000;
|
||||
}
|
||||
|
||||
.ok-msg {
|
||||
color: #009900;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.wp-ffpc-donation {
|
||||
padding: 0.8em;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f6f6f6;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
|
||||
}
|
||||
|
||||
.wp-ffpc-donation * {
|
||||
display: inline;
|
||||
line-height: 2em;
|
||||
}
|
||||
|
||||
.wp-ffpc-donation .currency {
|
||||
padding: 0 0 0 0.3em;
|
||||
|
||||
}
|
||||
|
||||
.wp-ffpc-donation .submit {
|
||||
display: inline-block;
|
||||
width: 74px;
|
||||
height: 21px;
|
||||
}
|
||||
|
||||
.wp-ffpc-donation .ui-slider {
|
||||
position: relative;
|
||||
text-align: left;
|
||||
display: inline-block;
|
||||
width: 16em;
|
||||
margin: 0 2em 0 2em;
|
||||
height: 0.4em;
|
||||
background-color: #111;
|
||||
border: 1px solid #ccc;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
background: #f1f1f1;
|
||||
}
|
||||
|
||||
.wp-ffpc-donation .ui-slider .ui-slider-handle {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
width: 1.2em;
|
||||
height: 1.2em;
|
||||
margin-top: -0.4em;
|
||||
cursor: default;
|
||||
border: 1px solid #ccc;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
background: #f1f1f1;
|
||||
background-image: -webkit-gradient(linear,left bottom,left top,from(#ececec),to(#f9f9f9));
|
||||
background-image: -webkit-linear-gradient(bottom,#ececec,#f9f9f9);
|
||||
background-image: -moz-linear-gradient(bottom,#ececec,#f9f9f9);
|
||||
background-image: -o-linear-gradient(bottom,#ececec,#f9f9f9);
|
||||
background-image: linear-gradient(to top,#ececec,#f9f9f9);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
||||
.button-warning {
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
line-height: 23px;
|
||||
height: 24px;
|
||||
margin: 0;
|
||||
padding: 0 10px 1px;
|
||||
cursor: pointer;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
-webkit-border-radius: 3px;
|
||||
-webkit-appearance: none;
|
||||
border-radius: 3px;
|
||||
white-space: nowrap;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
background: #f3f3f3;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#f4f4f4));
|
||||
background-image: -webkit-linear-gradient(top, #fefefe, #f4f4f4);
|
||||
background-image: -moz-linear-gradient(top, #fefefe, #f4f4f4);
|
||||
background-image: -o-linear-gradient(top, #fefefe, #f4f4f4);
|
||||
background-image: linear-gradient(to bottom, #fefefe, #f4f4f4);
|
||||
border-color: #bbb;
|
||||
color: #900;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
}
|
||||
|
||||
.button-warning:hover,
|
||||
.button-warning:focus {
|
||||
background: #f3f3f3;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f3f3f3));
|
||||
background-image: -webkit-linear-gradient(top, #fff, #f3f3f3);
|
||||
background-image: -moz-linear-gradient(top, #fff, #f3f3f3);
|
||||
background-image: -ms-linear-gradient(top, #fff, #f3f3f3);
|
||||
background-image: -o-linear-gradient(top, #fff, #f3f3f3);
|
||||
background-image: linear-gradient(to bottom, #fff, #f3f3f3);
|
||||
border-color: #900;
|
||||
color: #a00;
|
||||
-webkit-box-shadow: 1px 1px 1px rgba(0,0,0,.2);
|
||||
box-shadow: 1px 1px 1px rgba(0,0,0,.2);
|
||||
}
|
||||
|
||||
.button-warning:active {
|
||||
background: #eee;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#fefefe));
|
||||
background-image: -webkit-linear-gradient(top, #f4f4f4, #fefefe);
|
||||
background-image: -moz-linear-gradient(top, #f4f4f4, #fefefe);
|
||||
background-image: -ms-linear-gradient(top, #f4f4f4, #fefefe);
|
||||
background-image: -o-linear-gradient(top, #f4f4f4, #fefefe);
|
||||
background-image: linear-gradient(to bottom, #f4f4f4, #fefefe);
|
||||
border-color: #900;
|
||||
color: #a00;
|
||||
text-shadow: 0 -1px 0 #fff;
|
||||
-webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
|
||||
box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Subproject commit a355960827c466a01a00f3d4e04c6ee812594c37
|
629
wp-ffpc-abstract.php
Normal file
629
wp-ffpc-abstract.php
Normal file
|
@ -0,0 +1,629 @@
|
|||
<?php
|
||||
|
||||
defined('ABSPATH') or die("Walk away.");
|
||||
|
||||
/* __ only availabe if we're running from the inside of wordpress, not in advanced-cache.php phase */
|
||||
if ( !function_exists ('__translate__') ) {
|
||||
/* __ only availabe if we're running from the inside of wordpress, not in advanced-cache.php phase */
|
||||
if ( function_exists ( '__' ) ) {
|
||||
function __translate__ ( $text, $domain ) { return __($text, $domain); }
|
||||
}
|
||||
else {
|
||||
function __translate__ ( $text, $domain ) { return $text; }
|
||||
}
|
||||
}
|
||||
|
||||
if ( !function_exists ('__debug__') ) {
|
||||
/* __ only availabe if we're running from the inside of wordpress, not in advanced-cache.php phase */
|
||||
function __debug__ ( $text ) {
|
||||
if ( defined('WP_FFPC__DEBUG_MODE') && WP_FFPC__DEBUG_MODE == true)
|
||||
error_log ( __FILE__ . ': ' . $text );
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('WP_FFPC_ABSTRACT')):
|
||||
|
||||
/**
|
||||
* abstract class for common, required functionalities
|
||||
*
|
||||
*/
|
||||
abstract class WP_FFPC_ABSTRACT {
|
||||
|
||||
const slug_save = '&saved=true';
|
||||
const slug_delete = '&deleted=true';
|
||||
const common_slug = 'wp-common/';
|
||||
|
||||
protected $plugin_constant;
|
||||
protected $options = array();
|
||||
protected $defaults = array();
|
||||
protected $status = 0;
|
||||
protected $network = false;
|
||||
protected $settings_link = '';
|
||||
protected $settings_slug = '';
|
||||
protected $plugin_url;
|
||||
protected $plugin_dir;
|
||||
protected $common_url;
|
||||
protected $common_dir;
|
||||
protected $plugin_file;
|
||||
protected $plugin_name;
|
||||
protected $plugin_version;
|
||||
protected $plugin_settings_page;
|
||||
protected $button_save;
|
||||
protected $button_delete;
|
||||
protected $capability = 'manage_options';
|
||||
protected $admin_css_handle;
|
||||
protected $admin_css_url;
|
||||
protected $utils = null;
|
||||
|
||||
protected $donation_business_name;
|
||||
protected $donation_item_name;
|
||||
protected $donation_business_id;
|
||||
protected $donation = false;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $plugin_constant General plugin identifier, same as directory & base PHP file name
|
||||
* @param string $plugin_version Version number of the parameter
|
||||
* @param string $plugin_name Readable name of the plugin
|
||||
* @param mixed $defaults Default value(s) for plugin option(s)
|
||||
* @param string $donation_link Donation link of plugin
|
||||
*
|
||||
*/
|
||||
public function __construct( $plugin_constant, $plugin_version, $plugin_name, $defaults, $donation_business_name = false, $donation_item_name = false, $donation_business_id = false ) {
|
||||
|
||||
$this->plugin_constant = $plugin_constant;
|
||||
$this->plugin_file = $this->plugin_constant . '/' . $this->plugin_constant . '.php';
|
||||
|
||||
$this->plugin_version = $plugin_version;
|
||||
$this->plugin_name = $plugin_name;
|
||||
$this->defaults = $defaults;
|
||||
|
||||
$this->plugin_settings_page = $this->plugin_constant .'-settings';
|
||||
|
||||
$this->button_save = $this->plugin_constant . '-save';
|
||||
$this->button_delete = $this->plugin_constant . '-delete';
|
||||
|
||||
if ( !empty( $donation_business_name ) && !empty( $donation_item_name ) && !empty( $donation_business_id ) ) {
|
||||
$this->donation_business_name = $donation_business_name;
|
||||
$this->donation_item_name = $donation_item_name;
|
||||
$this->donation_business_id = $donation_business_id;
|
||||
$this->donation = true;
|
||||
}
|
||||
|
||||
//$this->utils = new PluginUtils();
|
||||
|
||||
/* we need network wide plugin check functions */
|
||||
if ( ! function_exists( 'is_plugin_active_for_network' ) )
|
||||
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
|
||||
/* check if plugin is network-activated */
|
||||
if ( @is_plugin_active_for_network ( $this->plugin_file ) ) {
|
||||
$this->network = true;
|
||||
$this->settings_slug = 'settings.php';
|
||||
}
|
||||
else {
|
||||
$this->settings_slug = 'options-general.php';
|
||||
}
|
||||
|
||||
/* set the settings page link string */
|
||||
$this->settings_link = $this->settings_slug . '?page=' . $this->plugin_settings_page;
|
||||
|
||||
/* initialize plugin, plugin specific init functions */
|
||||
$this->plugin_post_construct();
|
||||
|
||||
add_action( 'init', array(&$this,'plugin_init'));
|
||||
add_action( 'admin_enqueue_scripts', array(&$this,'enqueue_admin_css_js'));
|
||||
add_action( 'plugins_loaded', array(&$this,'plugin_load_textdomain'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* activation hook function, to be extended
|
||||
*/
|
||||
abstract function plugin_activate();
|
||||
|
||||
/**
|
||||
* deactivation hook function, to be extended
|
||||
*/
|
||||
abstract function plugin_deactivate ();
|
||||
|
||||
/**
|
||||
* runs within the __construct, after all the initial settings
|
||||
*/
|
||||
abstract function plugin_post_construct();
|
||||
|
||||
/**
|
||||
* first init hook function, to be extended, before options were read
|
||||
*/
|
||||
abstract function plugin_pre_init();
|
||||
|
||||
/**
|
||||
* second init hook function, to be extended, after options were read
|
||||
*/
|
||||
abstract function plugin_post_init();
|
||||
|
||||
public function plugin_init() {
|
||||
|
||||
/* initialize plugin, plugin specific init functions */
|
||||
$this->plugin_pre_init();
|
||||
|
||||
/* get the options */
|
||||
$this->plugin_options_read();
|
||||
|
||||
register_activation_hook( $this->plugin_file , array( &$this, 'plugin_activate' ) );
|
||||
register_deactivation_hook( $this->plugin_file , array( &$this, 'plugin_deactivate' ) );
|
||||
|
||||
/* register settings pages */
|
||||
if ( $this->network )
|
||||
add_filter( "network_admin_plugin_action_links_" . $this->plugin_file, array( &$this, 'plugin_settings_link' ) );
|
||||
else
|
||||
add_filter( "plugin_action_links_" . $this->plugin_file, array( &$this, 'plugin_settings_link' ) );
|
||||
|
||||
/* register admin init, catches $_POST and adds submenu to admin menu */
|
||||
if ( $this->network )
|
||||
add_action('network_admin_menu', array( &$this , 'plugin_admin_init') );
|
||||
else
|
||||
add_action('admin_menu', array( &$this , 'plugin_admin_init') );
|
||||
|
||||
add_filter('contextual_help', array( &$this, 'plugin_admin_help' ), 10, 2);
|
||||
|
||||
/* setup plugin, plugin specific setup functions that need options */
|
||||
$this->plugin_post_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* admin panel, load plugin textdomain
|
||||
*/
|
||||
public function plugin_load_textdomain() {
|
||||
load_plugin_textdomain( 'wp-ffpc', false , dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* admin panel, the HTML usually
|
||||
*/
|
||||
abstract function plugin_admin_panel();
|
||||
|
||||
/**
|
||||
* admin help menu
|
||||
*/
|
||||
abstract function plugin_admin_help( $contextual_help, $screen_id );
|
||||
|
||||
/**
|
||||
* admin init called by WordPress add_action, needs to be public
|
||||
*/
|
||||
public function plugin_admin_init() {
|
||||
|
||||
/* save parameter updates, if there are any */
|
||||
if ( isset( $_POST[ $this->button_save ] ) && check_admin_referer( 'wp-ffpc') ) {
|
||||
|
||||
$this->plugin_options_save();
|
||||
$this->status = 1;
|
||||
header( "Location: ". $this->settings_link . self::slug_save );
|
||||
}
|
||||
|
||||
/* delete parameters if requested */
|
||||
if ( isset( $_POST[ $this->button_delete ] ) && check_admin_referer( 'wp-ffpc') ) {
|
||||
$this->plugin_options_delete();
|
||||
$this->status = 2;
|
||||
header( "Location: ". $this->settings_link . self::slug_delete );
|
||||
}
|
||||
|
||||
/* load additional moves */
|
||||
$this->plugin_extend_admin_init();
|
||||
|
||||
/* add submenu to settings pages */
|
||||
add_submenu_page( $this->settings_slug, $this->plugin_name . __translate__( ' options' , 'wp-ffpc'), $this->plugin_name, $this->capability, $this->plugin_settings_page, array ( &$this , 'plugin_admin_panel' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* to be extended
|
||||
*
|
||||
*/
|
||||
abstract function plugin_extend_admin_init();
|
||||
|
||||
/**
|
||||
* callback function to add settings link to plugins page
|
||||
*
|
||||
* @param array $links Current links to add ours to
|
||||
*
|
||||
*/
|
||||
public function plugin_settings_link ( $links ) {
|
||||
$settings_link = '<a href="' . $this->settings_link . '">' . __translate__( 'Settings', 'wp-ffpc') . '</a>';
|
||||
array_unshift( $links, $settings_link );
|
||||
return $links;
|
||||
}
|
||||
|
||||
/* add admin styling */
|
||||
public function enqueue_admin_css_js(){
|
||||
/* jquery ui tabs is provided by WordPress */
|
||||
wp_enqueue_script ( "jquery-ui-tabs" );
|
||||
wp_enqueue_script ( "jquery-ui-slider" );
|
||||
|
||||
/* additional admin styling */
|
||||
wp_register_style( $this->admin_css_handle, $this->admin_css_url, array('dashicons'), false, 'all' );
|
||||
wp_enqueue_style( $this->admin_css_handle );
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes saved options from database
|
||||
*/
|
||||
protected function plugin_options_delete () {
|
||||
static::_delete_option ( $this->plugin_constant, $this->network );
|
||||
|
||||
/* additional moves */
|
||||
$this->plugin_extend_options_delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* hook to add functionality into plugin_options_read
|
||||
*/
|
||||
abstract function plugin_extend_options_delete ();
|
||||
|
||||
/**
|
||||
* reads options stored in database and reads merges them with default values
|
||||
*/
|
||||
protected function plugin_options_read () {
|
||||
$options = static::_get_option ( $this->plugin_constant, $this->network );
|
||||
|
||||
/* this is the point to make any migrations from previous versions */
|
||||
$this->plugin_options_migrate( $options );
|
||||
|
||||
/* map missing values from default */
|
||||
foreach ( $this->defaults as $key => $default )
|
||||
if ( !@array_key_exists ( $key, $options ) )
|
||||
$options[$key] = $default;
|
||||
|
||||
/* removed unused keys, rare, but possible */
|
||||
foreach ( @array_keys ( $options ) as $key )
|
||||
if ( !@array_key_exists( $key, $this->defaults ) )
|
||||
unset ( $options[$key] );
|
||||
|
||||
/* any additional read hook */
|
||||
$this->plugin_extend_options_read( $options );
|
||||
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* hook for parameter migration, runs right after options read from DB
|
||||
*/
|
||||
abstract function plugin_options_migrate( &$options );
|
||||
|
||||
/**
|
||||
* hook to add functionality into plugin_options_read, runs after defaults check
|
||||
*/
|
||||
abstract function plugin_extend_options_read ( &$options );
|
||||
|
||||
/**
|
||||
* used on update and to save current options to database
|
||||
*
|
||||
* @param boolean $activating [optional] true on activation hook
|
||||
*
|
||||
*/
|
||||
protected function plugin_options_save ( $activating = false ) {
|
||||
|
||||
/* only try to update defaults if it's not activation hook, $_POST is not empty and the post
|
||||
is ours */
|
||||
if ( !$activating && !empty ( $_POST ) && isset( $_POST[ $this->button_save ] ) ) {
|
||||
/* we'll only update those that exist in the defaults array */
|
||||
$options = $this->defaults;
|
||||
|
||||
foreach ( $options as $key => $default )
|
||||
{
|
||||
/* $_POST element is available */
|
||||
if ( !empty( $_POST[$key] ) ) {
|
||||
$update = $_POST[$key];
|
||||
|
||||
/* get rid of slashes in strings, just in case */
|
||||
if ( is_string ( $update ) )
|
||||
$update = stripslashes($update);
|
||||
|
||||
$options[$key] = $update;
|
||||
}
|
||||
/* empty $_POST element: when HTML form posted, empty checkboxes a 0 input
|
||||
values will not be part of the $_POST array, thus we need to check
|
||||
if this is the situation by checking the types of the elements,
|
||||
since a missing value means update from an integer to 0
|
||||
*/
|
||||
elseif ( empty( $_POST[$key] ) && ( is_bool ( $default ) || is_int( $default ) ) ) {
|
||||
$options[$key] = 0;
|
||||
}
|
||||
elseif ( empty( $_POST[$key] ) && is_array( $default) ) {
|
||||
$options[$key] = array();
|
||||
}
|
||||
}
|
||||
|
||||
/* update the options array */
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/* set plugin version */
|
||||
$this->options['version'] = $this->plugin_version;
|
||||
|
||||
/* call hook function for additional moves before saving the values */
|
||||
$this->plugin_extend_options_save( $activating );
|
||||
|
||||
/* save options to database */
|
||||
static::_update_option ( $this->plugin_constant , $this->options, $this->network );
|
||||
}
|
||||
|
||||
/**
|
||||
* hook to add functionality into plugin_options_save
|
||||
*/
|
||||
abstract function plugin_extend_options_save ( $activating );
|
||||
|
||||
/**
|
||||
* function to easily print a variable
|
||||
*
|
||||
* @param mixed $var Variable to dump
|
||||
* @param boolean $ret Return text instead of printing if true
|
||||
*
|
||||
*/
|
||||
protected function print_var ( $var , $ret = false ) {
|
||||
if ( @is_array ( $var ) || @is_object( $var ) || @is_bool( $var ) )
|
||||
$var = var_export ( $var, true );
|
||||
|
||||
if ( $ret )
|
||||
return $var;
|
||||
else
|
||||
echo $var;
|
||||
}
|
||||
|
||||
/**
|
||||
* print value of an element from defaults array
|
||||
*
|
||||
* @param mixed $e Element index of $this->defaults array
|
||||
*
|
||||
*/
|
||||
protected function print_default ( $e ) {
|
||||
_e('Default : ', 'wp-ffpc');
|
||||
$select = 'select_' . $e;
|
||||
if ( @is_array ( $this->$select ) ) {
|
||||
$x = $this->$select;
|
||||
$this->print_var ( $x[ $this->defaults[ $e ] ] );
|
||||
}
|
||||
else {
|
||||
$this->print_var ( $this->defaults[ $e ] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* select options field processor
|
||||
*
|
||||
* @param elements
|
||||
* array to build <option> values of
|
||||
*
|
||||
* @param $current
|
||||
* the current active element
|
||||
*
|
||||
* @param $print
|
||||
* boolean: is true, the options will be printed, otherwise the string will be returned
|
||||
*
|
||||
* @return
|
||||
* prints or returns the options string
|
||||
*
|
||||
*/
|
||||
protected function print_select_options ( $elements, $current, $valid = false, $print = true ) {
|
||||
|
||||
if ( is_array ( $valid ) )
|
||||
$check_disabled = true;
|
||||
else
|
||||
$check_disabled = false;
|
||||
|
||||
$opt = '';
|
||||
foreach ($elements as $value => $name ) {
|
||||
//$disabled .= ( @array_key_exists( $valid[ $value ] ) && $valid[ $value ] == false ) ? ' disabled="disabled"' : '';
|
||||
$opt .= '<option value="' . $value . '" ';
|
||||
$opt .= selected( $value , $current );
|
||||
|
||||
// ugly tree level valid check to prevent array warning messages
|
||||
if ( is_array( $valid ) && isset ( $valid [ $value ] ) && $valid [ $value ] == false )
|
||||
$opt .= ' disabled="disabled"';
|
||||
|
||||
$opt .= '>';
|
||||
$opt .= $name;
|
||||
$opt .= "</option>\n";
|
||||
}
|
||||
|
||||
if ( $print )
|
||||
echo $opt;
|
||||
else
|
||||
return $opt;
|
||||
}
|
||||
|
||||
/**
|
||||
* creates PayPal donation form based on plugin details
|
||||
*
|
||||
*/
|
||||
protected function plugin_donation_form () {
|
||||
if ( $this->donation ) :
|
||||
?>
|
||||
<script>
|
||||
jQuery(document).ready(function($) {
|
||||
jQuery(function() {
|
||||
var select = $( "#amount" );
|
||||
var slider = $( '<div id="donation-slider"></div>' ).insertAfter( select ).slider({
|
||||
min: 1,
|
||||
max: 8,
|
||||
range: "min",
|
||||
value: select[ 0 ].selectedIndex + 1,
|
||||
slide: function( event, ui ) {
|
||||
select[ 0 ].selectedIndex = ui.value - 1;
|
||||
}
|
||||
});
|
||||
$( "#amount" ).change(function() {
|
||||
slider.slider( "value", this.selectedIndex + 1 );
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="<?php echo $this->plugin_constant ?>-donation">
|
||||
<label for="amount"><?php _e( "This plugin helped your business? I'd appreciate a coffee in return :) Please!", 'wp-ffpc'); ?></label>
|
||||
<select name="amount" id="amount">
|
||||
<option value="3">3$</option>
|
||||
<option value="5">5$</option>
|
||||
<option value="10" selected="selected">10$</option>
|
||||
<option value="15">15$</option>
|
||||
<option value="30">30$</option>
|
||||
<option value="42">42$</option>
|
||||
<option value="75">75$</option>
|
||||
<option value="100">100$</option>
|
||||
</select>
|
||||
<input type="hidden" id="cmd" name="cmd" value="_donations" />
|
||||
<input type="hidden" id="tax" name="tax" value="0" />
|
||||
<input type="hidden" id="business" name="business" value="<?php echo $this->donation_business_id ?>" />
|
||||
<input type="hidden" id="bn" name="bn" value="<?php echo $this->donation_business_name ?>" />
|
||||
<input type="hidden" id="item_name" name="item_name" value="<?php _e('Donation for ', 'wp-ffpc'); echo $this->donation_item_name ?>" />
|
||||
<input type="hidden" id="currency_code" name="currency_code" value="USD" />
|
||||
<input type="submit" name="submit" value="<?php _e('Donate via PayPal', 'wp-ffpc') ?>" class="button-secondary" />
|
||||
</form>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
public function getoption ( $key ) {
|
||||
return ( empty ( $this->options[ $key] ) ) ? false : $this->options[ $key];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UTILS
|
||||
*/
|
||||
/**
|
||||
* option update; will handle network wide or standalone site options
|
||||
*
|
||||
*/
|
||||
public static function _update_option ( $optionID, $data, $network = false ) {
|
||||
if ( $network ) {
|
||||
static::debug( sprintf( __( ' – updating network option %s', 'PluginUtils' ), $optionID ) );
|
||||
update_site_option( $optionID , $data );
|
||||
}
|
||||
else {
|
||||
static::debug( sprintf( __( '- updating option %s', 'PluginUtils' ), $optionID ));
|
||||
update_option( $optionID , $data );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* read option; will handle network wide or standalone site options
|
||||
*
|
||||
*/
|
||||
public static function _get_option ( $optionID, $network = false ) {
|
||||
if ( $network ) {
|
||||
static::debug ( sprintf( __( '- getting network option %s', 'PluginUtils' ), $optionID ) );
|
||||
$options = get_site_option( $optionID );
|
||||
}
|
||||
else {
|
||||
static::debug( sprintf( __( ' – getting option %s', 'PluginUtils' ), $optionID ));
|
||||
$options = get_option( $optionID );
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* clear option; will handle network wide or standalone site options
|
||||
*
|
||||
*/
|
||||
public static function _delete_option ( $optionID, $network = false ) {
|
||||
if ( $network ) {
|
||||
static::debug ( sprintf( __( ' – deleting network option %s', 'PluginUtils' ), $optionID ) );
|
||||
delete_site_option( $optionID );
|
||||
}
|
||||
else {
|
||||
static::debug ( sprintf( __( ' – deleting option %s', 'PluginUtils' ), $optionID ) );
|
||||
delete_option( $optionID );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* read option; will handle network wide or standalone site options
|
||||
*
|
||||
*/
|
||||
public static function _site_url ( $site = '', $network = false ) {
|
||||
if ( $network && !empty( $site ) )
|
||||
$url = get_blog_option ( $site, 'siteurl' );
|
||||
else
|
||||
$url = get_bloginfo ( 'url' );
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* replaces http:// with https:// in an url if server is currently running on https
|
||||
*
|
||||
* @param string $url URL to check
|
||||
*
|
||||
* @return string URL with correct protocol
|
||||
*
|
||||
*/
|
||||
public static function replace_if_ssl ( $url ) {
|
||||
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )
|
||||
$_SERVER['HTTPS'] = 'on';
|
||||
|
||||
if ( isset($_SERVER['HTTPS']) && (( strtolower($_SERVER['HTTPS']) == 'on' ) || ( $_SERVER['HTTPS'] == '1' ) ))
|
||||
$url = str_replace ( 'http://' , 'https://' , $url );
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
static function debug( $message, $level = LOG_NOTICE ) {
|
||||
if ( @is_array( $message ) || @is_object ( $message ) )
|
||||
$message = json_encode($message);
|
||||
|
||||
|
||||
switch ( $level ) {
|
||||
case LOG_ERR :
|
||||
wp_die( '<h1>Error:</h1>' . '<p>' . $message . '</p>' );
|
||||
exit;
|
||||
default:
|
||||
if ( !defined( 'WP_DEBUG' ) || WP_DEBUG != true || !defined( 'WP_FFPC__DEBUG_MODE' ) || WP_FFPC__DEBUG_MODE != true )
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
error_log( __CLASS__ . ": " . $message );
|
||||
}
|
||||
|
||||
/**
|
||||
* display formatted alert message
|
||||
*
|
||||
* @param string $msg Error message
|
||||
* @param string $error "level" of error
|
||||
* @param boolean $network WordPress network or not, DEPRECATED
|
||||
*
|
||||
*/
|
||||
static public function alert ( $msg, $level=LOG_WARNING, $network=false ) {
|
||||
if ( empty($msg)) return false;
|
||||
|
||||
switch ($level) {
|
||||
case LOG_ERR:
|
||||
case LOG_WARNING:
|
||||
$css = "error";
|
||||
break;
|
||||
default:
|
||||
$css = "updated";
|
||||
break;
|
||||
}
|
||||
|
||||
$r = '<div class="'. $css .'"><p>'. sprintf ( __('%s', 'PluginUtils' ), $msg ) .'</p></div>';
|
||||
if ( version_compare(phpversion(), '5.3.0', '>=')) {
|
||||
add_action('admin_notices', function() use ($r) { echo $r; }, 10 );
|
||||
}
|
||||
else {
|
||||
global $tmp;
|
||||
$tmp = $r;
|
||||
$f = create_function ( '', 'global $tmp; echo $tmp;' );
|
||||
add_action('admin_notices', $f );
|
||||
}
|
||||
static::debug( $msg, $level );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
endif;
|
|
@ -1,51 +1,89 @@
|
|||
<?php
|
||||
|
||||
defined('ABSPATH') or die("Walk away.");
|
||||
|
||||
/**
|
||||
* advanced cache worker of WordPress plugin WP-FFPC
|
||||
*/
|
||||
|
||||
function __wp_ffpc_debug__ ( $text ) {
|
||||
if ( defined('WP_FFPC__DEBUG_MODE') && WP_FFPC__DEBUG_MODE == true)
|
||||
error_log ( 'WP_FFPC_ACache' . ': ' . $text );
|
||||
}
|
||||
|
||||
/* check for WP cache enabled*/
|
||||
if ( !WP_CACHE )
|
||||
if ( !defined('WP_CACHE') || WP_CACHE != true ) {
|
||||
__wp_ffpc_debug__('WP_CACHE is not true');
|
||||
return false;
|
||||
}
|
||||
|
||||
/* no cache for post request (comments, plugins and so on) */
|
||||
if ($_SERVER["REQUEST_METHOD"] == 'POST')
|
||||
if ($_SERVER["REQUEST_METHOD"] == 'POST') {
|
||||
__wp_ffpc_debug__('POST requests are never cached');
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to avoid enabling the cache if sessions are managed
|
||||
* with request parameters and a session is active
|
||||
*/
|
||||
if (defined('SID') && SID != '')
|
||||
if (defined('SID') && SID != '') {
|
||||
__wp_ffpc_debug__('SID found, skipping cache');
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check for config */
|
||||
if (!isset($wp_ffpc_config))
|
||||
if (!isset($wp_ffpc_config)) {
|
||||
__wp_ffpc_debug__('wp_ffpc_config variable not found');
|
||||
return false;
|
||||
}
|
||||
|
||||
/* request uri */
|
||||
$wp_ffpc_uri = $_SERVER['REQUEST_URI'];
|
||||
|
||||
/* no cache for robots.txt */
|
||||
if ( stripos($wp_ffpc_uri, 'robots.txt') )
|
||||
if ( stripos($wp_ffpc_uri, 'robots.txt') ) {
|
||||
__wp_ffpc_debug__ ( 'Skippings robots.txt hit');
|
||||
return false;
|
||||
}
|
||||
|
||||
/* multisite files can be too large for memcached */
|
||||
if ( function_exists('is_multisite') && stripos($wp_ffpc_uri, '/files/') && is_multisite() )
|
||||
if ( function_exists('is_multisite') && stripos($wp_ffpc_uri, '/files/') && is_multisite() ) {
|
||||
__wp_ffpc_debug__ ( 'Skippings multisite /files/ hit');
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check if config is network active: use network config */
|
||||
if (!empty ( $wp_ffpc_config['network'] ) )
|
||||
if (!empty ( $wp_ffpc_config['network'] ) ) {
|
||||
$wp_ffpc_config = $wp_ffpc_config['network'];
|
||||
__wp_ffpc_debug__('using "network" level config');
|
||||
}
|
||||
/* check if config is active for site : use site config */
|
||||
elseif ( !empty ( $wp_ffpc_config[ $_SERVER['HTTP_HOST'] ] ) )
|
||||
elseif ( !empty ( $wp_ffpc_config[ $_SERVER['HTTP_HOST'] ] ) ) {
|
||||
$wp_ffpc_config = $wp_ffpc_config[ $_SERVER['HTTP_HOST'] ];
|
||||
__wp_ffpc_debug__("using {$_SERVER['HTTP_HOST']} level config");
|
||||
}
|
||||
/* plugin config not found :( */
|
||||
else
|
||||
else {
|
||||
__wp_ffpc_debug__("no usable config found");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* no cache for WooCommerce URL patterns */
|
||||
if ( isset($wp_ffpc_config['nocache_woocommerce']) && !empty($wp_ffpc_config['nocache_woocommerce']) &&
|
||||
isset($wp_ffpc_config['nocache_woocommerce_url']) && trim($wp_ffpc_config['nocache_woocommerce_url']) ) {
|
||||
$pattern = sprintf('#%s#', trim($wp_ffpc_config['nocache_woocommerce_url']));
|
||||
if ( preg_match($pattern, $wp_ffpc_uri) ) {
|
||||
__wp_ffpc_debug__ ( "Cache exception based on WooCommenrce URL regex pattern matched, skipping");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* no cache for uri with query strings, things usually go bad that way */
|
||||
if ( isset($wp_ffpc_config['nocache_dyn']) && !empty($wp_ffpc_config['nocache_dyn']) && stripos($wp_ffpc_uri, '?') !== false )
|
||||
if ( isset($wp_ffpc_config['nocache_dyn']) && !empty($wp_ffpc_config['nocache_dyn']) && stripos($wp_ffpc_uri, '?') !== false ) {
|
||||
__wp_ffpc_debug__ ( 'Dynamic url cache is disabled ( url with "?" ), skipping');
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check for cookies that will make us not cache the content, like logged in WordPress cookie */
|
||||
if ( isset($wp_ffpc_config['nocache_cookies']) && !empty($wp_ffpc_config['nocache_cookies']) ) {
|
||||
|
@ -56,6 +94,7 @@ if ( isset($wp_ffpc_config['nocache_cookies']) && !empty($wp_ffpc_config['nocach
|
|||
/* check for any matches to user-added cookies to no-cache */
|
||||
foreach ( $nocache_cookies as $nocache_cookie ) {
|
||||
if( strpos( $n, $nocache_cookie ) === 0 ) {
|
||||
__wp_ffpc_debug__ ( "Cookie exception matched: {$n}, skipping");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -67,17 +106,19 @@ if ( isset($wp_ffpc_config['nocache_cookies']) && !empty($wp_ffpc_config['nocach
|
|||
if ( isset($wp_ffpc_config['nocache_url']) && trim($wp_ffpc_config['nocache_url']) ) {
|
||||
$pattern = sprintf('#%s#', trim($wp_ffpc_config['nocache_url']));
|
||||
if ( preg_match($pattern, $wp_ffpc_uri) ) {
|
||||
__wp_ffpc_debug__ ( "Cache exception based on URL regex pattern matched, skipping");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* canonical redirect storage */
|
||||
$wp_ffpc_redirect = null;
|
||||
/* fires up the backend storage array with current config */
|
||||
include_once ('wp-ffpc-backend.php');
|
||||
$wp_ffpc_backend = new WP_FFPC_Backend( $wp_ffpc_config );
|
||||
$backend_class = 'WP_FFPC_Backend_' . $wp_ffpc_config['cache_type'];
|
||||
$wp_ffpc_backend = new $backend_class ( $wp_ffpc_config );
|
||||
|
||||
//$wp_ffpc_backend = new WP_FFPC_Backend( $wp_ffpc_config );
|
||||
|
||||
/* no cache for for logged in users unless it's set
|
||||
identifier cookies are listed in backend as var for easier usage
|
||||
|
@ -87,30 +128,34 @@ if ( !isset($wp_ffpc_config['cache_loggedin']) || $wp_ffpc_config['cache_loggedi
|
|||
foreach ($_COOKIE as $n=>$v) {
|
||||
foreach ( $wp_ffpc_backend->cookies as $nocache_cookie ) {
|
||||
if( strpos( $n, $nocache_cookie ) === 0 ) {
|
||||
__wp_ffpc_debug__ ( "No cache for cookie: {$n}, skipping");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* will store time of page generation */
|
||||
$wp_ffpc_gentime = 0;
|
||||
|
||||
/* backend connection failed, no caching :( */
|
||||
if ( $wp_ffpc_backend->status() === false )
|
||||
if ( $wp_ffpc_backend->status() === false ) {
|
||||
__wp_ffpc_debug__ ( "Backend offline");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* try to get data & meta keys for current page */
|
||||
$wp_ffpc_keys = array ( 'meta' => $wp_ffpc_config['prefix_meta'], 'data' => $wp_ffpc_config['prefix_data'] );
|
||||
$wp_ffpc_values = array();
|
||||
|
||||
__wp_ffpc_debug__ ( "Trying to fetch entries");
|
||||
|
||||
foreach ( $wp_ffpc_keys as $internal => $key ) {
|
||||
$key = $wp_ffpc_backend->key ( $key );
|
||||
$value = $wp_ffpc_backend->get ( $key );
|
||||
|
||||
if ( ! $value ) {
|
||||
__wp_ffpc_debug__("No cached data found");
|
||||
/* does not matter which is missing, we need both, if one fails, no caching */
|
||||
wp_ffpc_start();
|
||||
return;
|
||||
|
@ -118,11 +163,13 @@ foreach ( $wp_ffpc_keys as $internal => $key ) {
|
|||
else {
|
||||
/* store results */
|
||||
$wp_ffpc_values[ $internal ] = $value;
|
||||
__wp_ffpc_debug__('Got value for ' . $internal);
|
||||
}
|
||||
}
|
||||
|
||||
/* serve cache 404 status */
|
||||
if ( isset( $wp_ffpc_values['meta']['status'] ) && $wp_ffpc_values['meta']['status'] == 404 ) {
|
||||
__wp_ffpc_debug__("Serving 404");
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
/* if I kill the page serving here, the 404 page will not be showed at all, so we do not do that
|
||||
* flush();
|
||||
|
@ -132,6 +179,7 @@ if ( isset( $wp_ffpc_values['meta']['status'] ) && $wp_ffpc_values['meta']['sta
|
|||
|
||||
/* server redirect cache */
|
||||
if ( isset( $wp_ffpc_values['meta']['redirect'] ) && $wp_ffpc_values['meta']['redirect'] ) {
|
||||
__wp_ffpc_debug__("Serving redirect to {$wp_ffpc_values['meta']['redirect']}");
|
||||
header('Location: ' . $wp_ffpc_values['meta']['redirect'] );
|
||||
/* cut the connection as fast as possible */
|
||||
flush();
|
||||
|
@ -143,6 +191,7 @@ if ( array_key_exists( "HTTP_IF_MODIFIED_SINCE" , $_SERVER ) && !empty( $wp_ffpc
|
|||
$if_modified_since = strtotime(preg_replace('/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"]));
|
||||
/* check is cache is still valid */
|
||||
if ( $if_modified_since >= $wp_ffpc_values['meta']['lastmodified'] ) {
|
||||
__wp_ffpc_debug__("Serving 304 Not Modified");
|
||||
header("HTTP/1.0 304 Not Modified");
|
||||
/* connection cut for faster serving */
|
||||
flush();
|
||||
|
@ -156,31 +205,68 @@ if ( array_key_exists( "HTTP_IF_MODIFIED_SINCE" , $_SERVER ) && !empty( $wp_ffpc
|
|||
if (!empty ( $wp_ffpc_values['meta']['mime'] ) )
|
||||
header('Content-Type: ' . $wp_ffpc_values['meta']['mime']);
|
||||
|
||||
/* don't allow browser caching of page */
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0');
|
||||
header('Pragma: no-cache');
|
||||
/* set expiry date */
|
||||
if (isset($wp_ffpc_values['meta']['expire']) && !empty ( $wp_ffpc_values['meta']['expire'] ) ) {
|
||||
$hash = md5 ( $wp_ffpc_uri . $wp_ffpc_values['meta']['expire'] );
|
||||
|
||||
/* expire at this very moment */
|
||||
switch ($wp_ffpc_values['meta']['type']) {
|
||||
case 'home':
|
||||
case 'feed':
|
||||
$expire = $wp_ffpc_config['browsercache_home'];
|
||||
break;
|
||||
case 'archive':
|
||||
$expire = $wp_ffpc_config['browsercache_taxonomy'];
|
||||
break;
|
||||
case 'single':
|
||||
$expire = $wp_ffpc_config['browsercache'];
|
||||
break;
|
||||
default:
|
||||
$expire = 0;
|
||||
}
|
||||
|
||||
header('Cache-Control: public,max-age='.$expire.',s-maxage='.$expire.',must-revalidate');
|
||||
header('Expires: ' . gmdate("D, d M Y H:i:s", $wp_ffpc_values['meta']['expire'] ) . " GMT");
|
||||
header('ETag: '. $hash);
|
||||
unset($expire, $hash);
|
||||
}
|
||||
else {
|
||||
/* in case there is no expiry set, expire immediately and don't serve Etag; browser cache is disabled */
|
||||
header('Expires: ' . gmdate("D, d M Y H:i:s", time() ) . " GMT");
|
||||
/* if I set these, the 304 not modified will never, ever kick in, so not setting these
|
||||
* leaving here as a reminder why it should not be set */
|
||||
//header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0, s-maxage=0, post-check=0, pre-check=0');
|
||||
//header('Pragma: no-cache');
|
||||
}
|
||||
|
||||
/* if shortlinks were set */
|
||||
if (!empty ( $wp_ffpc_values['meta']['shortlink'] ) )
|
||||
if (isset($wp_ffpc_values['meta']['shortlink']) && !empty ( $wp_ffpc_values['meta']['shortlink'] ) )
|
||||
header( 'Link:<'. $wp_ffpc_values['meta']['shortlink'] .'>; rel=shortlink' );
|
||||
|
||||
/* if last modifications were set (for posts & pages) */
|
||||
if ( !empty($wp_ffpc_values['meta']['lastmodified']) )
|
||||
if (isset($wp_ffpc_values['meta']['lastmodified']) && !empty($wp_ffpc_values['meta']['lastmodified']) )
|
||||
header( 'Last-Modified: ' . gmdate("D, d M Y H:i:s", $wp_ffpc_values['meta']['lastmodified'] ). " GMT" );
|
||||
|
||||
/* pingback urls, if existx */
|
||||
if ( !empty( $wp_ffpc_values['meta']['pingback'] ) && $wp_ffpc_config['pingback_header'] )
|
||||
if ( isset($wp_ffpc_values['meta']['pingback']) && !empty( $wp_ffpc_values['meta']['pingback'] ) && isset($wp_ffpc_config['pingback_header']) && $wp_ffpc_config['pingback_header'] )
|
||||
header( 'X-Pingback: ' . $wp_ffpc_values['meta']['pingback'] );
|
||||
|
||||
/* for debugging */
|
||||
if ( $wp_ffpc_config['response_header'] )
|
||||
if ( isset($wp_ffpc_config['response_header']) && $wp_ffpc_config['response_header'] )
|
||||
header( 'X-Cache-Engine: WP-FFPC with ' . $wp_ffpc_config['cache_type'] .' via PHP');
|
||||
|
||||
/* HTML data */
|
||||
echo $wp_ffpc_values['data'];
|
||||
if ( isset($wp_ffpc_config['generate_time']) && $wp_ffpc_config['generate_time'] == '1' && stripos($wp_ffpc_values['data'], '</body>') ) {
|
||||
$mtime = explode ( " ", microtime() );
|
||||
$wp_ffpc_gentime = ( $mtime[1] + $mtime[0] ) - $wp_ffpc_gentime;
|
||||
|
||||
$insertion = "\n<!-- WP-FFPC cache output stats\n\tcache engine: ". $wp_ffpc_config['cache_type'] ."\n\tUNIX timestamp: ". time() . "\n\tdate: ". date( 'c' ) . "\n\tfrom server: ". $_SERVER['SERVER_ADDR'] . " -->\n";
|
||||
$index = stripos( $wp_ffpc_values['data'] , '</body>' );
|
||||
|
||||
$wp_ffpc_values['data'] = substr_replace( $wp_ffpc_values['data'], $insertion, $index, 0);
|
||||
}
|
||||
|
||||
__wp_ffpc_debug__("Serving data");
|
||||
echo trim($wp_ffpc_values['data']);
|
||||
|
||||
flush();
|
||||
die();
|
||||
|
@ -243,18 +329,99 @@ function wp_ffpc_callback( $buffer ) {
|
|||
if (strlen($buffer) == 0)
|
||||
return '';
|
||||
|
||||
if ( isset($wp_ffpc_config[ 'nocache_comment' ]) && !empty($wp_ffpc_config[ 'nocache_comment' ]) && trim($wp_ffpc_config[ 'nocache_comment' ])) {
|
||||
$pattern = sprintf('#%s#', trim($wp_ffpc_config['nocache_comment']));
|
||||
__wp_ffpc_debug__ ( sprintf("Testing comment with pattern: %s", $pattern));
|
||||
if ( preg_match($pattern, $buffer) ) {
|
||||
__wp_ffpc_debug__ ( "Cache exception based on content regex pattern matched, skipping");
|
||||
return $buffer;
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_home() || is_feed() ) {
|
||||
if (is_home())
|
||||
$meta['type'] = 'home';
|
||||
elseif(is_feed())
|
||||
$meta['type'] = 'feed';
|
||||
elseif ( is_archive() )
|
||||
|
||||
if (isset($wp_ffpc_config['browsercache_home']) && !empty($wp_ffpc_config['browsercache_home']) && $wp_ffpc_config['browsercache_home'] > 0) {
|
||||
$meta['expire'] = time() + $wp_ffpc_config['browsercache_home'];
|
||||
}
|
||||
|
||||
__wp_ffpc_debug__( 'Getting latest post for for home & feed');
|
||||
/* get newest post and set last modified accordingly */
|
||||
$args = array(
|
||||
'numberposts' => 1,
|
||||
'orderby' => 'modified',
|
||||
'order' => 'DESC',
|
||||
'post_status' => 'publish',
|
||||
);
|
||||
|
||||
$recent_post = wp_get_recent_posts( $args, OBJECT );
|
||||
if ( !empty($recent_post)) {
|
||||
$recent_post = array_pop($recent_post);
|
||||
if (!empty ( $recent_post->post_modified_gmt ) ) {
|
||||
$meta['lastmodified'] = strtotime ( $recent_post->post_modified_gmt );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
elseif ( is_archive() ) {
|
||||
$meta['type'] = 'archive';
|
||||
elseif ( is_single() )
|
||||
if (isset($wp_ffpc_config['browsercache_taxonomy']) && !empty($wp_ffpc_config['browsercache_taxonomy']) && $wp_ffpc_config['browsercache_taxonomy'] > 0) {
|
||||
$meta['expire'] = time() + $wp_ffpc_config['browsercache_taxonomy'];
|
||||
}
|
||||
|
||||
global $wp_query;
|
||||
|
||||
if ( null != $wp_query->tax_query && !empty($wp_query->tax_query)) {
|
||||
__wp_ffpc_debug__( 'Getting latest post for taxonomy: ' . json_encode($wp_query->tax_query));
|
||||
|
||||
$args = array(
|
||||
'numberposts' => 1,
|
||||
'orderby' => 'modified',
|
||||
'order' => 'DESC',
|
||||
'post_status' => 'publish',
|
||||
'tax_query' => $wp_query->tax_query,
|
||||
);
|
||||
|
||||
$recent_post = get_posts( $args, OBJECT );
|
||||
|
||||
if ( !empty($recent_post)) {
|
||||
$recent_post = array_pop($recent_post);
|
||||
if (!empty ( $recent_post->post_modified_gmt ) ) {
|
||||
$meta['lastmodified'] = strtotime ( $recent_post->post_modified_gmt );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
elseif ( is_single() || is_page() ) {
|
||||
$meta['type'] = 'single';
|
||||
elseif ( is_page() )
|
||||
$meta['type'] = 'page';
|
||||
else
|
||||
if (isset($wp_ffpc_config['browsercache']) && !empty($wp_ffpc_config['browsercache']) && $wp_ffpc_config['browsercache'] > 0) {
|
||||
$meta['expire'] = time() + $wp_ffpc_config['browsercache'];
|
||||
}
|
||||
|
||||
/* try if post is available
|
||||
if made with archieve, last listed post can make this go bad
|
||||
*/
|
||||
global $post;
|
||||
if ( !empty($post) && !empty ( $post->post_modified_gmt ) ) {
|
||||
/* get last modification data */
|
||||
$meta['lastmodified'] = strtotime ( $post->post_modified_gmt );
|
||||
|
||||
/* get shortlink, if possible */
|
||||
if (function_exists('wp_get_shortlink')) {
|
||||
$shortlink = wp_get_shortlink( );
|
||||
if (!empty ( $shortlink ) )
|
||||
$meta['shortlink'] = $shortlink;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$meta['type'] = 'unknown';
|
||||
}
|
||||
|
||||
if ( $meta['type'] != 'unknown' ) {
|
||||
/* check if caching is disabled for page type */
|
||||
|
@ -282,46 +449,42 @@ function wp_ffpc_callback( $buffer ) {
|
|||
/* set mimetype */
|
||||
$meta['mime'] = $meta['mime'] . $wp_ffpc_config['charset'];
|
||||
|
||||
/* try if post is available
|
||||
if made with archieve, last listed post can make this go bad
|
||||
*/
|
||||
global $post;
|
||||
if ( !empty($post) && ( $meta['type'] == 'single' || $meta['type'] == 'page' ) && !empty ( $post->post_modified_gmt ) ) {
|
||||
/* get last modification data */
|
||||
$meta['lastmodified'] = strtotime ( $post->post_modified_gmt );
|
||||
|
||||
/* get shortlink, if possible */
|
||||
if (function_exists('wp_get_shortlink')) {
|
||||
$shortlink = wp_get_shortlink( );
|
||||
if (!empty ( $shortlink ) )
|
||||
$meta['shortlink'] = $shortlink;
|
||||
}
|
||||
}
|
||||
|
||||
/* store pingback url if pingbacks are enabled */
|
||||
if ( get_option ( 'default_ping_status' ) == 'open' )
|
||||
$meta['pingback'] = get_bloginfo('pingback_url');
|
||||
|
||||
$to_store = $buffer;
|
||||
|
||||
/* add generation info is option is set, but only to HTML */
|
||||
if ( $wp_ffpc_config['generate_time'] == '1' && stripos($buffer, '</body>') ) {
|
||||
global $wp_ffpc_gentime;
|
||||
$mtime = explode ( " ", microtime() );
|
||||
$wp_ffpc_gentime = ( $mtime[1] + $mtime[0] )- $wp_ffpc_gentime;
|
||||
|
||||
$insertion = "\n<!-- \nWP-FFPC \n\tcache engine: ". $wp_ffpc_config['cache_type'] ."\n\tpage generation time: ". round( $wp_ffpc_gentime, 3 ) ." seconds\n\tgeneraton UNIX timestamp: ". time() . "\n\tgeneraton date: ". date( 'c' ) . "\n\tserver: ". $_SERVER['SERVER_ADDR'] . "\n-->\n";
|
||||
$insertion = "\n<!-- WP-FFPC cache generation stats" . "\n\tgeneration time: ". round( $wp_ffpc_gentime, 3 ) ." seconds\n\tgeneraton UNIX timestamp: ". time() . "\n\tgeneraton date: ". date( 'c' ) . "\n\tgenerator server: ". $_SERVER['SERVER_ADDR'] . " -->\n";
|
||||
$index = stripos( $buffer , '</body>' );
|
||||
|
||||
$buffer = substr_replace( $buffer, $insertion, $index, 0);
|
||||
$to_store = substr_replace( $buffer, $insertion, $index, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to edit the content to be stored in cache.
|
||||
*
|
||||
* This hooks allows the user to edit the page content right before it is about
|
||||
* to be stored in the cache. This could be useful for alterations like
|
||||
* minification.
|
||||
*
|
||||
* @since 1.10.2
|
||||
*
|
||||
* @param string $to_store The content to be stored in cache.
|
||||
*/
|
||||
$to_store = apply_filters( 'wp-ffpc-to-store', $to_store );
|
||||
|
||||
$prefix_meta = $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_meta'] );
|
||||
$wp_ffpc_backend->set ( $prefix_meta, $meta );
|
||||
|
||||
$prefix_data = $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_data'] );
|
||||
|
||||
//if ( $wp_ffpc_config['gzip'] && function_exists('gzencode') )
|
||||
|
||||
$wp_ffpc_backend->set ( $prefix_data , $buffer );
|
||||
$wp_ffpc_backend->set ( $prefix_data , $to_store );
|
||||
|
||||
if ( !empty( $meta['status'] ) && $meta['status'] == 404 ) {
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
|
@ -332,8 +495,6 @@ function wp_ffpc_callback( $buffer ) {
|
|||
}
|
||||
|
||||
/* echoes HTML out */
|
||||
return $buffer;
|
||||
return trim($buffer);
|
||||
}
|
||||
/*** END GENERATING CACHE ENTRY ***/
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,39 +1,29 @@
|
|||
<?php
|
||||
|
||||
defined('ABSPATH') or die("Walk away.");
|
||||
|
||||
/* this is the base class for all backends; the actual workers
|
||||
* are included at the end of the file from backends/ directory */
|
||||
|
||||
if (!class_exists('WP_FFPC_Backend')) :
|
||||
|
||||
include_once ( 'wp-common/plugin_utils.php');
|
||||
/**
|
||||
*
|
||||
* @var string $plugin_constant Namespace of the plugin
|
||||
* @var mixed $connection Backend object storage variable
|
||||
* @var boolean $alive Alive flag of backend connection
|
||||
* @var array $options Configuration settings array
|
||||
* @var array $status Backends status storage
|
||||
* @var array $cookies Logged in cookies to search for
|
||||
* @var array $urimap Map to render key with
|
||||
* @var object $utilities Utilities singleton
|
||||
*
|
||||
*/
|
||||
class WP_FFPC_Backend {
|
||||
|
||||
abstract class WP_FFPC_Backend {
|
||||
|
||||
const host_separator = ',';
|
||||
const port_separator = ':';
|
||||
|
||||
private $plugin_constant = 'wp-ffpc';
|
||||
private $connection = NULL;
|
||||
private $alive = false;
|
||||
private $options = array();
|
||||
private $status = array();
|
||||
protected $connection = NULL;
|
||||
protected $alive = false;
|
||||
protected $options = array();
|
||||
protected $status = array();
|
||||
public $cookies = array();
|
||||
private $urimap = array();
|
||||
private $utilities;
|
||||
protected $urimap = array();
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param mixed $config Configuration options
|
||||
* @param boolean $network WordPress Network indicator flah
|
||||
*
|
||||
*/
|
||||
public function __construct( $config ) {
|
||||
|
@ -41,42 +31,41 @@ class WP_FFPC_Backend {
|
|||
/* no config, nothing is going to work */
|
||||
if ( empty ( $config ) ) {
|
||||
return false;
|
||||
//die ( __translate__ ( 'WP-FFPC Backend class received empty configuration array, the plugin will not work this way', $this->plugin_constant ) );
|
||||
//die ( __translate__ ( 'WP-FFPC Backend class received empty configuration array, the plugin will not work this way', 'wp-ffpc') );
|
||||
}
|
||||
|
||||
/* set config */
|
||||
$this->options = $config;
|
||||
|
||||
/* these are the list of the cookies to look for when looking for logged in user */
|
||||
$this->cookies = array ( 'comment_author_' , 'wordpressuser_' , 'wp-postpass_', 'wordpress_logged_in_' );
|
||||
|
||||
/* make utilities singleton */
|
||||
$this->utilities = new PluginUtils();
|
||||
|
||||
/* map the key with the predefined schemes */
|
||||
$ruser = isset ( $_SERVER['REMOTE_USER'] ) ? $_SERVER['REMOTE_USER'] : '';
|
||||
$ruri = isset ( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '';
|
||||
$rhost = isset ( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : '';
|
||||
$scookie = isset ( $_COOKIE['PHPSESSID'] ) ? $_COOKIE['PHPSESSID'] : '';
|
||||
|
||||
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )
|
||||
$_SERVER['HTTPS'] = 'on';
|
||||
|
||||
$scheme = ( isset($_SERVER['HTTPS']) && (( strtolower($_SERVER['HTTPS']) == 'on' ) || ( $_SERVER['HTTPS'] == '1' ) )) ? 'https://' : 'http://';
|
||||
|
||||
$this->urimap = array(
|
||||
'$scheme' => str_replace ( '://', '', $this->utilities->replace_if_ssl ( 'http://' ) ),
|
||||
'$scheme' => str_replace ( '://', '', $scheme ),
|
||||
'$host' => $rhost,
|
||||
'$request_uri' => $ruri,
|
||||
'$remote_user' => $ruser,
|
||||
'$cookie_PHPSESSID' => $scookie,
|
||||
);
|
||||
|
||||
/* split hosts entry to servers */
|
||||
/* split single line hosts entry */
|
||||
$this->set_servers();
|
||||
|
||||
/* call backend initiator based on cache type */
|
||||
$init = $this->proxy( 'init' );
|
||||
|
||||
/* info level */
|
||||
$this->log ( __translate__('init starting', $this->plugin_constant ));
|
||||
$this->$init();
|
||||
$this->log ( 'init starting' );
|
||||
|
||||
/* call backend initiator based on cache type */
|
||||
$init = $this->_init();
|
||||
|
||||
if (is_admin() && function_exists('add_filter')) {
|
||||
add_filter('wp_ffpc_clear_keys_array', function($to_clear, $options) {
|
||||
|
@ -93,7 +82,10 @@ class WP_FFPC_Backend {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @param string $uri
|
||||
* @param mixed $default_urimap
|
||||
*/
|
||||
public static function parse_urimap($uri, $default_urimap=null) {
|
||||
$uri_parts = parse_url( $uri );
|
||||
|
||||
|
@ -110,11 +102,14 @@ class WP_FFPC_Backend {
|
|||
return $uri_map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $urimap
|
||||
* @param string $subject
|
||||
*/
|
||||
public static function map_urimap($urimap, $subject) {
|
||||
return str_replace(array_keys($urimap), $urimap, $subject);
|
||||
}
|
||||
|
||||
/*********************** PUBLIC / PROXY FUNCTIONS ***********************/
|
||||
|
||||
/**
|
||||
* build key to make requests with
|
||||
|
@ -126,10 +121,16 @@ class WP_FFPC_Backend {
|
|||
public function key ( $prefix, $customUrimap = null ) {
|
||||
$urimap = $customUrimap ?: $this->urimap;
|
||||
|
||||
/* data is string only with content, meta is not used in nginx */
|
||||
$key = $prefix . self::map_urimap($urimap, $this->options['key']);
|
||||
$this->log ( sprintf( __translate__( 'original key configuration: %s', $this->plugin_constant ), $this->options['key'] ) );
|
||||
$this->log ( sprintf( __translate__( 'setting key to: %s', $this->plugin_constant ), $key ) );
|
||||
$key_base = self::map_urimap($urimap, $this->options['key']);
|
||||
|
||||
if (( isset($this->options['hashkey']) && $this->options['hashkey'] == true) || $this->options['cache_type'] == 'redis' )
|
||||
$key_base = sha1($key_base);
|
||||
|
||||
$key = $prefix . $key_base;
|
||||
|
||||
$this->log ( sprintf( 'original key configuration: %s', $this->options['key'] ) );
|
||||
$this->log ( sprintf( 'setting key for: %s', $key_base ) );
|
||||
$this->log ( sprintf( 'setting key to: %s', $key ) );
|
||||
return $key;
|
||||
}
|
||||
|
||||
|
@ -142,20 +143,19 @@ class WP_FFPC_Backend {
|
|||
* @return mixed False when entry not found or entry value on success
|
||||
*/
|
||||
public function get ( &$key ) {
|
||||
|
||||
/* look for backend aliveness, exit on inactive backend */
|
||||
if ( ! $this->is_alive() )
|
||||
if ( ! $this->is_alive() ) {
|
||||
$this->log ('WARNING: Backend offline');
|
||||
return false;
|
||||
}
|
||||
|
||||
/* log the current action */
|
||||
$this->log ( sprintf( __translate__( 'get %s', $this->plugin_constant ), $key ) );
|
||||
$this->log ( sprintf( 'GET %s', $key ) );
|
||||
|
||||
/* proxy to internal function */
|
||||
$internal = $this->proxy( 'get' );
|
||||
$result = $this->$internal( $key );
|
||||
$result = $this->_get( $key );
|
||||
|
||||
if ( $result === false )
|
||||
$this->log ( sprintf( __translate__( 'failed to get entry: %s', $this->plugin_constant ), $key ) );
|
||||
if ( $result === false || $result === null )
|
||||
$this->log ( sprintf( 'failed to get entry: %s', $key ) );
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -169,13 +169,12 @@ class WP_FFPC_Backend {
|
|||
* @return mixed $result status of set function
|
||||
*/
|
||||
public function set ( &$key, &$data, $expire = false ) {
|
||||
|
||||
/* look for backend aliveness, exit on inactive backend */
|
||||
if ( ! $this->is_alive() )
|
||||
return false;
|
||||
|
||||
/* log the current action */
|
||||
$this->log ( sprintf( __translate__( 'set %s expiration time: %s', $this->plugin_constant ), $key, $this->options['expire'] ) );
|
||||
$this->log ( sprintf( 'set %s expiration time: %s', $key, $this->options['expire'] ) );
|
||||
|
||||
/* expiration time based is based on type from now on */
|
||||
/* fallback */
|
||||
|
@ -187,18 +186,23 @@ class WP_FFPC_Backend {
|
|||
elseif (( is_tax() || is_category() || is_tag() || is_archive() ) && isset($this->options['expire_taxonomy']))
|
||||
$expire = (int) $this->options['expire_taxonomy'];
|
||||
|
||||
/* log the current action */
|
||||
$this->log ( sprintf( 'SET %s', $key ) );
|
||||
/* proxy to internal function */
|
||||
$internal = $this->proxy( 'set' );
|
||||
$result = $this->$internal( $key, $data, $expire );
|
||||
$result = $this->_set( $key, $data, $expire );
|
||||
|
||||
/* check result validity */
|
||||
if ( $result === false )
|
||||
$this->log ( sprintf( __translate__( 'failed to set entry: %s', $this->plugin_constant ), $key ), LOG_WARNING );
|
||||
if ( $result === false || $result === null )
|
||||
$this->log ( sprintf( 'failed to set entry: %s', $key ), LOG_WARNING );
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* next generation clean
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function clear_ng ( $new_status, $old_status, $post ) {
|
||||
$this->clear ( $post->ID );
|
||||
}
|
||||
|
@ -208,7 +212,6 @@ class WP_FFPC_Backend {
|
|||
*
|
||||
* @param string $post_id ID of post to invalidate
|
||||
* @param boolean $force Force flush cache
|
||||
* @param boolean $comment Clear a single page based on comment trigger
|
||||
*
|
||||
*/
|
||||
public function clear ( $post_id = false, $force = false ) {
|
||||
|
@ -219,21 +222,20 @@ class WP_FFPC_Backend {
|
|||
|
||||
/* exit if no post_id is specified */
|
||||
if ( empty ( $post_id ) && $force === false ) {
|
||||
$this->log ( __translate__('not clearing unidentified post ', $this->plugin_constant ), LOG_WARNING );
|
||||
$this->log ( 'not clearing unidentified post', LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* if invalidation method is set to full, flush cache */
|
||||
if ( ( $this->options['invalidation_method'] === 0 || $force === true ) ) {
|
||||
/* log action */
|
||||
$this->log ( __translate__('flushing cache', $this->plugin_constant ) );
|
||||
$this->log ( 'flushing cache' );
|
||||
|
||||
/* proxy to internal function */
|
||||
$internal = $this->proxy ( 'flush' );
|
||||
$result = $this->$internal();
|
||||
$result = $this->_flush();
|
||||
|
||||
if ( $result === false )
|
||||
$this->log ( __translate__('failed to flush cache', $this->plugin_constant ), LOG_WARNING );
|
||||
$this->log ( 'failed to flush cache', LOG_WARNING );
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -270,7 +272,7 @@ class WP_FFPC_Backend {
|
|||
|
||||
/* no path, don't do anything */
|
||||
if ( empty( $permalink ) && $permalink != false ) {
|
||||
$this->log ( sprintf( __translate__( 'unable to determine path from Post Permalink, post ID: %s', $this->plugin_constant ), $post_id ), LOG_WARNING );
|
||||
$this->log ( sprintf( 'unable to determine path from Post Permalink, post ID: %s', $post_id ), LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -304,10 +306,13 @@ class WP_FFPC_Backend {
|
|||
$this->clear_keys( $to_clear );
|
||||
}
|
||||
|
||||
/*
|
||||
* unset entries by key
|
||||
* @param array $keys
|
||||
*/
|
||||
public function clear_keys( $keys ) {
|
||||
$to_clear = apply_filters('wp_ffpc_clear_keys_array', $keys, $this->options);
|
||||
$internal = $this->proxy ( 'clear' );
|
||||
$this->$internal ( $to_clear );
|
||||
$this->_clear ( $to_clear );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -372,12 +377,17 @@ class WP_FFPC_Backend {
|
|||
|
||||
if ( !empty ( $terms ) ) {
|
||||
foreach ( $terms as $term ) {
|
||||
|
||||
/* skip terms that have no post associated and somehow slipped
|
||||
* throught hide_empty */
|
||||
if ( $term->count == 0)
|
||||
continue;
|
||||
|
||||
/* get the permalink for the term */
|
||||
$link = get_term_link ( $term->slug, $taxonomy->name );
|
||||
/* add to container */
|
||||
$links[ $link ] = true;
|
||||
/* remove the taxonomy name from the link, lots of plugins remove this for SEO, it's better to include them than leave them out
|
||||
in worst case, we cache some 404 as well
|
||||
/* remove the taxonomy name from the link, lots of plugins remove this for SEO, it's better to include them than leave them out in worst case, we cache some 404 as well
|
||||
*/
|
||||
$link = str_replace ( '/'.$taxonomy->rewrite['slug'], '', $link );
|
||||
/* add to container */
|
||||
|
@ -406,30 +416,19 @@ class WP_FFPC_Backend {
|
|||
if ( ! $this->is_alive() )
|
||||
return false;
|
||||
|
||||
$internal = $this->proxy ( 'status' );
|
||||
$this->$internal();
|
||||
$internal = $this->_status();
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* backend proxy function name generator
|
||||
*
|
||||
* @return string Name of internal function based on cache_type
|
||||
*
|
||||
*/
|
||||
private function proxy ( $method ) {
|
||||
return $this->options['cache_type'] . '_' . $method;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to check backend aliveness
|
||||
*
|
||||
* @return boolean true if backend is alive, false if not
|
||||
*
|
||||
*/
|
||||
private function is_alive() {
|
||||
protected function is_alive() {
|
||||
if ( ! $this->alive ) {
|
||||
$this->log ( __translate__("backend is not active, exiting function ", $this->plugin_constant ) . __FUNCTION__, LOG_WARNING );
|
||||
$this->log ( "backend is not active, exiting function " . __FUNCTION__, LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -441,7 +440,10 @@ class WP_FFPC_Backend {
|
|||
*
|
||||
*
|
||||
*/
|
||||
private function set_servers () {
|
||||
protected function set_servers () {
|
||||
if ( empty ($this->options['hosts']) )
|
||||
return false;
|
||||
|
||||
/* replace servers array in config according to hosts field */
|
||||
$servers = explode( self::host_separator , $this->options['hosts']);
|
||||
|
||||
|
@ -449,11 +451,15 @@ class WP_FFPC_Backend {
|
|||
|
||||
foreach ( $servers as $snum => $sstring ) {
|
||||
|
||||
if ( stristr($sstring, 'unix://' ) ) {
|
||||
$host = str_replace('unix:/','',$sstring);
|
||||
$port = 0;
|
||||
}
|
||||
else {
|
||||
$separator = strpos( $sstring , self::port_separator );
|
||||
$host = substr( $sstring, 0, $separator );
|
||||
$port = substr( $sstring, $separator + 1 );
|
||||
// unix socket failsafe
|
||||
if ( empty ($port) ) $port = 0;
|
||||
}
|
||||
|
||||
$this->options['servers'][$sstring] = array (
|
||||
'host' => $host,
|
||||
|
@ -480,608 +486,37 @@ class WP_FFPC_Backend {
|
|||
* @var mixed $message Message to log
|
||||
* @var int $log_level Log level
|
||||
*/
|
||||
private function log ( $message, $log_level = LOG_NOTICE ) {
|
||||
if ( !isset ( $this->options['log'] ) || $this->options['log'] != 1 )
|
||||
return false;
|
||||
else
|
||||
$this->utilities->log ( $this->plugin_constant , $message, $log_level );
|
||||
}
|
||||
|
||||
/*********************** END PUBLIC FUNCTIONS ***********************/
|
||||
/*********************** APC FUNCTIONS ***********************/
|
||||
/**
|
||||
* init apc backend: test APC availability and set alive status
|
||||
*/
|
||||
private function apc_init () {
|
||||
/* verify apc functions exist, apc extension is loaded */
|
||||
if ( ! function_exists( 'apc_cache_info' ) ) {
|
||||
$this->log ( __translate__('APC extension missing', $this->plugin_constant ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* verify apc is working */
|
||||
if ( apc_cache_info("user",true) ) {
|
||||
$this->log ( __translate__('backend OK', $this->plugin_constant ) );
|
||||
$this->alive = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* health checker for APC
|
||||
*
|
||||
* @return boolean Aliveness status
|
||||
*
|
||||
*/
|
||||
private function apc_status () {
|
||||
$this->status = true;
|
||||
return $this->alive;
|
||||
}
|
||||
|
||||
/**
|
||||
* get function for APC backend
|
||||
*
|
||||
* @param string $key Key to get values for
|
||||
*
|
||||
* @return mixed Fetched data based on key
|
||||
*
|
||||
*/
|
||||
private function apc_get ( &$key ) {
|
||||
return apc_fetch( $key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set function for APC backend
|
||||
*
|
||||
* @param string $key Key to set with
|
||||
* @param mixed $data Data to set
|
||||
*
|
||||
* @return boolean APC store outcome
|
||||
*/
|
||||
private function apc_set ( &$key, &$data, &$expire ) {
|
||||
return apc_store( $key , $data , $expire );
|
||||
}
|
||||
protected function log ( $message, $level = LOG_NOTICE ) {
|
||||
if ( @is_array( $message ) || @is_object ( $message ) )
|
||||
$message = json_encode($message);
|
||||
|
||||
|
||||
/**
|
||||
* Flushes APC user entry storage
|
||||
*
|
||||
* @return boolean APC flush outcome status
|
||||
*
|
||||
*/
|
||||
private function apc_flush ( ) {
|
||||
return apc_clear_cache('user');
|
||||
switch ( $level ) {
|
||||
case LOG_ERR :
|
||||
wp_die( '<h1>Error:</h1>' . '<p>' . $message . '</p>' );
|
||||
exit;
|
||||
default:
|
||||
if ( !defined( 'WP_DEBUG' ) || WP_DEBUG != true || !defined( 'WP_FFPC__DEBUG_MODE' ) || WP_FFPC__DEBUG_MODE != true )
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes entry from APC or flushes APC user entry storage
|
||||
*
|
||||
* @param mixed $keys Keys to clear, string or array
|
||||
*/
|
||||
private function apc_clear ( &$keys ) {
|
||||
/* make an array if only one string is present, easier processing */
|
||||
if ( !is_array ( $keys ) )
|
||||
$keys = array ( $keys => true );
|
||||
|
||||
foreach ( $keys as $key => $dummy ) {
|
||||
if ( ! apc_delete ( $key ) ) {
|
||||
$this->log ( sprintf( __translate__( 'Failed to delete APC entry: %s', $this->plugin_constant ), $key ), LOG_WARNING );
|
||||
//throw new Exception ( __translate__('Deleting APC entry failed with key ', $this->plugin_constant ) . $key );
|
||||
}
|
||||
else {
|
||||
$this->log ( sprintf( __translate__( 'APC entry delete: %s', $this->plugin_constant ), $key ) );
|
||||
}
|
||||
}
|
||||
error_log( __CLASS__ . ": " . $message );
|
||||
}
|
||||
|
||||
/*********************** END APC FUNCTIONS ***********************/
|
||||
/*********************** APCu FUNCTIONS ***********************/
|
||||
/**
|
||||
* init apcu backend: test APCu availability and set alive status
|
||||
*/
|
||||
private function apcu_init () {
|
||||
/* verify apcu functions exist, apcu extension is loaded */
|
||||
if ( ! function_exists( 'apcu_cache_info' ) ) {
|
||||
$this->log ( __translate__('APCu extension missing', $this->plugin_constant ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* verify apcu is working */
|
||||
if ( apcu_cache_info("user") ) {
|
||||
$this->log ( __translate__('backend OK', $this->plugin_constant ) );
|
||||
$this->alive = true;
|
||||
}
|
||||
abstract protected function _init ();
|
||||
abstract protected function _status ();
|
||||
abstract protected function _get ( &$key );
|
||||
abstract protected function _set ( &$key, &$data, &$expire );
|
||||
abstract protected function _flush ();
|
||||
abstract protected function _clear ( &$keys );
|
||||
}
|
||||
|
||||
/**
|
||||
* health checker for APC
|
||||
*
|
||||
* @return boolean Aliveness status
|
||||
*
|
||||
*/
|
||||
private function apcu_status () {
|
||||
$this->status = true;
|
||||
return $this->alive;
|
||||
}
|
||||
endif;
|
||||
|
||||
/**
|
||||
* get function for APC backend
|
||||
*
|
||||
* @param string $key Key to get values for
|
||||
*
|
||||
* @return mixed Fetched data based on key
|
||||
*
|
||||
*/
|
||||
private function apcu_get ( &$key ) {
|
||||
return apcu_fetch( $key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set function for APC backend
|
||||
*
|
||||
* @param string $key Key to set with
|
||||
* @param mixed $data Data to set
|
||||
*
|
||||
* @return boolean APC store outcome
|
||||
*/
|
||||
private function apcu_set ( &$key, &$data, &$expire ) {
|
||||
return apcu_store( $key , $data , $expire );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flushes APC user entry storage
|
||||
*
|
||||
* @return boolean APC flush outcome status
|
||||
*
|
||||
*/
|
||||
private function apcu_flush ( ) {
|
||||
return apcu_clear_cache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes entry from APC or flushes APC user entry storage
|
||||
*
|
||||
* @param mixed $keys Keys to clear, string or array
|
||||
*/
|
||||
private function apcu_clear ( &$keys ) {
|
||||
/* make an array if only one string is present, easier processing */
|
||||
if ( !is_array ( $keys ) )
|
||||
$keys = array ( $keys => true );
|
||||
|
||||
foreach ( $keys as $key => $dummy ) {
|
||||
if ( ! apcu_delete ( $key ) ) {
|
||||
$this->log ( sprintf( __translate__( 'Failed to delete APC entry: %s', $this->plugin_constant ), $key ), LOG_WARNING );
|
||||
//throw new Exception ( __translate__('Deleting APC entry failed with key ', $this->plugin_constant ) . $key );
|
||||
}
|
||||
else {
|
||||
$this->log ( sprintf( __translate__( 'APC entry delete: %s', $this->plugin_constant ), $key ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********************** END APC FUNCTIONS ***********************/
|
||||
|
||||
/*********************** MEMCACHED FUNCTIONS ***********************/
|
||||
/**
|
||||
* init memcached backend
|
||||
*/
|
||||
private function memcached_init () {
|
||||
/* Memcached class does not exist, Memcached extension is not available */
|
||||
if (!class_exists('Memcached')) {
|
||||
$this->log ( __translate__(' Memcached extension missing, wp-ffpc will not be able to function correctly!', $this->plugin_constant ), LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check for existing server list, otherwise we cannot add backends */
|
||||
if ( empty ( $this->options['servers'] ) && ! $this->alive ) {
|
||||
$this->log ( __translate__("Memcached servers list is empty, init failed", $this->plugin_constant ), LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check is there's no backend connection yet */
|
||||
if ( $this->connection === NULL ) {
|
||||
$this->connection = new Memcached();
|
||||
|
||||
/* use binary and not compressed format, good for nginx and still fast */
|
||||
$this->connection->setOption( Memcached::OPT_COMPRESSION , false );
|
||||
if ($this->options['memcached_binary']){
|
||||
$this->connection->setOption( Memcached::OPT_BINARY_PROTOCOL , true );
|
||||
}
|
||||
|
||||
if ( version_compare( phpversion( 'memcached' ) , '2.0.0', '>=' ) && ini_get( 'memcached.use_sasl' ) == 1 && isset($this->options['authpass']) && !empty($this->options['authpass']) && isset($this->options['authuser']) && !empty($this->options['authuser']) ) {
|
||||
$this->connection->setSaslAuthData ( $this->options['authuser'], $this->options['authpass']);
|
||||
}
|
||||
}
|
||||
|
||||
/* check if initialization was success or not */
|
||||
if ( $this->connection === NULL ) {
|
||||
$this->log ( __translate__( 'error initializing Memcached PHP extension, exiting', $this->plugin_constant ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check if we already have list of servers, only add server(s) if it's not already connected */
|
||||
$servers_alive = array();
|
||||
if ( !empty ( $this->status ) ) {
|
||||
$servers_alive = $this->connection->getServerList();
|
||||
/* create check array if backend servers are already connected */
|
||||
if ( !empty ( $servers ) ) {
|
||||
foreach ( $servers_alive as $skey => $server ) {
|
||||
$skey = $server['host'] . ":" . $server['port'];
|
||||
$servers_alive[ $skey ] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* adding servers */
|
||||
foreach ( $this->options['servers'] as $server_id => $server ) {
|
||||
/* reset server status to unknown */
|
||||
$this->status[$server_id] = -1;
|
||||
|
||||
/* only add servers that does not exists already in connection pool */
|
||||
if ( !@array_key_exists($server_id , $servers_alive ) ) {
|
||||
$this->connection->addServer( $server['host'], $server['port'] );
|
||||
$this->log ( sprintf( __translate__( '%s added', $this->plugin_constant ), $server_id ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* backend is now alive */
|
||||
$this->alive = true;
|
||||
$this->memcached_status();
|
||||
}
|
||||
|
||||
/**
|
||||
* sets current backend alive status for Memcached servers
|
||||
*
|
||||
*/
|
||||
private function memcached_status () {
|
||||
/* server status will be calculated by getting server stats */
|
||||
$this->log ( __translate__("checking server statuses", $this->plugin_constant ));
|
||||
/* get server list from connection */
|
||||
$servers = $this->connection->getServerList();
|
||||
|
||||
foreach ( $servers as $server ) {
|
||||
$server_id = $server['host'] . self::port_separator . $server['port'];
|
||||
/* reset server status to offline */
|
||||
$this->status[$server_id] = 0;
|
||||
if ($this->connection->set($this->plugin_constant, time())) {
|
||||
$this->log ( sprintf( __translate__( '%s server is up & running', $this->plugin_constant ), $server_id ) );
|
||||
$this->status[$server_id] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* get function for Memcached backend
|
||||
*
|
||||
* @param string $key Key to get values for
|
||||
*
|
||||
*/
|
||||
private function memcached_get ( &$key ) {
|
||||
return $this->connection->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set function for Memcached backend
|
||||
*
|
||||
* @param string $key Key to set with
|
||||
* @param mixed $data Data to set
|
||||
*
|
||||
*/
|
||||
private function memcached_set ( &$key, &$data, &$expire ) {
|
||||
$result = $this->connection->set ( $key, $data , $expire );
|
||||
|
||||
/* if storing failed, log the error code */
|
||||
if ( $result === false ) {
|
||||
$code = $this->connection->getResultCode();
|
||||
$this->log ( sprintf( __translate__( 'unable to set entry: %s', $this->plugin_constant ), $key ) );
|
||||
$this->log ( sprintf( __translate__( 'Memcached error code: %s', $this->plugin_constant ), $code ) );
|
||||
//throw new Exception ( __translate__('Unable to store Memcached entry ', $this->plugin_constant ) . $key . __translate__( ', error code: ', $this->plugin_constant ) . $code );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Flush memcached entries
|
||||
*/
|
||||
private function memcached_flush ( ) {
|
||||
return $this->connection->flush();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes entry from Memcached or flushes Memcached storage
|
||||
*
|
||||
* @param mixed $keys String / array of string of keys to delete entries with
|
||||
*/
|
||||
private function memcached_clear ( &$keys ) {
|
||||
|
||||
/* make an array if only one string is present, easier processing */
|
||||
if ( !is_array ( $keys ) )
|
||||
$keys = array ( $keys => true );
|
||||
|
||||
foreach ( $keys as $key => $dummy ) {
|
||||
$kresult = $this->connection->delete( $key );
|
||||
|
||||
if ( $kresult === false ) {
|
||||
$code = $this->connection->getResultCode();
|
||||
$this->log ( sprintf( __translate__( 'unable to delete entry: %s', $this->plugin_constant ), $key ) );
|
||||
$this->log ( sprintf( __translate__( 'Memcached error code: %s', $this->plugin_constant ), $code ) );
|
||||
}
|
||||
else {
|
||||
$this->log ( sprintf( __translate__( 'entry deleted: %s', $this->plugin_constant ), $key ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
/*********************** END MEMCACHED FUNCTIONS ***********************/
|
||||
|
||||
/*********************** MEMCACHE FUNCTIONS ***********************/
|
||||
/**
|
||||
* init memcache backend
|
||||
*/
|
||||
private function memcache_init () {
|
||||
/* Memcached class does not exist, Memcache extension is not available */
|
||||
if (!class_exists('Memcache')) {
|
||||
$this->log ( __translate__('PHP Memcache extension missing', $this->plugin_constant ), LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check for existing server list, otherwise we cannot add backends */
|
||||
if ( empty ( $this->options['servers'] ) && ! $this->alive ) {
|
||||
$this->log ( __translate__("servers list is empty, init failed", $this->plugin_constant ), LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check is there's no backend connection yet */
|
||||
if ( $this->connection === NULL )
|
||||
$this->connection = new Memcache();
|
||||
|
||||
/* check if initialization was success or not */
|
||||
if ( $this->connection === NULL ) {
|
||||
$this->log ( __translate__( 'error initializing Memcache PHP extension, exiting', $this->plugin_constant ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* adding servers */
|
||||
foreach ( $this->options['servers'] as $server_id => $server ) {
|
||||
/* in case of unix socket */
|
||||
if ( $server['port'] === 0 )
|
||||
$this->status[$server_id] = $this->connection->connect ( 'unix:/' . $server['host'] );
|
||||
else
|
||||
$this->status[$server_id] = $this->connection->connect ( $server['host'] , $server['port'] );
|
||||
|
||||
$this->log ( sprintf( __translate__( '%s added', $this->plugin_constant ), $server_id ) );
|
||||
}
|
||||
|
||||
/* backend is now alive */
|
||||
$this->alive = true;
|
||||
$this->memcache_status();
|
||||
}
|
||||
|
||||
/**
|
||||
* check current backend alive status for Memcached
|
||||
*
|
||||
*/
|
||||
private function memcache_status () {
|
||||
/* server status will be calculated by getting server stats */
|
||||
$this->log ( __translate__("checking server statuses", $this->plugin_constant ));
|
||||
/* get servers statistic from connection */
|
||||
foreach ( $this->options['servers'] as $server_id => $server ) {
|
||||
if ( $server['port'] === 0 )
|
||||
$this->status[$server_id] = $this->connection->getServerStatus( $server['host'], 11211 );
|
||||
else
|
||||
$this->status[$server_id] = $this->connection->getServerStatus( $server['host'], $server['port'] );
|
||||
if ( $this->status[$server_id] == 0 )
|
||||
$this->log ( sprintf( __translate__( '%s server is down', $this->plugin_constant ), $server_id ) );
|
||||
else
|
||||
$this->log ( sprintf( __translate__( '%s server is up & running', $this->plugin_constant ), $server_id ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get function for Memcached backend
|
||||
*
|
||||
* @param string $key Key to get values for
|
||||
*
|
||||
*/
|
||||
private function memcache_get ( &$key ) {
|
||||
return $this->connection->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set function for Memcached backend
|
||||
*
|
||||
* @param string $key Key to set with
|
||||
* @param mixed $data Data to set
|
||||
*
|
||||
*/
|
||||
private function memcache_set ( &$key, &$data, &$expire ) {
|
||||
$result = $this->connection->set ( $key, $data , 0 , $expire );
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Flush memcached entries
|
||||
*/
|
||||
private function memcache_flush ( ) {
|
||||
return $this->connection->flush();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes entry from Memcached or flushes Memcached storage
|
||||
*
|
||||
* @param mixed $keys String / array of string of keys to delete entries with
|
||||
*/
|
||||
private function memcache_clear ( &$keys ) {
|
||||
/* make an array if only one string is present, easier processing */
|
||||
if ( !is_array ( $keys ) )
|
||||
$keys = array ( $keys => true );
|
||||
|
||||
foreach ( $keys as $key => $dummy ) {
|
||||
$kresult = $this->connection->delete( $key );
|
||||
|
||||
if ( $kresult === false ) {
|
||||
$this->log ( sprintf( __translate__( 'unable to delete entry: %s', $this->plugin_constant ), $key ) );
|
||||
}
|
||||
else {
|
||||
$this->log ( sprintf( __translate__( 'entry deleted: %s', $this->plugin_constant ), $key ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********************** END MEMCACHE FUNCTIONS ***********************/
|
||||
|
||||
/*********************** REDIS FUNCTIONS ***********************/
|
||||
/**
|
||||
* init memcache backend
|
||||
*/
|
||||
private function redis_init () {
|
||||
if (!class_exists('Redis')) {
|
||||
$this->log ( __translate__('PHP Redis extension missing', $this->plugin_constant ), LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check for existing server list, otherwise we cannot add backends */
|
||||
if ( empty ( $this->options['servers'] ) && ! $this->alive ) {
|
||||
$this->log ( __translate__("servers list is empty, init failed", $this->plugin_constant ), LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check is there's no backend connection yet */
|
||||
if ( $this->connection === NULL )
|
||||
$this->connection = new Redis();
|
||||
|
||||
/* check if initialization was success or not */
|
||||
if ( $this->connection === NULL ) {
|
||||
$this->log ( __translate__( 'error initializing Redis extension, exiting', $this->plugin_constant ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
//$this->connection->setOption(Redis::OPT_PREFIX, $this->plugin_constant );
|
||||
|
||||
/* adding server *
|
||||
foreach ( $this->options['servers'] as $server_id => $server ) {
|
||||
/* in case of unix socket *
|
||||
if ( $server['port'] === 0 ) {
|
||||
try {
|
||||
$this->status[$server_id] = $this->connection->connect ( $server['host'] );
|
||||
} catch ( RedisException $e ) {
|
||||
$this->log ( sprintf( __translate__( 'adding %s to the Redis pool failed, error: %s', $this->plugin_constant ), $server['host'], $e ) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
$this->status[$server_id] = $this->connection->connect ( $server['host'] , $server['port'] );
|
||||
} catch ( RedisException $e ) {
|
||||
$this->log ( sprintf( __translate__( 'adding %s:%s to the Redis pool failed, error: %s', $this->plugin_constant ), $server['host'] , $server['port'], $e ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->log ( sprintf( __translate__( 'server #%s added', $this->plugin_constant ), $server_id ) );
|
||||
}*/
|
||||
|
||||
/* adding server */
|
||||
$key = array_unshift ( array_keys ( $this->options['servers'] ));
|
||||
$server = array_unshift( $this->options['servers'] );
|
||||
|
||||
try {
|
||||
if ( $server['port'] === 0 )
|
||||
$this->status[$key] = $this->connection->connect ( $server['host'] );
|
||||
else
|
||||
$this->status[$key] = $this->connection->connect ( $server['host'], $server['port'] );
|
||||
} catch ( RedisException $e ) {
|
||||
$this->log ( sprintf( __translate__( 'adding %s to the Redis pool failed, error: %s', $this->plugin_constant ), $server['host'], $e ) );
|
||||
}
|
||||
|
||||
$this->log ( sprintf( __translate__( 'server #%s added', $this->plugin_constant ), $server_id ) );
|
||||
|
||||
if ( !empty( $this->options['authpass'])) {
|
||||
$auth = $this->connection->auth( $this->options['authpass'] );
|
||||
if ( $auth == false ) {
|
||||
$this->log ( __translate__( 'Redis authentication failed, exiting', $this->plugin_constant ), LOG_WARNING );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* backend is now alive */
|
||||
$this->alive = true;
|
||||
$this->redis_status();
|
||||
}
|
||||
|
||||
/**
|
||||
* check current backend alive status for Memcached
|
||||
*
|
||||
*/
|
||||
private function redis_status () {
|
||||
/* server status will be calculated by getting server stats */
|
||||
$this->log ( __translate__("checking server statuses", $this->plugin_constant ));
|
||||
|
||||
/* get servers statistic from connection */
|
||||
try {
|
||||
$this->connection->ping();
|
||||
} catch ( RedisException $e ) {
|
||||
$this->log ( sprintf( __translate__( 'Redis status check failed, error: %s', $this->plugin_constant ), $e ) );
|
||||
}
|
||||
|
||||
$this->log ( sprintf( __translate__( 'Redis is up', $this->plugin_constant ), $server_id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* get function for Memcached backend
|
||||
*
|
||||
* @param string $key Key to get values for
|
||||
*
|
||||
*/
|
||||
private function redis_get ( &$key ) {
|
||||
return $this->connection->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set function for Memcached backend
|
||||
*
|
||||
* @param string $key Key to set with
|
||||
* @param mixed $data Data to set
|
||||
*
|
||||
*/
|
||||
private function redis_set ( &$key, &$data, &$expire ) {
|
||||
$result = $this->connection->set ( $key, $data , Array('nx', 'ex' => $expire) );
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Flush memcached entries
|
||||
*/
|
||||
private function redis_flush ( ) {
|
||||
return $this->connection->flushDB();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes entry from Memcached or flushes Memcached storage
|
||||
*
|
||||
* @param mixed $keys String / array of string of keys to delete entries with
|
||||
*/
|
||||
private function redis_clear ( &$keys ) {
|
||||
/* make an array if only one string is present, easier processing */
|
||||
if ( !is_array ( $keys ) )
|
||||
$keys = array ( $keys => true );
|
||||
|
||||
$kresults = $this->connection->delete( $keys );
|
||||
|
||||
foreach ( $kresults as $key => $value ) {
|
||||
$this->log ( sprintf( __translate__( 'entry deleted: %s', $this->plugin_constant ), $value ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*********************** END REDIS FUNCTIONS ***********************/
|
||||
|
||||
|
||||
}
|
||||
|
||||
endif; ?>
|
||||
$wp_ffpc_backends = glob( dirname( __FILE__ ) . "/backends/*.php" );
|
||||
foreach ( $wp_ffpc_backends as $backend )
|
||||
include_once $backend;
|
||||
unset( $wp_ffpc_backends, $backend );
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
|
||||
defined('ABSPATH') or die("Walk away.");
|
||||
|
||||
if ( ! class_exists( 'WP_FFPC' ) ) :
|
||||
|
||||
/* get the plugin abstract class*/
|
||||
include_once ( dirname(__FILE__) . '/wp-common/plugin_abstract.php' );
|
||||
include_once ( dirname(__FILE__) . '/wp-ffpc-abstract.php' );
|
||||
/* get the common functions class*/
|
||||
include_once ( dirname(__FILE__) .'/wp-ffpc-backend.php' );
|
||||
|
||||
|
@ -22,7 +24,7 @@ include_once ( dirname(__FILE__) .'/wp-ffpc-backend.php' );
|
|||
* @var array $shell_possibilities List of possible precache worker callers
|
||||
[TODO] finish list of vars
|
||||
*/
|
||||
class WP_FFPC extends PluginAbstract {
|
||||
class WP_FFPC extends WP_FFPC_ABSTRACT {
|
||||
const host_separator = ',';
|
||||
const port_separator = ':';
|
||||
const donation_id_key = 'hosted_button_id=';
|
||||
|
@ -67,20 +69,19 @@ class WP_FFPC extends PluginAbstract {
|
|||
*
|
||||
*/
|
||||
public function plugin_post_construct () {
|
||||
static::debug ( __CLASS__, 'post_construct' );
|
||||
$this->plugin_url = plugin_dir_url( __FILE__ );
|
||||
$this->plugin_dir = plugin_dir_path( __FILE__ );
|
||||
|
||||
$this->common_url = $this->plugin_url . self::common_slug;
|
||||
$this->common_dir = $this->plugin_dir . self::common_slug;
|
||||
|
||||
$this->admin_css_handle = $this->plugin_constant . '-admin-css';
|
||||
$this->admin_css_url = $this->common_url . 'wp-admin.css';
|
||||
$this->admin_css_url = $this->plugin_url . 'wp-admin.css';
|
||||
}
|
||||
|
||||
/**
|
||||
* init hook function runs before admin panel hook, themeing and options read
|
||||
*/
|
||||
public function plugin_pre_init() {
|
||||
static::debug ( __CLASS__, 'pre_init' );
|
||||
/* advanced cache "worker" file */
|
||||
$this->acache_worker = $this->plugin_dir . $this->plugin_constant . '-acache.php';
|
||||
/* WordPress advanced-cache.php file location */
|
||||
|
@ -88,7 +89,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
/* nginx sample config file */
|
||||
$this->nginx_sample = $this->plugin_dir . $this->plugin_constant . '-nginx-sample.conf';
|
||||
/* backend driver file */
|
||||
$this->acache_backend = $this->plugin_dir . $this->plugin_constant . '-backend.php';
|
||||
$this->acache_backend = $this->plugin_dir . $this->plugin_constant . '-engine.php';
|
||||
/* flush button identifier */
|
||||
$this->button_flush = $this->plugin_constant . '-flush';
|
||||
/* precache button identifier */
|
||||
|
@ -112,6 +113,9 @@ class WP_FFPC extends PluginAbstract {
|
|||
}
|
||||
}
|
||||
|
||||
if (!isset($_SERVER['HTTP_HOST']))
|
||||
$_SERVER['HTTP_HOST'] = '127.0.0.1';
|
||||
|
||||
/* set global config key; here, because it's needed for migration */
|
||||
if ( $this->network ) {
|
||||
$this->global_config_key = 'network';
|
||||
|
@ -119,7 +123,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
else {
|
||||
$sitedomain = parse_url( get_option('siteurl') , PHP_URL_HOST);
|
||||
if ( $_SERVER['HTTP_HOST'] != $sitedomain ) {
|
||||
$this->errors['domain_mismatch'] = sprintf( __("Domain mismatch: the site domain configuration (%s) does not match the HTTP_HOST (%s) variable in PHP. Please fix the incorrect one, otherwise the plugin may not work as expected.", $this->plugin_constant ), $sitedomain, $_SERVER['HTTP_HOST'] );
|
||||
$this->errors['domain_mismatch'] = sprintf( __("Domain mismatch: the site domain configuration (%s) does not match the HTTP_HOST (%s) variable in PHP. Please fix the incorrect one, otherwise the plugin may not work as expected.", 'wp-ffpc'), $sitedomain, $_SERVER['HTTP_HOST'] );
|
||||
}
|
||||
|
||||
$this->global_config_key = $_SERVER['HTTP_HOST'];
|
||||
|
@ -127,40 +131,39 @@ class WP_FFPC extends PluginAbstract {
|
|||
|
||||
/* cache type possible values array */
|
||||
$this->select_cache_type = array (
|
||||
'apc' => __( 'APC' , $this->plugin_constant ),
|
||||
'apcu' => __( 'APCu' , $this->plugin_constant ),
|
||||
'memcache' => __( 'PHP Memcache' , $this->plugin_constant ),
|
||||
'memcached' => __( 'PHP Memcached' , $this->plugin_constant ),
|
||||
'redis' => __( 'Redis (experimental, it will break!)' , $this->plugin_constant ),
|
||||
'apc' => __( 'APC' , 'wp-ffpc'),
|
||||
'apcu' => __( 'APCu' , 'wp-ffpc'),
|
||||
'memcache' => __( 'PHP Memcache' , 'wp-ffpc'),
|
||||
'memcached' => __( 'PHP Memcached' , 'wp-ffpc'),
|
||||
);
|
||||
/* check for required functions / classes for the cache types */
|
||||
|
||||
$this->valid_cache_type = array (
|
||||
'apc' => function_exists( 'apc_cache_info' ) ? true : false,
|
||||
'apc' => (function_exists( 'apc_cache_info' ) && version_compare(PHP_VERSION, '5.3.0') <= 0 ) ? true : false,
|
||||
'apcu' => function_exists( 'apcu_cache_info' ) ? true : false,
|
||||
'memcache' => class_exists ( 'Memcache') ? true : false,
|
||||
'memcached' => class_exists ( 'Memcached') ? true : false,
|
||||
'redis' => class_exists( 'Redis' ) ? true : false,
|
||||
);
|
||||
|
||||
/* invalidation method possible values array */
|
||||
$this->select_invalidation_method = array (
|
||||
0 => __( 'flush cache' , $this->plugin_constant ),
|
||||
1 => __( 'only modified post' , $this->plugin_constant ),
|
||||
2 => __( 'modified post and all taxonomies' , $this->plugin_constant ),
|
||||
3 => __( 'modified post and posts index page' , $this->plugin_constant ),
|
||||
0 => __( 'flush cache' , 'wp-ffpc'),
|
||||
1 => __( 'only modified post' , 'wp-ffpc'),
|
||||
2 => __( 'modified post and all related taxonomies' , 'wp-ffpc'),
|
||||
);
|
||||
|
||||
/* map of possible key masks */
|
||||
$this->list_uri_vars = array (
|
||||
'$scheme' => __('The HTTP scheme (i.e. http, https).', $this->plugin_constant ),
|
||||
'$host' => __('Host in the header of request or name of the server processing the request if the Host header is not available.', $this->plugin_constant ),
|
||||
'$request_uri' => __('The *original* request URI as received from the client including the args', $this->plugin_constant ),
|
||||
'$remote_user' => __('Name of user, authenticated by the Auth Basic Module', $this->plugin_constant ),
|
||||
'$cookie_PHPSESSID' => __('PHP Session Cookie ID, if set ( empty if not )', $this->plugin_constant ),
|
||||
//'$cookie_COOKnginy IE' => __('Value of COOKIE', $this->plugin_constant ),
|
||||
//'$http_HEADER' => __('Value of HTTP request header HEADER ( lowercase, dashes converted to underscore )', $this->plugin_constant ),
|
||||
//'$query_string' => __('Full request URI after rewrites', $this->plugin_constant ),
|
||||
//'' => __('', $this->plugin_constant ),
|
||||
'$scheme' => __('The HTTP scheme (i.e. http, https).', 'wp-ffpc'),
|
||||
'$host' => __('Host in the header of request or name of the server processing the request if the Host header is not available.', 'wp-ffpc'),
|
||||
'$request_uri' => __('The *original* request URI as received from the client including the args', 'wp-ffpc'),
|
||||
'$remote_user' => __('Name of user, authenticated by the Auth Basic Module', 'wp-ffpc'),
|
||||
'$cookie_PHPSESSID' => __('PHP Session Cookie ID, if set ( empty if not )', 'wp-ffpc'),
|
||||
'$accept_lang' => __('First HTTP Accept Lang set in the HTTP request', 'wp-ffpc'),
|
||||
//'$cookie_COOKnginy IE' => __('Value of COOKIE', 'wp-ffpc'),
|
||||
//'$http_HEADER' => __('Value of HTTP request header HEADER ( lowercase, dashes converted to underscore )', 'wp-ffpc'),
|
||||
//'$query_string' => __('Full request URI after rewrites', 'wp-ffpc'),
|
||||
//'' => __('', 'wp-ffpc'),
|
||||
);
|
||||
|
||||
/* get current wp_cron schedules */
|
||||
|
@ -181,7 +184,8 @@ class WP_FFPC extends PluginAbstract {
|
|||
public function plugin_post_init () {
|
||||
|
||||
/* initiate backend */
|
||||
$this->backend = new WP_FFPC_Backend ( $this->options );
|
||||
$backend_class = 'WP_FFPC_Backend_' . $this->options['cache_type'];
|
||||
$this->backend = new $backend_class ( $this->options );
|
||||
|
||||
/* re-save settings after update */
|
||||
add_action( 'upgrader_process_complete', array ( &$this->plugin_upgrade ), 10, 2 );
|
||||
|
@ -212,52 +216,56 @@ class WP_FFPC extends PluginAbstract {
|
|||
add_action( self::precache_id , array( &$this, 'precache_coldrun' ) );
|
||||
|
||||
/* link on to settings for plugins page */
|
||||
$settings_link = ' » <a href="' . $this->settings_link . '">' . __( 'WP-FFPC Settings', $this->plugin_constant ) . '</a>';
|
||||
$settings_link = ' » <a href="' . $this->settings_link . '">' . __( 'WP-FFPC Settings', 'wp-ffpc') . '</a>';
|
||||
|
||||
/* check & collect errors */
|
||||
/* look for WP_CACHE */
|
||||
if ( ! WP_CACHE )
|
||||
$this->errors['no_wp_cache'] = __("WP_CACHE is disabled. Without that, cache plugins, like this, will not work. Please add `define ( 'WP_CACHE', true );` to the beginning of wp-config.php.", $this->plugin_constant );
|
||||
$this->errors['no_wp_cache'] = __("WP_CACHE is disabled. Without that, cache plugins, like this, will not work. Please add `define ( 'WP_CACHE', true );` to the beginning of wp-config.php.", 'wp-ffpc');
|
||||
|
||||
/* look for global settings array */
|
||||
if ( ! $this->global_saved )
|
||||
$this->errors['no_global_saved'] = sprintf( __('This site was reached as %s ( according to PHP HTTP_HOST ) and there are no settings present for this domain in the WP-FFPC configuration yet. Please save the <a href="%s">WP-FFPC settings</a> for the domain or fix the webserver configuration!', $this->plugin_constant), $_SERVER['HTTP_HOST'], $settings_link);
|
||||
$this->errors['no_global_saved'] = sprintf( __('This site was reached as %s ( according to PHP HTTP_HOST ) and there are no settings present for this domain in the WP-FFPC configuration yet. Please save the %s for the domain or fix the webserver configuration!', 'wp-ffpc'), $_SERVER['HTTP_HOST'], $settings_link);
|
||||
|
||||
/* look for writable acache file */
|
||||
if ( file_exists ( $this->acache ) && ! is_writable ( $this->acache ) )
|
||||
$this->errors['no_acache_write'] = sprintf(__('Advanced cache file (%s) is not writeable!<br />Please change the permissions on the file.', $this->plugin_constant), $this->acache);
|
||||
$this->errors['no_acache_write'] = sprintf(__('Advanced cache file (%s) is not writeable!<br />Please change the permissions on the file.', 'wp-ffpc'), $this->acache);
|
||||
|
||||
/* look for acache file */
|
||||
if ( ! file_exists ( $this->acache ) )
|
||||
$this->errors['no_acache_saved'] = sprintf (__('Advanced cache file is yet to be generated, please save <a href="%s">WP-FFPC settings!</a>', $this->plugin_constant), $settings_link );
|
||||
$this->errors['no_acache_saved'] = sprintf (__('Advanced cache file is yet to be generated, please save %s', 'wp-ffpc'), $settings_link );
|
||||
|
||||
/* look for extensions that should be available */
|
||||
foreach ( $this->valid_cache_type as $backend => $status ) {
|
||||
if ( $this->options['cache_type'] == $backend && ! $status ) {
|
||||
$this->errors['no_backend'] = sprintf ( __('%s cache backend activated but no PHP %s extension was found.<br />Please either use different backend or activate the module!', $this->plugin_constant), $backend, $backend );
|
||||
$this->errors['no_backend'] = sprintf ( __('%s cache backend activated but no PHP %s extension was found.<br />Please either use different backend or activate the module!', 'wp-ffpc'), $backend, $backend );
|
||||
}
|
||||
}
|
||||
|
||||
/* get the current runtime configuration for memcache in PHP because Memcache in binary mode is really problematic */
|
||||
if ( extension_loaded ( 'memcache' ) ) {
|
||||
$memcache_settings = ini_get_all( 'memcache' );
|
||||
if ( !empty ( $memcache_settings ) && $this->options['cache_type'] == 'memcache' )
|
||||
if ( !empty ( $memcache_settings ) && $this->options['cache_type'] == 'memcache' && isset($memcache_settings['memcache.protocol']) )
|
||||
{
|
||||
$memcache_protocol = strtolower($memcache_settings['memcache.protocol']['local_value']);
|
||||
if ( $memcache_protocol == 'binary' ) {
|
||||
$this->errors['memcached_binary'] = __('WARNING: Memcache extension is configured to use binary mode. This is very buggy and the plugin will most probably not work correctly. <br />Please consider to change either to ASCII mode or to Memcached extension.', $this->plugin_constant );
|
||||
$this->errors['memcached_binary'] = __('WARNING: Memcache extension is configured to use binary mode. This is very buggy and the plugin will most probably not work correctly. <br />Please consider to change either to ASCII mode or to Memcached extension.', 'wp-ffpc');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$filtered_errors = apply_filters('wp_ffpc_post_init_errors_array', $this->errors);
|
||||
if ($filtered_errors) {
|
||||
if ( php_sapi_name() != "cli" ) {
|
||||
foreach ( $this->errors as $e => $msg ) {
|
||||
$this->utils->alert ( $msg, LOG_WARNING, $this->network );
|
||||
static::alert ( $msg, LOG_WARNING, $this->network );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_filter('contextual_help', array( &$this, 'plugin_admin_nginx_help' ), 10, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* activation hook function, to be extended
|
||||
*/
|
||||
|
@ -294,7 +302,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
$this->update_global_config();
|
||||
$this->plugin_options_save();
|
||||
$this->deploy_advanced_cache();
|
||||
$this->utils->alert ( __('WP-FFPC settings were upgraded; please double check if everything is still working correctly.', $this->plugin_constant ), LOG_NOTICE );
|
||||
static::alert ( __('WP-FFPC settings were upgraded; please double check if everything is still working correctly.', 'wp-ffpc'), LOG_NOTICE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -304,11 +312,11 @@ class WP_FFPC extends PluginAbstract {
|
|||
*/
|
||||
public function plugin_extend_admin_init () {
|
||||
/* save parameter updates, if there are any */
|
||||
if ( isset( $_POST[ $this->button_flush ] ) && check_admin_referer ( $this->plugin_constant ) ) {
|
||||
if ( isset( $_POST[ $this->button_flush ] ) && check_admin_referer ( 'wp-ffpc') ) {
|
||||
/* remove precache log entry */
|
||||
$this->utils->_delete_option( self::precache_log );
|
||||
static::_delete_option( self::precache_log );
|
||||
/* remove precache timestamp entry */
|
||||
$this->utils->_delete_option( self::precache_timestamp );
|
||||
static::_delete_option( self::precache_timestamp );
|
||||
|
||||
/* remove precache logfile */
|
||||
if ( @file_exists ( $this->precache_logfile ) ) {
|
||||
|
@ -327,7 +335,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
}
|
||||
|
||||
/* save parameter updates, if there are any */
|
||||
if ( isset( $_POST[ $this->button_precache ] ) && check_admin_referer ( $this->plugin_constant ) ) {
|
||||
if ( isset( $_POST[ $this->button_precache ] ) && check_admin_referer ( 'wp-ffpc') ) {
|
||||
/* is no shell function is possible, fail */
|
||||
if ( $this->shell_function == false ) {
|
||||
$this->status = 5;
|
||||
|
@ -349,7 +357,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
|
||||
/* add our page only if the screenid is correct */
|
||||
if ( strpos( $screen_id, $this->plugin_settings_page ) ) {
|
||||
$contextual_help = __('<p>Please visit <a href="http://wordpress.org/support/plugin/wp-ffpc">the official support forum of the plugin</a> for help.</p>', $this->plugin_constant );
|
||||
$contextual_help = __('<p>Please visit <a href="http://wordpress.org/support/plugin/wp-ffpc">the official support forum of the plugin</a> for help.</p>', 'wp-ffpc');
|
||||
|
||||
/* [TODO] give detailed information on errors & troubleshooting
|
||||
get_current_screen()->add_help_tab( array(
|
||||
|
@ -366,6 +374,28 @@ class WP_FFPC extends PluginAbstract {
|
|||
return $contextual_help;
|
||||
}
|
||||
|
||||
/**
|
||||
* admin help panel
|
||||
*/
|
||||
public function plugin_admin_nginx_help($contextual_help, $screen_id ) {
|
||||
|
||||
/* add our page only if the screenid is correct */
|
||||
if ( strpos( $screen_id, $this->plugin_settings_page ) ) {
|
||||
$content = __('<h3>Sample config for nginx to utilize the data entries</h3>', 'wp-ffpc');
|
||||
$content .= __('<div class="update-nag">This is not meant to be a copy-paste configuration; you most probably have to tailor it to your needs.</div>', 'wp-ffpc');
|
||||
$content .= __('<div class="update-nag"><strong>In case you are about to use nginx to fetch memcached entries directly and to use SHA1 hash keys, you will need an nginx version compiled with <a href="http://wiki.nginx.org/HttpSetMiscModule">HttpSetMiscModule</a>. Otherwise set_sha1 function is not available in nginx.</strong></div>', 'wp-ffpc');
|
||||
$content .= '<code><pre>' . $this->nginx_example() . '</pre></code>';
|
||||
|
||||
get_current_screen()->add_help_tab( array(
|
||||
'id' => 'wp-ffpc-nginx-help',
|
||||
'title' => __( 'nginx example', 'wp-ffpc' ),
|
||||
'content' => $content,
|
||||
) );
|
||||
}
|
||||
|
||||
return $contextual_help;
|
||||
}
|
||||
|
||||
/**
|
||||
* admin panel, the admin page displayed for plugin settings
|
||||
*/
|
||||
|
@ -376,6 +406,18 @@ class WP_FFPC extends PluginAbstract {
|
|||
if( ! function_exists( 'current_user_can' ) || ! current_user_can( 'manage_options' ) ){
|
||||
die( );
|
||||
}
|
||||
|
||||
/* woo_commenrce page url */
|
||||
if ( class_exists( 'WooCommerce' ) ) {
|
||||
$page_wc_checkout=str_replace( home_url(), '', wc_get_page_permalink( 'checkout' ) );
|
||||
$page_wc_myaccount=str_replace( home_url(), '', wc_get_page_permalink( 'myaccount' ) );
|
||||
$page_wc_cart=str_replace( home_url(), '', wc_get_page_permalink( 'cart' ) );
|
||||
$wcapi='^/wc-api|^/\?wc-api=';
|
||||
$this->options['nocache_woocommerce_url'] = '^'.$page_wc_checkout.'|^'.$page_wc_myaccount.'|^'.$page_wc_cart.'|'.$wcapi;
|
||||
} else {
|
||||
$this->options['nocache_woocommerce_url'] = '';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
|
@ -396,28 +438,28 @@ class WP_FFPC extends PluginAbstract {
|
|||
* if options were saved, display saved message
|
||||
*/
|
||||
if (isset($_GET[ self::key_save ]) && $_GET[ self::key_save ]=='true' || $this->status == 1) { ?>
|
||||
<div class='updated settings-error'><p><strong><?php _e( 'Settings saved.' , $this->plugin_constant ) ?></strong></p></div>
|
||||
<div class='updated settings-error'><p><strong><?php _e( 'Settings saved.' , 'wp-ffpc') ?></strong></p></div>
|
||||
<?php }
|
||||
|
||||
/**
|
||||
* if options were delete, display delete message
|
||||
*/
|
||||
if (isset($_GET[ self::key_delete ]) && $_GET[ self::key_delete ]=='true' || $this->status == 2) { ?>
|
||||
<div class='error'><p><strong><?php _e( 'Plugin options deleted.' , $this->plugin_constant ) ?></strong></p></div>
|
||||
<div class='error'><p><strong><?php _e( 'Plugin options deleted.' , 'wp-ffpc') ?></strong></p></div>
|
||||
<?php }
|
||||
|
||||
/**
|
||||
* if options were saved
|
||||
*/
|
||||
if (isset($_GET[ self::key_flush ]) && $_GET[ self::key_flush ]=='true' || $this->status == 3) { ?>
|
||||
<div class='updated settings-error'><p><strong><?php _e( "Cache flushed." , $this->plugin_constant ); ?></strong></p></div>
|
||||
<div class='updated settings-error'><p><strong><?php _e( "Cache flushed." , 'wp-ffpc'); ?></strong></p></div>
|
||||
<?php }
|
||||
|
||||
/**
|
||||
* if options were saved, display saved message
|
||||
*/
|
||||
if ( ( isset($_GET[ self::key_precache ]) && $_GET[ self::key_precache ]=='true' ) || $this->status == 4) { ?>
|
||||
<div class='updated settings-error'><p><strong><?php _e( 'Precache process was started, it is now running in the background, please be patient, it may take a very long time to finish.' , $this->plugin_constant ) ?></strong></p></div>
|
||||
<div class='updated settings-error'><p><strong><?php _e( 'Precache process was started, it is now running in the background, please be patient, it may take a very long time to finish.' , 'wp-ffpc') ?></strong></p></div>
|
||||
<?php }
|
||||
|
||||
/**
|
||||
|
@ -425,28 +467,29 @@ class WP_FFPC extends PluginAbstract {
|
|||
*/
|
||||
?>
|
||||
|
||||
<h2><?php echo $this->plugin_name ; _e( ' settings', $this->plugin_constant ) ; ?></h2>
|
||||
<h2><?php echo $this->plugin_name ; _e( ' settings', 'wp-ffpc') ; ?></h2>
|
||||
|
||||
<div class="updated">
|
||||
<p><strong><?php _e ( 'Driver: ' , $this->plugin_constant); echo $this->options['cache_type']; ?></strong></p>
|
||||
<p><strong><?php _e ( 'Driver: ' , 'wp-ffpc'); echo $this->options['cache_type']; ?></strong></p>
|
||||
<?php
|
||||
/* only display backend status if memcache-like extension is running */
|
||||
if ( strstr ( $this->options['cache_type'], 'memcache') ) {
|
||||
?><p><?php
|
||||
_e( '<strong>Backend status:</strong><br />', $this->plugin_constant );
|
||||
_e( '<strong>Backend status:</strong><br />', 'wp-ffpc');
|
||||
|
||||
/* we need to go through all servers */
|
||||
$servers = $this->backend->status();
|
||||
error_log(__CLASS__ . ':' .json_encode($servers));
|
||||
if ( is_array( $servers ) && !empty ( $servers ) ) {
|
||||
foreach ( $servers as $server_string => $status ) {
|
||||
echo $server_string ." => ";
|
||||
|
||||
if ( $status == 0 )
|
||||
_e ( '<span class="error-msg">down</span><br />', $this->plugin_constant );
|
||||
_e ( '<span class="error-msg">down</span><br />', 'wp-ffpc');
|
||||
elseif ( ( $this->options['cache_type'] == 'memcache' && $status > 0 ) || $status == 1 )
|
||||
_e ( '<span class="ok-msg">up & running</span><br />', $this->plugin_constant );
|
||||
_e ( '<span class="ok-msg">up & running</span><br />', 'wp-ffpc');
|
||||
else
|
||||
_e ( '<span class="error-msg">unknown, please try re-saving settings!</span><br />', $this->plugin_constant );
|
||||
_e ( '<span class="error-msg">unknown, please try re-saving settings!</span><br />', 'wp-ffpc');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,7 +498,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
</div>
|
||||
<form autocomplete="off" method="post" action="#" id="<?php echo $this->plugin_constant ?>-settings" class="plugin-admin">
|
||||
|
||||
<?php wp_nonce_field( $this->plugin_constant ); ?>
|
||||
<?php wp_nonce_field( 'wp-ffpc'); ?>
|
||||
|
||||
<?php $switcher_tabs = $this->plugin_admin_panel_get_tabs(); ?>
|
||||
<ul class="tabs">
|
||||
|
@ -465,65 +508,88 @@ class WP_FFPC extends PluginAbstract {
|
|||
</ul>
|
||||
|
||||
<fieldset id="<?php echo $this->plugin_constant ?>-type">
|
||||
<legend><?php _e( 'Set cache type', $this->plugin_constant ); ?></legend>
|
||||
<legend><?php _e( 'Set cache type', 'wp-ffpc'); ?></legend>
|
||||
<dl>
|
||||
<dt>
|
||||
<label for="cache_type"><?php _e('Select backend', $this->plugin_constant); ?></label>
|
||||
<label for="cache_type"><?php _e('Select backend', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<select name="cache_type" id="cache_type">
|
||||
<?php $this->print_select_options ( $this->select_cache_type , $this->options['cache_type'], $this->valid_cache_type ) ?>
|
||||
</select>
|
||||
<span class="description"><?php _e('Select backend storage driver', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Select backend storage driver', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="expire"><?php _e('Expiration time for posts', $this->plugin_constant); ?></label>
|
||||
<label for="expire"><?php _e('Expiration time for posts', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="number" name="expire" id="expire" value="<?php echo $this->options['expire']; ?>" />
|
||||
<span class="description"><?php _e('Sets validity time of post entry in seconds, including custom post types and pages.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Sets validity time of post entry in seconds, including custom post types and pages.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="expire_taxonomy"><?php _e('Expiration time for taxonomy', $this->plugin_constant); ?></label>
|
||||
<label for="browsercache"><?php _e('Browser cache expiration time of posts', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="number" name="browsercache" id="browsercache" value="<?php echo $this->options['browsercache']; ?>" />
|
||||
<span class="description"><?php _e('Sets validity time of posts/pages/singles for the browser cache.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="expire_taxonomy"><?php _e('Expiration time for taxonomy', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="number" name="expire_taxonomy" id="expire_taxonomy" value="<?php echo $this->options['expire_taxonomy']; ?>" />
|
||||
<span class="description"><?php _e('Sets validity time of taxonomy entry in seconds, including custom taxonomy.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Sets validity time of taxonomy entry in seconds, including custom taxonomy.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="expire_home"><?php _e('Expiration time for home', $this->plugin_constant); ?></label>
|
||||
<label for="browsercache_taxonomy"><?php _e('Browser cache expiration time of taxonomy', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="number" name="browsercache_taxonomy" id="browsercache_taxonomy" value="<?php echo $this->options['browsercache_taxonomy']; ?>" />
|
||||
<span class="description"><?php _e('Sets validity time of taxonomy for the browser cache.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="expire_home"><?php _e('Expiration time for home', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="number" name="expire_home" id="expire_home" value="<?php echo $this->options['expire_home']; ?>" />
|
||||
<span class="description"><?php _e('Sets validity time of home.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Sets validity time of home on server side.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="charset"><?php _e('Charset', $this->plugin_constant); ?></label>
|
||||
<label for="browsercache_home"><?php _e('Browser cache expiration time of home', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="number" name="browsercache_home" id="browsercache_home" value="<?php echo $this->options['browsercache_home']; ?>" />
|
||||
<span class="description"><?php _e('Sets validity time of home for the browser cache.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="charset"><?php _e('Charset', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" name="charset" id="charset" value="<?php echo $this->options['charset']; ?>" />
|
||||
<span class="description"><?php _e('Charset of HTML and XML (pages and feeds) data.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Charset of HTML and XML (pages and feeds) data.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="invalidation_method"><?php _e('Cache invalidation method', $this->plugin_constant); ?></label>
|
||||
<label for="invalidation_method"><?php _e('Cache invalidation method', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<select name="invalidation_method" id="invalidation_method">
|
||||
<?php $this->print_select_options ( $this->select_invalidation_method , $this->options['invalidation_method'] ) ?>
|
||||
</select>
|
||||
<div class="description"><?php _e('Select cache invalidation method.', $this->plugin_constant); ?>
|
||||
<div class="description"><?php _e('Select cache invalidation method.', 'wp-ffpc'); ?>
|
||||
<ol>
|
||||
<?php
|
||||
$invalidation_method_description = array(
|
||||
'clears everything in storage, <strong>including values set by other applications</strong>',
|
||||
'clear only the modified posts entry, everything else remains in cache',
|
||||
'removes all taxonomy term cache ( categories, tags, home, etc ) and the modified post as well<br><strong>Caution! Slows down page/post saving when there are many tags.</strong>',
|
||||
'clear cache for modified post and posts index page'
|
||||
'unvalidates post and the taxonomy related to the post',
|
||||
);
|
||||
foreach ($this->select_invalidation_method AS $current_key => $current_invalidation_method) {
|
||||
printf('<li><em>%1$s</em> - %2$s</li>', $current_invalidation_method, $invalidation_method_description[$current_key]);
|
||||
|
@ -533,35 +599,35 @@ class WP_FFPC extends PluginAbstract {
|
|||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="comments_invalidate"><?php _e('Invalidate on comment actions', $this->plugin_constant); ?></label>
|
||||
<label for="comments_invalidate"><?php _e('Invalidate on comment actions', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="checkbox" name="comments_invalidate" id="comments_invalidate" value="1" <?php checked($this->options['comments_invalidate'],true); ?> />
|
||||
<span class="description"><?php _e('Trigger cache invalidation when a comments is posted, edited, trashed. ', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Trigger cache invalidation when a comments is posted, edited, trashed. ', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="prefix_data"><?php _e('Data prefix', $this->plugin_constant); ?></label>
|
||||
<label for="prefix_data"><?php _e('Data prefix', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" name="prefix_data" id="prefix_data" value="<?php echo $this->options['prefix_data']; ?>" />
|
||||
<span class="description"><?php _e('Prefix for HTML content keys, can be used in nginx.<br /><strong>WARNING</strong>: changing this will result the previous cache to becomes invalid!<br />If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Prefix for HTML content keys, can be used in nginx.<br /><strong>WARNING</strong>: changing this will result the previous cache to becomes invalid!<br />If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="prefix_meta"><?php _e('Meta prefix', $this->plugin_constant); ?></label>
|
||||
<label for="prefix_meta"><?php _e('Meta prefix', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" name="prefix_meta" id="prefix_meta" value="<?php echo $this->options['prefix_meta']; ?>" />
|
||||
<span class="description"><?php _e('Prefix for meta content keys, used only with PHP processing.<br /><strong>WARNING</strong>: changing this will result the previous cache to becomes invalid!', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Prefix for meta content keys, used only with PHP processing.<br /><strong>WARNING</strong>: changing this will result the previous cache to becomes invalid!', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="key"><?php _e('Key scheme', $this->plugin_constant); ?></label>
|
||||
<label for="key"><?php _e('Key scheme', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" name="key" id="key" value="<?php echo $this->options['key']; ?>" />
|
||||
<span class="description"><?php _e('Key layout; <strong>use the guide below to change it</strong>.<br /><strong>WARNING</strong>: changing this will result the previous cache to becomes invalid!<br />If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', $this->plugin_constant); ?><?php ?></span>
|
||||
<span class="description"><?php _e('Key layout; <strong>use the guide below to change it</strong>.<br /><strong>WARNING</strong>: changing this will result the previous cache to becomes invalid!<br />If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', 'wp-ffpc'); ?><?php ?></span>
|
||||
<dl class="description"><?php
|
||||
foreach ( $this->list_uri_vars as $uri => $desc ) {
|
||||
echo '<dt>'. $uri .'</dt><dd>'. $desc .'</dd>';
|
||||
|
@ -569,37 +635,47 @@ class WP_FFPC extends PluginAbstract {
|
|||
?></dl>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="hashkey"><?php _e('SHA1 hash key', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="checkbox" name="hashkey" id="hashkey" value="1" <?php checked($this->options['hashkey'],true); ?> />
|
||||
<span class="description"><?php _e('Occasionally URL can be too long to be used as key for the backend storage, especially with memcached. Turn on this feature to use SHA1 hash of the URL as key instead. Please be aware that you have to add ( or uncomment ) a line and a <strong>module</strong> in nginx if you want nginx to fetch the data directly; for details, please see the nginx example tab.', 'wp-ffpc'); ?>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="<?php echo $this->plugin_constant ?>-debug">
|
||||
<legend><?php _e( 'Debug & in-depth settings', $this->plugin_constant ); ?></legend>
|
||||
<h3><?php _e('Notes', $this->plugin_constant);?></h3>
|
||||
<p><?php _e('The former method of debug logging flag has been removed. In case you need debug log from WP-FFPC please set the <a href="http://codex.wordpress.org/WP_DEBUG">WP_DEBUG</a> constant `true`.<br /> This will enable NOTICE level messages apart from the WARNING level ones which are always displayed.', $this->plugin_constant); ?></p>
|
||||
<legend><?php _e( 'Debug & in-depth settings', 'wp-ffpc'); ?></legend>
|
||||
<h3><?php _e('Notes', 'wp-ffpc');?></h3>
|
||||
<p><?php _e('The former method of debug logging flag has been removed. In case you need debug log from WP-FFPC please set both the <a href="http://codex.wordpress.org/WP_DEBUG">WP_DEBUG</a> and the WP_FFPC__DEBUG_MODE constants `true` in wp-config.php.<br /> This will enable NOTICE level messages apart from the WARNING level ones which are always displayed.', 'wp-ffpc'); ?></p>
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
<label for="pingback_header"><?php _e('Enable X-Pingback header preservation', $this->plugin_constant); ?></label>
|
||||
<label for="pingback_header"><?php _e('Enable X-Pingback header preservation', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="checkbox" name="pingback_header" id="pingback_header" value="1" <?php checked($this->options['pingback_header'],true); ?> />
|
||||
<span class="description"><?php _e('Preserve X-Pingback URL in response header.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Preserve X-Pingback URL in response header.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="response_header"><?php _e("Add X-Cache-Engine header", $this->plugin_constant); ?></label>
|
||||
<label for="response_header"><?php _e("Add X-Cache-Engine header", 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="checkbox" name="response_header" id="response_header" value="1" <?php checked($this->options['response_header'],true); ?> />
|
||||
<span class="description"><?php _e('Add X-Cache-Engine HTTP header to HTTP responses.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Add X-Cache-Engine HTTP header to HTTP responses.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="generate_time"><?php _e("Add HTML debug comment", $this->plugin_constant); ?></label>
|
||||
<label for="generate_time"><?php _e("Add HTML debug comment", 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="checkbox" name="generate_time" id="generate_time" value="1" <?php checked($this->options['generate_time'],true); ?> />
|
||||
<span class="description"><?php _e('Adds comment string including plugin name, cache engine and page generation time to every generated entry before closing <body> tag.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Adds comment string including plugin name, cache engine and page generation time to every generated entry before closing <body> tag.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
@ -607,70 +683,77 @@ class WP_FFPC extends PluginAbstract {
|
|||
</fieldset>
|
||||
|
||||
<fieldset id="<?php echo $this->plugin_constant ?>-exceptions">
|
||||
<legend><?php _e( 'Set cache additions/excepions', $this->plugin_constant ); ?></legend>
|
||||
<legend><?php _e( 'Set cache additions/excepions', 'wp-ffpc'); ?></legend>
|
||||
<dl>
|
||||
<dt>
|
||||
<label for="cache_loggedin"><?php _e('Enable cache for logged in users', $this->plugin_constant); ?></label>
|
||||
<label for="cache_loggedin"><?php _e('Enable cache for logged in users', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="checkbox" name="cache_loggedin" id="cache_loggedin" value="1" <?php checked($this->options['cache_loggedin'],true); ?> />
|
||||
<span class="description"><?php _e('Cache pages even if user is logged in.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Cache pages even if user is logged in.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<?php _e("Excludes", $this->plugin_constant); ?></label>
|
||||
<?php _e("Excludes", 'wp-ffpc'); ?></label>
|
||||
<dd>
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:16%; text-align:left"><label for="nocache_home"><?php _e("Exclude home", $this->plugin_constant); ?></label></th>
|
||||
<th style="width:16%; text-align:left"><label for="nocache_feed"><?php _e("Exclude feeds", $this->plugin_constant); ?></label></th>
|
||||
<th style="width:16%; text-align:left"><label for="nocache_archive"><?php _e("Exclude archives", $this->plugin_constant); ?></label></th>
|
||||
<th style="width:16%; text-align:left"><label for="nocache_page"><?php _e("Exclude pages", $this->plugin_constant); ?></label></th>
|
||||
<th style="width:16%; text-align:left"><label for="nocache_single"><?php _e("Exclude singulars", $this->plugin_constant); ?></label></th>
|
||||
<th style="width:17%; text-align:left"><label for="nocache_dyn"><?php _e("Dynamic requests", $this->plugin_constant); ?></label></th>
|
||||
<th style="width:13%; text-align:left"><label for="nocache_home"><?php _e("Exclude home", 'wp-ffpc'); ?></label></th>
|
||||
<th style="width:13%; text-align:left"><label for="nocache_feed"><?php _e("Exclude feeds", 'wp-ffpc'); ?></label></th>
|
||||
<th style="width:13%; text-align:left"><label for="nocache_archive"><?php _e("Exclude archives", 'wp-ffpc'); ?></label></th>
|
||||
<th style="width:13%; text-align:left"><label for="nocache_page"><?php _e("Exclude pages", 'wp-ffpc'); ?></label></th>
|
||||
<th style="width:13%; text-align:left"><label for="nocache_single"><?php _e("Exclude singulars", 'wp-ffpc'); ?></label></th>
|
||||
<th style="width:17%; text-align:left"><label for="nocache_dyn"><?php _e("Dynamic requests", 'wp-ffpc'); ?></label></th>
|
||||
<th style="width:18%; text-align:left"><label for="nocache_woocommerce"><?php _e("WooCommerce", 'wp-ffpc'); ?></label></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" name="nocache_home" id="nocache_home" value="1" <?php checked($this->options['nocache_home'],true); ?> />
|
||||
<span class="description"><?php _e('Never cache home.', $this->plugin_constant); ?>
|
||||
<span class="description"><?php _e('Never cache home.', 'wp-ffpc'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="nocache_feed" id="nocache_feed" value="1" <?php checked($this->options['nocache_feed'],true); ?> />
|
||||
<span class="description"><?php _e('Never cache feeds.', $this->plugin_constant); ?>
|
||||
<span class="description"><?php _e('Never cache feeds.', 'wp-ffpc'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="nocache_archive" id="nocache_archive" value="1" <?php checked($this->options['nocache_archive'],true); ?> />
|
||||
<span class="description"><?php _e('Never cache archives.', $this->plugin_constant); ?>
|
||||
<span class="description"><?php _e('Never cache archives.', 'wp-ffpc'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="nocache_page" id="nocache_page" value="1" <?php checked($this->options['nocache_page'],true); ?> />
|
||||
<span class="description"><?php _e('Never cache pages.', $this->plugin_constant); ?>
|
||||
<span class="description"><?php _e('Never cache pages.', 'wp-ffpc'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="nocache_single" id="nocache_single" value="1" <?php checked($this->options['nocache_single'],true); ?> />
|
||||
<span class="description"><?php _e('Never cache singulars.', $this->plugin_constant); ?>
|
||||
<span class="description"><?php _e('Never cache singulars.', 'wp-ffpc'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="nocache_dyn" id="nocache_dyn" value="1" <?php checked($this->options['nocache_dyn'],true); ?> />
|
||||
<span class="description"><?php _e('Exclude every URL with "?" in it.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Exclude every URL with "?" in it.', 'wp-ffpc'); ?></span>
|
||||
</td>
|
||||
<td>
|
||||
<input type="hidden" name="nocache_woocommerce_url" id="nocache_woocommerce_url" value="<?php if(isset( $this->options['nocache_woocommerce_url'] ) ) echo $this->options['nocache_woocommerce_url']; ?>" />
|
||||
<input type="checkbox" name="nocache_woocommerce" id="nocache_woocommerce" value="1" <?php checked($this->options['nocache_woocommerce'],true); ?> />
|
||||
<span class="description"><?php _e('Exclude dynamic WooCommerce page.', 'wp-ffpc');?>
|
||||
<?php if(isset( $this->options['nocache_woocommerce_url'] ) ) echo "<br />Url:".$this->options['nocache_woocommerce_url']; ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<dt>
|
||||
<label for="nocache_cookies"><?php _e("Exclude based on cookies", $this->plugin_constant); ?></label>
|
||||
<label for="nocache_cookies"><?php _e("Exclude based on cookies", 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" name="nocache_cookies" id="nocache_cookies" value="<?php if(isset( $this->options['nocache_cookies'] ) ) echo $this->options['nocache_cookies']; ?>" />
|
||||
<span class="description"><?php _e('Exclude content based on cookies names starting with this from caching. Separate multiple cookies names with commas.<br />If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Exclude content based on cookies names starting with this from caching. Separate multiple cookies names with commas.<br />If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="nocache_url"><?php _e("Don't cache following URL paths - use with caution!", $this->plugin_constant); ?></label>
|
||||
<label for="nocache_url"><?php _e("Don't cache following URL paths - use with caution!", 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<textarea name="nocache_url" id="nocache_url" rows="3" cols="100" class="large-text code"><?php
|
||||
|
@ -678,81 +761,86 @@ class WP_FFPC extends PluginAbstract {
|
|||
echo $this->options['nocache_url'];
|
||||
}
|
||||
?></textarea>
|
||||
<span class="description"><?php _e('Regular expressions use you must! e.g. <em>pattern1|pattern2|etc</em>', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Regular expressions use you must! e.g. <em>pattern1|pattern2|etc</em>', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="nocache_comment"><?php _e("Exclude from cache based on content", 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input name="nocache_comment" id="nocache_comment" type="text" value="<?php if(isset( $this->options['nocache_comment'] ) ) echo $this->options['nocache_comment']; ?>" />
|
||||
<span class="description"><?php _e('Enter a regex pattern that will trigger excluding content from caching. Eg. <!--nocache-->. Regular expressions use you must! e.g. <em>pattern1|pattern2|etc</em><br />
|
||||
<strong>WARNING:</strong> be careful where you display this, because it will apply to any content, including archives, collection pages, singles, anything. If empty, this setting will be ignored.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="<?php echo $this->plugin_constant ?>-servers">
|
||||
<legend><?php _e('Backend server settings', $this->plugin_constant); ?></legend>
|
||||
<legend><?php _e('Backend server settings', 'wp-ffpc'); ?></legend>
|
||||
<dl>
|
||||
<dt>
|
||||
<label for="hosts"><?php _e('Hosts', $this->plugin_constant); ?></label>
|
||||
<label for="hosts"><?php _e('Hosts', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" name="hosts" id="hosts" value="<?php echo $this->options['hosts']; ?>" />
|
||||
<span class="description">
|
||||
<?php _e('List of backends, with the following syntax: <br />- in case of TCP based connections, list the servers as host1:port1,host2:port2,... . Do not add trailing , and always separate host and port with : .<br />- in2.0.0b1 case using unix sockets with the Memcache driver: unix:// ', $this->plugin_constant); ?></span>
|
||||
<?php _e('List of backends, with the following syntax: <br />- in case of TCP based connections, list the servers as host1:port1,host2:port2,... . Do not add trailing , and always separate host and port with : .<br />- for a unix socket enter: unix://[socket_path]', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="memcached_binary"><?php _e('Enable memcached binary mode', $this->plugin_constant); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="checkbox" name="memcached_binary" id="memcached_binary" value="1" <?php checked($this->options['memcached_binary'],true); ?> />
|
||||
<span class="description"><?php _e('Some memcached proxies and implementations only support the ASCII protocol.', $this->plugin_constant); ?></span>
|
||||
</dd>
|
||||
|
||||
<?php
|
||||
if ( strstr ( $this->options['cache_type'], 'memcached') && extension_loaded ( 'memcached' ) && version_compare( phpversion( 'memcached' ) , '2.0.0', '>=' ) || ( $this->options['cache_type'] == 'redis' ) ) { ?>
|
||||
<h3><?php _e('Authentication ( only for SASL enabled Memcached)')?></h3>
|
||||
<?php
|
||||
if ( ! ini_get('memcached.use_sasl') && ( !empty( $this->options['authuser'] ) || !empty( $this->options['authpass'] ) ) ) { ?>
|
||||
<div class="error"><p><strong><?php _e( 'WARNING: you\'ve entered username and/or password for memcached authentication ( or your browser\'s autocomplete did ) which will not work unless you enable memcached sasl in the PHP settings: add `memcached.use_sasl=1` to php.ini' , $this->plugin_constant ) ?></strong></p></div>
|
||||
<div class="error"><p><strong><?php _e( 'WARNING: you\'ve entered username and/or password for memcached authentication ( or your browser\'s autocomplete did ) which will not work unless you enable memcached sasl in the PHP settings: add `memcached.use_sasl=1` to php.ini' , 'wp-ffpc') ?></strong></p></div>
|
||||
<?php } ?>
|
||||
<dt>
|
||||
<label for="authuser"><?php _e('Authentication: username', $this->plugin_constant); ?></label>
|
||||
<label for="authuser"><?php _e('Authentication: username', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" autocomplete="off" name="authuser" id="authuser" value="<?php echo $this->options['authuser']; ?>" />
|
||||
<span class="description">
|
||||
<?php _e('Username for authentication with memcached backends', $this->plugin_constant); ?></span>
|
||||
<?php _e('Username for authentication with backends', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="authpass"><?php _e('Authentication: password', $this->plugin_constant); ?></label>
|
||||
<label for="authpass"><?php _e('Authentication: password', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="password" autocomplete="off" name="authpass" id="authpass" value="<?php echo $this->options['authpass']; ?>" />
|
||||
<span class="description">
|
||||
<?php _e('Password for authentication with memcached backends - WARNING, the password will be stored plain-text since it needs to be used!', $this->plugin_constant); ?></span>
|
||||
<?php _e('Password for authentication with for backends - WARNING, the password will be stored in an unsecure format!', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
<?php } ?>
|
||||
|
||||
<h3><?php _e('Memcached specific settings')?></h3>
|
||||
<dt>
|
||||
<label for="memcached_binary"><?php _e('Enable memcached binary mode', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="checkbox" name="memcached_binary" id="memcached_binary" value="1" <?php checked($this->options['memcached_binary'],true); ?> />
|
||||
<span class="description"><?php _e('Some memcached proxies and implementations only support the ASCII protocol.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="<?php echo $this->plugin_constant ?>-nginx">
|
||||
<legend><?php _e('Sample config for nginx to utilize the data entries', $this->plugin_constant); ?></legend>
|
||||
<pre><?php echo $this->nginx_example(); ?></pre>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="<?php echo $this->plugin_constant ?>-precache">
|
||||
<legend><?php _e('Precache settings & log from previous pre-cache generation', $this->plugin_constant); ?></legend>
|
||||
<legend><?php _e('Precache settings & log from previous pre-cache generation', 'wp-ffpc'); ?></legend>
|
||||
|
||||
<dt>
|
||||
<label for="precache_schedule"><?php _e('Precache schedule', $this->plugin_constant); ?></label>
|
||||
<label for="precache_schedule"><?php _e('Precache schedule', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<select name="precache_schedule" id="precache_schedule">
|
||||
<?php $this->print_select_options ( $this->select_schedules, $this->options['precache_schedule'] ) ?>
|
||||
</select>
|
||||
<span class="description"><?php _e('Schedule autorun for precache with WP-Cron', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Schedule autorun for precache with WP-Cron', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
|
||||
<?php
|
||||
|
||||
$gentime = $this->utils->_get_option( self::precache_timestamp, $this->network );
|
||||
$log = $this->utils->_get_option( self::precache_log, $this->network );
|
||||
$gentime = static::_get_option( self::precache_timestamp, $this->network );
|
||||
$log = static::_get_option( self::precache_log, $this->network );
|
||||
|
||||
if ( @file_exists ( $this->precache_logfile ) ) {
|
||||
$logtime = filemtime ( $this->precache_logfile );
|
||||
|
@ -760,14 +848,14 @@ class WP_FFPC extends PluginAbstract {
|
|||
/* update precache log in DB if needed */
|
||||
if ( $logtime > $gentime ) {
|
||||
$log = file ( $this->precache_logfile );
|
||||
$this->utils->_update_option( self::precache_log , $log, $this->network );
|
||||
$this->utils->_update_option( self::precache_timestamp , $logtime, $this->network );
|
||||
static::_update_option( self::precache_log , $log, $this->network );
|
||||
static::_update_option( self::precache_timestamp , $logtime, $this->network );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( empty ( $log ) ) {
|
||||
_e('No precache log was found!', $this->plugin_constant);
|
||||
_e('No precache log was found!', 'wp-ffpc');
|
||||
}
|
||||
else { ?>
|
||||
<p><strong><?php _e( 'Time of run: ') ?><?php echo date('r', $gentime ); ?></strong></p>
|
||||
|
@ -791,59 +879,59 @@ class WP_FFPC extends PluginAbstract {
|
|||
<?php } ?>
|
||||
</fieldset>
|
||||
|
||||
<?php do_action('wp_ffpc_admin_panel_tabs_extra_content', $this->plugin_constant); ?>
|
||||
<?php do_action('wp_ffpc_admin_panel_tabs_extra_content', 'wp-ffpc'); ?>
|
||||
|
||||
<p class="clear">
|
||||
<input class="button-primary" type="submit" name="<?php echo $this->button_save ?>" id="<?php echo $this->button_save ?>" value="<?php _e('Save Changes', $this->plugin_constant ) ?>" />
|
||||
<input class="button-primary" type="submit" name="<?php echo $this->button_save ?>" id="<?php echo $this->button_save ?>" value="<?php _e('Save Changes', 'wp-ffpc') ?>" />
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
<form method="post" action="#" id="<?php echo $this->plugin_constant ?>-commands" class="plugin-admin" style="padding-top:2em;">
|
||||
|
||||
<?php wp_nonce_field( $this->plugin_constant ); ?>
|
||||
<?php wp_nonce_field( 'wp-ffpc'); ?>
|
||||
|
||||
<ul class="tabs">
|
||||
<li><a href="#<?php echo $this->plugin_constant ?>-precache" class="wp-switch-editor"><?php _e( 'Precache', $this->plugin_constant ); ?></a></li>
|
||||
<li><a href="#<?php echo $this->plugin_constant ?>-flush" class="wp-switch-editor"><?php _e( 'Empty cache', $this->plugin_constant ); ?></a></li>
|
||||
<li><a href="#<?php echo $this->plugin_constant ?>-reset" class="wp-switch-editor"><?php _e( 'Reset settings', $this->plugin_constant ); ?></a></li>
|
||||
<li><a href="#<?php echo $this->plugin_constant ?>-precache" class="wp-switch-editor"><?php _e( 'Precache', 'wp-ffpc'); ?></a></li>
|
||||
<li><a href="#<?php echo $this->plugin_constant ?>-flush" class="wp-switch-editor"><?php _e( 'Empty cache', 'wp-ffpc'); ?></a></li>
|
||||
<li><a href="#<?php echo $this->plugin_constant ?>-reset" class="wp-switch-editor"><?php _e( 'Reset settings', 'wp-ffpc'); ?></a></li>
|
||||
</ul>
|
||||
|
||||
<fieldset id="<?php echo $this->plugin_constant ?>-precache">
|
||||
<legend><?php _e( 'Precache', $this->plugin_constant ); ?></legend>
|
||||
<legend><?php _e( 'Precache', 'wp-ffpc'); ?></legend>
|
||||
<dl>
|
||||
<dt>
|
||||
<?php if ( ( isset( $_GET[ self::key_precache_disabled ] ) && $_GET[ self::key_precache_disabled ] =='true' ) || $this->status == 5 || $this->shell_function == false ) { ?>
|
||||
<strong><?php _e( "Precache functionality is disabled due to unavailable system call function. <br />Since precaching may take a very long time, it's done through a background CLI process in order not to run out of max execution time of PHP. Please enable one of the following functions if you whish to use precaching: " , $this->plugin_constant ) ?><?php echo join( ',' , $this->shell_possibilities ); ?></strong>
|
||||
<strong><?php _e( "Precache functionality is disabled due to unavailable system call function. <br />Since precaching may take a very long time, it's done through a background CLI process in order not to run out of max execution time of PHP. Please enable one of the following functions if you whish to use precaching: " , 'wp-ffpc') ?><?php echo join( ',' , $this->shell_possibilities ); ?></strong>
|
||||
<?php }
|
||||
else { ?>
|
||||
<input class="button-secondary" type="submit" name="<?php echo $this->button_precache ?>" id="<?php echo $this->button_precache ?>" value="<?php _e('Pre-cache', $this->plugin_constant ) ?>" />
|
||||
<input class="button-secondary" type="submit" name="<?php echo $this->button_precache ?>" id="<?php echo $this->button_precache ?>" value="<?php _e('Pre-cache', 'wp-ffpc') ?>" />
|
||||
<?php } ?>
|
||||
</dt>
|
||||
<dd>
|
||||
<span class="description"><?php _e('Start a background process that visits all permalinks of all blogs it can found thus forces WordPress to generate cached version of all the pages.<br />The plugin tries to visit links of taxonomy terms without the taxonomy name as well. This may generate 404 hits, please be prepared for these in your logfiles if you plan to pre-cache.', $this->plugin_constant); ?></span>
|
||||
<span class="description"><?php _e('Start a background process that visits all permalinks of all blogs it can found thus forces WordPress to generate cached version of all the pages.<br />The plugin tries to visit links of taxonomy terms without the taxonomy name as well. This may generate 404 hits, please be prepared for these in your logfiles if you plan to pre-cache.', 'wp-ffpc'); ?></span>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<fieldset id="<?php echo $this->plugin_constant ?>-flush">
|
||||
<legend><?php _e( 'Precache', $this->plugin_constant ); ?></legend>
|
||||
<legend><?php _e( 'Precache', 'wp-ffpc'); ?></legend>
|
||||
<dl>
|
||||
<dt>
|
||||
<input class="button-warning" type="submit" name="<?php echo $this->button_flush ?>" id="<?php echo $this->button_flush ?>" value="<?php _e('Clear cache', $this->plugin_constant ) ?>" />
|
||||
<input class="button-warning" type="submit" name="<?php echo $this->button_flush ?>" id="<?php echo $this->button_flush ?>" value="<?php _e('Clear cache', 'wp-ffpc') ?>" />
|
||||
</dt>
|
||||
<dd>
|
||||
<span class="description"><?php _e ( "Clear all entries in the storage, including the ones that were set by other processes.", $this->plugin_constant ); ?> </span>
|
||||
<span class="description"><?php _e ( "Clear all entries in the storage, including the ones that were set by other processes.", 'wp-ffpc'); ?> </span>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<fieldset id="<?php echo $this->plugin_constant ?>-reset">
|
||||
<legend><?php _e( 'Precache', $this->plugin_constant ); ?></legend>
|
||||
<legend><?php _e( 'Precache', 'wp-ffpc'); ?></legend>
|
||||
<dl>
|
||||
<dt>
|
||||
<input class="button-warning" type="submit" name="<?php echo $this->button_delete ?>" id="<?php echo $this->button_delete ?>" value="<?php _e('Reset options', $this->plugin_constant ) ?>" />
|
||||
<input class="button-warning" type="submit" name="<?php echo $this->button_delete ?>" id="<?php echo $this->button_delete ?>" value="<?php _e('Reset options', 'wp-ffpc') ?>" />
|
||||
</dt>
|
||||
<dd>
|
||||
<span class="description"><?php _e ( "Reset settings to defaults.", $this->plugin_constant ); ?> </span>
|
||||
<span class="description"><?php _e ( "Reset settings to defaults.", 'wp-ffpc'); ?> </span>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
@ -854,12 +942,11 @@ class WP_FFPC extends PluginAbstract {
|
|||
|
||||
private function plugin_admin_panel_get_tabs() {
|
||||
$default_tabs = array(
|
||||
'type' => __( 'Cache type', $this->plugin_constant ),
|
||||
'debug' => __( 'Debug & in-depth', $this->plugin_constant ),
|
||||
'exceptions' => __( 'Cache exceptions', $this->plugin_constant ),
|
||||
'servers' => __( 'Backend settings', $this->plugin_constant ),
|
||||
'nginx' => __( 'nginx', $this->plugin_constant ),
|
||||
'precache' => __( 'Precache & precache log', $this->plugin_constant )
|
||||
'type' => __( 'Cache type', 'wp-ffpc'),
|
||||
'debug' => __( 'Debug & in-depth', 'wp-ffpc'),
|
||||
'exceptions' => __( 'Cache exceptions', 'wp-ffpc'),
|
||||
'servers' => __( 'Backend settings', 'wp-ffpc'),
|
||||
'precache' => __( 'Precache & precache log', 'wp-ffpc')
|
||||
);
|
||||
|
||||
return apply_filters('wp_ffpc_admin_panel_tabs', $default_tabs);
|
||||
|
@ -876,11 +963,11 @@ class WP_FFPC extends PluginAbstract {
|
|||
if ( $this->options['precache_schedule'] != 'null' ) {
|
||||
/* clear all other schedules before adding a new in order to replace */
|
||||
wp_clear_scheduled_hook ( self::precache_id );
|
||||
$this->utils->log ( $this->plugin_constant, __( 'Scheduling WP-CRON event', $this->plugin_constant ) );
|
||||
static::debug ( $this->plugin_constant, __( 'Scheduling WP-CRON event', 'wp-ffpc') );
|
||||
$this->scheduled = wp_schedule_event( time(), $this->options['precache_schedule'] , self::precache_id );
|
||||
}
|
||||
elseif ( ( !isset($this->options['precache_schedule']) || $this->options['precache_schedule'] == 'null' ) && !empty( $schedule ) ) {
|
||||
$this->utils->log ( $this->plugin_constant, __('Clearing WP-CRON scheduled hook ' , $this->plugin_constant ) );
|
||||
static::debug ( $this->plugin_constant, __('Clearing WP-CRON scheduled hook ' , 'wp-ffpc') );
|
||||
wp_clear_scheduled_hook ( self::precache_id );
|
||||
}
|
||||
|
||||
|
@ -938,11 +1025,11 @@ class WP_FFPC extends PluginAbstract {
|
|||
}
|
||||
|
||||
/* look for previous config leftovers */
|
||||
$try = get_site_option( $this->plugin_constant );
|
||||
$try = get_site_option( 'wp-ffpc');
|
||||
/* network option key changed, remove & migrate the leftovers if there's any */
|
||||
if ( !empty ( $try ) && $this->network ) {
|
||||
/* clean it up, we don't use it anymore */
|
||||
delete_site_option ( $this->plugin_constant );
|
||||
delete_site_option ( 'wp-ffpc');
|
||||
|
||||
if ( empty ( $options ) && array_key_exists ( $this->global_config_key, $try ) ) {
|
||||
$options = $try [ $this->global_config_key ];
|
||||
|
@ -975,17 +1062,17 @@ class WP_FFPC extends PluginAbstract {
|
|||
*/
|
||||
private function deploy_advanced_cache( ) {
|
||||
|
||||
/* in case advanced-cache.php was already there, remove it */
|
||||
if ( @file_exists( $this->acache ))
|
||||
unlink ($this->acache);
|
||||
|
||||
/* is deletion was unsuccessful, die, we have no rights to do that, fail */
|
||||
if ( @file_exists( $this->acache ))
|
||||
if (!touch($this->acache)) {
|
||||
error_log('Generating advanced-cache.php failed: '.$this->acache.' is not writable');
|
||||
return false;
|
||||
}
|
||||
|
||||
/* if no active site left no need for advanced cache :( */
|
||||
if ( empty ( $this->global_config ) )
|
||||
if ( empty ( $this->global_config ) ) {
|
||||
error_log('Generating advanced-cache.php failed: Global config is empty');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* add the required includes and generate the needed code */
|
||||
$string[] = "<?php";
|
||||
|
@ -995,6 +1082,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
|
||||
/* write the file and start caching from this point */
|
||||
return file_put_contents( $this->acache, join( "\n" , $string ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1007,11 +1095,20 @@ class WP_FFPC extends PluginAbstract {
|
|||
/* read the sample file */
|
||||
$nginx = file_get_contents ( $this->nginx_sample );
|
||||
|
||||
if ( isset($this->options['hashkey']) && $this->options['hashkey'] == true )
|
||||
$mckeys = ' set_sha1 $memcached_sha1_key $memcached_raw_key;
|
||||
set $memcached_key DATAPREFIX$memcached_sha1_key;';
|
||||
else
|
||||
$mckeys = ' set $memcached_key DATAPREFIX$memcached_raw_key;';
|
||||
|
||||
$nginx = str_replace ( 'HASHEDORNOT' , $mckeys , $nginx );
|
||||
|
||||
/* replace the data prefix with the configured one */
|
||||
$to_replace = array ( 'DATAPREFIX' , 'SERVERROOT', 'SERVERLOG' );
|
||||
$replace_with = array ( $this->options['prefix_data'] . $this->options['key'] , ABSPATH, $_SERVER['SERVER_NAME'] );
|
||||
$to_replace = array ( 'DATAPREFIX' , 'KEYFORMAT', 'SERVERROOT', 'SERVERLOG' );
|
||||
$replace_with = array ( $this->options['prefix_data'], $this->options['key'] , ABSPATH, $_SERVER['SERVER_NAME'] );
|
||||
$nginx = str_replace ( $to_replace , $replace_with , $nginx );
|
||||
|
||||
|
||||
/* set upstream servers from configured servers, best to get from the actual backend */
|
||||
$servers = $this->backend->get_servers();
|
||||
$nginx_servers = '';
|
||||
|
@ -1052,14 +1149,15 @@ class WP_FFPC extends PluginAbstract {
|
|||
}
|
||||
|
||||
/* add custom response header if specified in the options */
|
||||
if( $this->options['response_header'] ){
|
||||
if( $this->options['response_header'] && strstr ( $this->options['cache_type'], 'memcached') ) {
|
||||
$response_header = 'add_header X-Cache-Engine "WP-FFPC with ' . $this->options['cache_type'] .' via nginx";';
|
||||
$nginx = str_replace ( 'RESPONSE_HEADER' , $response_header , $nginx );
|
||||
} else{
|
||||
}
|
||||
else {
|
||||
$nginx = str_replace ( 'RESPONSE_HEADER' , '' , $nginx );
|
||||
}
|
||||
|
||||
return $nginx;
|
||||
return htmlspecialchars($nginx);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1162,8 +1260,8 @@ class WP_FFPC extends PluginAbstract {
|
|||
if ( $this->network ) {
|
||||
/* list all blogs */
|
||||
global $wpdb;
|
||||
$pfix = empty ( $wpdb->base_prefix ) ? 'wp' : $wpdb->base_prefix;
|
||||
$blog_list = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ". $pfix ."_blogs ORDER BY blog_id", '' ) );
|
||||
$pfix = empty ( $wpdb->base_prefix ) ? 'wp_' : $wpdb->base_prefix;
|
||||
$blog_list = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ". $pfix ."blogs ORDER BY blog_id", '' ) );
|
||||
|
||||
foreach ($blog_list as $blog) {
|
||||
if ( $blog->archived != 1 && $blog->spam != 1 && $blog->deleted != 1) {
|
||||
|
@ -1239,7 +1337,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
}
|
||||
|
||||
/* in case the bloglinks are relative links add the base url, site specific */
|
||||
$baseurl = empty( $url ) ? $this->utils->_site_url() : $url;
|
||||
$baseurl = empty( $url ) ? static::_site_url() : $url;
|
||||
if ( !strstr( $permalink, $baseurl ) ) {
|
||||
$permalink = $baseurl . $permalink;
|
||||
}
|
||||
|
|
|
@ -1,52 +1,11 @@
|
|||
http {
|
||||
|
||||
# memcached servers, generated according to wp-ffpc config
|
||||
upstream memcached-servers {
|
||||
MEMCACHED_SERVERS
|
||||
}
|
||||
|
||||
# PHP-FPM upstream; change it accordingly to your local config!
|
||||
upstream php-fpm {
|
||||
server 127.0.0.1:9000;
|
||||
}
|
||||
|
||||
server {
|
||||
## Listen ports
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
# use _ if you want to accept everything, or replace _ with domain
|
||||
server_name _;
|
||||
|
||||
# root of WordPress
|
||||
root SERVERROOT;
|
||||
|
||||
# set up logging
|
||||
access_log /var/log/nginx/SERVERLOG.access.log;
|
||||
error_log /var/log/nginx/SERVERLOG.error.log;
|
||||
|
||||
## PHP5-FPM
|
||||
location ~ (\.php) {
|
||||
# these settings are usually in fastcgi_params
|
||||
|
||||
fastcgi_index index.php;
|
||||
fastcgi_connect_timeout 10;
|
||||
fastcgi_send_timeout 180;
|
||||
fastcgi_read_timeout 180;
|
||||
fastcgi_buffer_size 512k;
|
||||
fastcgi_buffers 4 256k;
|
||||
fastcgi_busy_buffers_size 512k;
|
||||
fastcgi_temp_file_write_size 512k;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
fastcgi_keep_conn on;
|
||||
|
||||
# --- contents of {nginx config dir, usuall /etc/nginx}/fastcgi_params ---
|
||||
fastcgi_param SCRIPT_NAME $script_name;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
fastcgi_param QUERY_STRING $query_string;
|
||||
fastcgi_param REQUEST_METHOD $request_method;
|
||||
fastcgi_param CONTENT_TYPE $content_type;
|
||||
fastcgi_param CONTENT_LENGTH $content_length;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $script_name;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
fastcgi_param DOCUMENT_URI $document_uri;
|
||||
fastcgi_param DOCUMENT_ROOT $document_root;
|
||||
|
@ -58,19 +17,39 @@ MEMCACHED_SERVERS
|
|||
fastcgi_param SERVER_ADDR $server_addr;
|
||||
fastcgi_param SERVER_PORT $server_port;
|
||||
fastcgi_param SERVER_NAME $server_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
|
||||
fastcgi_param HTTPS $https if_not_empty;
|
||||
fastcgi_param SSL_PROTOCOL $ssl_protocol if_not_empty;
|
||||
fastcgi_param SSL_CIPHER $ssl_cipher if_not_empty;
|
||||
fastcgi_param SSL_SESSION_ID $ssl_session_id if_not_empty;
|
||||
fastcgi_param SSL_CLIENT_VERIFY $ssl_client_verify if_not_empty;
|
||||
fastcgi_param REDIRECT_STATUS 200;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_connect_timeout 10;
|
||||
fastcgi_send_timeout 360;
|
||||
fastcgi_read_timeout 3600;
|
||||
fastcgi_buffer_size 512k;
|
||||
fastcgi_buffers 512 512k;
|
||||
fastcgi_intercept_errors on;
|
||||
|
||||
# uncomment these for HTTPS usage
|
||||
#fastcgi_param HTTPS $https if_not_empty;
|
||||
#fastcgi_param SSL_PROTOCOL $ssl_protocol if_not_empty;
|
||||
#fastcgi_param SSL_CIPHER $ssl_cipher if_not_empty;
|
||||
#fastcgi_param SSL_SESSION_ID $ssl_session_id if_not_empty;
|
||||
#fastcgi_param SSL_CLIENT_VERIFY $ssl_client_verify if_not_empty;
|
||||
|
||||
default_type text/html;
|
||||
set $memcached_key data-$scheme://$host$request_uri;
|
||||
|
||||
# --- part needs to go inside the http { } block of nginx ---
|
||||
# --- memcached ---
|
||||
upstream memcached {
|
||||
MEMCACHED_SERVERS
|
||||
}
|
||||
|
||||
# --- PHP-FPM upstream --- change it accordingly to your local config!
|
||||
upstream php-fpm {
|
||||
server 127.0.0.1:9000;
|
||||
}
|
||||
|
||||
|
||||
# --- part needs to go inside the server { } block of nginx ---
|
||||
set $memcached_raw_key KEYFORMAT;
|
||||
|
||||
HASHEDORNOT
|
||||
|
||||
set $memcached_request 1;
|
||||
|
||||
if ($request_method = POST ) {
|
||||
|
@ -89,24 +68,40 @@ MEMCACHED_SERVERS
|
|||
|
||||
COOKIES_EXCEPTION
|
||||
|
||||
|
||||
location ~ ^(?<script_name>.+?\.php)(?<path_info>.*)$ {
|
||||
default_type text/html;
|
||||
|
||||
if ( $memcached_request = 1) {
|
||||
RESPONSE_HEADER
|
||||
memcached_pass memcached-servers;
|
||||
error_page 404 = @nocache;
|
||||
break;
|
||||
memcached_pass memcached;
|
||||
error_page 404 = @fallback;
|
||||
}
|
||||
|
||||
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||
}
|
||||
|
||||
location @nocache {
|
||||
add_header X-Cache-Engine "not cached";
|
||||
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||
fastcgi_split_path_info ^(?<script_name>.+?\.php)(?<path_info>.*)$;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$script_name;
|
||||
fastcgi_param PATH_TRANSLATED $document_root$path_info;
|
||||
include params/fastcgi;
|
||||
fastcgi_keep_conn on;
|
||||
fastcgi_pass php-fpm;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php;
|
||||
try_files $uri $uri/ @rewrites;
|
||||
}
|
||||
|
||||
location @fallback {
|
||||
# add_header X-Cache-Engine "WP-FFPC nginx via memcached - fallback - not cached";
|
||||
|
||||
fastcgi_split_path_info ^(?<script_name>.+?\.php)(?<path_info>.*)$;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$script_name;
|
||||
fastcgi_param PATH_TRANSLATED $document_root$path_info;
|
||||
include fastcgi_params;
|
||||
fastcgi_keep_conn on;
|
||||
fastcgi_pass php-fpm;
|
||||
}
|
||||
|
||||
location @rewrites {
|
||||
rewrite ^ /index.php last;
|
||||
}
|
||||
|
||||
|
|
21
wp-ffpc.php
21
wp-ffpc.php
|
@ -3,13 +3,15 @@
|
|||
Plugin Name: WP-FFPC
|
||||
Plugin URI: https://github.com/petermolnar/wp-ffpc
|
||||
Description: WordPress in-memory full page cache plugin
|
||||
Version: 1.7.9
|
||||
Version: 1.11.2
|
||||
Author: Peter Molnar <hello@petermolnar.eu>
|
||||
Author URI: http://petermolnar.eu/
|
||||
Author URI: http://petermolnar.net/
|
||||
License: GPLv3
|
||||
Text Domain: wp-ffpc
|
||||
Domain Path: /languages/
|
||||
*/
|
||||
|
||||
/* Copyright 2010-2014 Peter Molnar ( hello@petermolnar.eu )
|
||||
/*Copyright 2010-2017 Peter Molnar ( hello@petermolnar.eu )
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 3, as
|
||||
|
@ -25,6 +27,8 @@ License: GPLv3
|
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA02110-1301USA
|
||||
*/
|
||||
|
||||
defined('ABSPATH') or die("Walk away.");
|
||||
|
||||
include_once ( 'wp-ffpc-class.php' );
|
||||
|
||||
$wp_ffpc_defaults= array (
|
||||
|
@ -32,6 +36,9 @@ $wp_ffpc_defaults = array (
|
|||
'memcached_binary' => false,
|
||||
'authpass' => '',
|
||||
'authuser' => '',
|
||||
'browsercache' => 0,
|
||||
'browsercache_home' => 0,
|
||||
'browsercache_taxonomy' => 0,
|
||||
'expire' => 300,
|
||||
'expire_home' => 300,
|
||||
'expire_taxonomy' => 300,
|
||||
|
@ -49,15 +56,17 @@ $wp_ffpc_defaults = array (
|
|||
'nocache_page' => false,
|
||||
'nocache_cookies' => false,
|
||||
'nocache_dyn' => true,
|
||||
'nocache_woocommerce' => true,
|
||||
'nocache_woocommerce_url' => '',
|
||||
'nocache_url' => '^/wp-',
|
||||
'nocache_comment' => '',
|
||||
'response_header' => false,
|
||||
'generate_time' => false,
|
||||
'precache_schedule' => 'null',
|
||||
'key' => '$scheme://$host$request_uri',
|
||||
'comments_invalidate' => true,
|
||||
'pingback_header' => false,
|
||||
'hashkey' => false,
|
||||
);
|
||||
|
||||
$wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.7.9', 'WP-FFPC', $wp_ffpc_defaults, 'PeterMolnar_WordPressPlugins_wp-ffpc_HU' , 'WP-FFPC' , 'FA3NT7XDVHPWU' );
|
||||
|
||||
?>
|
||||
$wp_ffpc= new WP_FFPC ( 'wp-ffpc', '1.11.2', 'WP-FFPC', $wp_ffpc_defaults );
|
Loading…
Reference in a new issue