本文整理汇总了PHP中HtmlHelper::span方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlHelper::span方法的具体用法?PHP HtmlHelper::span怎么用?PHP HtmlHelper::span使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlHelper
的用法示例。
在下文中一共展示了HtmlHelper::span方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: metabox_html
/**
* Prints the HTML markup for the metabox
*/
public static function metabox_html($post)
{
if (is_null($post)) {
global $post;
}
$template = self::get_template($post);
if (count(self::$media_list)) {
$is_first = true;
foreach (self::$media_list as $k => $elem) {
$template_checker = new TemplateChecker($elem['include'], $elem['exclude']);
if (!$template_checker->check($template)) {
continue;
}
$name = self::META_KEY_NAME . '-' . $elem['id'];
wp_nonce_field(__FILE__, $name . '_nonce');
$value = get_post_meta($post->ID, $name, true);
// main edit button
$edit_button = HtmlHelper::anchor('javascript:;', HtmlHelper::span('', array('class' => 'wp-media-buttons-icon')) . __('Manage Media', 'wtu_framework'), array('id' => 'wtu-media-manager-button-' . $elem['id'], 'class' => 'button media-manager-button', 'data-target' => '#wtu-media-manager-element-' . $elem['id'], 'data-target-undo' => '#wtu-media-manager-undo-' . $elem['id'], 'data-target-delete' => '#wtu-media-manager-delete-' . $elem['id'], 'data-counter' => '#wtu-media-manager-counter-' . $elem['id'], 'data-frame-id' => 'wtu-media-manager-' . $elem['id'], 'data-title' => sprintf(__('Manage Media for %s', 'wtu_framework'), $elem['label']), 'data-button-label' => sprintf(__('Add selected media to %s set', 'wtu_framework'), $elem['label']), 'data-multiple' => 'true', 'data-elem-id' => $elem['id'], 'data-shortcode' => $elem['shortcode'], 'title' => sprintf(__('Manage Media for %s', 'wtu_framework'), $elem['label'])));
// input to store temp values, use text instead of hidden to debug
$input = HtmlHelper::input($name, 'hidden', array('id' => 'wtu-media-manager-element-' . $elem['id'], 'value' => $value));
// Counter
$number = 0;
if (isset($value) && $value != '') {
$number = count(explode(',', $value));
}
$counter = ' ' . HtmlHelper::span($number > 0 ? sprintf(_n('1 element', '%s elements', $number, 'wtu_framework'), $number) : __('Empty', 'wtu_framework'), array('id' => 'wtu-media-manager-counter-' . $elem['id'], 'data-label-no-images' => __('Empty', 'wtu_framework'), 'data-label-one-image' => __('1 element', 'wtu_framework'), 'data-label-more-images' => __('%s elements', 'wtu_framework')));
// delete button
$delete = HtmlHelper::anchor('javascript:;', __('Delete', 'wtu_framework'), array('id' => 'wtu-media-manager-delete-' . $elem['id'], 'style' => $value ? '' : 'display:none;', 'class' => 'delete-media-manager-gallery submitdelete', 'data-counter' => '#wtu-media-manager-counter-' . $elem['id'], 'data-gallery' => $elem['id'], 'data-target' => '#wtu-media-manager-element-' . $elem['id'], 'data-target-undo' => '#wtu-media-manager-undo-' . $elem['id'], 'data-target-origin' => '#wtu-media-manager-button-' . $elem['id'], 'title' => __('Delete Media Set', 'wtu_framework')));
// undo button
$undo = HtmlHelper::anchor('javascript:;', __('Undo', 'wtu_framework'), array('id' => 'wtu-media-manager-undo-' . $elem['id'], 'style' => 'display:none;', 'class' => 'undo-media-manager-gallery', 'data-gallery' => $elem['id'], 'data-target' => '#wtu-media-manager-element-' . $elem['id'], 'data-elem-id' => $elem['id'], 'data-target-origin' => '#wtu-media-manager-button-' . $elem['id'], 'data-target-delete' => '#wtu-media-manager-delete-' . $elem['id'], 'data-counter' => '#wtu-media-manager-counter-' . $elem['id'], 'title' => __('Restore Media Set', 'wtu_framework')));
$title = HtmlHelper::paragraph(HtmlHelper::strong($elem['label']));
$inner_html = '';
if (!$is_first) {
$inner_html .= HtmlHelper::br();
}
$inner_html .= '<table class="widefat"><thead>';
$inner_html .= '<td width="33%">' . $title . '</td>';
$inner_html .= '<td width="33%"> </td>';
$inner_html .= '<td width="33%">' . $edit_button . '</td></thead>';
$inner_html .= '<tbody><tr style="line-height: 25px;"><td class="submitbox">' . $delete . $undo . '</td>';
$inner_html .= '<td> </td>';
$inner_html .= '<td>' . $counter . '</td>';
$inner_html .= '</tr></tbody></table>';
$inner_html .= $input;
echo HtmlHelper::div($inner_html, array('class' => ''));
$is_first = false;
}
}
//var_dump($value);
}
示例2: image
/**
* Returns the markup for an adaptive image
* @param int $attachment_id the iamge id
* @param string $size the image size
* @param array $attr img tag attributes
* @return string html merkup
*/
public function image($attachment_id, $size, $attr = array())
{
$default_attr = self::get_image($attachment_id, $size);
@($attr['class'] = $default_attr['class'] . ' responsive-image-placeholder ' . $attr['class']);
return HtmlHelper::span('', $default_attr) . HtmlHelper::standard_tag('noscript', wp_get_attachment_image($imageid, $size, false, $attr));
}