本文整理汇总了PHP中fw_unique_increment函数的典型用法代码示例。如果您正苦于以下问题:PHP fw_unique_increment函数的具体用法?PHP fw_unique_increment怎么用?PHP fw_unique_increment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fw_unique_increment函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: frontend_render
/**
* {@inheritdoc}
*/
public function frontend_render(array $item, $input_value)
{
$options = $item['options'];
$attr = array('name' => $item['shortcode'], 'placeholder' => $options['placeholder'], 'id' => 'id-' . fw_unique_increment());
if ($options['required']) {
$attr['required'] = 'required';
}
if (!empty($options['constraints']['constraint'])) {
$constraint = $options['constraints']['constraint'];
$constraint_data = $options['constraints'][$constraint];
switch ($constraint) {
case 'characters':
case 'words':
if ($constraint_data['min'] || $constraint_data['max']) {
$attr['data-constraint'] = json_encode(array('type' => $constraint, 'data' => $constraint_data));
}
if ($constraint == 'characters' && $constraint_data['max']) {
$attr['maxlength'] = $constraint_data['max'];
}
break;
default:
trigger_error('Unknown constraint: ' . $constraint, E_USER_WARNING);
}
}
return fw_render_view($this->locate_path('/views/view.php', dirname(__FILE__) . '/view.php'), array('item' => $item, 'attr' => $attr, 'value' => is_null($input_value) ? $options['default_value'] : $input_value));
}
开发者ID:alireza--noori,项目名称:initial-portfolio-website-test-,代码行数:29,代码来源:class-fw-option-type-form-builder-item-textarea.php
示例2: frontend_render
/**
* {@inheritdoc}
*/
public function frontend_render(array $item, $input_value)
{
$options = $item['options'];
$attr = array('type' => 'text', 'name' => $item['shortcode'], 'placeholder' => $options['placeholder'], 'value' => is_null($input_value) ? '' : $input_value, 'id' => 'id-' . fw_unique_increment());
if ($options['required']) {
$attr['required'] = 'required';
}
return fw_render_view($this->locate_path('/views/view.php', dirname(__FILE__) . '/view.php'), array('item' => $item, 'attr' => $attr));
}
开发者ID:northpen,项目名称:northpen,代码行数:12,代码来源:class-fw-option-type-form-builder-item-email.php
示例3: frontend_render
/**
* {@inheritdoc}
*/
public function frontend_render(array $item, $input_value)
{
$options = $item['options'];
$value = (string) $input_value;
$choices = array();
foreach ($options['choices'] as $choice) {
$attr = array('value' => $choice);
if ($choice === $value) {
$attr['selected'] = 'selected';
}
$choices[] = $attr;
}
if ($options['randomize']) {
shuffle($choices);
}
return fw_render_view($this->locate_path('/views/view.php', dirname(__FILE__) . '/view.php'), array('item' => $item, 'choices' => $choices, 'value' => $value, 'attr' => array('type' => 'select', 'name' => $item['shortcode'], 'id' => 'id-' . fw_unique_increment())));
}
开发者ID:alireza--noori,项目名称:initial-portfolio-website-test-,代码行数:20,代码来源:class-fw-option-type-form-builder-item-select.php
示例4: render_box
/**
* Render a meta box
*
* @param string $id
* @param string $title
* @param string $content HTML
* @param array $other Optional elements
*
* @return string Generated meta box html
*/
public function render_box($id, $title, $content, $other = array())
{
if (!function_exists('add_meta_box')) {
trigger_error('Try call this method later (\'admin_init\' action), add_meta_box() function does not exists yet.', E_USER_WARNING);
return '';
}
$other = array_merge(array('html_before_title' => false, 'html_after_title' => false, 'attr' => array()), $other);
$placeholders = array('id' => '{{meta_box_id}}', 'title' => '{{meta_box_title}}', 'content' => '{{meta_box_content}}');
$placeholders['html_before_title'] = '{{meta_box_html_before_title}}';
$placeholders['html_after_title'] = '{{meta_box_html_after_title}}';
$placeholders['attr'] = '{{meta_box_attr}}';
$placeholders['attr_class'] = '{{meta_box_attr_class}}';
$cache_key = 'fw_meta_box_template';
try {
$meta_box_template = FW_Cache::get($cache_key);
} catch (FW_Cache_Not_Found_Exception $e) {
$temp_screen_id = 'fw-temp-meta-box-screen-id-' . fw_unique_increment();
$context = 'normal';
add_meta_box($placeholders['id'], $placeholders['title'], $this->print_meta_box_content_callback, $temp_screen_id, $context, 'default', $placeholders['content']);
ob_start();
do_meta_boxes($temp_screen_id, $context, null);
$meta_box_template = ob_get_clean();
remove_meta_box($id, $temp_screen_id, $context);
$meta_box_template = str_replace('<div id="' . $context . '-sortables" class="meta-box-sortables">', '', $meta_box_template);
$meta_box_template = explode('</div>', $meta_box_template);
array_pop($meta_box_template);
$meta_box_template = implode('</div>', $meta_box_template);
// add 'fw-postbox' class and some attr related placeholders
$meta_box_template = str_replace('class="postbox', $placeholders['attr'] . ' class="postbox fw-postbox' . $placeholders['attr_class'], $meta_box_template);
$meta_box_template = str_replace('<span>' . $placeholders['title'] . '</span>', '<small class="fw-html-before-title">' . $placeholders['html_before_title'] . '</small>' . '<span>' . $placeholders['title'] . '</span>' . '<small class="fw-html-after-title">' . $placeholders['html_after_title'] . '</small>', $meta_box_template);
FW_Cache::set($cache_key, $meta_box_template);
}
$attr_class = '';
if (isset($other['attr']['class'])) {
$attr_class = ' ' . $other['attr']['class'];
unset($other['attr']['class']);
}
unset($other['attr']['id']);
// replace placeholders with data/content
return str_replace(array($placeholders['id'], $placeholders['title'], $placeholders['content'], $placeholders['html_before_title'], $placeholders['html_after_title'], $placeholders['attr'], $placeholders['attr_class']), array(esc_attr($id), $title, $content, $other['html_before_title'], $other['html_after_title'], fw_attr_to_html($other['attr']), esc_attr($attr_class)), $meta_box_template);
}
开发者ID:isatrio,项目名称:Unyson,代码行数:51,代码来源:backend.php
示例5: die
<?php
if (!defined('FW')) {
die('Forbidden');
}
$tabs_options = array();
foreach ($thumbnails as $thumbnails_tab_title => &$thumbnails_tab_thumbnails) {
$tabs_options['random-' . fw_unique_increment()] = array('type' => 'tab', 'title' => $thumbnails_tab_title, 'attr' => array('class' => 'fw-option-type-builder-thumbnails-tab'), 'options' => array('random-' . fw_unique_increment() => array('type' => 'html', 'label' => false, 'desc' => false, 'html' => implode("\n", $thumbnails_tab_thumbnails))));
}
$div_attr = $option['attr'];
unset($div_attr['value'], $div_attr['name']);
$div_attr['class'] .= ' fw-option-type-builder-tabs-count-' . count($tabs_options);
?>
<div <?php
echo fw_attr_to_html($div_attr);
?>
>
<?php
echo fw()->backend->option_type('hidden')->render($id, array(), array('value' => $data['value']['json'], 'id_prefix' => $data['id_prefix'] . 'input--', 'name_prefix' => $data['name_prefix']));
?>
<div class="builder-items-types fw-clearfix">
<?php
echo fw()->backend->render_options($tabs_options);
?>
</div>
<div class="builder-root-items"></div>
</div>
<?php
// do action once to add one backdrop for all builders in page
if ($option['fullscreen']) {
开发者ID:reardestani,项目名称:Unyson-Builder-Extension,代码行数:31,代码来源:view.php
示例6: prepare_slider_version_v4
/**
* @Slick Slider v4
* @return {HTML}
* */
public function prepare_slider_version_v4($id = '')
{
$margin_top = fw_get_db_post_option($id, 'margin_top', true);
$margin_bottom = fw_get_db_post_option($id, 'margin_bottom', true);
$pagination = fw_get_db_post_option($id, 'pagination', true);
$auto = fw_get_db_post_option($id, 'auto', true);
$slider_speed = fw_get_db_post_option($id, 'slider_speed', true);
$slider_type = fw_get_db_post_option($id, 'slider_type', true);
$flag = fw_unique_increment();
law_firm_enqueue_slick_library();
//fw_print($slider_type);
$autoPlay = 'true';
if (isset($auto) && $auto == 'disable') {
$autoPlay = 'false';
}
$navigation = 'true';
if (isset($pagination) && $pagination == 'disable') {
$navigation = 'false';
}
$css = array();
if (isset($margin_top) && !empty($margin_top)) {
$css[] = 'margin-top:' . $margin_top . 'px;';
}
if (isset($margin_bottom) && !empty($margin_bottom)) {
$css[] = 'margin-bottom:' . $margin_bottom . 'px;';
}
if (isset($slider_type['slider_v4']['slides']) && is_array($slider_type['slider_v4']['slides']) && !empty($slider_type['slider_v4']['slides'])) {
$slides = $slider_type['slider_v4']['slides'];
?>
<div class="system-slider" style="<?php
echo implode(' ', $css);
?>
">
<div class="fadeslider-home" id="main-slider-<?php
echo esc_js($flag);
?>
">
<?php
foreach ($slides as $key => $slide) {
$button_link = $slide['button_link'];
$button_link_title = $slide['button_link_title'];
$slider_title = $slide['slider_title'];
$slider_description = $slide['slider_description'];
$slider_subheading = $slide['slider_subheading'];
if (isset($slide['slider_bg_image']['url']) && !empty($slide['slider_bg_image']['url'])) {
?>
<div style="background-image: url(<?php
echo esc_url($slide['slider_bg_image']['url']);
?>
);">
<?php
if (!empty($slider_title) || !empty($slider_subheading) || !empty($slider_description) || !empty($button_link_title)) {
?>
<div class="slide-inner">
<div class="container">
<div class="row">
<div class="col-xs-12 col-xs-offset-0 col-sm-10 col-sm-offset-1 col-lg-8 col-lg-offset-2">
<?php
if (!empty($slider_title)) {
?>
<h1 class="slidetop"><?php
echo esc_attr($slider_title);
?>
</h1>
<?php
}
?>
<?php
if (!empty($slider_subheading)) {
?>
<h2 class="slidebottom"><?php
echo esc_attr($slider_subheading);
?>
</h2>
<?php
}
?>
<?php
if (!empty($slider_description)) {
?>
<p class="slidebottom"><i style="text-transform: lowercase;"><?php
echo esc_attr($slider_description);
?>
</i></p>
<?php
}
?>
<?php
if (isset($button_link_title) && !empty($button_link_title)) {
?>
<div class="shortcode-buttons add2 slidebottom">
<a href="<?php
echo esc_url($button_link);
?>
" class="btn btn-default"><?php
//.........这里部分代码省略.........
开发者ID:ansfazi,项目名称:xaraar_core,代码行数:101,代码来源:class-slider.php
示例7: fw_htmlspecialchars
<label><?php
echo fw_htmlspecialchars($item['options']['label']);
?>
<?php
if ($options['required']) {
?>
<sup>*</sup><?php
}
?>
</label>
<div class="custom-radio">
<?php
foreach ($choices as $choice) {
?>
<?php
$choice['id'] = 'rand-' . fw_unique_increment();
?>
<div class="options">
<input <?php
echo fw_attr_to_html($choice);
?>
/>
<label for="<?php
echo esc_attr($choice['id']);
?>
"><?php
echo $choice['value'];
?>
</label>
</div>
<?php
开发者ID:northpen,项目名称:northpen,代码行数:31,代码来源:view.php
注:本文中的fw_unique_increment函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论