コード例 #1
0
ファイル: Taxonomy.php プロジェクト: zhengxiexie/wordpress
 /** 
  * Constructor 
  *
  * Adds filters to allow overriding the gallery/overlay.
  */
 public function __construct($owner, $auto_register = true)
 {
     add_filter('myatu_bgm_active_gallery', array($this, 'onActiveGallery'), 20, 1);
     add_filter('myatu_bgm_active_overlay', array($this, 'onActiveOverlay'), 20, 1);
     add_filter('myatu_bgm_background_color', array($this, 'onBackgroundColor'), 20, 1);
     parent::__construct($owner, $auto_register);
 }
コード例 #2
0
ファイル: Submit.php プロジェクト: zhengxiexie/wordpress
 /** Constructor [Override] */
 public function __construct($owner, $auto_register = true)
 {
     parent::__construct($owner, false);
     // We sneak our own name instead of the auto-generated one, so WP will apply its own CSS.
     $this->name = 'submitdiv';
     if ($auto_register == true) {
         $this->register();
     }
 }
コード例 #3
0
ファイル: Single.php プロジェクト: zhengxiexie/wordpress
 /**
  * Constructor
  *
  * Adds a filter, to display the custom CSS
  */
 public function __construct($owner, $auto_register = true)
 {
     add_filter('myatu_bgm_active_gallery', array($this, 'onActiveGallery'), 25, 1);
     add_filter('myatu_bgm_active_overlay', array($this, 'onActiveOverlay'), 25, 1);
     add_filter('myatu_bgm_background_color', array($this, 'onBackgroundColor'), 25, 1);
     $active = true;
     // If we're on the admin side, check if there's sufficient rights to override the posts/pages
     if (is_admin()) {
         switch ($owner->options->single_post_override) {
             case 'admin':
                 if (!current_user_can('edit_theme_options')) {
                     $active = false;
                 }
                 break;
             case 'editor':
                 if (!current_user_can('edit_private_posts')) {
                     $active = false;
                 }
                 break;
             case 'author':
                 if (!current_user_can('publish_posts')) {
                     $active = false;
                 }
                 break;
             case 'contributor':
                 if (!current_user_can('edit_posts')) {
                     $active = false;
                 }
                 break;
             default:
                 $active = false;
                 // Failsafe
                 break;
         }
     }
     if ($active) {
         // Include Custom Post Types
         $this->pages = array_merge($this->pages, get_post_types(array('_builtin' => false, 'public' => true)));
         // Exclude our own Custom Post Type
         unset($this->pages[\Myatu\WordPress\BackgroundManager\Main::PT_GALLERY]);
         parent::__construct($owner, $auto_register);
     }
 }
コード例 #4
0
ファイル: Link.php プロジェクト: zhengxiexie/wordpress
 /** 
  * Constructor 
  *
  * Adds a filter, to override the image link
  */
 public function __construct($owner, $auto_register = true)
 {
     add_filter('myatu_bgm_image_link', array($this, 'onImageLink'), 15, 2);
     parent::__construct($owner, $auto_register);
 }
コード例 #5
0
ファイル: Stylesheet.php プロジェクト: zhengxiexie/wordpress
 /** 
  * Constructor 
  *
  * Adds a filter, to display the custom CSS
  */
 public function __construct($owner, $auto_register = true)
 {
     add_filter('myatu_bgm_custom_styles', array($this, 'onCustomStyles'), 15, 2);
     parent::__construct($owner, $auto_register);
 }