/**
  * Prints options inputs
  * @uses selected
  * @param MslsBlog $blog
  * @param string $type
  * @param MslsOptionsTax $mydata
  * @param string $item_format
  */
 public function print_option(MslsBlog $blog, $type, MslsOptionsTax $mydata, $item_format)
 {
     switch_to_blog($blog->userblog_id);
     $language = $blog->get_language();
     $flag_url = MslsOptions::instance()->get_flag_url($language);
     $icon = MslsAdminIcon::create()->set_language($language)->set_src($flag_url);
     $options = '';
     $terms = get_terms($type, array('hide_empty' => 0));
     if ($mydata->has_value($language)) {
         $icon->set_href($mydata->{$language});
     }
     if (!empty($terms)) {
         foreach ($terms as $term) {
             $options .= sprintf('<option value="%s" %s>%s</option>', $term->term_id, selected($term->term_id, $mydata->{$language}, false), $term->name);
         }
     }
     printf($item_format, $language, $icon, $options);
     restore_current_blog();
 }
 /**
  * Verify the description-method
  */
 function test_description_cmp()
 {
     $a = new MslsBlog(null, null);
     $b = new MslsBlog(null, null);
     $this->assertEquals(0, $a->description($a, $b));
 }
Esempio n. 3
0
 /**
  * Sort objects by description
  * @param MslsBlog $a
  * @param MslsBlog $b
  * return int
  */
 public static function description(MslsBlog $a, MslsBlog $b)
 {
     return self::_cmp($a->get_description(), $b->get_description());
 }