. */ // don't load directly - exit if add_action or plugins_url functions do not exist if ( ! defined( 'ABSPATH' ) || ! function_exists( 'add_action' ) || ! function_exists( 'plugins_url' ) ) { die(); } /*************************************************************************************************************************************************************************** DEFINES **************************************************************************************************************************************************************************/ ! defined( '__DIR__' ) && define( '__DIR__', realpath( dirname( __FILE__ ) ) ); // Added in PHP 5.3.0 if ( ! defined( 'AA_PP_DIR' ) ) { // WORDPRESS BUILTINS ! defined( 'WP_CONTENT_DIR' ) && define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); ! defined( 'WP_CONTENT_URL' ) && define( 'WP_CONTENT_URL', WP_SITEURL . '/wp-content' ); ! defined( 'WP_PLUGIN_DIR' ) && define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); ! defined( 'WP_PLUGIN_URL' ) && define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); ! defined( 'COOKIEPATH' ) && define( 'COOKIEPATH', preg_replace( '|https?://[^/]+|i', '', WP_HOME . '/' ) ); ! defined( 'SITECOOKIEPATH' ) && define( 'SITECOOKIEPATH', preg_replace( '|https?://[^/]+|i', '', WP_SITEURL . '/' ) ); ! defined( 'ADMIN_COOKIE_PATH' ) && define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); ! defined( 'PLUGINS_COOKIE_PATH' ) && define( 'PLUGINS_COOKIE_PATH', preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL ) ); // AA_PP DEFINES ! defined( 'AA_PP_HAS_ISCLOG' ) && define( 'AA_PP_HAS_ISCLOG', class_exists( 'ISCLOG' ) ); ! defined( 'AA_PP_DIR' ) && define( 'AA_PP_DIR', __DIR__ ); ! defined( 'AA_PP_FILE' ) && define( 'AA_PP_FILE', __FILE__ ); ! defined( 'AA_PP_URL' ) && define( 'AA_PP_URL', WP_PLUGIN_URL . '/' . basename( AA_PP_DIR ) ); //! defined( 'AA_PP_PATH' ) && define( 'AA_PP_PATH', plugin_dir_path( AA_PP_FILE ) ); //! defined( 'AA_PP_BASENAME' ) && define( 'AA_PP_BASENAME', plugin_basename( AA_PP_FILE ) ); } /** * Singleton return of AA_PP * * @return object AA_PP object */ function aa_pp_get_object() { //ISC_DEBUG && ISCLOG::ti(); static $aa_pp_object = null; if ( null === $aa_pp_object || ! is_object( $aa_pp_object ) ) { require_once AA_PP_DIR . '/includes/class-aa_pp.php'; $aa_pp_object = new AA_PP(); $AA_PP =& $aa_pp_object; } //ISC_DEBUG && ISCLOG::ti(); return $aa_pp_object; } if ( is_admin() ) : /** * A super efficient way to add the AA_PP->init() function to wordpress actions on init. * * @return void */ function aa_pp_init() { ISC_DEBUG && ISCLOG::ti(); $AA_PP = aa_pp_get_object(); $AA_PP->init(); ISC_DEBUG && ISCLOG::ti(); } add_action( 'init', 'aa_pp_init', 0 ); /** * Run on Activation * * @return void */ function aa_pp_activate() { ISC_DEBUG && ISCLOG::ti(); $AA_PP = aa_pp_get_object(); $AA_PP->activate(); ISC_DEBUG && ISCLOG::ti(); } register_activation_hook( __FILE__, 'aa_pp_activate' ); /** * Deactivate * * @return void */ function aa_pp_deactivate() { ISC_DEBUG && ISCLOG::ti(); $AA_PP = aa_pp_get_object(); $AA_PP->deactivate(); ISC_DEBUG && ISCLOG::ti(); } register_deactivation_hook( __FILE__, 'aa_pp_deactivate' ); /** * Uninstallation * * @return void */ function aa_pp_uninstall() { ISC_DEBUG && ISCLOG::ti(); $AA_PP = aa_pp_get_object(); $AA_PP->uninstall(); ISC_DEBUG && ISCLOG::ti(); } register_uninstall_hook( __FILE__, 'aa_pp_uninstall' ); /** * Add options link to plugin listing in backend * * @return void */ function aa_pp_plugin_action_links( $l ) { return array_merge( array( 'Settings' ), $l ); } add_filter( 'plugin_action_links_askapache-password-protect/askapache-password-protect.php', 'aa_pp_plugin_action_links' ); endif; // EOF