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'); } }
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); }
/** * @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); }
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); }
/** * @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')); }
/** * @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; }
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; }
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(); }
/** * @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')); } }
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')); }
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(); }
/** * @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); }
/** * {@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']; } }
/** * @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)); }
public function _filter_verify_comment_meta_data($comment_data) { if ($this->accept_stars($comment_data['comment_post_ID']) && intval(FW_Request::POST($this->field_name)) < 1) { wp_die('<strong>' . __('ERROR', 'fw') . '</strong>' . ': ' . __('please rate the post.', 'fw')); } return $comment_data; }
public function set_favorites_action() { $favorites = json_decode(FW_Request::POST('favorites'), true); $this->set_favorites($favorites); $this->get_favorites_action(); }
public function _settings_form_render($data) { $this->enqueue_options_static(array()); wp_enqueue_script('fw-form-helpers'); $options = fw()->theme->get_settings_options(); if (empty($options)) { return $data; } if ($values = FW_Request::POST(FW_Option_Type::get_default_name_prefix())) { // This is form submit, extract correct values from $_POST values $values = fw_get_options_values_from_input($options, $values); } else { // Extract previously saved correct values $values = fw_get_db_settings_option(); } $ajax_submit = fw()->theme->get_config('settings_form_ajax_submit'); $side_tabs = fw()->theme->get_config('settings_form_side_tabs'); $data['attr']['class'] = 'fw-settings-form'; if ($side_tabs) { $data['attr']['class'] .= ' fw-backend-side-tabs'; } $data['submit']['html'] = '<!-- -->'; // is generated in view do_action('fw_settings_form_render', array('ajax_submit' => $ajax_submit, 'side_tabs' => $side_tabs)); fw_render_view(fw_get_framework_directory('/views/backend-settings-form.php'), array('options' => $options, 'values' => $values, 'reset_input_name' => '_fw_reset_options', 'ajax_submit' => $ajax_submit, 'side_tabs' => $side_tabs), false); return $data; }
/** * @internal */ public function _admin_action_wp_ajax_backup_settings_save() { if (!current_user_can('manage_options')) { wp_send_json_error(); } $options = $this->get_backup_settings_options(); $values = fw_get_options_values_from_input($options, FW_Request::POST('values')); fw_set_db_extension_data($this->get_name(), 'settings', $values); $this->reschedule(); // do reschedule // $this->init_services_cron(); // make cron.xxx services to be up to date wp_send_json_success(); }
/** * Get correct values from input (POST) for given options * This values can be saved in db then replaced with $option['value'] for each option * @param array $options * @param array $input_array * @return array Values */ function fw_get_options_values_from_input(array $options, $input_array = null) { if (!is_array($input_array)) { $input_array = FW_Request::POST(FW_Option_Type::get_default_name_prefix()); } $values = array(); foreach (fw_extract_only_options($options) as $id => $option) { $values[$id] = fw()->backend->option_type($option['type'])->get_value_from_input($option, isset($input_array[$id]) ? $input_array[$id] : null); if (is_null($values[$id])) { // do not save null values unset($values[$id]); } } return $values; }
public function _settings_form_render($data) { /** * wp moves flash message error with js after first h2 * if there are any h2 on the page it shows it wrong */ echo '<h2 class="fw-hidden"></h2>'; $options = fw()->theme->get_settings_options(); if (empty($options)) { return $data; } $values = FW_Request::POST(FW_Option_Type::get_default_name_prefix(), fw_get_db_settings_option()); echo fw()->backend->render_options($options, $values); $data['submit']['html'] = '<button class="button-primary button-large">' . __('Save', 'fw') . '</button>'; return $data; }
/** * @param array $data * @return array * @internal */ public function _extension_settings_form_save($data) { $extension = fw()->extensions->get(FW_Request::POST('fw_extension_name')); $options_before_save = (array) fw_get_db_ext_settings_option($extension->get_name()); fw_set_db_ext_settings_option($extension->get_name(), null, array_merge($options_before_save, fw_get_options_values_from_input($extension->get_settings_options()))); FW_Flash_Messages::add('fw_extension_settings_saved', __('Extensions settings successfully saved.', 'fw'), 'success'); $data['redirect'] = fw_current_url(); do_action('fw_extension_settings_form_saved:' . $extension->get_name(), $options_before_save); return $data; }
/** * @internal */ public function _action_ajax_delete_template() { if (!current_user_can('edit_posts')) { wp_send_json_error(); } $builder_type = (string) FW_Request::POST('builder_type'); if (!$this->builder_type_is_valid($builder_type)) { wp_send_json_error(); } $templates = $this->get_db_templates($builder_type); $template_id = (string) FW_Request::POST('template_id'); if (!isset($templates[$template_id])) { wp_send_json_error(); } unset($templates[$template_id]); $this->set_db_templates($builder_type, $templates); wp_send_json_success(); }
function save_option_value($option_id, $option, $value, $data = array()) { $settings = FW_Request::POST('fw_options/' . $option_id); fw_ext('sidebars')->save_sidebar_settings($settings); }
public function _settings_form_save($data) { $flash_id = 'fw_settings_form_save'; $old_values = (array) fw_get_db_settings_option(); if (!empty($_POST['_fw_reset_options'])) { // The "Reset" button was pressed fw_set_db_settings_option(null, array()); FW_Flash_Messages::add($flash_id, __('The options were successfully reset', 'fw'), 'success'); do_action('fw_settings_form_reset', $old_values); } else { // The "Save" button was pressed fw_set_db_settings_option(null, fw_get_options_values_from_input(fw()->theme->get_settings_options())); FW_Flash_Messages::add($flash_id, __('The options were successfully saved', 'fw'), 'success'); do_action('fw_settings_form_saved', $old_values); } $redirect_url = fw_current_url(); $focus_tab_input_name = '_focus_tab'; $focus_tab_id = trim(FW_Request::POST($focus_tab_input_name)); if (!empty($focus_tab_id)) { $redirect_url = add_query_arg($focus_tab_input_name, $focus_tab_id, remove_query_arg($focus_tab_input_name, $redirect_url)); } $data['redirect'] = $redirect_url; return $data; }
/** * @internal */ public function _action_update_extensions() { $nonce_name = '_nonce_fw_ext_update_extensions'; if (!isset($_POST[$nonce_name]) || !wp_verify_nonce($_POST[$nonce_name])) { wp_die(__('Invalid nonce.', 'fw')); } $form_input_name = 'extensions'; $extensions_list = FW_Request::POST($form_input_name); if (empty($extensions_list)) { FW_Flash_Messages::add('fw_ext_update', __('Please check the extensions you want to update.', 'fw'), 'warning'); wp_redirect(self_admin_url('update-core.php')); exit; } if (is_string($extensions_list)) { $extensions_list = json_decode($extensions_list); } else { $extensions_list = array_keys($extensions_list); } if (!class_exists('_FW_Ext_Update_Extensions_Upgrader_Skin')) { fw_include_file_isolated($this->get_declared_path('/includes/classes/class--fw-ext-update-extensions-upgrader-skin.php')); } $skin = new _FW_Ext_Update_Extensions_Upgrader_Skin(array('title' => __('Extensions Update', 'fw'))); require_once ABSPATH . 'wp-admin/admin-header.php'; $skin->header(); do { $original_post_value = $_POST[$form_input_name]; $_POST[$form_input_name] = wp_slash(json_encode($extensions_list)); if (!FW_WP_Filesystem::request_access(fw_get_framework_directory('/extensions'), fw_current_url(), array($nonce_name, $form_input_name))) { // revert hack changes $_POST[$form_input_name] = $original_post_value; unset($original_post_value); break; } // revert hack changes $_POST[$form_input_name] = $original_post_value; unset($original_post_value); $updates = $this->get_extensions_with_updates(); if (empty($updates)) { $skin->error(__('No extensions updates found.', 'fw')); break; } foreach ($extensions_list as $extension_name) { if (!($extension = fw()->extensions->get($extension_name))) { $skin->error(sprintf(__('Extension "%s" does not exist or is disabled.', 'fw'), $extension_name)); continue; } if (!isset($updates[$extension_name])) { $skin->error(sprintf(__('No update found for the "%s" extension.', 'fw'), $extension->manifest->get_name())); continue; } $update = $updates[$extension_name]; if (is_wp_error($update)) { $skin->error($update); continue; } /** @var FW_Ext_Update_Service $service */ $service = $this->get_child($update['service']); $update_result = $this->update(array('wp_fs_destination_dir' => FW_WP_Filesystem::real_path_to_filesystem_path($extension->get_declared_path()), 'download_callback' => array($service, '_download_extension'), 'download_callback_args' => array($extension, $update['latest_version'], $this->get_wp_fs_tmp_dir()), 'skin' => $skin, 'title' => sprintf(__('%s extension', 'fw'), $extension->manifest->get_name())), true); if (is_wp_error($update_result)) { $skin->error($update_result); continue; } $skin->set_result(true); if (!$this->get_config('extensions_as_one_update')) { $skin->decrement_extension_update_count($extension_name); } } if ($this->get_config('extensions_as_one_update')) { $skin->decrement_extension_update_count($extension_name); } $skin->after(); } while (false); $skin->footer(); require_once ABSPATH . 'wp-admin/admin-footer.php'; }
/** * @param array $fw_form_data * * @return array * * @internal */ public function _frontend_form_save($fw_form_data) { $form_id = FW_Request::POST('fw_ext_forms_form_id'); $form_type = FW_Request::POST('fw_ext_forms_form_type'); /** * @var FW_Ext_Forms_Type $form_instance */ $form_instance = fw_ext($form_type); /** * @var FW_Option_Type_Form_Builder $builder */ $builder = fw()->backend->option_type($form_instance->get_form_builder_type()); /** * {json: '...', ...} */ $builder_value = $form_instance->get_form_builder_value($form_id); /** * {[item], [item], ...} */ $builder_value_json_array = json_decode($builder_value['json'], true); /** * By default redirect to the same page * to prevent form submit alert on page refresh */ $fw_form_data['redirect'] = fw_current_url(); if (empty($builder_value_json_array)) { return $fw_form_data; } /** * {shortcode => item} */ $shortcode_to_item = array(); $this->extract_shortcode_item($shortcode_to_item, $builder_value_json_array); $process_data = $form_instance->process_form($builder->frontend_get_value_from_items($builder_value_json_array, FW_Request::POST()), array('shortcode_to_item' => $shortcode_to_item, 'builder_value' => $builder_value)); if (is_array($process_data)) { if (isset($process_data['redirect'])) { $fw_form_data['redirect'] = $process_data['redirect']; } } do_action('fw_ext_forms_frontend_submit', array('id' => $form_id, 'type' => $form_type, 'instance' => $form_instance, 'process_data' => $process_data)); return $fw_form_data; }
/** * @internal */ public function _admin_action_add_new_sidebar_ajax() { $name = FW_Request::POST('name'); $result = $this->backend->save_new_sidebar($name); $this->ajax_response($result); }
/** * @internal * * @param $data * * @return mixed */ public function _form_render($data) { $options = $this->get_seo_options(); if (empty($options)) { return $data; } $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; }
<?php echo fw()->backend->render_options($options, $values); ?> <div class="form-footer-buttons"> <!-- This div is required to follow after options in order to have special styles in case options will contain tabs (css adjacent selector + ) --> <?php echo fw_html_tag('input', array('type' => 'submit', 'name' => '_fw_save_options', 'value' => __('Save Changes', 'fw'), 'class' => 'button-primary button-large')); echo $side_tabs ? '' : ' '; echo fw_html_tag('input', array('type' => 'submit', 'name' => '_fw_reset_options', 'value' => __('Reset Options', 'fw'), 'class' => 'button-secondary button-large')); ?> </div> <!-- focus tab --> <?php $focus_tab_id = trim(FW_Request::POST($focus_tab_input_name, FW_Request::GET($focus_tab_input_name, ''))); echo fw_html_tag('input', array('type' => 'hidden', 'name' => $focus_tab_input_name, 'value' => $focus_tab_id)); ?> <script type="text/javascript"> jQuery(function($){ fwEvents.one("fw:options:init", function(){ var $form = $('form[data-fw-form-id="fw_settings"]:first'); $form.on("click", ".fw-options-tabs-wrapper > .fw-options-tabs-list > ul > li > a", function(){ $form.find("input[name='<?php echo esc_js($focus_tab_input_name); ?> ']").val( $(this).attr("href").replace(/^#/, "") // tab id ); });
/** * If now is a submit of this form * @return bool */ public function is_submitted() { if (is_null($this->is_submitted)) { $method = strtoupper($this->attr('method')); if ($method === 'POST') { $this->is_submitted = isset($_POST[self::$id_input_name]) && FW_Request::POST(self::$id_input_name) === $this->id; } elseif ($method === 'GET') { $this->is_submitted = isset($_GET[self::$id_input_name]) && FW_Request::GET(self::$id_input_name) === $this->id; } else { $this->is_submitted = false; } } return $this->is_submitted; }