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


PHP sanitize_title_with_dashes函数代码示例

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


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

示例1: missing_plugins_warning

    /**
     * Missing plugins warning.
     */
    public function missing_plugins_warning()
    {
        if ($this->missing) {
            $missing = '';
            $missing_slugs = array();
            $counter = 0;
            foreach ($this->missing as $title => $data) {
                $url = $data['url'];
                $missing_slugs[] = 'wpml-missing-' . sanitize_title_with_dashes($data['slug']);
                $counter++;
                if (sizeof($this->missing) == $counter) {
                    $sep = '';
                } elseif (sizeof($this->missing) - 1 == $counter) {
                    $sep = ' ' . __('and', 'wpml-translation-management') . ' ';
                } else {
                    $sep = ', ';
                }
                $missing .= '<a href="' . $url . '">' . $title . '</a>' . $sep;
            }
            $missing_slugs_classes = implode(' ', $missing_slugs);
            ?>
			<div class="message error wpml-admin-notice wpml-gfml-inactive <?php 
            echo $missing_slugs_classes;
            ?>
"><p><?php 
            printf(__('Gravity Forms Multilingual is enabled but not effective. It requires %s in order to work.', 'wpml-translation-management'), $missing);
            ?>
</p></div>
			<?php 
        }
    }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:34,代码来源:class-wpml-gfml-requirements.php

示例2: admin_menu

 public static function admin_menu()
 {
     $tribe_settings = TribeSettings::instance();
     // Export entries
     if ($_REQUEST['page'] === 'tribe-events-calendar-registration-export' and !is_null($_REQUEST['id'])) {
         $post_id = $_REQUEST['id'];
         $forms = GFFormsModel::get_forms();
         foreach ($forms as $form) {
             if (strtolower($form->title) == strtolower(self::$formTitle)) {
                 $form_id = $form->id;
                 $entries = GFAPI::get_entries($form_id, array('field_filters' => array(array('key' => '7', 'value' => $post_id))), null, array('offset' => '0', 'page_size' => '1000'));
                 header("Content-type: text/csv");
                 header("Content-Disposition: attachment; filename=" . sanitize_title_with_dashes($entries[0]['6']) . ".csv");
                 header("Pragma: no-cache");
                 header("Expires: 0");
                 echo $entries[0]['6'] . "\n";
                 echo "Date Created, First Name, Last Name, Email, Phone Number, Number of Participants\n";
                 foreach ($entries as $entry) {
                     echo $entry['date_created'] . ',';
                     echo $entry['1'] . ',';
                     echo $entry['2'] . ',';
                     echo $entry['3'] . ',';
                     echo $entry['4'] . ',';
                     echo $entry['5'] . "\n";
                 }
                 die;
             }
         }
     }
 }
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:30,代码来源:ecgf.php

示例3: glyphs_get_typekit_fonts

 /**
  * Get info about the fonts available in the current kit
  *
  * @param  string        $kit_id    The id of the kit.
  * @param  bool          $force     True to ignore cached info.
  * @return array|bool               An array of font information, or false if the kit ID is invalid.
  */
 function glyphs_get_typekit_fonts($kit_id = null, $force = false)
 {
     if (null === $kit_id) {
         $kit_id = get_theme_mod('typekit-id', false);
     }
     if (!$kit_id) {
         return false;
     }
     // Get cached font info
     $fonts = get_transient('glyphs-typekit-fonts');
     if (empty($fonts) || true === $force) {
         $fonts = array();
         // Look up the font kit
         $response = wp_remote_get('https://typekit.com/api/v1/json/kits/' . $kit_id . '/published');
         $response_code = wp_remote_retrieve_response_code($response);
         $response_body = json_decode(wp_remote_retrieve_body($response));
         // If the font kit returns a valid response, parse the font info
         if (200 === (int) $response_code && is_object($response_body) && isset($response_body->kit) && isset($response_body->kit->families) && is_array($response_body->kit->families)) {
             foreach ($response_body->kit->families as $family) {
                 $fonts[sanitize_title_with_dashes($family->slug)] = array('label' => wp_strip_all_tags($family->name), 'stack' => isset($family->css_stack) ? wp_strip_all_tags($family->css_stack) : '');
             }
         }
         // Cache the font info
         set_transient('glyphs-typekit-fonts', $fonts, DAY_IN_SECONDS);
     }
     return $fonts;
 }
开发者ID:andrewkhunn,项目名称:lancero,代码行数:34,代码来源:glyphs-global.php

示例4: custom_permalinks

function custom_permalinks($title)
{
    $title = sanitize_title_with_dashes($title);
    $toupper = create_function('$m', 'return strtoupper($m[0]);');
    $title = preg_replace_callback('/(%[0-9a-f]{2}?)+/', $toupper, $title);
    return $title;
}
开发者ID:rexin,项目名称:zhibei-tib,代码行数:7,代码来源:permalink-encoding.php

示例5: register_facet

 public function register_facet($facet_name, $facet_class, $args = array())
 {
     $args = wp_parse_args($args, array('has_rewrite' => FALSE, 'priority' => 5));
     // if the class hasn't been loaded yet and it's an internal class, then load it
     if (!class_exists($facet_class)) {
         // format the filesystem path to try to load this class file from
         $class_path = __DIR__ . '/class-' . str_replace('_', '-', sanitize_title_with_dashes($facet_class)) . '.php';
         // check if this class file is an internal class, try to load it
         if (file_exists($class_path)) {
             require_once $class_path;
         }
     }
     // instantiate the facet
     if (class_exists($facet_class)) {
         $this->facets->{$facet_name} = new $facet_class($facet_name, $args, $this);
     } else {
         return FALSE;
     }
     // register the query var and associate it with this facet
     $query_var = $this->facets->{$facet_name}->register_query_var();
     $this->_query_vars[$query_var] = $facet_name;
     // set the priority to determine how to generate the permalink when there are two or more active facets
     // as with WP hook priority, this should be 1-10
     // facets without pretty permalink rewrite rules get no priority
     if (9 > $args['priority'] && !$args['has_rewrite']) {
         $args['priority'] = 9;
     }
     $this->priority[$facet_name] = (int) $args['priority'];
 }
开发者ID:nrporter,项目名称:scriblio,代码行数:29,代码来源:class-facets.php

示例6: register_sidebars

 public static function register_sidebars()
 {
     $sidebars = apply_filters('piklist_sidebars', array());
     foreach ($sidebars as $sidebar) {
         register_sidebar(array_merge(array('name' => $sidebar['name'], 'id' => sanitize_title_with_dashes($sidebar['name']), 'description' => isset($sidebar['description']) ? $sidebar['description'] : null, 'before_widget' => isset($sidebar['before_widget']) ? $sidebar['before_widget'] : '<div id="%1$s" class="widget-container %2$s">', 'after_widget' => isset($sidebar['after_widget']) ? $sidebar['after_widget'] : '</div>', 'before_title' => isset($sidebar['before_title']) ? $sidebar['before_title'] : '<h3 class="widget-title">', 'after_title' => isset($sidebar['after_title']) ? $sidebar['after_title'] : '</h3>'), $sidebar));
     }
 }
开发者ID:Themes-Protoarte,项目名称:piklist,代码行数:7,代码来源:class-piklist-widget.php

示例7: fetch_feed

 function fetch_feed($username, $slice = 8)
 {
     $barcelona_remote_url = esc_url('http://instagram.com/' . trim(strtolower($username)));
     $barcelona_transient_key = 'barcelona_instagram_feed_' . sanitize_title_with_dashes($username);
     $slice = absint($slice);
     if (false === ($barcelona_result_data = get_transient($barcelona_transient_key))) {
         $barcelona_remote = wp_remote_get($barcelona_remote_url);
         if (is_wp_error($barcelona_remote) || 200 != wp_remote_retrieve_response_code($barcelona_remote)) {
             return new WP_Error('not-connected', esc_html__('Unable to communicate with Instagram.', 'barcelona'));
         }
         preg_match('#window\\.\\_sharedData\\s\\=\\s(.*?)\\;\\<\\/script\\>#', $barcelona_remote['body'], $barcelona_match);
         if (!empty($barcelona_match)) {
             $barcelona_data = json_decode(end($barcelona_match), true);
             if (is_array($barcelona_data) && isset($barcelona_data['entry_data']['ProfilePage'][0]['user']['media']['nodes'])) {
                 $barcelona_result_data = $barcelona_data['entry_data']['ProfilePage'][0]['user']['media']['nodes'];
             }
         }
         if (is_array($barcelona_result_data)) {
             set_transient($barcelona_transient_key, $barcelona_result_data, 60 * 60 * 2);
         }
     }
     if (empty($barcelona_result_data)) {
         return new WP_Error('no-images', esc_html__('Instagram did not return any images.', 'barcelona'));
     }
     return array_slice($barcelona_result_data, 0, $slice);
 }
开发者ID:yalmaa,项目名称:little-magazine,代码行数:26,代码来源:barcelona-instagram-feed.php

示例8: BMP

 function BMP()
 {
     // constructor
     global $wpdb;
     require_once ABSPATH . '/wp-admin/includes/plugin.php';
     $this->AllCategories = get_terms('category', array('fields' => 'ids', 'get' => 'all'));
     $this->PluginOptionName = 'BMP_Options';
     $this->TablePrefix = $wpdb->prefix . 'bmp_';
     $this->OptionsTable = $this->TablePrefix . 'options';
     // character encoding
     $this->BlogCharset = get_option('blog_charset');
     $pluginfile = WP_PLUGIN_DIR . '/' . MLM_PLUGIN_NAME . '/mlm-loader .php';
     $this->PluginInfo = (object) get_plugin_data($pluginfile);
     $this->Version = $this->PluginInfo->Version;
     $this->WPVersion = $GLOBALS['wp_version'] + 0;
     $this->pluginPath = $pluginfile;
     $this->pluginDir = dirname($this->pluginPath);
     $this->PluginFile = basename(dirname($pluginfile)) . '/' . basename($pluginfile);
     $this->PluginSlug = sanitize_title_with_dashes($this->PluginInfo->Name);
     $this->pluginBasename = plugin_basename($this->pluginPath);
     //			$this->pluginURL = get_bloginfo('wpurl') . '/' . PLUGINDIR . '/' . dirname(plugin_basename($this->pluginPath));
     //			$this->pluginURL = plugins_url('', $this->pluginPath);
     // this method works even if the WLM folder is just a symlink
     $this->pluginURL = plugins_url('', '/') . basename($this->pluginDir);
 }
开发者ID:EvandroEpifanio,项目名称:binary-mlm-pro,代码行数:25,代码来源:Class.php

示例9: sanitizeStringStrong

 /**
  * Uses WordPress function to sanitize the input string.
  *
  * Limits the output to alphanumeric characters, underscore (_) and dash (-).
  * Whitespace becomes a dash.
  *
  * @param string $string
  * @return string
  */
 public static function sanitizeStringStrong($string)
 {
     $string = str_ireplace('%', '-', $string);
     // Added this because sanitize_title_with_dashes will still allow % to passthru.
     $string = sanitize_title_with_dashes($string);
     return $string;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:16,代码来源:class.utility.php

示例10: update

 public static function update($id, $values)
 {
     $new_values = array();
     $new_values['frm_param'] = isset($values['param']) ? sanitize_title_with_dashes($values['param']) : '';
     $fields = array('dyncontent', 'insert_loc', 'type', 'show_count', 'form_id', 'entry_id', 'post_id');
     foreach ($fields as $field) {
         if (isset($values[$field])) {
             $new_values['frm_' . $field] = $values[$field];
         }
     }
     if (isset($values['options'])) {
         $new_values['frm_options'] = array();
         foreach ($values['options'] as $key => $value) {
             $new_values['frm_options'][$key] = $value;
         }
     }
     foreach ($new_values as $key => $val) {
         update_post_meta($id, $key, $val);
         unset($key, $val);
     }
     if (!isset($new_values['frm_form_id']) || empty($new_values['frm_form_id'])) {
         return;
     }
     //update post meta of post selected for auto insertion
     if (isset($new_values['frm_insert_loc']) && $new_values['frm_insert_loc'] != 'none' && isset($new_values['frm_post_id']) && (int) $new_values['frm_post_id']) {
         update_post_meta($new_values['frm_post_id'], 'frm_display_id', $id);
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:28,代码来源:FrmProDisplay.php

示例11: render_field_typography_html

 /**
  * Renders the typography field for PP_PB_WF_Fields::render_field_typography()
  *
  * @param $value
  * @param $key
  *
  * @return string
  */
 public function render_field_typography_html($key, $value)
 {
     $html = '';
     // Make sure the size fields are set correctly.
     if (!isset($value['size'])) {
         $value['size'] = $value['size_' . $value['unit']];
     }
     $unit = $value['unit'];
     $html .= '<span class="unit-container ' . esc_attr('unit-' . sanitize_title_with_dashes($unit)) . '">' . "\n";
     /* Size fields */
     $html .= $this->typography_size($key, $value);
     /* Font Unit */
     $html .= '<select class="woo-typography woo-typography-unit" name="' . esc_attr($key . '[unit]') . '" id="' . esc_attr($key . '_unit') . '">' . "\n";
     $html .= '<option value="px" ' . selected($unit, 'px', false) . '">px</option>' . "\n";
     $html .= '<option value="em" ' . selected($unit, 'em', false) . '>em</option>' . "\n";
     $html .= '</select>' . "\n";
     /* Weights */
     $font_weights = (array) apply_filters('wf_fields_typography_font_weights', array('300' => __('Thin', 'woothemes'), '300 italic' => __('Thin Italic', 'woothemes'), 'normal' => __('Normal', 'woothemes'), 'italic' => __('Italic', 'woothemes'), 'bold' => __('Bold', 'woothemes'), 'bold italic' => __('Bold/Italic', 'woothemes')));
     if (0 < count($font_weights)) {
         $html .= '<select class="woo-typography woo-typography-font-weight woo-typography-style" name="' . esc_attr($key . '[style]') . '" id="' . esc_attr($key . '_style') . '">' . "\n";
         foreach ($font_weights as $k => $v) {
             $html .= '<option value="' . esc_attr($k) . '" ' . selected($value['style'], $k, false) . '>' . esc_html($v) . '</option>' . "\n";
         }
         $html .= '</select>' . "\n";
     }
     /* Font Face */
     $html .= $this->typography_font_face($key, $value);
     /* Border Color */
     $html .= '<input id="' . esc_attr($key . '_color') . '" name="' . esc_attr($key . '[color]') . '" size="40" type="text" class="woo-typography-color colour" value="' . esc_attr($value['color']) . '" />' . "\n";
     $html .= '</span>' . "\n";
     return $html;
 }
开发者ID:shramee,项目名称:test-ppb,代码行数:40,代码来源:class-pp-pb-wf-fields-helper.php

示例12: shortcode_tag_link

 function shortcode_tag_link($atts, $content)
 {
     $url = home_url('/');
     $target = sanitize_title_with_dashes($content);
     $link = "<a href='{$url}tag/{$target}'>{$content}</a>";
     return $link;
 }
开发者ID:andwilr,项目名称:wp-timber-theme,代码行数:7,代码来源:functions.php

示例13: update

 function update($id, $values)
 {
     global $wpdb, $frmprodb, $frm_field;
     $new_values = array();
     $values['display_key'] = isset($values['display_key']) ? $values['display_key'] : $values['name'];
     $new_values['display_key'] = FrmAppHelper::get_unique_key($values['display_key'], $frmprodb->displays, 'display_key', $id);
     $new_values['param'] = isset($values['param']) ? sanitize_title_with_dashes($values['param']) : '';
     $fields = array('name', 'description', 'content', 'dyncontent', 'insert_loc', 'type', 'show_count', 'form_id', 'entry_id', 'post_id');
     foreach ($fields as $field) {
         $new_values[$field] = $values[$field];
     }
     $new_values['entry_id'] = isset($values['entry_id']) ? (int) $values['entry_id'] : 0;
     if (isset($values['options'])) {
         $new_values['options'] = array();
         foreach ($values['options'] as $key => $value) {
             $new_values['options'][$key] = $value;
         }
         $new_values['options'] = maybe_serialize($new_values['options']);
     }
     $query_results = $wpdb->update($frmprodb->displays, $new_values, array('id' => $id));
     if ($query_results) {
         wp_cache_delete($id, 'frm_display');
         do_action('frm_update_display', $id, $values);
     }
     return $query_results;
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:26,代码来源:FrmProDisplay.php

示例14: from_html

 public static function from_html($html, $title)
 {
     // give us soem breathing room
     ini_set('max_execution_time', 180);
     //$ohtml = $html;
     // pre-parse remote or url based assets
     try {
         $html = self::_pre_parse_remote_assets($html);
     } catch (Exception $e) {
         die('error');
         echo '<h1>Problem parsing html.</h1>';
         echo '<h2>' . force_balance_tags($e->getMessage()) . '</h2>';
         return;
     }
     // if we are debugging the pdf, then depending on the mode, dump the html contents onw
     if (QSOT_DEBUG_PDF & 2) {
         // || ( current_user_can( 'edit_posts' ) && isset( $_GET['as'] ) && 'html' == $_GET['as'] ) ) {
         echo '<pre>';
         echo htmlspecialchars($html);
         echo '</pre>';
         die;
     }
     // include the library
     require_once QSOT::plugin_dir() . 'libs/dompdf/dompdf_config.inc.php';
     // make and output the pdf
     $pdf = new DOMPDF();
     $pdf->load_html($html);
     $pdf->render();
     $pdf->stream(sanitize_title_with_dashes('ticket-' . $title) . '.pdf', array('Attachment' => 1));
     exit;
 }
开发者ID:Jayriq,项目名称:opentickets-community,代码行数:31,代码来源:pdf.class.php

示例15: tlpFmSettingsUpdate

 function tlpFmSettingsUpdate()
 {
     global $TLPfoodmenu;
     $error = true;
     if ($TLPfoodmenu->verifyNonce()) {
         $data = array();
         if ($_REQUEST['general']) {
             $general['slug'] = isset($_REQUEST['general']['slug']) ? $_REQUEST['general']['slug'] ? sanitize_title_with_dashes($_REQUEST['general']['slug']) : 'food-menu' : 'food-menu';
             $general['character_limit'] = isset($_REQUEST['general']['character_limit']) ? $_REQUEST['general']['character_limit'] ? intval($_REQUEST['general']['character_limit']) : 150 : 150;
             $general['em_display_col'] = $_REQUEST['general']['em_display_col'] ? esc_attr($_REQUEST['general']['em_display_col']) : 2;
             $general['currency'] = $_REQUEST['general']['currency'] ? esc_attr($_REQUEST['general']['currency']) : null;
             $general['currency_position'] = $_REQUEST['general']['currency_position'] ? esc_attr($_REQUEST['general']['currency_position']) : null;
             $data['general'] = $general;
             $TLPfoodmenu->activate();
         }
         if ($_REQUEST['others']) {
             $others['css'] = $_REQUEST['others']['css'] ? esc_attr($_REQUEST['others']['css']) : null;
             $data['others'] = $others;
         }
         update_option($TLPfoodmenu->options['settings'], $data);
         $error = false;
         $msg = __('Settings successfully updated', TLP_FOOD_MENU_SLUG);
     } else {
         $msg = __('Security Error !!', TLP_FOOD_MENU_SLUG);
     }
     $response = array('error' => $error, 'msg' => $msg);
     wp_send_json($response);
     die;
 }
开发者ID:dorkyhuman,项目名称:things,代码行数:29,代码来源:FmSettings.php


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