本文整理汇总了PHP中WPSEO_Utils::filter_input方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Utils::filter_input方法的具体用法?PHP WPSEO_Utils::filter_input怎么用?PHP WPSEO_Utils::filter_input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Utils
的用法示例。
在下文中一共展示了WPSEO_Utils::filter_input方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter_input_post
/**
* 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 '';
}
}
示例2: config_page_scripts
/**
* 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);
}
}
示例3: wpseo_get_export
/**
* 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());
}
示例4: load_tour
/**
* 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'));
}
}
示例5: parse_item_query
/**
* 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;
}
示例6: remove_stopwords_from_slug
/**
* 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;
}