本文整理汇总了PHP中MS_Helper_Html::content_tag方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Helper_Html::content_tag方法的具体用法?PHP MS_Helper_Html::content_tag怎么用?PHP MS_Helper_Html::content_tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Helper_Html
的用法示例。
在下文中一共展示了MS_Helper_Html::content_tag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content_box
/**
* Echo a content list as tag-list.
*
* @since 1.0.0
*
* @param array $contents List of content items to display.
*/
protected function content_box($rule)
{
static $row_items = 0;
$rule_titles = MS_Model_Rule::get_rule_type_titles();
$title = $rule_titles[$rule->rule_type];
$contents = (array) $rule->get_contents(null, true);
$membership_id = $this->data['membership']->id;
$row_items += 1;
$new_row = $row_items % 4 === 0;
$show_sep = ($row_items - 1) % 4 === 0;
if ($show_sep && $row_items > 1) {
MS_Helper_Html::html_separator();
}
?>
<div class="ms-part-4 ms-min-height">
<?php
if (!$new_row) {
MS_Helper_Html::html_separator('vertical');
}
?>
<div class="ms-bold">
<?php
printf('%s (%s):', $title, $rule->count_rules());
?>
</div>
<div class="inside">
<ul class="ms-content-tag-list ms-group">
<?php
foreach ($contents as $content) {
if ($content->access) {
MS_Helper_Html::content_tag($content);
}
}
?>
</ul>
<div class="ms-protection-edit-wrapper">
<?php
$edit_url = MS_Controller_Plugin::get_admin_url('protection', array('tab' => $rule->rule_type, 'membership_id' => $membership_id));
MS_Helper_Html::html_element(array('id' => 'edit_' . $rule->rule_type, 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'title' => $title, 'value' => sprintf(__('Edit %s Access', 'membership2'), $title), 'url' => $edit_url, 'class' => 'wpmui-field-button button'));
?>
</div>
</div>
</div>
<?php
if ($new_row) {
echo '</div><div class="ms-group">';
}
}
示例2: content_box
/**
* Echo a content list as 2-column table that show Content-Title and the
* Available date.
* Used by Dripped-Content view.
*
* @since 1.0.0
*
* @param array $contents List of content items to display.
*/
protected function content_box($contents)
{
$row_class = '';
ksort($contents);
$rule_titles = MS_Model_Rule::get_rule_type_titles();
$edit_url = MS_Controller_Plugin::get_admin_url('protection', array('tab' => $rule->rule_type));
$edit_link = array('id' => 'edit_dripped', 'type' => MS_Helper_Html::TYPE_HTML_LINK);
?>
<table class="ms-list-table ms-list-date widefat">
<thead>
<tr>
<th class="col-icon"> </th>
<th class="col-text"><?php
_e('Rule', MS_TEXT_DOMAIN);
?>
</th>
<th class="col-text"><?php
_e('Protected Item', MS_TEXT_DOMAIN);
?>
</th>
<th class="col-date"><?php
_e('Access', MS_TEXT_DOMAIN);
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($contents as $id => $content) {
$row_class = $row_class == 'alternate' ? '' : 'alternate';
?>
<tr class="<?php
echo esc_attr($row_class . ' ' . $content->icon);
?>
">
<td class="col-icon">
<i class="dashicons dashicons-<?php
echo esc_attr($content->icon);
?>
"></i>
</td>
<td class="col-text col-type">
<?php
$edit_link['url'] = esc_url_raw(add_query_arg('tab', $content->type, $edit_url));
$edit_link['value'] = $rule_titles[$content->type];
MS_Helper_Html::html_element($edit_link);
?>
</td>
<td class="col-text">
<?php
MS_Helper_Html::content_tag($content, 'span');
?>
</td>
<td class="col-date">
<?php
echo '' . $content->date;
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}