Ejemplo n.º 1
0
 /**
  * Factory method
  * @return MslsContentTypes
  */
 public static function create()
 {
     $_request = MslsPlugin::get_superglobals(array('taxonomy'));
     if ('' != $_request['taxonomy']) {
         return MslsTaxonomy::instance();
     }
     return MslsPostType::instance();
 }
 /**
  * Init
  * @return MslsCustomFilter
  */
 public static function init()
 {
     $obj = new self();
     $options = MslsOptions::instance();
     if (!$options->is_excluded()) {
         $post_type = MslsPostType::instance()->get_request();
         if (!empty($post_type)) {
             add_action('restrict_manage_posts', array($obj, 'add_filter'));
             add_filter('parse_query', array($obj, 'execute_filter'));
         }
     }
     return $obj;
 }
Ejemplo n.º 3
0
 /**
  * Init
  * @return MslsCustomColumn
  */
 public static function init()
 {
     $obj = new self();
     $options = MslsOptions::instance();
     if (!$options->is_excluded()) {
         $post_type = MslsPostType::instance()->get_request();
         if (!empty($post_type)) {
             add_filter("manage_{$post_type}_posts_columns", array($obj, 'th'));
             add_action("manage_{$post_type}_posts_custom_column", array($obj, 'td'), 10, 2);
             add_action('trashed_post', array($obj, 'delete'));
         }
     }
     return $obj;
 }
 /**
  * Verify the instance-method
  * @covers MslsPostType::instance
  * @covers MslsPostType::__construct
  */
 function test_instance_method()
 {
     $obj = MslsPostType::instance();
     $this->assertInstanceOf('MslsPostType', $obj);
     return $obj;
 }
 /**
  * Add
  */
 public function add()
 {
     foreach (MslsPostType::instance()->get() as $post_type) {
         add_meta_box('msls', __('Multisite Language Switcher', 'msls'), array($this, MslsOptions::instance()->activate_autocomplete ? 'render_input' : 'render_select'), $post_type, 'side', 'high');
     }
 }