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


PHP ninja_forms_random_string函数代码示例

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


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

示例1: ninja_forms_display_honeypot

/**
 * Output our honeypot field
 * @since  2.9.22
 * @param  int  $form_id
 * @return void
 */
function ninja_forms_display_honeypot($form_id)
{
    $hp_name = ninja_forms_random_string(5);
    ?>
	<div class="hp-wrap">
		<label><?php 
    _e('If you are a human and are seeing this field, please leave it blank.', 'ninja-forms');
    ?>
			<input type="text" value="" name="_<?php 
    echo $hp_name;
    ?>
">
			<input type="hidden" value="_<?php 
    echo $hp_name;
    ?>
" name="_hp_name">
		</label>
	</div>
	<?php 
}
开发者ID:nihrain,项目名称:accelerate,代码行数:26,代码来源:honeypot.php

示例2: process

 /**
  * Process our Success Message notification
  * 
  * @access public
  * @since 2.8
  * @return void
  */
 public function process($id)
 {
     global $ninja_forms_processing;
     // We need to get our name setting so that we can use it to create a unique success message ID.
     $name = Ninja_Forms()->notification($id)->get_setting('name');
     // If our name is empty, we need to generate a random string.
     if (empty($name)) {
         $name = ninja_forms_random_string(4);
     }
     $success_msg = apply_filters('nf_success_msg', Ninja_Forms()->notification($id)->get_setting('success_msg'), $id);
     $success_msg = do_shortcode(wpautop($success_msg));
     $success_msg = nf_parse_fields_shortcode($success_msg);
     $ninja_forms_processing->add_success_msg('success_msg-' . $name, $success_msg);
 }
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:21,代码来源:notification-success-message.php

示例3: set_transient_id

 /**
  * Set $_SESSION variable used for storing items in transient variables
  * 
  * @access public
  * @since 2.7
  * @return void
  */
 public function set_transient_id()
 {
     if (!session_id()) {
         session_start();
     }
     if (!isset($_SESSION['ninja_forms_transient_id']) and !is_admin()) {
         $t_id = ninja_forms_random_string();
         // Make sure that our transient ID isn't currently in use.
         while (get_transient($t_id) !== false) {
             $_id = ninja_forms_random_string();
         }
         $_SESSION['ninja_forms_transient_id'] = $t_id;
     }
 }
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:21,代码来源:ninja-forms.php

示例4: ninja_forms_field_uploads_create_key

function ninja_forms_field_uploads_create_key($update_array)
{
    $new_key = ninja_forms_random_string(5);
    if (array_key_exists($new_key, $update_array)) {
        $new_key = ninja_forms_random_string(5);
    }
    return $new_key;
}
开发者ID:webtlp,项目名称:gdid,代码行数:8,代码来源:pre-process.php

示例5: set_transient_id

 /**
  * Set Ninja_Forms()->session variable used for storing items in transient variables
  *
  * @access public
  * @since 2.7
  * @return string $t_id;
  */
 public function set_transient_id()
 {
     $transient_id = $this->session->get('nf_transient_id');
     if (!$transient_id && !is_admin()) {
         $transient_id = ninja_forms_random_string();
         // Make sure that our transient ID isn't currently in use.
         while (get_transient($transient_id) !== false) {
             $_id = ninja_forms_random_string();
         }
         $this->session->set('nf_transient_id', $transient_id);
     }
     return $transient_id;
 }
开发者ID:jbs321,项目名称:portfolio,代码行数:20,代码来源:ninja-forms.php

示例6: ninja_forms_field_upload_display

/**
 * This is the main display function that will be called on the front-end when a user is filling out a form.
 *
 * @param int $field_id - ID number of the field that is currently being displayed.
 * @param array $data - array of field data as it has been processed to this point.
 */
function ninja_forms_field_upload_display($field_id, $data)
{
    global $ninja_forms_loading, $ninja_forms_processing;
    $plugin_settings = get_option('ninja_forms_settings');
    if (isset($plugin_settings['max_filesize'])) {
        $max_filesize = $plugin_settings['max_filesize'] * 1048576;
    } else {
        $max_filesize = 2097152;
    }
    if (isset($data['upload_multi']) and $data['upload_multi'] == 1) {
        $upload_multi = 'multi';
    } else {
        $upload_multi = '';
    }
    if (isset($data['upload_multi_count'])) {
        $upload_multi_count = $data['upload_multi_count'];
    } else {
        $upload_multi_count = '';
    }
    $user_file_name = '';
    $file_name = '';
    $file_path = '';
    $file_url = '';
    $prefill = false;
    if (is_object($ninja_forms_processing) and $ninja_forms_processing->get_error('upload_' . $field_id)) {
        $field_error = true;
    } else {
        $field_error = false;
    }
    $user_value = '';
    if (isset($data['default_value']) and !empty($data['default_value'])) {
        $user_value = $data['default_value'];
        $prefill = true;
    } else {
        if (is_object($ninja_forms_processing) and $ninja_forms_processing->get_field_value($field_id) and $ninja_forms_processing->get_all_errors()) {
            $user_value = $ninja_forms_processing->get_field_value($field_id);
            $prefill = true;
        }
    }
    if (is_array($user_value)) {
        $tmp = false;
        foreach ($user_value as $key => $val) {
            if (isset($val['file_name']) and !empty($val['file_name'])) {
                $tmp = true;
            }
        }
        if (!$tmp) {
            $prefill = false;
        }
    } else {
        if (is_string($user_value)) {
            $filename = basename($user_value);
            $tmp_array = array(ninja_forms_random_string(5) => array('complete' => 1, 'user_file_name' => $filename, 'file_name' => $filename, 'file_url' => $user_value));
            $user_value = $tmp_array;
        }
    }
    //var_dump ( $user_value );
    if (count($user_value) > 1) {
        $str_label = __('Files', 'ninja-forms-uploads');
    } else {
        $str_label = __('File', 'ninja-forms-uploads');
    }
    if ($prefill and !$field_error) {
        // Loop through our files array and allow the user to replace each on individually.
        // This code outputs a different file input field for each. Every field is also accompanied by hidden inputs.
        if (is_array($user_value) and !empty($user_value)) {
            if ($upload_multi == 'multi') {
                ?>
				<ul style="list-style:none;">
				<?php 
                foreach ($user_value as $key => $val) {
                    if (isset($val['complete'])) {
                        $complete = $val['complete'];
                    } else {
                        $complete = 1;
                    }
                    if (!isset($val['upload_id'])) {
                        $val['upload_id'] = '';
                    }
                    // Output the accompanying file data that will be accessible in the extra_values during processing.
                    ?>
					<li id="ninja_forms_file_upload_<?php 
                    echo $field_id;
                    ?>
_<?php 
                    echo $key;
                    ?>
_li">
						<input type="hidden" name="_upload_<?php 
                    echo $field_id;
                    ?>
[<?php 
                    echo $key;
                    ?>
//.........这里部分代码省略.........
开发者ID:pjsinco,项目名称:doctorsthatdo-wp-content,代码行数:101,代码来源:file-uploads.php


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