); return $menu_items; } /** * Adds a footer comment related to object cache to the strings. * * @param array $strings Existing footer strings. * @return array Modified footer strings. */ public function w3tc_footer_comment( $strings ) { $w3tc_o = Dispatcher::component( 'ObjectCache_WpObjectCache_Regular' ); $strings = $w3tc_o->w3tc_footer_comment( $strings ); return $strings; } /** * Collects usage statistics for the object cache. * * @param mixed $storage Data storage to collect statistics. * * @return void */ public function w3tc_usage_statistics_of_request( $storage ) { $w3tc_o = Dispatcher::component( 'ObjectCache_WpObjectCache_Regular' ); $w3tc_o->w3tc_usage_statistics_of_request( $storage ); } /** * Adds object cache metrics to the usage statistics. * * @param array $metrics Existing metrics. * * @return array Modified metrics. */ public function w3tc_usage_statistics_metrics( $metrics ) { $metrics = array_merge( $metrics, array( 'objectcache_get_total', 'objectcache_get_hits', 'objectcache_sets', 'objectcache_flushes', 'objectcache_time_ms', ) ); return $metrics; } /** * Adds object cache sources to the usage statistics. * * @param array $sources Existing sources. * * @return array Modified sources. */ public function w3tc_usage_statistics_sources( $sources ) { $w3tc_c = Dispatcher::config(); if ( 'apc' === $w3tc_c->get_string( 'objectcache.engine' ) ) { $sources['apc_servers']['objectcache'] = array( 'name' => __( 'Object Cache', 'w3-total-cache' ), ); } elseif ( 'memcached' === $w3tc_c->get_string( 'objectcache.engine' ) ) { $sources['memcached_servers']['objectcache'] = array( 'servers' => $w3tc_c->get_array( 'objectcache.memcached.servers' ), 'username' => $w3tc_c->get_string( 'objectcache.memcached.username' ), 'password' => $w3tc_c->get_string( 'objectcache.memcached.password' ), 'binary_protocol' => $w3tc_c->get_boolean( 'objectcache.memcached.binary_protocol' ), 'name' => __( 'Object Cache', 'w3-total-cache' ), ); } elseif ( 'redis' === $w3tc_c->get_string( 'objectcache.engine' ) ) { $sources['redis_servers']['objectcache'] = array( 'servers' => $w3tc_c->get_array( 'objectcache.redis.servers' ), 'verify_tls_certificates' => $w3tc_c->get_boolean( 'objectcache.redis.verify_tls_certificates' ), 'username' => $w3tc_c->get_boolean( 'objectcache.redis.username' ), 'dbid' => $w3tc_c->get_integer( 'objectcache.redis.dbid' ), 'password' => $w3tc_c->get_string( 'objectcache.redis.password' ), 'name' => __( 'Object Cache', 'w3-total-cache' ), ); } return $sources; } }