/**
  * Factory method
  *
  * @param int $id
  *
  * @return MslsOptionsTax
  */
 public static function create($id = 0)
 {
     if (is_admin()) {
         $obj = MslsContentTypes::create();
         $id = (int) $id;
         $req = $obj->acl_request();
     } else {
         $id = get_queried_object_id();
         $req = is_category() ? 'category' : (is_tag() ? 'post_tag' : '');
     }
     switch ($req) {
         case 'category':
             $options = new MslsOptionsTaxTermCategory($id);
             break;
         case 'post_tag':
             $options = new MslsOptionsTaxTerm($id);
             break;
         default:
             $options = new MslsOptionsTax($id);
     }
     if ($req) {
         add_filter('check_url', array($options, 'check_base'), 9, 2);
     } else {
         global $wp_rewrite;
         $options->with_front = !empty($wp_rewrite->extra_permastructs[$options->get_tax_query()]['with_front']);
     }
     return $options;
 }
 /**
  * Factory method
  * @return MslsAdminIcon
  */
 public static function create()
 {
     $obj = MslsContentTypes::create();
     $type = $obj->get_request();
     if ($obj->is_taxonomy()) {
         return new MslsAdminIconTaxonomy($type);
     }
     return new MslsAdminIcon($type);
 }
 /**
  * Factory method
  * @param int $id
  * @return MslsOptionsTax
  */
 public static function create($id = 0)
 {
     if (is_admin()) {
         $obj = MslsContentTypes::create();
         $id = (int) $id;
         $req = $obj->acl_request();
     } else {
         global $wp_query;
         $id = $wp_query->get_queried_object_id();
         $req = is_category() ? 'category' : (is_tag() ? 'post_tag' : '');
     }
     if ('category' == $req) {
         return new MslsOptionsTaxTermCategory($id);
     } elseif ('post_tag' == $req) {
         return new MslsOptionsTaxTerm($id);
     }
     return new MslsOptionsTax($id);
 }
 /**
  * Factory method
  * @param int $id
  * @return MslsOptions
  */
 public static function create($id = 0)
 {
     if (is_admin()) {
         $id = (int) $id;
         if (MslsContentTypes::create()->is_taxonomy()) {
             return MslsOptionsTax::create($id);
         }
         return new MslsOptionsPost($id);
     }
     if (self::is_main_page()) {
         return new MslsOptions();
     } elseif (self::is_tax_page()) {
         return MslsOptionsTax::create();
     } elseif (self::is_query_page()) {
         return MslsOptionsQuery::create();
     }
     global $wp_query;
     return new MslsOptionsPost($wp_query->get_queried_object_id());
 }
 /**
  * Factory method
  *
  * @param int $id
  *
  * @return MslsOptions
  */
 public static function create($id = 0)
 {
     if (is_admin()) {
         $id = (int) $id;
         if (MslsContentTypes::create()->is_taxonomy()) {
             return MslsOptionsTax::create($id);
         }
         return new MslsOptionsPost($id);
     }
     if (self::is_main_page()) {
         $options = new MslsOptions();
     } elseif (self::is_tax_page()) {
         $options = MslsOptionsTax::create();
     } elseif (self::is_query_page()) {
         $options = MslsOptionsQuery::create();
     } else {
         $options = new MslsOptionsPost(get_queried_object_id());
     }
     add_filter('check_url', array($options, 'check_for_blog_slug'), 10, 2);
     return $options;
 }
 /**
  * Print the input fields
  * Returns true if the blogcollection is not empty
  * @param StdClass $tag
  * @param string $title_format
  * @param string $item_format
  * @return boolean
  */
 public function the_input($tag, $title_format, $item_format)
 {
     $blogs = MslsBlogCollection::instance()->get();
     if ($blogs) {
         $term_id = is_object($tag) ? $tag->term_id : 0;
         $mydata = MslsOptionsTax::create($term_id);
         $type = MslsContentTypes::create()->get_request();
         printf($title_format, __('Multisite Language Switcher', 'multisite-language-switcher'));
         foreach ($blogs as $blog) {
             $this->print_option($blog, $type, $mydata, $item_format);
         }
         return true;
     }
     return false;
 }
 /**
  * Set calls the save method if taxonomy is set
  * @param int $term_id
  * @codeCoverageIgnore
  */
 public function set($term_id)
 {
     if (MslsContentTypes::create()->acl_request()) {
         $this->save($term_id, 'MslsOptionsTax');
     }
 }
 /**
  * Verify the create-method
  */
 function test_create_method()
 {
     $obj = MslsContentTypes::create();
     $this->assertInstanceOf('MslsContentTypes', $obj);
     return $obj;
 }