get_number() public method

Get rtmedia html number field in admin options.
public get_number ( string/array $attributes = '' ) : string
$attributes string/array
return string
Ejemplo n.º 1
0
 /**
  * Generate rtmedia dimensions in admin options.
  *
  * @access protected
  *
  * @param  array $attributes
  *
  * @return string $html
  */
 protected function generate_dimensions($attributes)
 {
     $element = 'rtDimension';
     global $rtmedia;
     $options = $rtmedia->options;
     $defaults = array('desc' => '', 'show_desc' => false);
     $attributes = wp_parse_args($attributes, $defaults);
     extract($attributes);
     $html = '';
     $html .= '<td>' . parent::get_number(array('name' => "rtmedia-options[{$key}_width]", 'value' => $width, 'class' => array('small-text large-offset-1'), 'show_desc' => $show_desc)) . '</td>';
     if (isset($height)) {
         $html .= '<td>' . parent::get_number(array('name' => "rtmedia-options[{$key}_height]", 'value' => $height, 'class' => array('small-text large-offset-1'), 'show_desc' => $show_desc)) . '</td>';
     }
     if (isset($crop)) {
         $html .= '<td>' . parent::get_switch(array('name' => "rtmedia-options[{$key}_crop]", 'rtForm_options' => array(array('' => 1, 'checked' => $crop)), 'value' => isset($options["rtmedia-options[{$key}_crop]"]) ? $options["rtmedia-options[{$key}_crop]"] : '0', 'show_desc' => $show_desc)) . '</td>';
     }
     if ($desc && $show_desc) {
         $html .= '<span class="clearfix large-offset-3 description">' . esc_html($desc) . '</span>';
     }
     if (isset($attributes['label'])) {
         $html = parent::enclose_label('container', $html, $attributes['label']);
     }
     return $html;
 }
Ejemplo n.º 2
0
 /**
  * Show rtmedia number in admin options.
  *
  * @access static
  *
  * @param  array $args
  *
  * @return void
  */
 public static function number($args)
 {
     global $rtmedia;
     $options = $rtmedia->options;
     $defaults = array('key' => '', 'desc' => '');
     $args = wp_parse_args($args, $defaults);
     extract($args);
     if (!isset($value)) {
         trigger_error(__('Please provide a "value" in the argument.', 'rtmedia'));
         return;
     }
     if (!empty($key)) {
         $args['name'] = 'rtmedia-options[' . $key . ']';
     }
     $args['value'] = $value;
     $numObj = new rtForm();
     echo $numObj->get_number($args);
 }