Пример #1
0
 if (function_exists('register_activation_hook')) {
     register_activation_hook(__FILE__, array($oUserAccessManager, 'install'));
 }
 //uninstall
 if (function_exists('register_uninstall_hook')) {
     register_uninstall_hook(__FILE__, 'userAccessManagerUninstall');
 } elseif (function_exists('register_deactivation_hook')) {
     //Fallback
     register_deactivation_hook(__FILE__, array($oUserAccessManager, 'uninstall'));
 }
 //deactivation
 if (function_exists('register_deactivation_hook')) {
     register_deactivation_hook(__FILE__, array($oUserAccessManager, 'deactivate'));
 }
 //Redirect
 $aUamOptions = $oUserAccessManager->getAdminOptions();
 if ($aUamOptions['redirect'] != 'false' || isset($_GET['uamgetfile'])) {
     add_filter('wp_headers', array($oUserAccessManager, 'redirect'), 10, 2);
 }
 //Actions
 if (function_exists('add_action')) {
     add_action('wp_print_scripts', array($oUserAccessManager, 'addScripts'));
     add_action('wp_print_styles', array($oUserAccessManager, 'addStyles'));
     add_action('admin_init', 'userAccessManagerAP');
     add_action('admin_menu', 'userAccessManagerAPMenu');
 }
 //Filters
 if (function_exists('add_filter')) {
     add_filter('wp_get_attachment_thumb_url', array($oUserAccessManager, 'getFileUrl'), 10, 2);
     add_filter('wp_get_attachment_url', array($oUserAccessManager, 'getFileUrl'), 10, 2);
     add_filter('the_posts', array($oUserAccessManager, 'showPost'));
 if (function_exists('register_activation_hook')) {
     register_activation_hook(__FILE__, array(&$userAccessManager, 'install'));
 }
 //uninstall
 if (function_exists('register_uninstall_hook')) {
     register_uninstall_hook(__FILE__, 'userAccessManagerUninstall');
 } elseif (function_exists('register_deactivation_hook')) {
     //Fallback
     register_deactivation_hook(__FILE__, array(&$userAccessManager, 'uninstall'));
 }
 //deactivation
 if (function_exists('register_deactivation_hook')) {
     register_deactivation_hook(__FILE__, array(&$userAccessManager, 'deactivate'));
 }
 //Redirect
 $uamOptions = $userAccessManager->getAdminOptions();
 if ($uamOptions['redirect'] != 'false' || isset($_GET['uamgetfile'])) {
     add_filter('wp_headers', array(&$userAccessManager, 'redirect'), 10, 2);
 }
 //Actions
 if (function_exists('add_action')) {
     add_action('wp_print_scripts', array(&$userAccessManager, 'addScripts'));
     add_action('wp_print_styles', array(&$userAccessManager, 'addStyles'));
     add_action('admin_init', 'userAccessManagerAP');
     add_action('admin_menu', 'userAccessManagerAPMenu');
 }
 //Filters
 if (function_exists('add_filter')) {
     add_filter('wp_get_attachment_thumb_url', array(&$userAccessManager, 'getFileUrl'), 10, 2);
     add_filter('wp_get_attachment_url', array(&$userAccessManager, 'getFileUrl'), 10, 2);
     add_filter('the_posts', array(&$userAccessManager, 'showPost'));