当前位置: 首页>>代码示例>>PHP>>正文


PHP fw_rand_md5函数代码示例

本文整理汇总了PHP中fw_rand_md5函数的典型用法代码示例。如果您正苦于以下问题:PHP fw_rand_md5函数的具体用法?PHP fw_rand_md5怎么用?PHP fw_rand_md5使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fw_rand_md5函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($id, $option, $data)
 {
     $this->id = $id;
     $this->option = $option;
     $this->data = $data;
     /**
      * Generate random editor_id that will be used.
      * Using a hash of combination of $option and $id is not enough. It
      * usually repeats itself on the page pretty often.
      */
     $this->editor_id = fw()->backend->option_type('wp-editor')->get_id_prefix() . fw_rand_md5();
 }
开发者ID:cristeamdev,项目名称:Unyson,代码行数:12,代码来源:class-fw-wp-editor-settings.php

示例2: get_value_from_items

 /**
  * {@inheritdoc}
  */
 public function get_value_from_items($items)
 {
     if (!is_array($items)) {
         return array();
     }
     static $recursion_level = 0;
     /** prevent duplicate shortcodes */
     static $found_shortcodes = array();
     /**
      * @var FW_Option_Type_Builder_Item[] $item_types
      */
     $item_types = $this->get_item_types();
     $fixed_items = array();
     foreach ($items as $item_attributes) {
         if (!isset($item_attributes['type']) || !isset($item_types[$item_attributes['type']])) {
             // invalid item type
             continue;
         }
         $fixed_item_attributes = $item_types[$item_attributes['type']]->get_value_from_attributes($item_attributes);
         if (empty($fixed_item_attributes['shortcode']) || isset($found_shortcodes[$fixed_item_attributes['shortcode']])) {
             $fixed_item_attributes['shortcode'] = sanitize_key(str_replace('-', '_', $item_attributes['type']) . '_' . substr(fw_rand_md5(), 0, 7));
         }
         $found_shortcodes[$fixed_item_attributes['shortcode']] = true;
         if (isset($fixed_item_attributes['_items'])) {
             // item leaved _items key, this means that it has/accepts items in it
             $recursion_level++;
             $fixed_item_attributes['_items'] = $this->get_value_from_items($fixed_item_attributes['_items']);
             $recursion_level--;
         }
         $fixed_items[] = $fixed_item_attributes;
         unset($fixed_item_attributes);
     }
     /**
      * this will be real return (not inside a recursion)
      * make some clean up
      */
     if (!$recursion_level) {
         $found_shortcodes = array();
     }
     return $fixed_items;
 }
开发者ID:northpen,项目名称:northpen,代码行数:44,代码来源:class-fw-option-type-form-builder.php

示例3: generate_id

 /**
  * @param null|int $length_limit
  * @return string
  */
 protected function generate_id($length_limit = null)
 {
     $id = fw_rand_md5();
     if ($length_limit) {
         $id = substr($id, 0, (int) $length_limit);
     }
     return $id;
 }
开发者ID:isatrio,项目名称:Unyson,代码行数:12,代码来源:simple.php

示例4: __construct

 /**
  * @param string $id
  */
 public function __construct($id = null)
 {
     $this->id = (string) (is_null($id) ? fw_rand_md5() : $id);
 }
开发者ID:ThemeFuse,项目名称:Unyson-Backups-Extension,代码行数:7,代码来源:class-fw-ext-backups-task-collection.php

示例5: fw

				<div class="fw-option-box-options fw-force-xs">
					<?php 
    echo fw()->backend->render_options($box_options, $values, array('id_prefix' => $data['id_prefix'] . $id . '-' . $i . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . '][' . $i . ']'));
    ?>
				</div>
				<?php 
    echo fw()->backend->render_box($data['id_prefix'] . $id . '-' . $i . '-box', '&nbsp;', ob_get_clean(), array('html_after_title' => $controls_html, 'attr' => array('class' => 'fw-option-type-addable-box-pending-title-update')));
    ?>
			</div>
		<?php 
}
unset($values);
?>
	</div>
	<br class="default-box-template fw-hidden" data-template="<?php 
/**
 * Place template in attribute to prevent it to be treated as html
 * when this option will be used inside another option template
 */
$values = array();
// must contain characters that will remain the same after htmlspecialchars()
$increment_placeholder = '###-addable-box-increment-' . fw_rand_md5() . '-###';
echo fw_htmlspecialchars('<div class="fw-option-box" data-name-prefix="' . fw_htmlspecialchars($data['name_prefix'] . '[' . $id . '][' . $increment_placeholder . ']') . '">' . fw()->backend->render_box($data['id_prefix'] . $id . '-' . $increment_placeholder . '-box', '&nbsp;', '<div class="fw-option-box-options fw-force-xs">' . fw()->backend->render_options($box_options, $values, array('id_prefix' => $data['id_prefix'] . $id . '-' . $increment_placeholder . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . '][' . $increment_placeholder . ']')) . '</div>', array('html_after_title' => $controls_html)) . '</div>');
?>
">
	<div class="fw-option-boxes-controls">
		<?php 
echo fw_html_tag('button', array('type' => 'button', 'onclick' => 'return false;', 'class' => 'button fw-option-boxes-add-button', 'data-increment' => ++$i, 'data-increment-placeholder' => $increment_placeholder, 'data-limit' => intval($option['limit'])), __('Add', 'fw'));
?>
	</div>
</div>
开发者ID:alireza--noori,项目名称:initial-portfolio-website-test-,代码行数:31,代码来源:view.php

示例6: _action_save_post

 /**
  * @param int $post_id
  * @param WP_Post $post
  * @param bool $update
  */
 public function _action_save_post($post_id, $post, $update)
 {
     if (isset($_POST['post_ID']) && intval($_POST['post_ID']) === intval($post_id) && !empty($_POST[FW_Option_Type::get_default_name_prefix()])) {
         /**
          * This happens on regular post form submit
          * All data from $_POST belongs this $post
          * so we save them in its post meta
          */
         static $post_options_save_happened = false;
         if ($post_options_save_happened) {
             /**
              * Prevent multiple options save for same post
              * It can happen from a recursion or wp_update_post() for same post id
              */
             return;
         } else {
             $post_options_save_happened = true;
         }
         $old_values = (array) fw_get_db_post_option($post_id);
         $current_values = fw_get_options_values_from_input(fw()->theme->get_post_options($post->post_type));
         fw_set_db_post_option($post_id, null, array_diff_key($current_values, $this->process_options_handlers(fw()->theme->get_post_options($post->post_type), $current_values)));
         /**
          * @deprecated
          * Use the 'fw_post_options_update' action
          */
         do_action('fw_save_post_options', $post_id, $post, $old_values);
     } elseif ($original_post_id = wp_is_post_revision($post_id)) {
         /**
          * Do nothing, the
          * - '_wp_put_post_revision'
          * - 'wp_restore_post_revision'
          * - 'wp_creating_autosave'
          * actions will handle this
          */
     } elseif ($original_post_id = wp_is_post_autosave($post_id)) {
         // fixme: I don't know how to test this. The execution never entered here
         FW_Flash_Messages::add(fw_rand_md5(), 'Unhandled auto-save');
     } else {
         /**
          * This happens on:
          * - post add (auto-draft): do nothing
          * - revision restore: do nothing, that is handled by the 'wp_restore_post_revision' action
          */
     }
 }
开发者ID:joelgarciajr84,项目名称:Unyson,代码行数:50,代码来源:backend.php

示例7: _get_value_from_input

 protected function _get_value_from_input($option, $input_value)
 {
     if (is_null($input_value)) {
         $id = empty($option['value']) ? fw_rand_md5() : $option['value'];
     } else {
         $id = $input_value;
     }
     if (empty($id) || !is_string($id)) {
         $id = fw_rand_md5();
     }
     global $post;
     if ($post) {
         $post_id = $post->ID;
     } else {
         $post_id = '~';
     }
     if (!isset(self::$ids[$post_id])) {
         self::$ids[$post_id] = array();
     }
     while (isset(self::$ids[$post_id][$id])) {
         $id = fw_rand_md5();
     }
     self::$ids[$post_id][$id] = true;
     return $id;
 }
开发者ID:kreapress,项目名称:Unyson,代码行数:25,代码来源:simple.php


注:本文中的fw_rand_md5函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。