/** * Filter POST variables. * * @param string $var_name * * @return mixed */ private function filter_input_post($var_name) { $val = WPSEO_Utils::filter_input(INPUT_POST, $var_name); if ($val) { return WPSEO_Option::sanitize_text_field($val); } else { return ''; } }
/** * Loads the required scripts for the config page. */ function config_page_scripts() { wp_enqueue_script('wpseo-admin-script', plugins_url('js/wp-seo-admin' . WPSEO_CSSJS_SUFFIX . '.js', WPSEO_FILE), array('jquery', 'jquery-ui-core'), WPSEO_VERSION, true); wp_enqueue_script('dashboard'); wp_enqueue_script('thickbox'); $page = WPSEO_Utils::filter_input(INPUT_GET, 'page'); if ('wpseo_social' === $page) { wp_enqueue_media(); wp_enqueue_script('wpseo-admin-media', plugins_url('js/wp-seo-admin-media' . WPSEO_CSSJS_SUFFIX . '.js', WPSEO_FILE), array('jquery', 'jquery-ui-core'), WPSEO_VERSION, true); wp_localize_script('wpseo-admin-media', 'wpseoMediaL10n', $this->localize_media_script()); } if ('wpseo_bulk-editor' === $page) { wp_enqueue_script('wpseo-bulk-editor', plugins_url('js/wp-seo-bulk-editor' . WPSEO_CSSJS_SUFFIX . '.js', WPSEO_FILE), array('jquery'), WPSEO_VERSION, true); } }
/** * Create an export and return the URL */ function wpseo_get_export() { check_ajax_referer('wpseo-export'); $include_taxonomy = WPSEO_Utils::filter_input(INPUT_POST, 'include_taxonomy') === 'true' ? true : false; $export = new WPSEO_Export($include_taxonomy); wpseo_ajax_json_echo_die($export->get_results()); }
/** * See if we should start our tour. */ private function load_tour() { $restart_tour = WPSEO_Utils::filter_input(INPUT_GET, 'wpseo_restart_tour'); if ($restart_tour) { $this->options['ignore_tour'] = false; update_option('wpseo', $this->options); } if ($this->options['tracking_popup_done'] === false || $this->options['ignore_tour'] === false) { add_action('admin_enqueue_scripts', array('WPSEO_Pointers', 'get_instance')); } }
/** * Parse the query to get items from database. * * Based on given parameters there will be parse a query which will get all the pages/posts and other post_types * from the database. * * @param string $subquery * @param string $all_states * @param string $post_type_clause * * @return string */ protected function parse_item_query($subquery, $all_states, $post_type_clause) { // Order By block $orderby = WPSEO_Utils::filter_input(INPUT_GET, 'orderby'); $orderby = !empty($orderby) ? esc_sql(sanitize_text_field($orderby)) : 'post_title'; $orderby = $this->sanitize_orderby($orderby); // Order clause $order = WPSEO_Utils::filter_input(INPUT_GET, 'order'); $order = !empty($order) ? esc_sql(strtoupper(sanitize_text_field($order))) : 'ASC'; $order = $this->sanitize_order($order); // Get all needed results $query = "\n\t\t\t\tSELECT ID, post_title, post_type, post_status, post_modified, post_date\n\t\t\t\tFROM {$subquery}\n\t\t\t\tWHERE post_status IN ({$all_states}) {$post_type_clause}\n\t\t\t\tORDER BY {$orderby} {$order}\n\t\t\t\tLIMIT %d,%d\n\t\t\t"; return $query; }
/** * Cleans stopwords out of the slug, if the slug hasn't been set yet. * * @since 1.1.7 * * @param string $slug if this isn't empty, the function will return an unaltered slug. * * @return string $clean_slug cleaned slug */ function remove_stopwords_from_slug($slug) { // Don't change an existing slug if (isset($slug) && $slug !== '') { return $slug; } if (!WPSEO_Utils::filter_input(INPUT_POST, 'post_title')) { return $slug; } // Don't change slug if the post is a draft, this conflicts with polylang if ('draft' == WPSEO_Utils::filter_input(INPUT_POST, 'post_status')) { return $slug; } // Lowercase the slug and strip slashes $clean_slug = sanitize_title(stripslashes(WPSEO_Utils::filter_input(INPUT_POST, 'post_title'))); // Turn it to an array and strip stopwords by comparing against an array of stopwords $clean_slug_array = array_diff(explode('-', $clean_slug), $this->stopwords()); // Turn the sanitized array into a string $clean_slug = join('-', $clean_slug_array); return $clean_slug; }