public static function checkbox($args = array()) { $field_class = isset($args['field_class']) ? $args['field_class'] : ''; $field_class = SB_PHP::add_string_with_space_before($field_class, 'sb-checkbox'); $args['field_class'] = $field_class; $args['type'] = 'checkbox'; SB_Field::text($args); }
public static function editor($args = array()) { $name = self::get_name($args); $value = isset($args['value']) ? $args['value'] : ''; $id = isset($args['id']) ? $args['id'] : ''; if (empty($id)) { $id = $name; } $label = isset($args['label']) ? $args['label'] : ''; $container_class = isset($args['container_class']) ? $args['container_class'] : ''; $container_class = SB_PHP::add_string_with_space_before($container_class, 'sb-post-meta-editor'); echo '<div class="' . $container_class . '">'; echo '<label for="' . $id . '">' . $label . ':</label>'; $args['textarea_name'] = $name; $row = isset($args['row']) ? $args['row'] : 5; $args['textarea_rows'] = $row; wp_editor($value, $id, $args); echo '</div>'; }
public static function button($args = array()) { $text = isset($args['text']) ? $args['text'] : ''; if (empty($text)) { return; } $class = isset($args['field_class']) ? $args['field_class'] : ''; $class = SB_PHP::add_string_with_space_before($class, 'sb-button'); $description = isset($args['description']) ? $args['description'] : ''; echo '<button class="' . $class . '">' . $text . '</button>'; if (!empty($description)) { echo '<p class="description">' . $description . '</p>'; } }
public static function the_temperature_html($post_id) { $class = 'item-temp'; $temp = SB_Post::get_temperature($post_id); if ($temp < 50) { $class = SB_PHP::add_string_with_space_before($class, 'temp-50'); } elseif ($temp >= 50 && $temp < 250) { $class = SB_PHP::add_string_with_space_before($class, 'temp-100'); } elseif ($temp >= 250 && $temp < 500) { $class = SB_PHP::add_string_with_space_before($class, 'temp-250'); } elseif ($temp >= 500 && $temp < 700) { $class = SB_PHP::add_string_with_space_before($class, 'temp-500'); } else { $class = SB_PHP::add_string_with_space_before($class, 'temp-1000'); } ?> <div class="<?php echo $class; ?> "><?php SB_Post::the_temperature($post_id); ?> </div> <?php }
public static function the_strength_indicator($class = '') { $class = SB_PHP::add_string_with_space_before($class, 'sb-password-strength-indicator password-meter'); echo '<span class="' . $class . '">' . __('Độ mạnh mật khẩu', 'sb-core') . '</span>'; }
public static function color_picker($args) { $id = isset($args['id']) ? $args['id'] : ''; $default = isset($args['default']) ? $args['default'] : ''; $value = isset($args['value']) ? $args['value'] : ''; $field_class = isset($args['field_class']) ? $args['field_class'] : ''; $field_class = SB_PHP::add_string_with_space_before($field_class, 'sb-color-picker'); $description = isset($args['description']) ? $args['description'] : ''; $colors = isset($args['colors']) ? (array) $args['colors'] : array(); $colors = array_filter($colors); $before = isset($args['before']) ? $args['before'] : '<div id="' . esc_attr($id) . '" class="sb-color-options">'; $after = isset($args['after']) ? $args['after'] : '</div>'; $name = isset($args['name']) ? $args['name'] : ''; echo $before; if (count($colors) > 0) { foreach ($colors as $color) { $color_name = isset($color['name']) ? $name . '[' . $color['name'] . ']' : ''; $color_value = isset($color['color']) ? $color['color'] : ''; $color_default = isset($color['default']) ? $color['default'] : ''; $color_description = isset($color['description']) ? $color['description'] : ''; $args = array('before' => '<div class="color-area">', 'name' => $color_name, 'value' => $color_value, 'default' => $color_default, 'description' => $color_description); self::color_picker($args); } } else { $atts = array('data-default-color' => $default); $args['attributes'] = $atts; self::text($args); } self::the_after($before, $after); }
public static function media_upload($args = array()) { $container_class = ''; extract($args, EXTR_OVERWRITE); SB_PHP::add_string_with_space_before($container_class, 'sb-media-upload'); $upload_button_class = isset($args['upload_button_class']) ? $args['upload_button_class'] : ''; $upload_button_class = SB_PHP::add_string_with_space_before($upload_button_class, 'sb-widget-button delegate'); $args['upload_button_class'] = $upload_button_class; $remove_button_class = isset($args['remove_button_class']) ? $args['remove_button_class'] : ''; $remove_button_class = SB_PHP::add_string_with_space_before($remove_button_class, 'sb-widget-button delegate'); $args['remove_button_class'] = $remove_button_class; ?> <div class="<?php echo $container_class; ?> "> <?php SB_Field::media_upload_no_preview($args); ?> </div> <?php }