예제 #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();
 }
 /**
  * Set the path by type
  * @uses add_query_arg()
  * @return MslsAdminIconTaxonomy
  */
 public function set_path()
 {
     $args = array('taxonomy' => $this->type);
     $post_type = MslsTaxonomy::instance()->get_post_type();
     if (!empty($post_type)) {
         $args['post_type'] = $post_type;
     }
     $this->path = add_query_arg($args, $this->path);
     return $this;
 }
 /**
  * Init
  * @return MslsCustomColumnTaxonomy
  */
 public static function init()
 {
     $obj = new self();
     $options = MslsOptions::instance();
     if (!$options->is_excluded()) {
         $taxonomy = MslsTaxonomy::instance()->get_request();
         if (!empty($taxonomy)) {
             add_filter("manage_edit-{$taxonomy}_columns", array($obj, 'th'));
             add_action("manage_{$taxonomy}_custom_column", array($obj, 'column_default'), 10, 3);
             add_action("delete_{$taxonomy}", array($obj, 'delete'));
         }
     }
     return $obj;
 }
 /**
  * Verify the instance-method
  * @covers MslsTaxonomy::instance
  * @covers MslsTaxonomy::__construct
  */
 function test_instance_method()
 {
     $obj = MslsTaxonomy::instance();
     $this->assertInstanceOf('MslsTaxonomy', $obj);
     return $obj;
 }