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


PHP FW_Request类代码示例

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


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

示例1: process_form

 public function process_form($form_values, $data)
 {
     $flash_id = 'fw_ext_contact_form_process';
     if (empty($form_values)) {
         FW_Flash_Messages::add($flash_id, __('Unable to process the form', 'fw'), 'error');
         return;
     }
     $form_id = FW_Request::POST('fw_ext_forms_form_id');
     if (empty($form_id)) {
         FW_Flash_Messages::add($flash_id, __('Unable to process the form', 'fw'), 'error');
     }
     $form = $this->get_db_data($this->get_name() . '-' . $form_id);
     if (empty($form)) {
         FW_Flash_Messages::add($flash_id, __('Unable to process the form', 'fw'), 'error');
     }
     $to = $form['email_to'];
     if (!filter_var($to, FILTER_VALIDATE_EMAIL)) {
         FW_Flash_Messages::add($flash_id, __('Invalid destination email (please contact the site administrator)', 'fw'), 'error');
         return;
     }
     $entry_data = array('form_values' => $form_values, 'shortcode_to_item' => $data['shortcode_to_item']);
     $result = fw_ext_mailer_send_mail($to, $this->get_db_data($this->get_name() . '-' . $form_id . '/subject_message', ''), $this->render_view('email', $entry_data), $entry_data);
     if ($result['status']) {
         FW_Flash_Messages::add($flash_id, $this->get_db_data($this->get_name() . '-' . $form_id . '/success_message', __('Message sent!', 'fw')), 'success');
     } else {
         FW_Flash_Messages::add($flash_id, $this->get_db_data($this->get_name() . '-' . $form_id . '/failure_message', __('Oops something went wrong.', 'fw')) . ' <em style="color:transparent;">' . $result['message'] . '</em>', 'error');
     }
 }
开发者ID:HilderH,项目名称:emprendamos,代码行数:28,代码来源:class-fw-extension-contact-forms.php

示例2: _ajax_get_results_json_ajax

 public function _ajax_get_results_json_ajax()
 {
     $this->load_data();
     $data_provider = FW_Request::POST('data_provider');
     $result = call_user_func($this->data[$data_provider]['callback'], FW_Request::POST());
     wp_send_json_success($result);
 }
开发者ID:northpen,项目名称:northpen,代码行数:7,代码来源:class-fw-shortcode-calendar.php

示例3: _theme_action_print_saved_css

 /**
  * @internal
  */
 public function _theme_action_print_saved_css()
 {
     $stored_style = FW_Request::COOKIE($this->cache_key);
     if (!empty($this->options['predefined'][$stored_style])) {
         echo $this->generate_initial_css($this->options['blocks'], $this->options['predefined'][$stored_style]);
     }
 }
开发者ID:puriwp,项目名称:Framework-Styling,代码行数:10,代码来源:class-fw-extension-switch-style-panel.php

示例4: delete_builder_template

function delete_builder_template()
{
    $path = 'builder_template/' . $_POST['builder_type'];
    $db_options = fw_get_db_settings_option($path);
    fw_aku(FW_Request::POST('uniqid'), $db_options);
    fw_set_db_settings_option($path, $db_options);
}
开发者ID:Code-Divine,项目名称:Dunda-Builder-Extension,代码行数:7,代码来源:template-saving.php

示例5: _admin_action_get_ajax_response

 /**
  * @internal
  */
 public static function _admin_action_get_ajax_response()
 {
     /**
      * @var WPDB $wpdb
      */
     global $wpdb;
     $type = FW_Request::POST('data/type');
     $names = json_decode(FW_Request::POST('data/names'), true);
     $title = FW_Request::POST('data/string');
     $items = array();
     switch ($type) {
         case 'posts':
             $items = $wpdb->get_results(call_user_func_array(array($wpdb, 'prepare'), array_merge(array("SELECT ID val, post_title title " . "FROM {$wpdb->posts} " . "WHERE post_title LIKE %s " . "AND post_status IN ( 'publish', 'private' ) " . "AND post_type IN ( " . implode(', ', array_fill(1, count($names), '%s')) . " ) " . "LIMIT 100", '%' . $wpdb->esc_like($title) . '%'), $names)));
             break;
         case 'taxonomy':
             $items = $wpdb->get_results(call_user_func_array(array($wpdb, 'prepare'), array_merge(array("SELECT terms.term_id val, terms.name title " . "FROM {$wpdb->terms} as terms, {$wpdb->term_taxonomy} as taxonomies " . "WHERE terms.name LIKE %s AND taxonomies.taxonomy IN ( " . implode(', ', array_fill(1, count($names), '%s')) . " ) " . "AND terms.term_id = taxonomies.term_id " . "AND taxonomies.term_id = taxonomies.term_taxonomy_id " . "LIMIT 100", '%' . $wpdb->esc_like($title) . '%'), $names)));
             break;
         case 'users':
             if (empty($names)) {
                 $items = $wpdb->get_results($wpdb->prepare("SELECT users.id val, users.user_nicename title " . "FROM {$wpdb->users} as users " . "WHERE users.user_nicename LIKE %s " . "LIMIT 100", '%' . $wpdb->esc_like($title) . '%'));
             } else {
                 $like_user_meta = array();
                 foreach ($names as $name) {
                     $like_user_meta[] = '%' . $wpdb->esc_like($name) . '%';
                 }
                 $items = $wpdb->get_results(call_user_func_array(array($wpdb, 'prepare'), array_merge(array("SELECT users.id val, users.user_nicename title " . "FROM {$wpdb->users} as users, {$wpdb->usermeta} as usermeta " . "WHERE users.user_nicename LIKE %s AND usermeta.meta_key = 'wp_capabilities' " . "AND ( " . implode(' OR ', array_fill(1, count($like_user_meta), 'usermeta.meta_value LIKE %s')) . " ) " . "AND usermeta.user_id = users.ID", '%' . $wpdb->esc_like($title) . '%'), $like_user_meta)));
             }
             break;
     }
     wp_send_json_success($items);
 }
开发者ID:cristeamdev,项目名称:Unyson,代码行数:34,代码来源:class-fw-option-type-multi-select.php

示例6: _admin_action_wp_ajax_backup_feedback

 /**
  * @internal
  */
 public function _admin_action_wp_ajax_backup_feedback()
 {
     $subject = FW_Request::POST('subject');
     if ($feedback = $this->backup()->get_feedback($subject)) {
         $html = $this->backup()->render_str('feedback', compact('subject'));
         wp_send_json_success(compact('html'));
     }
     wp_send_json_error(array('error' => 'No feedback was found'));
 }
开发者ID:setcomunicacao,项目名称:setdigital,代码行数:12,代码来源:class-fw-backup-ajax.php

示例7: _form_render

 /**
  * @internal
  */
 public function _form_render($data)
 {
     $this->add_admin_static();
     $options = array(array('custom_css' => array('title' => false, 'type' => 'box', 'options' => self::$user_options)));
     $values = FW_Request::POST(FW_Option_Type::get_default_name_prefix(), fw_get_db_extension_data($this->get_name(), 'options'));
     echo fw()->backend->render_options($options, $values);
     $data['submit']['html'] = '<button class="button-primary button-large">' . __('Save', 'fw') . '</button>';
     unset($options);
     return $data;
 }
开发者ID:puriwp,项目名称:Framework-Styling,代码行数:13,代码来源:class-fw-extension-styling.php

示例8: _action_admin_save_shortcodes

 public function _action_admin_save_shortcodes($post_id, $post)
 {
     if (wp_is_post_autosave($post_id)) {
         $original_id = wp_is_post_autosave($post_id);
         $original_post = get_post($original_id);
     } else {
         if (wp_is_post_revision($post_id)) {
             $original_id = wp_is_post_revision($post_id);
             $original_post = get_post($original_id);
         } else {
             $original_id = $post_id;
             $original_post = $post;
         }
     }
     if (!$this->is_supported_post($original_id) || !post_type_supports($original_post->post_type, $this->get_parent()->get_supports_feature_name())) {
         return false;
     }
     // todo: field 'content' smth changes ?
     $post_content = FW_Request::POST('content');
     // {"notification":{"1":{"message":"Message!","type":""}},"button":{"1":{},"2":{}},"text_block":{"1":{}}}
     $input_value = FW_Request::POST($this->meta_key);
     $tmp_val = json_decode($input_value, true);
     $new_val = array();
     // supported shortcodes
     $tags = implode('|', array_keys(fw_ext('shortcodes')->get_shortcodes()));
     $default_values = array();
     // only supported tags & integer\alphabetic string id
     if (preg_match_all('/\\[(' . $tags . ')(?:\\s+[^\\[\\]]*)fw_shortcode_id=[\\"\']([A-Za-z0-9]+)[\\"\'](?:\\s?[^\\[\\]]*)\\]/', $post_content, $output_array)) {
         foreach ($output_array[0] as $match_key => $match) {
             $tag = $output_array[1][$match_key];
             $id = $output_array[2][$match_key];
             if (!isset($tmp_val[$tag]) || !isset($tmp_val[$tag][$id]) || empty($tmp_val[$tag][$id])) {
                 $shortcode = fw_ext('shortcodes')->get_shortcode($tag);
                 if ($shortcode) {
                     $new_val[$tag][$id] = fw_get_options_values_from_input($shortcode->get_options(), array());
                 }
             } elseif (isset($tmp_val[$tag][$id]) and false === empty($tmp_val[$tag][$id])) {
                 $new_val[$tag][$id] = $tmp_val[$tag][$id];
             }
         }
     }
     // only supported tags match (defaults)
     if (preg_match_all('/\\[(' . $tags . ')(?:\\s+[^\\[\\]]*).*(?:\\s?[^\\[\\]]*)\\]/', $post_content, $output_array)) {
         foreach ($output_array[0] as $match_key => $match) {
             $tag = $output_array[1][$match_key];
             $shortcode = fw_ext('shortcodes')->get_shortcode($tag);
             if (!empty($shortcode) && is_array($shortcode->get_options())) {
                 $default_values[$tag] = fw_get_options_values_from_input($shortcode->get_options(), array());
             }
         }
     }
     update_post_meta($post_id, $this->meta_key_defaults, str_replace('\\', '\\\\', json_encode($default_values)));
     update_post_meta($post_id, $this->meta_key, str_replace('\\', '\\\\', json_encode($new_val)));
     return true;
 }
开发者ID:ExtPoint,项目名称:Unyson-PageBuilder-Extension,代码行数:55,代码来源:class-fw-extension-editor-shortcodes.php

示例9: _action_ajax_unset_storage_item

 public static function _action_ajax_unset_storage_item()
 {
     if (!current_user_can('edit_posts')) {
         wp_send_json_error();
     }
     $storage_items = self::get_storage_items();
     $key = array_search((int) FW_Request::POST('post_id'), $storage_items);
     unset($storage_items[$key]);
     self::set_storage_items($storage_items);
     wp_send_json_success();
 }
开发者ID:reardestani,项目名称:Unyson-Builder-Extension,代码行数:11,代码来源:fullscreen.php

示例10: _action_get_oembed_response

 public static function _action_get_oembed_response()
 {
     if (wp_verify_nonce(FW_Request::POST('_nonce'), '_action_get_oembed_response')) {
         $url = FW_Request::POST('url');
         $width = FW_Request::POST('preview/width');
         $height = FW_Request::POST('preview/height');
         $keep_ratio = FW_Request::POST('preview/keep_ratio') === 'true';
         $iframe = empty($keep_ratio) ? fw_oembed_get($url, compact('width', 'height')) : wp_oembed_get($url, compact('width', 'height'));
         wp_send_json_success(array('response' => $iframe));
     }
     wp_send_json_error(array('message' => 'Invalid nonce'));
 }
开发者ID:puriwp,项目名称:Theme-Framework,代码行数:12,代码来源:class-fw-option-type-oembed.php

示例11: _init

 /**
  * @internal
  */
 protected function _init()
 {
     if (!is_admin()) {
         // loads the shortcodes
         add_action('fw_extensions_init', array($this, '_action_fw_extensions_init'));
         // renders the shortcodes so that css will get in <head>
         add_action('wp_enqueue_scripts', array($this, '_action_enqueue_shortcodes_static_in_frontend_head'));
     } elseif (defined('DOING_AJAX') && DOING_AJAX === true && FW_Request::POST('fw_load_shortcodes')) {
         // load the shortcodes if this was requested via ajax
         add_action('fw_extensions_init', array($this, '_action_fw_extensions_init'));
     }
 }
开发者ID:alireza--noori,项目名称:initial-portfolio-website-test-,代码行数:15,代码来源:class-fw-extension-shortcodes.php

示例12: _action_ajax_delete_template

 public static function _action_ajax_delete_template()
 {
     if (!current_user_can('edit_posts')) {
         wp_send_json_error();
     }
     $builder_type = (string) FW_Request::POST('builder_type');
     if (empty($builder_type) || !fw()->backend->option_type($builder_type) || !fw()->backend->option_type($builder_type) instanceof FW_Option_Type_Builder) {
         wp_send_json_error();
     }
     $templates = self::get_templates($builder_type);
     unset($templates[(string) FW_Request::POST('uniqid')]);
     self::set_templates($builder_type, $templates);
     wp_send_json_success();
 }
开发者ID:setcomunicacao,项目名称:setdigital,代码行数:14,代码来源:template-saving.php

示例13: _action_ajax_cache_slide

 /**
  * @internal
  */
 public static function _action_ajax_cache_slide()
 {
     $output = '';
     $attr_data = json_decode(FW_Request::POST('option'), true);
     $option = $attr_data['option'];
     $id = $attr_data['id'];
     $data = $attr_data['data'];
     parse_str(FW_Request::POST('values'), $values);
     if (isset($values)) {
         $options_values_cache = $values['fw_options']['custom-slides'];
         $options_values = array_pop($options_values_cache);
         $valid_values = fw_get_options_values_from_input($option['slides_options'], $options_values);
         foreach ($values['fw_options']['custom-slides'] as $key => $value) {
             $output .= "<div class='fw-slide slide-" . $key . "'  data-order='" . $key . "'>";
             $output .= fw()->backend->render_options($option['slides_options'], $valid_values, array('id_prefix' => $data['id_prefix'] . $id . '-' . $key . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . '][' . $key . ']'));
             $output .= "</div>";
         }
     }
     wp_send_json($output);
 }
开发者ID:Archrom,项目名称:wordpress_remaf,代码行数:23,代码来源:class-fw-option-type-slides.php

示例14: frontend_validate

 /**
  * {@inheritdoc}
  */
 public function frontend_validate(array $item, $input_value)
 {
     $mesages = array('not-configured' => __('Could not validate the form', 'fw'), 'not-human' => __('Please fill the recaptcha', 'fw'));
     $keys = fw_ext('forms')->get_db_settings_option('recaptcha-keys');
     if (empty($keys)) {
         return $mesages['not-configured'];
     }
     $recaptcha = new ReCaptcha($keys['secret-key']);
     $gRecaptchaResponse = FW_Request::POST('g-recaptcha-response');
     if (empty($gRecaptchaResponse)) {
         return $mesages['not-human'];
     }
     $resp = $recaptcha->verify($gRecaptchaResponse);
     if ($resp->isSuccess()) {
         return false;
     } else {
         $errors = $resp->getErrorCodes();
         return $mesages['not-human'];
     }
 }
开发者ID:HilderH,项目名称:emprendamos,代码行数:23,代码来源:class-fw-option-type-form-builder-item-recaptcha.php

示例15: _action_ajax_render

 /**
  * @internal
  */
 public static function _action_ajax_render()
 {
     if (!current_user_can('edit_posts')) {
         wp_send_json_error();
     }
     $builder_type = (string) FW_Request::POST('builder_type');
     if (!fw()->backend->option_type($builder_type)) {
         wp_send_json_error();
     }
     $first = true;
     $html = '<div class="fw-builder-templates-types">';
     foreach (self::get_components() as $component) {
         $component_html = $component->_render(array('builder_type' => $builder_type));
         if (empty($component_html)) {
             continue;
         }
         $html .= '<div class="fw-builder-templates-type fw-builder-templates-type-' . esc_attr($component->get_type()) . '"' . ' data-type="' . esc_attr($component->get_type()) . '">' . '<a class="fw-builder-templates-type-title" href="#" onclick="return false;">' . $component->get_title() . '</a>' . '<div class="fw-builder-templates-type-content' . ($first ? '' : ' fw-hidden') . '">' . $component_html . '</div>' . '</div>';
         $first = false;
         unset($component_html);
     }
     $html .= '</div>';
     wp_send_json_success(array('html' => $html));
 }
开发者ID:reardestani,项目名称:Unyson-Builder-Extension,代码行数:26,代码来源:class-fw-ext-builder-templates.php


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