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


PHP sanitize_title函数代码示例

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


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

示例1: coni_body_classes

/**
 * Adds custom classes to the array of body classes.
 *
 * @param array $classes Classes for the body element.
 * @return array
 */
function coni_body_classes($classes)
{
    $coni_theme_data = wp_get_theme();
    $classes[] = sanitize_title($coni_theme_data['Name']);
    $classes[] = 'v' . $coni_theme_data['Version'];
    return $classes;
}
开发者ID:nicoandrade,项目名称:Coni,代码行数:13,代码来源:extras.php

示例2: acf_get_valid_options_page

function acf_get_valid_options_page($page = '')
{
    // allow for string
    if (empty($page)) {
        $page = array('page_title' => __('Options', 'acf'), 'menu_title' => __('Options', 'acf'), 'menu_slug' => 'acf-options');
    } elseif (is_string($page)) {
        $page_title = $page;
        $page = array('page_title' => $page_title, 'menu_title' => $page_title);
    }
    // defaults
    $page = wp_parse_args($page, array('page_title' => '', 'menu_title' => '', 'menu_slug' => '', 'capability' => 'edit_posts', 'parent_slug' => '', 'position' => false, 'icon_url' => false, 'redirect' => true, 'post_id' => 'options', 'autoload' => false, 'update_button' => __('Update', 'acf')));
    // ACF4 compatibility
    $migrate = array('title' => 'page_title', 'menu' => 'menu_title', 'slug' => 'menu_slug', 'parent' => 'parent_slug');
    foreach ($migrate as $old => $new) {
        if (!empty($page[$old])) {
            $page[$new] = acf_extract_var($page, $old);
        }
    }
    // page_title (allows user to define page with just page_title or title)
    if (empty($page['menu_title'])) {
        $page['menu_title'] = $page['page_title'];
    }
    // menu_slug
    if (empty($page['menu_slug'])) {
        $page['menu_slug'] = 'acf-options-' . sanitize_title($page['menu_title']);
    }
    // return
    return $page;
}
开发者ID:Garth619,项目名称:Femi9,代码行数:29,代码来源:api-options-page.php

示例3: process

 public static function process($data, $params)
 {
     if (isset($_GET['pal'])) {
         echo '<br /><br /><i><b>File</b> ' . __FILE__ . ' <b>Line</b> ' . __LINE__ . "</i><br />\n";
         echo '<pre>';
         echo 'Params: ';
         print_r($params);
         echo 'Data: ';
         print_r($data);
         echo '</pre>';
     }
     $res = new stdClass();
     $res->slug = '';
     if ($data->text == '') {
         return $res;
     }
     $slug = $data->text;
     $slug = self::replace_chars($slug, $params);
     if (isset($_GET['pslug'])) {
         echo '<br /><br /><i><b>File</b> ' . __FILE__ . ' <b>Line</b> ' . __LINE__ . "</i><br />\n";
         echo 'Alias: ' . $slug . '<br />';
     }
     $slug = wp_strip_all_tags($slug);
     /*$slug = preg_replace( '/[^a-zA-Z0-9\-\s]/', '', $slug );
     		$slug = preg_replace( '/\s+/', '-', $slug );
     		$slug = preg_replace( '/\-+/', '-', trim( $slug ) );*/
     $slug = sanitize_title($slug);
     $slug = strtolower($slug);
     if (isset($_GET['pslug'])) {
         echo '<br /><br /><i><b>File</b> ' . __FILE__ . ' <b>Line</b> ' . __LINE__ . "</i><br />\n";
         echo 'Alias: ' . $slug . '<br />';
     }
     $res->slug = $slug;
     return $res;
 }
开发者ID:kosir,项目名称:wp-pipes,代码行数:35,代码来源:slug.php

示例4: __construct

 /**
  * Construct Upload parameters.
  *
  * @since 2.3.0
  * @since 2.4.0 Add the $upload_dir_filter_args argument to the $arguments array
  *
  * @param array|string $args {
  *     @type int    $original_max_filesize  Maximum file size in kilobytes. Defaults to php.ini settings.
  *     @type array  $allowed_mime_types     List of allowed file extensions (eg: array( 'jpg', 'gif', 'png' ) ).
  *                                          Defaults to WordPress allowed mime types.
  *     @type string $base_dir               Component's upload base directory. Defaults to WordPress 'uploads'.
  *     @type string $action                 The upload action used when uploading a file, $_POST['action'] must be set
  *                                          and its value must equal $action {@link wp_handle_upload()} (required).
  *     @type string $file_input             The name attribute used in the file input. (required).
  *     @type array  $upload_error_strings   A list of specific error messages (optional).
  *     @type array  $required_wp_files      The list of required WordPress core files. Default: array( 'file' ).
  *     @type int    $upload_dir_filter_args 1 to receive the original Upload dir array in the Upload dir filter, 0 otherwise.
  *                                          Defaults to 0 (optional).
  * }
  */
 public function __construct($args = '')
 {
     // Upload action and the file input name are required parameters.
     if (empty($args['action']) || empty($args['file_input'])) {
         return false;
     }
     // Sanitize the action ID and the file input name.
     $this->action = sanitize_key($args['action']);
     $this->file_input = sanitize_key($args['file_input']);
     /**
      * Max file size defaults to php ini settings or, in the case of
      * a multisite config, the root site fileupload_maxk option
      */
     $this->default_args['original_max_filesize'] = (int) wp_max_upload_size();
     $params = bp_parse_args($args, $this->default_args, $this->action . '_upload_params');
     foreach ($params as $key => $param) {
         if ('upload_error_strings' === $key) {
             $this->{$key} = $this->set_upload_error_strings($param);
             // Sanitize the base dir.
         } elseif ('base_dir' === $key) {
             $this->{$key} = sanitize_title($param);
             // Sanitize the upload dir filter arg to pass.
         } elseif ('upload_dir_filter_args' === $key) {
             $this->{$key} = (int) $param;
             // Action & File input are already set and sanitized.
         } elseif ('action' !== $key && 'file_input' !== $key) {
             $this->{$key} = $param;
         }
     }
     // Set the path/url and base dir for uploads.
     $this->set_upload_dir();
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:52,代码来源:class-bp-attachment.php

示例5: output

 /**
  * Output the shortcode.
  *
  * @access public
  * @param array $atts
  * @return void
  */
 public static function output($atts)
 {
     global $wp;
     // Check cart class is loaded or abort
     if (is_null(WC()->cart)) {
         return;
     }
     if (!is_user_logged_in()) {
         $message = apply_filters('woocommerce_my_account_message', '');
         if (!empty($message)) {
             wc_add_notice($message);
         }
         if (isset($wp->query_vars['lost-password'])) {
             self::lost_password();
         } else {
             wc_get_template('myaccount/form-login.php');
         }
     } else {
         if (!empty($wp->query_vars['view-order'])) {
             self::view_order(absint($wp->query_vars['view-order']));
         } elseif (isset($wp->query_vars['edit-account'])) {
             self::edit_account();
         } elseif (isset($wp->query_vars['edit-address'])) {
             self::edit_address(wc_edit_address_i18n(sanitize_title($wp->query_vars['edit-address']), true));
         } elseif (isset($wp->query_vars['add-payment-method'])) {
             self::add_payment_method();
         } else {
             self::my_account($atts);
         }
     }
 }
开发者ID:nightbook,项目名称:woocommerce,代码行数:38,代码来源:class-wc-shortcode-my-account.php

示例6: prepare_items

 public function prepare_items()
 {
     global $wpdb, $per_page;
     $per_page = $this->get_items_per_page('formidable_page_formidable_entries_per_page');
     $form_id = $this->params['form'];
     if (!$form_id) {
         $this->items = array();
         $this->set_pagination_args(array('total_items' => 0, 'per_page' => $per_page));
         return;
     }
     $default_orderby = 'id';
     $default_order = 'DESC';
     $s_query = array('it.form_id' => $form_id);
     $s = isset($_REQUEST['s']) ? stripslashes($_REQUEST['s']) : '';
     if ($s != '' && FrmAppHelper::pro_is_installed()) {
         $fid = isset($_REQUEST['fid']) ? sanitize_title($_REQUEST['fid']) : '';
         $s_query = FrmProEntriesHelper::get_search_str($s_query, $s, $form_id, $fid);
     }
     $orderby = isset($_REQUEST['orderby']) ? sanitize_title($_REQUEST['orderby']) : $default_orderby;
     if (strpos($orderby, 'meta') !== false) {
         $order_field_type = FrmField::get_type(str_replace('meta_', '', $orderby));
         $orderby .= in_array($order_field_type, array('number', 'scale')) ? ' +0 ' : '';
     }
     $order = isset($_REQUEST['order']) ? sanitize_title($_REQUEST['order']) : $default_order;
     $order = ' ORDER BY ' . $orderby . ' ' . $order;
     $page = $this->get_pagenum();
     $start = (int) isset($_REQUEST['start']) ? absint($_REQUEST['start']) : ($page - 1) * $per_page;
     $this->items = FrmEntry::getAll($s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, false);
     $total_items = FrmEntry::getRecordCount($s_query);
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page));
 }
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:31,代码来源:FrmEntriesListHelper.php

示例7: register_taxonomies

 /**
  * Register core taxonomies.
  */
 public static function register_taxonomies()
 {
     if (taxonomy_exists('product_type')) {
         return;
     }
     do_action('woocommerce_register_taxonomy');
     $permalinks = get_option('woocommerce_permalinks');
     register_taxonomy('product_type', apply_filters('woocommerce_taxonomy_objects_product_type', array('product')), apply_filters('woocommerce_taxonomy_args_product_type', array('hierarchical' => false, 'show_ui' => false, 'show_in_nav_menus' => false, 'query_var' => is_admin(), 'rewrite' => false, 'public' => false)));
     register_taxonomy('product_cat', apply_filters('woocommerce_taxonomy_objects_product_cat', array('product')), apply_filters('woocommerce_taxonomy_args_product_cat', array('hierarchical' => true, 'update_count_callback' => '_wc_term_recount', 'label' => __('Product Categories', 'woocommerce'), 'labels' => array('name' => __('Product Categories', 'woocommerce'), 'singular_name' => __('Product Category', 'woocommerce'), 'menu_name' => _x('Categories', 'Admin menu name', 'woocommerce'), 'search_items' => __('Search Product Categories', 'woocommerce'), 'all_items' => __('All Product Categories', 'woocommerce'), 'parent_item' => __('Parent Product Category', 'woocommerce'), 'parent_item_colon' => __('Parent Product Category:', 'woocommerce'), 'edit_item' => __('Edit Product Category', 'woocommerce'), 'update_item' => __('Update Product Category', 'woocommerce'), 'add_new_item' => __('Add New Product Category', 'woocommerce'), 'new_item_name' => __('New Product Category Name', 'woocommerce')), 'show_ui' => true, 'query_var' => true, 'capabilities' => array('manage_terms' => 'manage_product_terms', 'edit_terms' => 'edit_product_terms', 'delete_terms' => 'delete_product_terms', 'assign_terms' => 'assign_product_terms'), 'rewrite' => array('slug' => empty($permalinks['category_base']) ? _x('product-category', 'slug', 'woocommerce') : $permalinks['category_base'], 'with_front' => false, 'hierarchical' => true))));
     register_taxonomy('product_tag', apply_filters('woocommerce_taxonomy_objects_product_tag', array('product')), apply_filters('woocommerce_taxonomy_args_product_tag', array('hierarchical' => false, 'update_count_callback' => '_wc_term_recount', 'label' => __('Product Tags', 'woocommerce'), 'labels' => array('name' => __('Product Tags', 'woocommerce'), 'singular_name' => __('Product Tag', 'woocommerce'), 'menu_name' => _x('Tags', 'Admin menu name', 'woocommerce'), 'search_items' => __('Search Product Tags', 'woocommerce'), 'all_items' => __('All Product Tags', 'woocommerce'), 'edit_item' => __('Edit Product Tag', 'woocommerce'), 'update_item' => __('Update Product Tag', 'woocommerce'), 'add_new_item' => __('Add New Product Tag', 'woocommerce'), 'new_item_name' => __('New Product Tag Name', 'woocommerce'), 'popular_items' => __('Popular Product Tags', 'woocommerce'), 'separate_items_with_commas' => __('Separate Product Tags with commas', 'woocommerce'), 'add_or_remove_items' => __('Add or remove Product Tags', 'woocommerce'), 'choose_from_most_used' => __('Choose from the most used Product tags', 'woocommerce'), 'not_found' => __('No Product Tags found', 'woocommerce')), 'show_ui' => true, 'query_var' => true, 'capabilities' => array('manage_terms' => 'manage_product_terms', 'edit_terms' => 'edit_product_terms', 'delete_terms' => 'delete_product_terms', 'assign_terms' => 'assign_product_terms'), 'rewrite' => array('slug' => empty($permalinks['tag_base']) ? _x('product-tag', 'slug', 'woocommerce') : $permalinks['tag_base'], 'with_front' => false))));
     register_taxonomy('product_shipping_class', apply_filters('woocommerce_taxonomy_objects_product_shipping_class', array('product', 'product_variation')), apply_filters('woocommerce_taxonomy_args_product_shipping_class', array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Shipping Classes', 'woocommerce'), 'labels' => array('name' => __('Shipping Classes', 'woocommerce'), 'singular_name' => __('Shipping Class', 'woocommerce'), 'menu_name' => _x('Shipping Classes', 'Admin menu name', 'woocommerce'), 'search_items' => __('Search Shipping Classes', 'woocommerce'), 'all_items' => __('All Shipping Classes', 'woocommerce'), 'parent_item' => __('Parent Shipping Class', 'woocommerce'), 'parent_item_colon' => __('Parent Shipping Class:', 'woocommerce'), 'edit_item' => __('Edit Shipping Class', 'woocommerce'), 'update_item' => __('Update Shipping Class', 'woocommerce'), 'add_new_item' => __('Add New Shipping Class', 'woocommerce'), 'new_item_name' => __('New Shipping Class Name', 'woocommerce')), 'show_ui' => false, 'show_in_nav_menus' => false, 'query_var' => is_admin(), 'capabilities' => array('manage_terms' => 'manage_product_terms', 'edit_terms' => 'edit_product_terms', 'delete_terms' => 'delete_product_terms', 'assign_terms' => 'assign_product_terms'), 'rewrite' => false)));
     global $wc_product_attributes;
     $wc_product_attributes = array();
     if ($attribute_taxonomies = wc_get_attribute_taxonomies()) {
         foreach ($attribute_taxonomies as $tax) {
             if ($name = wc_attribute_taxonomy_name($tax->attribute_name)) {
                 $tax->attribute_public = absint(isset($tax->attribute_public) ? $tax->attribute_public : 1);
                 $label = !empty($tax->attribute_label) ? $tax->attribute_label : $tax->attribute_name;
                 $wc_product_attributes[$name] = $tax;
                 $taxonomy_data = array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'labels' => array('name' => $label, 'singular_name' => $label, 'search_items' => sprintf(__('Search %s', 'woocommerce'), $label), 'all_items' => sprintf(__('All %s', 'woocommerce'), $label), 'parent_item' => sprintf(__('Parent %s', 'woocommerce'), $label), 'parent_item_colon' => sprintf(__('Parent %s:', 'woocommerce'), $label), 'edit_item' => sprintf(__('Edit %s', 'woocommerce'), $label), 'update_item' => sprintf(__('Update %s', 'woocommerce'), $label), 'add_new_item' => sprintf(__('Add New %s', 'woocommerce'), $label), 'new_item_name' => sprintf(__('New %s', 'woocommerce'), $label)), 'show_ui' => false, 'query_var' => 1 === $tax->attribute_public, 'rewrite' => false, 'sort' => false, 'public' => 1 === $tax->attribute_public, 'show_in_nav_menus' => 1 === $tax->attribute_public && apply_filters('woocommerce_attribute_show_in_nav_menus', false, $name), 'capabilities' => array('manage_terms' => 'manage_product_terms', 'edit_terms' => 'edit_product_terms', 'delete_terms' => 'delete_product_terms', 'assign_terms' => 'assign_product_terms'));
                 if (1 === $tax->attribute_public) {
                     $taxonomy_data['rewrite'] = array('slug' => empty($permalinks['attribute_base']) ? '' : trailingslashit($permalinks['attribute_base']) . sanitize_title($tax->attribute_name), 'with_front' => false, 'hierarchical' => true);
                 }
                 register_taxonomy($name, apply_filters("woocommerce_taxonomy_objects_{$name}", array('product')), apply_filters("woocommerce_taxonomy_args_{$name}", $taxonomy_data));
             }
         }
         do_action('woocommerce_after_register_taxonomy');
     }
 }
开发者ID:flasomm,项目名称:Montkailash,代码行数:32,代码来源:class-wc-post-types.php

示例8: add_menu

 function add_menu($args = array())
 {
     $defaults = array('title' => false, 'href' => false, 'parent' => false, 'id' => false, 'meta' => false);
     $r = wp_parse_args($args, $defaults);
     extract($r, EXTR_SKIP);
     if (empty($title)) {
         return false;
     }
     /* Make sure we have a valid ID */
     if (empty($id)) {
         $id = esc_attr(sanitize_title(trim($title)));
     }
     if (!empty($parent)) {
         /* Add the menu to the parent item */
         $child = array('id' => $id, 'title' => $title, 'href' => $href);
         if (!empty($meta)) {
             $child['meta'] = $meta;
         }
         $this->add_node($parent, $this->menu, $child);
     } else {
         /* Add the menu item */
         $this->menu->{$id} = array('title' => $title, 'href' => $href);
         if (!empty($meta)) {
             $this->menu->{$id}['meta'] = $meta;
         }
     }
 }
开发者ID:vpatrinica,项目名称:jfdesign,代码行数:27,代码来源:class-wp-admin-bar.php

示例9: output

 /**
  * Settings page.
  *
  * Handles the display of the main woocommerce settings page in admin.
  *
  * @access public
  * @return void
  */
 public static function output()
 {
     global $current_section, $current_tab;
     do_action('be_compare_settings_start');
     wp_enqueue_script('woocommerce_settings', WC()->plugin_url() . '/assets/js/admin/settings.min.js', array('jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris', 'chosen'), WC()->version, true);
     wp_localize_script('woocommerce_settings', 'woocommerce_settings_params', array('i18n_nav_warning' => __('The changes you made will be lost if you navigate away from this page.', 'be-compare-products')));
     // Include settings pages
     self::get_settings_pages();
     // Get current tab/section
     $current_tab = empty($_GET['tab']) ? 'settings' : sanitize_title($_GET['tab']);
     $current_section = empty($_REQUEST['section']) ? '' : sanitize_title($_REQUEST['section']);
     // Save settings if data has been posted
     if (!empty($_POST)) {
         self::save();
     }
     // Add any posted messages
     if (!empty($_GET['wc_error'])) {
         self::add_error(stripslashes($_GET['wc_error']));
     }
     if (!empty($_GET['wc_message'])) {
         self::add_message(stripslashes($_GET['wc_message']));
     }
     self::show_messages();
     // Get tabs for the settings page
     $tabs = apply_filters('be_compare_settings_tabs_array', array());
     include 'html-settings.php';
 }
开发者ID:WP-Panda,项目名称:m.video,代码行数:35,代码来源:class-settings.php

示例10: add_tabs

 /**
  * Add Contextual help tabs.
  */
 public function add_tabs()
 {
     $screen = get_current_screen();
     if (!$screen || !in_array($screen->id, wc_get_screen_ids())) {
         return;
     }
     $video_map = array('wc-settings' => array('title' => __('General Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true'), 'wc-settings-general' => array('title' => __('General Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true'), 'wc-settings-products' => array('title' => __('Product Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/lolkan4fxf?videoFoam=true'), 'wc-settings-tax' => array('title' => __('Tax Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/qp1v19dwrh?videoFoam=true'), 'wc-settings-shipping' => array('title' => __('Shipping Zones', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/95yiocro6p?videoFoam=true'), 'wc-settings-shipping-options' => array('title' => __('Shipping Options', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/9c9008dxnr?videoFoam=true'), 'wc-settings-shipping-classes' => array('title' => __('Shipping Classes', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/tpqg17aq99?videoFoam=true'), 'wc-settings-checkout' => array('title' => __('Checkout Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/65yjv96z51?videoFoam=true'), 'wc-settings-checkout-bacs' => array('title' => __('Bank Transfer (BACS) Payments', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/dh4piy3sek?videoFoam=true'), 'wc-settings-checkout-cheque' => array('title' => __('Check Payments', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/u2m2kcakea?videoFoam=true'), 'wc-settings-checkout-cod' => array('title' => __('Cash on Delivery', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/8hyli8wu5f?videoFoam=true'), 'wc-settings-checkout-paypal' => array('title' => __('PayPal Standard', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/rbl7e7l4k2?videoFoam=true'), 'wc-settings-checkout-paypalbraintree_cards' => array('title' => __('PayPal by Braintree', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/oyksirgn40?videoFoam=true'), 'wc-settings-checkout-stripe' => array('title' => __('Stripe', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/mf975hx5de?videoFoam=true'), 'wc-settings-checkout-simplify_commerce' => array('title' => __('Simplify Commerce', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/jdfzjiiw61?videoFoam=true'), 'wc-settings-account' => array('title' => __('Account Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/35mazq7il2?videoFoam=true'), 'wc-settings-email' => array('title' => __('Email Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/svcaftq4xv?videoFoam=true'), 'wc-settings-api' => array('title' => __('Webhook Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq?videoFoam=true'), 'product' => array('title' => __('Simple Products', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/ziyjmd4kut?videoFoam=true'), 'edit-product_cat' => array('title' => __('Product Categories', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'), 'edit-product_tag' => array('title' => __('Product Categories, Tags, Shipping Classes, &amp; Attributes', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'), 'product_attributes' => array('title' => __('Product Categories, Tags, Shipping Classes, &amp; Attributes', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'), 'wc-status' => array('title' => __('System Status', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/xdn733nnhi?videoFoam=true'), 'wc-reports' => array('title' => __('Reports', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/6aasex0w99?videoFoam=true'), 'edit-shop_coupon' => array('title' => __('Coupons', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true'), 'shop_coupon' => array('title' => __('Coupons', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true'), 'edit-shop_order' => array('title' => __('Managing Orders', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true'), 'shop_order' => array('title' => __('Managing Orders', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true'));
     $page = empty($_GET['page']) ? '' : sanitize_title($_GET['page']);
     $tab = empty($_GET['tab']) ? '' : sanitize_title($_GET['tab']);
     $section = empty($_REQUEST['section']) ? '' : sanitize_title($_REQUEST['section']);
     $video_key = $page ? implode('-', array_filter(array($page, $tab, $section))) : $screen->id;
     // Fallback for sections
     if (!isset($video_map[$video_key])) {
         $video_key = $page ? implode('-', array_filter(array($page, $tab))) : $screen->id;
     }
     // Fallback for tabs
     if (!isset($video_map[$video_key])) {
         $video_key = $page ? $page : $screen->id;
     }
     if (isset($video_map[$video_key])) {
         $screen->add_help_tab(array('id' => 'woocommerce_101_tab', 'title' => __('WooCommerce 101', 'woocommerce'), 'content' => '<h2><a href="https://docs.woocommerce.com/document/woocommerce-101-video-series/?utm_source=helptab&utm_medium=product&utm_content=videos&utm_campaign=woocommerceplugin">' . __('WooCommerce 101', 'woocommerce') . '</a> &ndash; ' . esc_html($video_map[$video_key]['title']) . '</h2>' . '<iframe data-src="' . esc_url($video_map[$video_key]['url']) . '" src="" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="480" height="298"></iframe>'));
     }
     $screen->add_help_tab(array('id' => 'woocommerce_support_tab', 'title' => __('Help &amp; Support', 'woocommerce'), 'content' => '<h2>' . __('Help &amp; Support', 'woocommerce') . '</h2>' . '<p>' . sprintf(__('Should you need help understanding, using, or extending WooCommerce, %splease read our documentation%s. You will find all kinds of resources including snippets, tutorials and much more.', 'woocommerce'), '<a href="https://docs.woocommerce.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin">', '</a>') . '</p>' . '<p>' . sprintf(__('For further assistance with WooCommerce core you can use the %scommunity forum%s. If you need help with premium add-ons sold by WooThemes, please %suse our helpdesk%s.', 'woocommerce'), '<a href="https://wordpress.org/support/plugin/woocommerce">', '</a>', '<a href="https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin">', '</a>') . '</p>' . '<p>' . __('Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce') . '</p>' . '<p><a href="' . admin_url('admin.php?page=wc-status') . '" class="button button-primary">' . __('System Status', 'woocommerce') . '</a> <a href="' . 'https://wordpress.org/support/plugin/woocommerce' . '" class="button">' . __('Community Forum', 'woocommerce') . '</a> <a href="' . 'https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin' . '" class="button">' . __('WooThemes Helpdesk', 'woocommerce') . '</a></p>'));
     $screen->add_help_tab(array('id' => 'woocommerce_bugs_tab', 'title' => __('Found a bug?', 'woocommerce'), 'content' => '<h2>' . __('Found a bug?', 'woocommerce') . '</h2>' . '<p>' . sprintf(__('If you find a bug within WooCommerce core you can create a ticket via <a href="%s">Github issues</a>. Ensure you read the <a href="%s">contribution guide</a> prior to submitting your report. To help us solve your issue, please be as descriptive as possible and include your <a href="%s">system status report</a>.', 'woocommerce'), 'https://github.com/woothemes/woocommerce/issues?state=open', 'https://github.com/woothemes/woocommerce/blob/master/.github/CONTRIBUTING.md', admin_url('admin.php?page=wc-status')) . '</p>' . '<p><a href="' . 'https://github.com/woothemes/woocommerce/issues?state=open' . '" class="button button-primary">' . __('Report a bug', 'woocommerce') . '</a> <a href="' . admin_url('admin.php?page=wc-status') . '" class="button">' . __('System Status', 'woocommerce') . '</a></p>'));
     $screen->add_help_tab(array('id' => 'woocommerce_education_tab', 'title' => __('Education', 'woocommerce'), 'content' => '<h2>' . __('Education', 'woocommerce') . '</h2>' . '<p>' . __('If you would like to learn about using WooCommerce from an expert, consider following a WooCommerce course ran by one of our educational partners.', 'woocommerce') . '</p>' . '<p><a href="' . 'https://woocommerce.com/educational-partners/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin' . '" class="button button-primary">' . __('View Education Partners', 'woocommerce') . '</a></p>'));
     $screen->add_help_tab(array('id' => 'woocommerce_onboard_tab', 'title' => __('Setup Wizard', 'woocommerce'), 'content' => '<h2>' . __('Setup Wizard', 'woocommerce') . '</h2>' . '<p>' . __('If you need to access the setup wizard again, please click on the button below.', 'woocommerce') . '</p>' . '<p><a href="' . admin_url('index.php?page=wc-setup') . '" class="button button-primary">' . __('Setup Wizard', 'woocommerce') . '</a></p>'));
     $screen->set_help_sidebar('<p><strong>' . __('For more information:', 'woocommerce') . '</strong></p>' . '<p><a href="' . 'https://woocommerce.com/?utm_source=helptab&utm_medium=product&utm_content=about&utm_campaign=woocommerceplugin' . '" target="_blank">' . __('About WooCommerce', 'woocommerce') . '</a></p>' . '<p><a href="' . 'https://wordpress.org/extend/plugins/woocommerce/' . '" target="_blank">' . __('WordPress.org Project', 'woocommerce') . '</a></p>' . '<p><a href="' . 'https://github.com/woothemes/woocommerce' . '" target="_blank">' . __('Github Project', 'woocommerce') . '</a></p>' . '<p><a href="' . 'https://woocommerce.com/product-category/themes/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin' . '" target="_blank">' . __('Official Themes', 'woocommerce') . '</a></p>' . '<p><a href="' . 'https://woocommerce.com/product-category/woocommerce-extensions/?utm_source=helptab&utm_medium=product&utm_content=wcextensions&utm_campaign=woocommerceplugin' . '" target="_blank">' . __('Official Extensions', 'woocommerce') . '</a></p>');
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:31,代码来源:class-wc-admin-help.php

示例11: awp_sanitize_data

 function awp_sanitize_data($input)
 {
     if (!isset($input['stylesheet_load']) || $input['stylesheet_load'] != '1') {
         $input['stylesheet_load'] = 0;
     } else {
         $input['stylesheet_load'] = 1;
     }
     // check to make sure the fields are not empty - if they are - fill with defaults
     if (empty($input['singular_name'])) {
         $input['singular_name'] = 'Community';
     }
     if (empty($input['plural_name'])) {
         $input['plural_name'] = 'Communities';
     }
     if (empty($input['slug'])) {
         $input['slug'] = 'communities';
     }
     if (empty($input['num_posts']) || !is_numeric($input['num_posts'])) {
         $input['num_posts'] = '8';
     }
     //if ( $input['order_by'] =='rand')  $input['num_posts'] = '999';
     // sanitize the fields
     $input['singular_name'] = wp_strip_all_tags($input['singular_name']);
     $input['plural_name'] = wp_strip_all_tags($input['plural_name']);
     $input['slug'] = sanitize_title($input['slug']);
     return $input;
 }
开发者ID:jdelia,项目名称:genesis-communities-cpt,代码行数:27,代码来源:class-awp-communities.php

示例12: get_product

 /**
  * get_product function.
  *
  * @access public
  * @param bool $the_product (default: false)
  * @param array $args (default: array())
  * @return WC_Product_Simple
  */
 public function get_product($the_product = false, $args = array())
 {
     global $post;
     if (false === $the_product) {
         $the_product = $post;
     } elseif (is_numeric($the_product)) {
         $the_product = get_post($the_product);
     }
     if (!$the_product) {
         return false;
     }
     $product_id = absint($the_product->ID);
     $post_type = $the_product->post_type;
     if (in_array($post_type, array('product', 'product_variation'))) {
         if (isset($args['product_type'])) {
             $product_type = $args['product_type'];
         } elseif ('product_variation' == $post_type) {
             $product_type = 'variation';
         } else {
             $terms = get_the_terms($product_id, 'product_type');
             $product_type = !empty($terms) && isset(current($terms)->name) ? sanitize_title(current($terms)->name) : 'simple';
         }
         // Create a WC coding standards compliant class name e.g. WC_Product_Type_Class instead of WC_Product_type-class
         $classname = 'WC_Product_' . preg_replace('/-(.)/e', "'_' . strtoupper( '\$1' )", ucfirst($product_type));
     } else {
         $classname = false;
         $product_type = false;
     }
     // Filter classname so that the class can be overridden if extended.
     $classname = apply_filters('woocommerce_product_class', $classname, $product_type, $post_type, $product_id);
     if (!class_exists($classname)) {
         $classname = 'WC_Product_Simple';
     }
     return new $classname($the_product, $args);
 }
开发者ID:rongandat,项目名称:sallumeh,代码行数:43,代码来源:class-wc-product-factory.php

示例13: add_playlist

 /** 
  * Function for add/ update playlist data.
  * 
  */
 public function add_playlist()
 {
     global $wpdb;
     if (isset($this->_status)) {
         $this->status_update($this->_playListId, $this->_status);
     }
     if (isset($this->_addnewPlaylist)) {
         $playlistName = filter_input(INPUT_POST, 'playlistname');
         $playlist_slugname = sanitize_title($playlistName);
         $playlistPublish = filter_input(INPUT_POST, 'ispublish');
         $playlist_slug = $this->_wpdb->get_var('SELECT COUNT(playlist_slugname) FROM ' . $wpdb->prefix . 'hdflvvideoshare_playlist WHERE playlist_slugname LIKE "' . $playlist_slugname . '%"');
         if ($playlist_slug > 0) {
             $playlist_slugname = $playlist_slugname . '-' . intval($playlist_slug + 1);
         }
         $playlsitData = array('playlist_name' => $playlistName, 'playlist_slugname' => $playlist_slugname, 'is_publish' => $playlistPublish);
         if ($this->_playListId) {
             $updateflag = $this->playlist_update($playlsitData, $this->_playListId);
             if ($updateflag) {
                 $this->admin_redirect('admin.php?page=newplaylist&playlistId=' . $this->_playListId . '&update=1');
             } else {
                 $this->admin_redirect('admin.php?page=newplaylist&playlistId=' . $this->_playListId . '&update=0');
             }
         } else {
             $ordering = $wpdb->get_var('SELECT COUNT( pid ) FROM ' . $wpdb->prefix . 'hdflvvideoshare_playlist');
             $ordering = $wpdb->get_var("SELECT MAX(playlist_order) FROM " . $wpdb->prefix . "hdflvvideoshare_playlist");
             $playlsitData['playlist_order'] = $ordering + 1;
             $addflag = $this->insert_playlist($playlsitData);
             if (!$addflag) {
                 $this->admin_redirect('admin.php?page=playlist&add=0');
             } else {
                 $this->admin_redirect('admin.php?page=playlist&add=1');
             }
         }
     }
 }
开发者ID:se7ven214,项目名称:Kungfuphp.local,代码行数:39,代码来源:playlistController.php

示例14: save_name

 public static function save_name($post_id)
 {
     // Refuse without valid nonce:
     if (!isset($_POST['scholar_name_nonce']) || !wp_verify_nonce($_POST['scholar_name_nonce'], plugin_basename(__FILE__))) {
         return;
     }
     //sanitize user input
     $prefix = sanitize_text_field($_POST['scholar_name_prefix']);
     $first = sanitize_text_field($_POST['scholar_name_first']);
     $middle = sanitize_text_field($_POST['scholar_name_middle']);
     $last = sanitize_text_field($_POST['scholar_name_last']);
     $gender = sanitize_text_field($_POST['scholar_name_gender']);
     $suffix = sanitize_text_field($_POST['scholar_name_suffix']);
     // Save the data:
     add_post_meta($post_id, 'scholar_prefix', $prefix, true) or update_post_meta($post_id, 'scholar_prefix', $prefix);
     add_post_meta($post_id, 'scholar_first_name', $first, true) or update_post_meta($post_id, 'scholar_first_name', $first);
     add_post_meta($post_id, 'scholar_last_name', $last, true) or update_post_meta($post_id, 'scholar_last_name', $last);
     add_post_meta($post_id, 'scholar_middle_name', $middle, true) or update_post_meta($post_id, 'scholar_middle_name', $middle);
     add_post_meta($post_id, 'scholar_gender', $gender, true) or update_post_meta($post_id, 'scholar_gender', $gender);
     add_post_meta($post_id, 'scholar_suffix', $suffix, true) or update_post_meta($post_id, 'scholar_suffix', $suffix);
     // Update the post slug:
     // unhook this function to prevent infinite looping
     remove_action('save_post', 'ScholarPerson::save_name');
     $post_name = implode(' ', compact('prefix', 'first', 'middle', 'last'));
     if (!empty($suffix)) {
         $post_name .= ', ' . $suffix;
     }
     // update the post slug
     wp_update_post(array('ID' => $post_id, 'post_name' => sanitize_title($post_name)));
     // re-hook this function
     add_action('save_post', 'ScholarPerson::save_name');
 }
开发者ID:holisticnetworking,项目名称:wp-scholar,代码行数:32,代码来源:person.class.php

示例15: translated_attribute_label

 function translated_attribute_label($label, $name)
 {
     global $sitepress;
     if (is_admin() && !wpml_is_ajax()) {
         global $wpdb, $sitepress_settings;
         $string_id = icl_get_string_id('taxonomy singular name: ' . $label, 'WordPress');
         if (defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '3.2', '>=')) {
             $strings_language = icl_st_get_string_language($string_id);
         } else {
             $strings_language = $sitepress_settings['st']['strings_language'];
         }
         if ($string_id && $sitepress_settings['admin_default_language'] != $strings_language) {
             $string = $wpdb->get_var($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s and language = %s", $string_id, $sitepress_settings['admin_default_language']));
             if ($string) {
                 return $string;
             }
         } else {
             return $label;
         }
     }
     $name = sanitize_title($name);
     $lang = $sitepress->get_current_language();
     $trnsl_labels = get_option('wcml_custom_attr_translations');
     if (isset($trnsl_labels[$lang][$name])) {
         return $trnsl_labels[$lang][$name];
     }
     return icl_t('WordPress', 'taxonomy singular name: ' . $label, $label);
 }
开发者ID:sergioblanco86,项目名称:git-gitlab.com-kinivo-kinivo.com,代码行数:28,代码来源:wc-strings.class.php


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