25 GNU General Public License for more details. |
25 GNU General Public License for more details. |
26 |
26 |
27 You should have received a copy of the GNU General Public License |
27 You should have received a copy of the GNU General Public License |
28 along with this program; if not, write to the Free Software |
28 along with this program; if not, write to the Free Software |
29 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
29 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
30 |
|
31 Copyright 2005-2015 Automattic, Inc. |
30 */ |
32 */ |
31 |
33 |
32 // Make sure we don't expose any info if called directly |
34 // Make sure we don't expose any info if called directly |
33 if ( !function_exists( 'add_action' ) ) { |
35 if ( !function_exists( 'add_action' ) ) { |
34 echo 'Hi there! I\'m just a plugin, not much I can do when called directly.'; |
36 echo 'Hi there! I\'m just a plugin, not much I can do when called directly.'; |
35 exit; |
37 exit; |
36 } |
38 } |
37 |
39 |
38 define( 'AKISMET_VERSION', '3.1.2' ); |
40 define( 'AKISMET_VERSION', '4.0.8' ); |
39 define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' ); |
41 define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' ); |
40 define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
41 define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
42 define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
42 define( 'AKISMET_DELETE_LIMIT', 100000 ); |
43 define( 'AKISMET_DELETE_LIMIT', 100000 ); |
43 |
44 |
44 register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) ); |
45 register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) ); |
45 register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) ); |
46 register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) ); |
46 |
47 |
47 require_once( AKISMET__PLUGIN_DIR . 'class.akismet.php' ); |
48 require_once( AKISMET__PLUGIN_DIR . 'class.akismet.php' ); |
48 require_once( AKISMET__PLUGIN_DIR . 'class.akismet-widget.php' ); |
49 require_once( AKISMET__PLUGIN_DIR . 'class.akismet-widget.php' ); |
|
50 require_once( AKISMET__PLUGIN_DIR . 'class.akismet-rest-api.php' ); |
49 |
51 |
50 add_action( 'init', array( 'Akismet', 'init' ) ); |
52 add_action( 'init', array( 'Akismet', 'init' ) ); |
51 |
53 |
52 if ( is_admin() ) { |
54 add_action( 'rest_api_init', array( 'Akismet_REST_API', 'init' ) ); |
|
55 |
|
56 if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
53 require_once( AKISMET__PLUGIN_DIR . 'class.akismet-admin.php' ); |
57 require_once( AKISMET__PLUGIN_DIR . 'class.akismet-admin.php' ); |
54 add_action( 'init', array( 'Akismet_Admin', 'init' ) ); |
58 add_action( 'init', array( 'Akismet_Admin', 'init' ) ); |
55 } |
59 } |
56 |
60 |
57 //add wrapper class around deprecated akismet functions that are referenced elsewhere |
61 //add wrapper class around deprecated akismet functions that are referenced elsewhere |
58 require_once( AKISMET__PLUGIN_DIR . 'wrapper.php' ); |
62 require_once( AKISMET__PLUGIN_DIR . 'wrapper.php' ); |
59 |
63 |
|
64 if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
65 require_once( AKISMET__PLUGIN_DIR . 'class.akismet-cli.php' ); |
|
66 } |