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


PHP FrmAppHelper::get_server_value方法代码示例

本文整理汇总了PHP中FrmAppHelper::get_server_value方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::get_server_value方法的具体用法?PHP FrmAppHelper::get_server_value怎么用?PHP FrmAppHelper::get_server_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FrmAppHelper的用法示例。


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

示例1: create

 public static function create($values)
 {
     global $wpdb;
     self::sanitize_entry_post($values);
     $values = apply_filters('frm_pre_create_entry', $values);
     if (!isset($values['item_key'])) {
         $values['item_key'] = '';
     }
     $item_name = self::get_new_entry_name($values, $values['item_key']);
     $new_values = array('item_key' => FrmAppHelper::get_unique_key($values['item_key'], $wpdb->prefix . 'frm_items', 'item_key'), 'name' => FrmAppHelper::truncate($item_name, 255, 1, ''), 'ip' => FrmAppHelper::get_ip_address(), 'is_draft' => isset($values['frm_saving_draft']) && $values['frm_saving_draft'] == 1 || isset($values['is_draft']) && $values['is_draft'] == 1 ? 1 : 0, 'form_id' => isset($values['form_id']) ? (int) $values['form_id'] : null, 'post_id' => isset($values['post_id']) ? (int) $values['post_id'] : 0, 'parent_item_id' => isset($values['parent_item_id']) ? (int) $values['parent_item_id'] : 0, 'created_at' => isset($values['created_at']) ? $values['created_at'] : current_time('mysql', 1), 'updated_at' => isset($values['updated_at']) ? $values['updated_at'] : (isset($values['created_at']) ? $values['created_at'] : current_time('mysql', 1)));
     if (is_array($new_values['name'])) {
         $new_values['name'] = reset($new_values['name']);
     }
     if (isset($values['description']) && !empty($values['description'])) {
         $new_values['description'] = maybe_serialize($values['description']);
     } else {
         $new_values['description'] = serialize(array('browser' => FrmAppHelper::get_server_value('HTTP_USER_AGENT'), 'referrer' => FrmAppHelper::get_server_value('HTTP_REFERER')));
     }
     //if(isset($values['id']) and is_numeric($values['id']))
     //    $new_values['id'] = $values['id'];
     if (isset($values['frm_user_id']) && (is_numeric($values['frm_user_id']) || FrmAppHelper::is_admin())) {
         $new_values['user_id'] = $values['frm_user_id'];
     } else {
         $user_ID = get_current_user_id();
         $new_values['user_id'] = $user_ID ? $user_ID : 0;
     }
     $new_values['updated_by'] = isset($values['updated_by']) ? $values['updated_by'] : $new_values['user_id'];
     // don't create duplicate entry
     if (self::is_duplicate($new_values, $values)) {
         return false;
     }
     $query_results = $wpdb->insert($wpdb->prefix . 'frm_items', $new_values);
     if (!$query_results) {
         return false;
     }
     $entry_id = $wpdb->insert_id;
     global $frm_vars;
     if (!isset($frm_vars['saved_entries'])) {
         $frm_vars['saved_entries'] = array();
     }
     $frm_vars['saved_entries'][] = (int) $entry_id;
     if (isset($values['item_meta'])) {
         FrmEntryMeta::update_entry_metas($entry_id, $values['item_meta']);
     }
     self::clear_cache();
     // this is a child entry
     $is_child = isset($values['parent_form_id']) && isset($values['parent_nonce']) && !empty($values['parent_form_id']) && wp_verify_nonce($values['parent_nonce'], 'parent');
     do_action('frm_after_create_entry', $entry_id, $new_values['form_id'], compact('is_child'));
     do_action('frm_after_create_entry_' . $new_values['form_id'], $entry_id, compact('is_child'));
     return $entry_id;
 }
开发者ID:rbkhrlstn,项目名称:formidable-forms,代码行数:51,代码来源:FrmEntry.php

示例2: remove_get_action

 /**
  * Used when switching the action for a bulk action
  * @since 2.0
  */
 public static function remove_get_action()
 {
     if (!isset($_GET)) {
         return;
     }
     $new_action = isset($_GET['action']) ? sanitize_text_field($_GET['action']) : (isset($_GET['action2']) ? sanitize_text_field($_GET['action2']) : '');
     if (!empty($new_action)) {
         $_SERVER['REQUEST_URI'] = str_replace('&action=' . $new_action, '', FrmAppHelper::get_server_value('REQUEST_URI'));
     }
 }
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:14,代码来源:FrmAppHelper.php

示例3: get_entry_description

 /**
  * Get the description value for a new entry
  *
  * @since 2.0.16
  * @param array $values
  * @return string
  */
 private static function get_entry_description($values)
 {
     if (isset($values['description']) && !empty($values['description'])) {
         $description = maybe_serialize($values['description']);
     } else {
         $description = serialize(array('browser' => FrmAppHelper::get_server_value('HTTP_USER_AGENT'), 'referrer' => FrmAppHelper::get_server_value('HTTP_REFERER')));
     }
     return $description;
 }
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:16,代码来源:FrmEntry.php

示例4: parse_akismet_array

 /**
  * @since 2.0
  * @param string $content
  */
 private static function parse_akismet_array(&$datas, $content)
 {
     $datas['blog'] = FrmAppHelper::site_url();
     $datas['user_ip'] = preg_replace('/[^0-9., ]/', '', FrmAppHelper::get_ip_address());
     $datas['user_agent'] = FrmAppHelper::get_server_value('HTTP_USER_AGENT');
     $datas['referrer'] = isset($_SERVER['HTTP_REFERER']) ? FrmAppHelper::get_server_value('HTTP_REFERER') : false;
     $datas['comment_type'] = 'formidable';
     $datas['comment_content'] = $content;
     if ($permalink = get_permalink()) {
         $datas['permalink'] = $permalink;
     }
     foreach ($_SERVER as $key => $value) {
         if (!in_array($key, array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW')) && is_string($value)) {
             $datas[$key] = wp_strip_all_tags($value);
         } else {
             $datas[$key] = '';
         }
         unset($key, $value);
     }
 }
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:24,代码来源:FrmEntryValidate.php

示例5: format_single_field

 /**
  * Format individual email fields
  *
  * @since 2.0
  * @param array $atts pass by reference
  * @param string $f (to, from, reply_to, etc)
  * @param string $val value saved in field
  * @param int $key if in array, this will be set
  */
 private static function format_single_field(&$atts, $f, $val, $key = false)
 {
     $val = trim($val);
     // If just a plain email is used
     if (is_email($val)) {
         // add sender's name if not included in $from
         if ($f == 'from') {
             $part_2 = $atts[$f];
             $part_1 = $atts['from_name'] ? $atts['from_name'] : wp_specialchars_decode(FrmAppHelper::site_name(), ENT_QUOTES);
         } else {
             return;
         }
     } else {
         $parts = explode(' ', $val);
         $part_2 = end($parts);
         // If inputted correcly, $part_2 should be an email
         if (is_email($part_2)) {
             $part_1 = trim(str_replace($part_2, '', $val));
         } else {
             if (in_array($f, array('from', 'reply_to'))) {
                 // In case someone just puts a name in the From or Reply To field
                 $part_1 = $val;
                 $part_2 = get_option('admin_email');
             } else {
                 // In case someone just puts a name in any other email field
                 if (false !== $key) {
                     unset($atts[$f][$key]);
                     return;
                 }
                 $atts[$f] = '';
                 return;
             }
         }
     }
     // if sending the email from a yahoo address, change it to the WordPress default
     if ($f == 'from' && strpos($part_2, '@yahoo.com')) {
         // Get the site domain and get rid of www.
         $sitename = strtolower(FrmAppHelper::get_server_value('SERVER_NAME'));
         if (substr($sitename, 0, 4) == 'www.') {
             $sitename = substr($sitename, 4);
         }
         $part_2 = 'wordpress@' . $sitename;
     }
     // Set up formatted value
     $final_val = '"' . str_replace('"', '', $part_1) . '" <' . $part_2 . '>';
     // If value is an array
     if (false !== $key) {
         $atts[$f][$key] = $final_val;
         return;
     }
     $atts[$f] = $final_val;
 }
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:61,代码来源:FrmNotification.php

示例6: print_column_headers

 /**
  * Print column headers, accounting for hidden and sortable columns.
  *
  * @since 2.0.18
  * @access public
  *
  * @staticvar int $cb_counter
  *
  * @param bool $with_id Whether to set the id attribute or not
  */
 public function print_column_headers($with_id = true)
 {
     list($columns, $hidden, $sortable, $primary) = $this->get_column_info();
     $current_url = set_url_scheme('http://' . FrmAppHelper::get_server_value('HTTP_HOST') . FrmAppHelper::get_server_value('REQUEST_URI'));
     $current_url = remove_query_arg('paged', $current_url);
     if (isset($_GET['orderby'])) {
         $current_orderby = sanitize_text_field($_GET['orderby']);
     } else {
         $current_orderby = '';
     }
     if (isset($_GET['order']) && 'desc' == $_GET['order']) {
         $current_order = 'desc';
     } else {
         $current_order = 'asc';
     }
     if (!empty($columns['cb'])) {
         static $cb_counter = 1;
         $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __('Select All') . '</label>' . '<input id="cb-select-all-' . esc_attr($cb_counter) . '" type="checkbox" />';
         $cb_counter++;
     }
     foreach ($columns as $column_key => $column_display_name) {
         $class = array('manage-column', "column-{$column_key}");
         if (in_array($column_key, $hidden)) {
             $class[] = 'hidden';
         }
         if ('cb' == $column_key) {
             $class[] = 'check-column';
         } else {
             if (in_array($column_key, array('posts', 'comments', 'links'))) {
                 $class[] = 'num';
             }
         }
         if ($column_key === $primary) {
             $class[] = 'column-primary';
         }
         if (isset($sortable[$column_key])) {
             list($orderby, $desc_first) = $sortable[$column_key];
             if ($current_orderby == $orderby) {
                 $order = 'asc' == $current_order ? 'desc' : 'asc';
                 $class[] = 'sorted';
                 $class[] = $current_order;
             } else {
                 $order = $desc_first ? 'desc' : 'asc';
                 $class[] = 'sortable';
                 $class[] = $desc_first ? 'asc' : 'desc';
             }
             $column_display_name = '<a href="' . esc_url(add_query_arg(compact('orderby', 'order'), $current_url)) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
         }
         $tag = 'cb' === $column_key ? 'td' : 'th';
         $scope = 'th' === $tag ? 'scope="col"' : '';
         $id = $with_id ? "id='" . esc_attr($column_key) . "'" : '';
         if (!empty($class)) {
             $class = "class='" . join(' ', $class) . "'";
         }
         echo "<{$tag} {$scope} {$id} {$class}>{$column_display_name}</{$tag}>";
     }
 }
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:67,代码来源:FrmListHelper.php

示例7: insert_form_popup

 public static function insert_form_popup()
 {
     $page = basename(FrmAppHelper::get_server_value('PHP_SELF'));
     if (!in_array($page, array('post.php', 'page.php', 'page-new.php', 'post-new.php'))) {
         return;
     }
     FrmAppHelper::load_admin_wide_js();
     $shortcodes = array('formidable' => array('name' => __('Form', 'formidable'), 'label' => __('Insert a Form', 'formidable')));
     $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
     include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php';
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:11,代码来源:FrmFormsController.php

示例8: get_other_shortcode_values

 /**
  * @since 2.0.8
  */
 private static function get_other_shortcode_values($args)
 {
     $atts = shortcode_parse_atts(stripslashes($args['matches'][3][$args['match_key']]));
     if (isset($atts['return_array'])) {
         $args['allow_array'] = $atts['return_array'];
     }
     $args['shortcode_atts'] = $atts;
     switch ($args['shortcode']) {
         case 'user_meta':
             if (isset($atts['key'])) {
                 $new_value = FrmProAppHelper::get_current_user_value($atts['key'], false);
             }
             break;
         case 'post_meta':
             if (isset($atts['key'])) {
                 $new_value = FrmProAppHelper::get_current_post_value($atts['key']);
             }
             break;
         case 'get':
             $new_value = self::do_get_shortcode($args);
             break;
         case 'auto_id':
             $new_value = self::do_auto_id_shortcode($args);
             break;
         case 'server':
             if (isset($atts['param'])) {
                 $new_value = FrmAppHelper::get_server_value($atts['param']);
             }
             break;
         case 'date':
             $new_value = FrmProAppHelper::get_date(isset($atts['format']) ? $atts['format'] : '');
             break;
         case 'time':
             $new_value = FrmProAppHelper::get_time($atts);
             break;
         default:
             $new_value = self::check_posted_item_meta($args['matches'][0][$args['match_key']], $args['shortcode'], $atts, $args['allow_array']);
             break;
     }
     return $new_value;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:44,代码来源:FrmProFieldsHelper.php

示例9: entry_link_href

 private static function entry_link_href($entry, $atts)
 {
     $args = array($atts['param_name'] => 'key' == $atts['param_value'] ? $entry->item_key : $entry->id);
     if ($atts['edit']) {
         $args['frm_action'] = 'edit';
     }
     if ($atts['link_type'] == 'scroll') {
         $link = '#' . $entry->item_key;
     } else {
         if ($atts['link_type'] == 'admin') {
             $link = add_query_arg($args, FrmAppHelper::get_server_value('REQUEST_URI'));
         } else {
             $link = add_query_arg($args, $atts['permalink']);
         }
     }
     return $link;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:17,代码来源:FrmProEntriesController.php

示例10: test_remove_get_action

 /**
  * @covers FrmAppHelper::remove_get_action
  */
 function test_remove_get_action()
 {
     $_GET['action'] = 'bulk_trash';
     $start_url = $_SERVER['REQUEST_URI'] = admin_url('admin.php?page=formidable&action=bulk_trash');
     FrmAppHelper::remove_get_action();
     $new_url = FrmAppHelper::get_server_value('REQUEST_URI');
     $this->assertNotEquals($new_url, $start_url);
 }
开发者ID:rbkhrlstn,项目名称:formidable-forms,代码行数:11,代码来源:test_FrmAppHelper.php


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