get_select() public method

Get rtmedia html input type select in admin options.
public get_select ( string/array $attributes = '' ) : string
$attributes string/array
return string
Exemplo n.º 1
0
 public static function selectBox($args)
 {
     global $rtmedia;
     $options = $rtmedia->options;
     $defaults = array('key' => '', 'desc' => '', 'default' => '', 'show_desc' => false, 'selects' => array());
     $args = wp_parse_args($args, $defaults);
     extract($args);
     if (!empty($key)) {
         $args['name'] = 'rtmedia-options[' . $key . ']';
     }
     $args['rtForm_options'] = array();
     foreach ($selects as $value => $key) {
         $args['rtForm_options'][] = array($key => $value, 'selected' => $default == $value ? true : false);
     }
     $chkObj = new rtForm();
     echo $chkObj->get_select($args);
 }
Exemplo n.º 2
0
 function select_privacy_ui($echo = true, $select_id = false)
 {
     global $rtmedia;
     if (!is_rtmedia_privacy_enable()) {
         return false;
     }
     if (!is_rtmedia_privacy_user_overide()) {
         return false;
     }
     global $rtmedia_media;
     $default = 0;
     if (isset($rtmedia_media->privacy)) {
         $default = $rtmedia_media->privacy;
     } else {
         $default = get_user_meta(get_current_user_id(), 'rtmedia-default-privacy', true);
         if ($default === false || $default === '') {
             $default = get_rtmedia_default_privacy();
         }
     }
     $form = new rtForm();
     $attributes = array('name' => 'privacy', 'class' => array('privacy'));
     if ($select_id && $select_id != "") {
         $attributes['id'] = $select_id;
     }
     global $rtmedia;
     $privacy_levels = $rtmedia->privacy_settings['levels'];
     if (class_exists('BuddyPress')) {
         if (!bp_is_active('friends')) {
             unset($privacy_levels[40]);
         }
     } else {
         unset($privacy_levels[40]);
     }
     foreach ($privacy_levels as $key => $value) {
         $privacy = explode(' - ', $value);
         $attributes['rtForm_options'][] = array($privacy[0] => $key, 'selected' => $key == $default ? 1 : 0);
     }
     if ($echo) {
         echo $form->get_select($attributes);
     } else {
         return $form->get_select($attributes);
     }
 }
Exemplo n.º 3
0
 function select_privacy_ui($echo = true, $element_id = false, $element_class = array(), $selected = false)
 {
     global $rtmedia;
     if (!is_rtmedia_privacy_enable()) {
         return false;
     }
     if (!is_rtmedia_privacy_user_overide()) {
         return false;
     }
     global $rtmedia_media;
     if (false !== $selected) {
         $default = $selected;
     } elseif (isset($rtmedia_media->privacy)) {
         $default = $rtmedia_media->privacy;
     } else {
         //todo user attribute
         $default = get_user_meta(get_current_user_id(), 'rtmedia-default-privacy', true);
         if (false === $default || '' === $default) {
             $default = get_rtmedia_default_privacy();
         }
     }
     $form = new rtForm();
     $attributes_class = array('privacy');
     if (!empty($element_class)) {
         if (!is_array($element_class)) {
             $attributes_class = array_merge($attributes_class, (array) $element_class);
         } else {
             $attributes_class = array_merge($attributes_class, $element_class);
         }
     }
     $attributes = array('name' => 'privacy', 'class' => $attributes_class);
     if ($element_id && '' !== $element_id) {
         $attributes['id'] = $element_id;
     }
     global $rtmedia;
     $privacy_levels = $rtmedia->privacy_settings['levels'];
     if (class_exists('BuddyPress')) {
         if (!bp_is_active('friends')) {
             unset($privacy_levels[40]);
         }
     } else {
         unset($privacy_levels[40]);
     }
     foreach ($privacy_levels as $key => $value) {
         $privacy = explode(' - ', $value);
         $attributes['rtForm_options'][] = array($privacy[0] => $key, 'selected' => intval($default) === $key ? 1 : 0);
     }
     if ($echo) {
         echo $form->get_select($attributes);
         // @codingStandardsIgnoreLine
     } else {
         return $form->get_select($attributes);
     }
 }