Changeset 1611754
- Timestamp:
- 03/10/2017 07:55:31 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sm-sticky-clicky-star/trunk/sm-sticky-clicky-star.php
r1207225 r1611754 11 11 * Text Domain: sm_sticky_clicky_star 12 12 * 13 * @package sm-sticky-clicky-star13 * @package sm-sticky-clicky-star 14 14 * @category plugin 15 * @author Seth Carstens <seth.carstens@gmail.com>15 * @author Seth Carstens <seth.carstens@gmail.com> 16 16 */ 17 17 18 18 //avoid direct calls to this file, because now WP core and framework has been used 19 19 if ( ! function_exists( 'add_filter' ) ) { 20 header('Status: 403 Forbidden'); header('HTTP/1.1 403 Forbidden'); exit(); 20 header( 'Status: 403 Forbidden' ); 21 header( 'HTTP/1.1 403 Forbidden' ); 22 exit(); 21 23 } 22 24 23 if(!class_exists('sm_sticky_clicky_star')) 24 { 25 class sm_sticky_clicky_star 26 { 27 public $installed_dir; 28 public $installed_url; 25 require_once( 'class-sm-sticky-clicky-star.php' ); 29 26 30 /** 31 * Construct the plugin object 32 */ 33 public function __construct() 34 { 35 $this->installed_dir = dirname(__FILE__); 36 $this->installed_url = plugins_url('/', __FILE__); 37 //only load the sticky clicky star plugin functions if the user has the capability to "sticky" posts. 38 add_action('init', array($this,'init')); 39 } // END public function __construct 40 41 /** 42 * Initialize the plugin -either for admin (back end) or public (front end) 43 */ 44 function init() { 45 46 if(current_user_can('edit_others_posts') || current_user_can('edit_post_sticky') ) { 47 require_once($this->installed_dir.'/sm-sticky-clicky-star-admin.php'); 48 new sm_sticky_clicky_star_admin($this); 49 } 50 } 51 52 /** 53 * Activate the plugin 54 */ 55 public static function activate() 56 { 57 // get the "admin" role object and add capability 58 $role = get_role( 'administrator' ); 59 $role->add_cap( 'edit_post_sticky' ); 60 } // END public static function activate 61 62 /** 63 * Deactivate the plugin 64 */ 65 public static function deactivate() 66 { 67 global $wp_roles; 68 foreach (array_keys($wp_roles->roles) as $role) { 69 $wp_roles->remove_cap($role, 'edit_post_sticky'); 70 } 71 } // END public static function deactivate 72 73 } // END class sm_sticky_clicky_star 74 } // END if(!class_exists('sm_sticky_clicky_star')) 75 76 if(class_exists('sm_sticky_clicky_star')) 77 { 27 if ( class_exists( 'sm_sticky_clicky_star' ) ) { 78 28 // Installation and uninstallation hooks 79 register_activation_hook( __FILE__, array('sm_sticky_clicky_star', 'activate'));80 register_deactivation_hook( __FILE__, array('sm_sticky_clicky_star', 'deactivate'));29 register_activation_hook( __FILE__, array( 'sm_sticky_clicky_star', 'activate' ) ); 30 register_deactivation_hook( __FILE__, array( 'sm_sticky_clicky_star', 'deactivate' ) ); 81 31 82 32 // instantiate the plugin class
Note: See TracChangeset
for help on using the changeset viewer.