• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_sprintf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: wplf_send_email_copy

function wplf_send_email_copy($return)
{
    // do nothing if form validation failed
    if (!$return->ok) {
        return;
    }
    $form_id = intval($_POST['_form_id']);
    // _form_id is already validated and we know it exists by this point
    $form_title = esc_html(get_the_title($form_id));
    $form_meta = get_post_meta($form_id);
    $referrer = esc_url_raw($_POST['referrer']);
    if (isset($form_meta['_wplf_email_copy_enabled']) && $form_meta['_wplf_email_copy_enabled'][0]) {
        $to = isset($form_meta['_wplf_email_copy_to']) ? $form_meta['_wplf_email_copy_to'][0] : get_option('admin_email');
        $subject = wp_sprintf(__('New submission from %s', 'wp-libre-form'), $referrer);
        $content = wp_sprintf(__('Form "%s" (ID %d) was submitted with values below: ', 'wp-libre-form'), $form_title, $form_id);
        $content = apply_filters('wplf_email_copy_content_start', $content, $form_title, $form_id) . "\n\n";
        foreach ($_POST as $key => $value) {
            if ('_' === $key[0]) {
                continue;
            }
            if (is_array($value)) {
                // in case input type="radio" submits an array
                $value = implode(', ', $value);
            }
            $content .= esc_html($key) . ': ' . esc_html(print_r($value, true)) . "\n";
        }
        wp_mail(apply_filters('wplf_email_copy_to', $to), apply_filters('wplf_email_copy_subject', $subject), apply_filters('wplf_email_copy_content', $content), apply_filters('wplf_email_copy_headers', ''), apply_filters('wplf_email_copy_attachments', array()));
    }
}
开发者ID:anttiviljami,项目名称:wp-libre-form,代码行数:29,代码来源:wplf-form-actions.php


示例2: sanitize_settings

 protected function sanitize_settings()
 {
     $this->sanitize_setting('bool', 'default', __('Default Blacklist', 'better-wp-security'));
     $this->sanitize_setting('bool', 'enable_ban_lists', __('Ban Lists', 'better-wp-security'));
     $this->sanitize_setting('newline-separated-ips', 'host_list', __('Ban Hosts', 'better-wp-security'));
     if (is_array($this->settings['host_list'])) {
         require_once ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-ip-tools.php';
         $whitelisted_hosts = array();
         $current_ip = ITSEC_Lib::get_ip();
         foreach ($this->settings['host_list'] as $host) {
             if (is_user_logged_in() && ITSEC_Lib_IP_Tools::intersect($current_ip, ITSEC_Lib_IP_Tools::ip_wild_to_ip_cidr($host))) {
                 $this->set_can_save(false);
                 /* translators: 1: input name, 2: invalid host */
                 $this->add_error(sprintf(__('The following host in %1$s matches your current IP and cannot be banned: %2$s', 'better-wp-security'), __('Ban Hosts', 'better-wp-security'), $host));
                 continue;
             }
             if (ITSEC_Lib::is_ip_whitelisted($host)) {
                 $whitelisted_hosts[] = $host;
             }
         }
         if (!empty($whitelisted_hosts)) {
             $this->set_can_save(false);
             /* translators: 1: input name, 2: invalid host list */
             $this->add_error(wp_sprintf(_n('The following IP in %1$s is whitelisted and cannot be banned: %2$l', 'The following IPs in %1$s are whitelisted and cannot be banned: %2$l', count($whitelisted_hosts), 'better-wp-security'), __('Ban Hosts', 'better-wp-security'), $whitelisted_hosts));
         }
     }
     $this->sanitize_setting(array($this, 'sanitize_agent_list_entry'), 'agent_list', __('Ban User Agents', 'better-wp-security'));
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:28,代码来源:validator.php


示例3: on_activate

 /**
  * Check some thinks on plugin activation
  *
  * @since   0.0.1
  * @access  public
  * @static
  * @return  void
  */
 public static function on_activate()
 {
     // check WordPress version
     if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) {
         deactivate_plugins(RW_Distributed_Profile_Server::$plugin_filename);
         die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_Site_Config::get_textdomain()), RW_Site_Config::get_plugin_data('Name')));
     }
     // check php version
     if (version_compare(PHP_VERSION, '5.3.0', '<')) {
         deactivate_plugins(RW_Site_Config::$plugin_filename);
         die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_Site_Config::get_textdomain()), RW_Site_Config::get_plugin_data('Name'), PHP_VERSION));
     }
     if (defined('RW_SITE_CONFIG_PLUGINS_CONFIG')) {
         if (false === get_site_option('rw_site_config_plugins')) {
             $plugins = unserialize(RW_SITE_CONFIG_PLUGINS_CONFIG);
             update_site_option('rw_site_config_plugins', $plugins);
         }
     }
     if (defined('RW_SITE_CONFIG_OPTIONS_CONFIG')) {
         if (false === get_site_option('rw_site_config_options')) {
             $options = unserialize(RW_SITE_CONFIG_OPTIONS_CONFIG);
             update_site_option('rw_site_config_options', $options);
         }
     }
 }
开发者ID:rpi-virtuell,项目名称:rw-site-config,代码行数:33,代码来源:RW_Site_Config_Installation.php


示例4: widget

 /**
  * Outputs the content of the widget
  *
  * @param array $args
  * @param array $instance
  */
 public function widget($args, $instance) {
     
     $title = apply_filters('widget_title', $instance['title']);
     $more_link = apply_filters('widget_more_link', $instance['more_link']);
     $visibility_count = apply_filters('widget_visibility_count', $instance['visibility_count']);
     $scrollbar = apply_filters('widget_scrollbar', $instance['scrollbar']);
     echo $args['before_widget'];
     echo '<div class="event-widget">';
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
     }
     
     $events_per_page = empty($scrollbar) ? $visibility_count:20;
     $events = get_posts(array('post_type' => 'event', 'posts_per_page' => $events_per_page));
     $hasScroll = !empty($scrollbar) ? 'hasScroll':'';
     $eventHtml = '<div class="content events '.$hasScroll.'">';
     foreach ($events as $event) {
         $attachment_id = get_post_thumbnail_id($event->ID);
         $featured_image = wp_get_attachment_url($attachment_id);
         //$featured_image = get_the_post_thumbnail($event->ID,array(64,64),array('class'=>'events-list-img'));
         $featured_image = empty($attachment_id)  ? get_stylesheet_directory_uri().'/images/default-event.png': $featured_image;   
         $link = get_permalink($event->ID);
         $title = wp_trim_words($event->post_title, 10, '...');
         $event_start_date = get_field('event_start_date_time',$event->ID);           
         $event_s_d = date('M d, Y', strtotime($event_start_date));
         $event_s_d_2 = date('Y-m-d', strtotime($event_start_date));
         $event_s_d_1 = date_create($event_s_d_2);
         $event_end_date = get_field('event_end_date_time',$event->ID);
         $event_e_d = date('M d, Y', strtotime($event_end_date));
         $event_e_d_2 = date('Y-m-d', strtotime($event_end_date));
         $event_e_d_1 = date_create($event_e_d_2);
         $event_date_diff = date_diff($event_e_d_1, $event_s_d_1);
         $event_date_diff_for =$event_date_diff->format("%R%a");
         $pcontent = wp_trim_words($event->post_content, 8, '...'); 
         $eventHtml .= '<div class="events-list">';
         $eventHtml .= sprintf('<img class="events-list-img" src="%2$s" alt="%1$s" />', $event->post_title, $featured_image);
         if($event_date_diff_for == "+0"){
              $eventHtml .= sprintf('<p class="events-date">%1$s</p>', $event_s_d);
         }else{
             $eventHtml .= sprintf('<p class="events-date">%1$s - %2$s</p>', $event_s_d, $event_e_d);
         }
         $eventHtml .= sprintf('<a href="%2$s" title="%1$s" class="events-list-title">%1$s</a>', $title, $link);
         $eventHtml .= sprintf('<p class="events-list-excerpt">%1$s</p>', $pcontent);
         $eventHtml .= sprintf('<a class="link-box" href="%2$s" title="%1$s" class="events-list-title"></a>', $title, $link);
         $eventHtml .= '</div>';
     }
     $eventHtml .= '</div>';
     echo $eventHtml;
     if(!empty($more_link)){
          echo wp_sprintf('<div class="event-wfooter more-links"><a class="readmore" href="%s" title="More Events">More Events</a></div>',$more_link);
     }
            
     echo '</div>';
     echo $args['after_widget'];
     
 }
开发者ID:ergov2015,项目名称:rideflag,代码行数:62,代码来源:widgets-events.php


示例5: onPluginActivation

 static function onPluginActivation()
 {
     if (phpVersionSupported()) {
         if (!WpLinkedDataInitializer::isPeclHttpInstalled()) {
             add_option('show_pecl_http_missing_warning', true);
         }
     } else {
         deactivate_plugins(__FILE__);
         wp_die(wp_sprintf('%1s: ' . __('Sorry, This plugin has taken a bold step in requiring PHP 5.3.0+. Your server is currently running PHP %2s, Please bug your host to upgrade to a recent version of PHP which is less bug-prone.', 'wp-linked-data'), __FILE__, PHP_VERSION));
     }
 }
开发者ID:assemblee-virtuelle,项目名称:wp-linked-data,代码行数:11,代码来源:wp-linked-data.php


示例6: on_activate

 /**
  * Check some thinks on plugin activation
  *
  * @since   0.0.1
  * @access  public
  * @static
  * @return  void
  */
 public static function on_activate()
 {
     // check WordPress version
     if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) {
         deactivate_plugins(RW_More_Rpi_Virtuell_Widget::$plugin_filename);
         die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_More_Rpi_Virtuell_Widget::get_textdomain()), RW_More_Rpi_Virtuell_Widget::get_plugin_data('Name')));
     }
     // check php version
     if (version_compare(PHP_VERSION, '5.3.0', '<')) {
         deactivate_plugins(RW_More_Rpi_Virtuell_Widget::$plugin_filename);
         die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_More_Rpi_Virtuell_Widget::get_textdomain()), RW_More_Rpi_Virtuell_Widget::get_plugin_data('Name'), PHP_VERSION));
     }
 }
开发者ID:rpi-virtuell,项目名称:rw-more-rpi-virtuell-widget,代码行数:21,代码来源:RW_More_Rpi_Virtuell_Widget_Installation.php


示例7: on_activate

 /**
  * Check some thinks on plugin activation
  *
  * @since   0.0.1
  * @access  public
  * @static
  * @return  void
  */
 public static function on_activate()
 {
     // check WordPress version
     if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) {
         deactivate_plugins(RW_Group_Blogs::$plugin_filename);
         die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_Group_Blogs::get_textdomain()), RW_Group_Blogs::get_plugin_data('Name')));
     }
     // check php version
     if (version_compare(PHP_VERSION, '5.3.0', '<')) {
         deactivate_plugins(RW_Group_Blogs::$plugin_filename);
         die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_Group_Blogs::get_textdomain()), RW_Group_Blogs::get_plugin_data('Name'), PHP_VERSION));
     }
     wp_schedule_event(time(), 'hourly', 'rw_group_blogs_cron');
 }
开发者ID:rpi-virtuell,项目名称:rw-group-blogs,代码行数:22,代码来源:RW_Group_Blogs_Installation.php


示例8: on_activate

 /**
  * Check some thinks on plugin activation
  *
  * @since   0.0.1
  * @access  public
  * @static
  * @return  void
  */
 public static function on_activate()
 {
     // check WordPress version
     if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) {
         deactivate_plugins(RW_Demo_Plugin::$plugin_filename);
         //@TODO  Klassename
         die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_Demo_Plugin::get_textdomain()), RW_Demo_Plugin::get_plugin_data('Name')));
     }
     // check php version
     if (version_compare(PHP_VERSION, '5.3.0', '<')) {
         deactivate_plugins(RW_Demo_Plugin::$plugin_filename);
         // @TODO  Klassenanme
         die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_Demo_Plugin::get_textdomain()), RW_Demo_Plugin::get_plugin_data('Name'), PHP_VERSION));
     }
     // check buddypress @TODO  Nur wenn BuddyPress activity für das Plugin nötig ist
     if (!function_exists('bp_activities')) {
         deactivate_plugins(RW_Demo_Plugin::$plugin_filename);
         //@TODO  Klassenname
         die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires BuddyPress to work.', RW_Sticky_Activity::get_textdomain()), RW_Sticky_Activity::get_plugin_data('Name'), PHP_VERSION));
     }
     // @TODO  Hier weitere Checks einbaun die das Plugin ggf als Abhängigkeiten hat. MU, bbPress usw
 }
开发者ID:rpi-virtuell,项目名称:plugin-skeleton,代码行数:30,代码来源:RW_Demo_Plugin_Installation.php


示例9: show_activation_message

 public function show_activation_message()
 {
     $new_packages = $GLOBALS['ithemes-updater-settings']->get_new_packages();
     if (empty($new_packages)) {
         return;
     }
     natcasesort($new_packages);
     require_once $GLOBALS['ithemes_updater_path'] . '/functions.php';
     $names = array();
     foreach ($new_packages as $package) {
         $names = Ithemes_Updater_Functions::get_package_name($package);
     }
     if (is_multisite() && is_network_admin()) {
         $url = network_admin_url('settings.php') . "?page={$this->page_name}";
     } else {
         $url = admin_url('options-general.php') . "?page={$this->page_name}";
     }
     echo '<div class="updated fade"><p>' . wp_sprintf(__('To receive automatic updates for %l, use the <a href="%s">iThemes Licensing</a> page found in the Settings menu.', 'it-l10n-Builder-Madison'), $names, $url) . '</p></div>';
     $GLOBALS['ithemes-updater-settings']->update_packages();
 }
开发者ID:jimrucinski,项目名称:Vine,代码行数:20,代码来源:admin.php


示例10: admin_page_load


//.........这里部分代码省略.........
         case 'verify_secrets_mismatch':
             $error = esc_html($error);
             $this->error = sprintf(__("<strong>Your Jetpack has a glitch.</strong>  Something went wrong that&#8217;s never supposed to happen.  Guess you&#8217;re just lucky: %s", 'jetpack'), "<code>{$error}</code>");
             if (!Jetpack::is_active()) {
                 $this->error .= '<br />';
                 $this->error .= sprintf(__('Try connecting again.', 'jetpack'));
             }
             break;
     }
     $message_code = Jetpack::state('message');
     $active_state = Jetpack::state('activated_modules');
     if (!empty($active_state)) {
         $available = Jetpack::get_available_modules();
         $active_state = explode(',', $active_state);
         $active_state = array_intersect($active_state, $available);
         if (count($active_state)) {
             foreach ($active_state as $mod) {
                 $this->stat('module-activated', $mod);
             }
         } else {
             $active_state = false;
         }
     }
     switch ($message_code) {
         case 'modules_activated':
             $this->message = sprintf(__('Welcome to <strong>Jetpack %s</strong>!', 'jetpack'), JETPACK__VERSION);
             if ($active_state) {
                 $titles = array();
                 foreach ($active_state as $mod) {
                     if ($mod_headers = Jetpack::get_module($mod)) {
                         $titles[] = '<strong>' . preg_replace('/\\s+(?![^<>]++>)/', '&nbsp;', $mod_headers['name']) . '</strong>';
                     }
                 }
                 if ($titles) {
                     $this->message .= '<br /><br />' . wp_sprintf(__('The following new modules have been activated: %l.', 'jetpack'), $titles);
                 }
             }
             if ($reactive_state = Jetpack::state('reactivated_modules')) {
                 $titles = array();
                 foreach (explode(',', $reactive_state) as $mod) {
                     if ($mod_headers = Jetpack::get_module($mod)) {
                         $titles[] = '<strong>' . preg_replace('/\\s+(?![^<>]++>)/', '&nbsp;', $mod_headers['name']) . '</strong>';
                     }
                 }
                 if ($titles) {
                     $this->message .= '<br /><br />' . wp_sprintf(__('The following modules have been updated: %l.', 'jetpack'), $titles);
                 }
             }
             break;
         case 'module_activated':
             if ($module = Jetpack::get_module(Jetpack::state('module'))) {
                 $this->message = sprintf(__('<strong>%s Activated!</strong> You can deactivate at any time by clicking Learn More and then Deactivate on the module card.', 'jetpack'), $module['name']);
                 $this->stat('module-activated', Jetpack::state('module'));
             }
             break;
         case 'module_deactivated':
             if ($module = Jetpack::get_module(Jetpack::state('module'))) {
                 $this->message = sprintf(__('<strong>%s Deactivated!</strong> You can activate it again at any time using the activate button on the module card.', 'jetpack'), $module['name']);
                 $this->stat('module-deactivated', Jetpack::state('module'));
             }
             break;
         case 'module_configured':
             $this->message = __('<strong>Module settings were saved.</strong> ', 'jetpack');
             break;
         case 'already_authorized':
             $this->message = __('<strong>Your Jetpack is already connected.</strong> ', 'jetpack');
             break;
         case 'authorized':
             $this->message = __("<strong>You&#8217;re fueled up and ready to go.</strong> ", 'jetpack');
             $this->message .= "<br />\n";
             $this->message .= __('The features below are now active. Click the learn more buttons to explore each feature.', 'jetpack');
             break;
     }
     $deactivated_plugins = Jetpack::state('deactivated_plugins');
     if (!empty($deactivated_plugins)) {
         $deactivated_plugins = explode(',', $deactivated_plugins);
         $deactivated_titles = array();
         foreach ($deactivated_plugins as $deactivated_plugin) {
             if (!isset($this->plugins_to_deactivate[$deactivated_plugin])) {
                 continue;
             }
             $deactivated_titles[] = '<strong>' . str_replace(' ', '&nbsp;', $this->plugins_to_deactivate[$deactivated_plugin][1]) . '</strong>';
         }
         if ($deactivated_titles) {
             if ($this->message) {
                 $this->message .= "<br /><br />\n";
             }
             $this->message .= wp_sprintf(_n('Jetpack contains the most recent version of the old %l plugin.', 'Jetpack contains the most recent versions of the old %l plugins.', count($deactivated_titles), 'jetpack'), $deactivated_titles);
             $this->message .= "<br />\n";
             $this->message .= _n('The old version has been deactivated and can be removed from your site.', 'The old versions have been deactivated and can be removed from your site.', count($deactivated_titles), 'jetpack');
         }
     }
     if ($this->message || $this->error) {
         add_action('jetpack_notices', array(&$this, 'admin_notices'));
     }
     if (isset($_GET['configure']) && Jetpack::is_module($_GET['configure'])) {
         do_action('jetpack_module_configuration_load_' . $_GET['configure']);
     }
     add_filter('jetpack_short_module_description', 'wptexturize');
 }
开发者ID:Bencheci,项目名称:blueRavenStudiosProject,代码行数:101,代码来源:jetpack.php


示例11: jetpack_shortcodes_more_info_connected

function jetpack_shortcodes_more_info_connected()
{
    ?>
	<div class="jp-info-img">
		<a href="http://en.support.wordpress.com/shortcodes/">
			<img class="jp-info-img" src="<?php 
    echo plugins_url(basename(dirname(dirname(__FILE__))) . '/_inc/images/screenshots/shortcodes.png');
    ?>
" alt="<?php 
    esc_attr_e('Shortcode Embeds', 'jetpack');
    ?>
" width="300" height="150" />
		</a>
	</div>

	<h4><?php 
    esc_html_e('Shortcode Embeds', 'jetpack');
    ?>
</h4>
	<p><?php 
    esc_html_e('Shortcodes allow you to easily and safely embed media from other places in your site. With just one simple code, you can tell WordPress to embed YouTube, Flickr, and other media.', 'jetpack');
    ?>
</p>
	<p><?php 
    esc_html_e('Enter a shortcode directly into the Post/Page editor to embed media. For specific instructions follow the links below.', 'jetpack');
    ?>
</p>
	<?php 
    $codes = array('archives' => 'http://support.wordpress.com/archives-shortcode/', 'audio' => 'http://support.wordpress.com/audio/', 'blip.tv' => 'http://support.wordpress.com/videos/bliptv/', 'dailymotion' => 'http://support.wordpress.com/videos/dailymotion/', 'flickr' => 'http://support.wordpress.com/videos/flickr-video/', 'scribd' => 'http://support.wordpress.com/scribd/', 'slideshare' => 'http://support.wordpress.com/slideshows/slideshare/', 'soundcloud' => 'http://support.wordpress.com/audio/soundcloud-audio-player/', 'vimeo' => 'http://support.wordpress.com/videos/vimeo/', 'youtube' => 'http://support.wordpress.com/videos/youtube/', 'polldaddy' => 'http://support.polldaddy.com/wordpress-shortcodes/');
    $codes['wpvideo (VideoPress)'] = 'http://en.support.wordpress.com/videopress/';
    $available = '';
    foreach ($codes as $code => $url) {
        $available[] = '<a href="' . $url . '" target="_blank">[' . $code . ']</a>';
    }
    ?>
	<p><?php 
    echo wp_sprintf(esc_html__('Available shortcodes are: %l.', 'jetpack'), $available);
    ?>
</p>
<?php 
}
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:41,代码来源:module-info.php


示例12: geodir_pagination

/**
 * Returns paginated HTML string based on the given parameters.
 *
 * @since 1.0.0
 * @since 1.5.5 Fixed pagination links when location selected.
 * @package GeoDirectory
 * @global object $wpdb WordPress Database object.
 * @global object $wp_query WordPress Query object.
 * @param string $before The HTML to prepend.
 * @param string $after The HTML to append.
 * @param string $prelabel The previous link label.
 * @param string $nxtlabel The next link label.
 * @param int $pages_to_show Number of pages to display on the pagination. Default: 5.
 * @param bool $always_show Do you want to show the pagination always? Default: false.
 */
function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false)
{
    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
    if (empty($prelabel)) {
        $prelabel = '<strong>&laquo;</strong>';
    }
    if (empty($nxtlabel)) {
        $nxtlabel = '<strong>&raquo;</strong>';
    }
    $half_pages_to_show = round($pages_to_show / 2);
    if (geodir_is_page('home') || get_option('geodir_set_as_home') && is_home()) {
        // dont apply default  pagination for geodirectory home page.
        return;
    }
    if (!is_single()) {
        if (function_exists('geodir_location_geo_home_link')) {
            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
        }
        $numposts = $wp_query->found_posts;
        $max_page = ceil($numposts / $posts_per_page);
        if (empty($paged)) {
            $paged = 1;
        }
        if ($max_page > 1 || $always_show) {
            // Extra pagination info
            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
            $start_no = ($paged - 1) * $posts_per_page + 1;
            $end_no = min($paged * $posts_per_page, $numposts);
            if ($geodir_pagination_more_info != '') {
                $pagination_info = '<div class="gd-pagination-details">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>';
                if ($geodir_pagination_more_info == 'before') {
                    $before = $before . $pagination_info;
                } else {
                    if ($geodir_pagination_more_info == 'after') {
                        $after = $pagination_info . $after;
                    }
                }
            }
            echo "{$before} <div class='Navi'>";
            if ($paged >= $pages_to_show - 1) {
                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
            }
            previous_posts_link($prelabel);
            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
                if ($i >= 1 && $i <= $max_page) {
                    if ($i == $paged) {
                        echo "<strong class='on'>{$i}</strong>";
                    } else {
                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
                    }
                }
            }
            next_posts_link($nxtlabel, $max_page);
            if ($paged + $half_pages_to_show < $max_page) {
                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
            }
            echo "</div> {$after}";
        }
        if (function_exists('geodir_location_geo_home_link')) {
            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
        }
    }
}
开发者ID:kkoppenhaver,项目名称:geodirectory,代码行数:78,代码来源:geodirectory_template_tags.php


示例13: explode

            $post_term = explode(',', trim($post_term, ','));
        }
        $post_term = array_unique($post_term);
        if (!empty($post_term)) {
            foreach ($post_term as $post_term) {
                $post_term = trim($post_term);
                if ($post_term != '') {
                    $term = get_term_by('id', $post_term, $post_taxonomy);
                    $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>{$term->name}</a>";
                    $terms[] = $term;
                }
            }
        }
        break;
    }
    $taxonomies[$post_taxonomy] = wp_sprintf('%s: %l.', ucwords($listing_label . ' Category'), $links, (object) $terms);
}
echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
if (isset($taxonomies[$post_type . '_tags'])) {
    echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
}
?>
                </p>
                <!-- Post terms end -->
                <?php 
if ((int) get_option('geodir_disable_gb_modal') != 1) {
    ?>
                    <!-- Post info tabs start -->
                    <script type="text/javascript">
                        jQuery(function () {
                            jQuery('#post-gallery a').lightBox({
开发者ID:bangjojo,项目名称:wp,代码行数:31,代码来源:listing-preview.php


示例14: render_shadow_indicator

        /**
         * Display a notice at the bottom of the window when inside a shadow
         */
        public function render_shadow_indicator()
        {
            ?>
<style>#shadow-indicator { font-family: Arial, sans-serif; position: fixed; bottom: 0; left: 0; right: 0; width: 100%; color: #fff; background: #cc0000; z-index: 3000; font-size:16px; line-height: 1; text-align: center; padding: 5px } #shadow-indicator a.clearlink { text-decoration: underline; color: #fff; }</style>
<div id="shadow-indicator">
<?php 
            echo wp_sprintf(__('You are currently in %s.', 'wpp-instance-switcher'), getenv('WP_ENV'));
            ?>
 <a class="clearlink" href="/?wpp_shadow=clear"><?php 
            _e('Exit', 'wpp-instance-switcher');
            ?>
</a>
</div>
<?php 
        }
开发者ID:seravo,项目名称:wp-palvelu-instance-switcher,代码行数:18,代码来源:wp-palvelu-instance-switcher.php


示例15: get_the_taxonomies

/**
 * Retrieve all taxonomies associated with a post.
 *
 * This function can be used within the loop. It will also return an array of
 * the taxonomies with links to the taxonomy and name.
 *
 * @since 2.5.0
 *
 * @param int $post Optional. Post ID or will use Global Post ID (in loop).
 * @param array $args Override the defaults.
 * @return array
 */
function get_the_taxonomies($post = 0, $args = array() ) {
	$post = get_post( $post );

	$args = wp_parse_args( $args, array(
		'template' => '%s: %l.',
	) );
	extract( $args, EXTR_SKIP );

	$taxonomies = array();

	if ( !$post )
		return $taxonomies;

	foreach ( get_object_taxonomies($post) as $taxonomy ) {
		$t = (array) get_taxonomy($taxonomy);
		if ( empty($t['label']) )
			$t['label'] = $taxonomy;
		if ( empty($t['args']) )
			$t['args'] = array();
		if ( empty($t['template']) )
			$t['template'] = $template;

		$terms = get_object_term_cache($post->ID, $taxonomy);
		if ( false === $terms )
			$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);

		$links = array();

		foreach ( $terms as $term )
			$links[] = "<a href='" . esc_attr( get_term_link($term) ) . "'>$term->name</a>";

		if ( $links )
			$taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);
	}
	return $taxonomies;
}
开发者ID:pauEscarcia,项目名称:AIMM,代码行数:48,代码来源:TAXONOMY.PHP


示例16: get_the_taxonomies

function get_the_taxonomies($post = 0) {
	if ( is_int($post) )
		$post =& get_post($post);
	elseif ( !is_object($post) )
		$post =& $GLOBALS['post'];

	$taxonomies = array();

	if ( !$post )
		return $taxonomies;

	$template = apply_filters('taxonomy_template', '%s: %l.');

	foreach ( get_object_taxonomies($post) as $taxonomy ) {
		$t = (array) get_taxonomy($taxonomy);
		if ( empty($t['label']) )
			$t['label'] = $taxonomy;
		if ( empty($t['args']) )
			$t['args'] = array();
		if ( empty($t['template']) )
			$t['template'] = $template;

		$terms = get_object_term_cache($post->ID, $taxonomy);
		if ( empty($terms) )
			$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);

		$links = array();

		foreach ( $terms as $term )
			$links[] = "<a href='" . attribute_escape(get_term_link($term, $taxonomy)) . "'>$term->name</a>";

		if ( $links )
			$taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);
	}
	return $taxonomies;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:36,代码来源:taxonomy.php


示例17: get_the_taxonomies

/**
 * Retrieve all taxonomies associated with a post.
 *
 * This function can be used within the loop. It will also return an array of
 * the taxonomies with links to the taxonomy and name.
 *
 * @since 2.5.0
 *
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 * @param array $args {
 *     Optional. Arguments about how to format the list of taxonomies. Default empty array.
 *
 *     @type string $template      Template for displaying a taxonomy label and list of terms.
 *                                 Default is "Label: Terms."
 *     @type string $term_template Template for displaying a single term in the list. Default is the term name
 *                                 linked to its archive.
 * }
 * @return array List of taxonomies.
 */
function get_the_taxonomies($post = 0, $args = array())
{
    $post = get_post($post);
    $args = wp_parse_args($args, array('template' => __('%s: %l.'), 'term_template' => '<a href="%1$s">%2$s</a>'));
    $taxonomies = array();
    if (!$post) {
        return $taxonomies;
    }
    foreach (get_object_taxonomies($post) as $taxonomy) {
        $t = (array) get_taxonomy($taxonomy);
        if (empty($t['label'])) {
            $t['label'] = $taxonomy;
        }
        if (empty($t['args'])) {
            $t['args'] = array();
        }
        if (empty($t['template'])) {
            $t['template'] = $args['template'];
        }
        if (empty($t['term_template'])) {
            $t['term_template'] = $args['term_template'];
        }
        $terms = get_object_term_cache($post->ID, $taxonomy);
        if (false === $terms) {
            $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
        }
        $links = array();
        foreach ($terms as $term) {
            $links[] = wp_sprintf($t['term_template'], esc_attr(get_term_link($term)), $term->name);
        }
        if ($links) {
            $taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);
        }
    }
    return $taxonomies;
}
开发者ID:n8maninger,项目名称:WordPress,代码行数:55,代码来源:taxonomy-functions.php


示例18: meta_tags

 public function meta_tags()
 {
     global $wp_query;
     $period = '';
     $template = '';
     $meta = array();
     /**
      * Can be used to specify a list of themes that set their own meta tags.
      *
      * If current site is using one of the themes listed as conflicting, inserting Jetpack SEO
      * meta tags will be prevented.
      *
      * @module seo-tools
      *
      * @since 4.4.0
      *
      * @param array List of conflicted theme names. Defaults to empty array.
      */
     $conflicted_themes = apply_filters('jetpack_seo_meta_tags_conflicted_themes', array());
     if (isset($conflicted_themes[get_option('template')])) {
         return;
     }
     /**
      * Can be used to insert custom site host that will used for meta title.
      *
      * @module seo-tools
      *
      * @since 4.4.0
      *
      * @param string Name of the site host. Defaults to empty string.
      */
     $site_host = apply_filters('jetpack_seo_site_host', '');
     $meta['title'] = sprintf(_x('%1$s', 'Site Title', 'jetpack'), get_bloginfo('title'));
     if (!empty($site_host)) {
         $meta['title'] = sprintf(_x('%1$s on %2$s', 'Site Title on WordPress', 'jetpack'), get_bloginfo('title'), $site_host);
     }
     $front_page_meta = Jetpack_SEO_Utils::get_front_page_meta_description();
     $description = $front_page_meta ? $front_page_meta : get_bloginfo('description');
     $meta['description'] = trim($description);
     // Try to target things if we're on a "specific" page of any kind.
     if (is_singular()) {
         $meta['title'] = sprintf(_x('%1$s | %2$s', 'Post Title | Site Title on WordPress', 'jetpack'), get_the_title(), $meta['title']);
         // Business users can overwrite the description.
         if (!(is_front_page() && Jetpack_SEO_Utils::get_front_page_meta_description())) {
             $description = Jetpack_SEO_Posts::get_post_description(get_post());
             if ($description) {
                 $description = wp_trim_words(strip_shortcodes(wp_kses($description, array())));
                 $meta['description'] = $description;
             }
         }
     } elseif (is_author()) {
         $obj = get_queried_object();
         $meta['title'] = sprintf(_x('Posts by %1$s | %2$s', 'Posts by Author Name | Blog Title on WordPress', 'jetpack'), $obj->display_name, $meta['title']);
         $meta['description'] = sprintf(_x('Read all of the posts by %1$s on %2$s', 'Read all of the posts by Author Name on Blog Title', 'jetpack'), $obj->display_name, get_bloginfo('title'));
     } elseif (is_tag() || is_category() || is_tax()) {
         $obj = get_queried_object();
         $meta['title'] = sprintf(_x('Posts about %1$s on %2$s', 'Posts about Category on Blog Title', 'jetpack'), single_term_title('', false), get_bloginfo('title'));
         $description = get_term_field('description', $obj->term_id, $obj->taxonomy, 'raw');
         if (!is_wp_error($description) && '' != $description) {
             $meta['description'] = wp_trim_words($description);
         } else {
             $authors = $this->get_authors();
             $meta['description'] = wp_sprintf(_x('Posts about %1$s written by %2$l', 'Posts about Category written by John and Bob', 'jetpack'), single_term_title('', false), $authors);
         }
     } elseif (is_date()) {
         if (is_year()) {
             $period = get_query_var('year');
             $template = _nx('%1$s post published by %2$l in the year %3$s', '%1$s posts published by %2$l in the year %3$s', count($wp_query->posts), '10 posts published by John in the year 2012', 'jetpack');
         } elseif (is_month()) {
             $period = date('F Y', mktime(0, 0, 0, get_query_var('monthnum'), 1, get_query_var('year')));
             $template = _nx('%1$s post published by %2$l during %3$s', '%1$s posts published by %2$l during %3$s', count($wp_query->posts), '10 posts publishes by John during May 2012', 'jetpack');
         } elseif (is_day()) {
             $period = date('F j, Y', mktime(0, 0, 0, get_query_var('monthnum'), get_query_var('day'), get_query_var('year')));
             $template = _nx('%1$s post published by %2$l on %3$s', '%1$s posts published by %2$l on %3$s', count($wp_query->posts), '10 posts published by John on May 30, 2012', 'jetpack');
         }
         $meta['title'] = sprintf(_x('Posts from %1$s on %2$s', 'Posts from May 2012 on Blog Title', 'jetpack'), $period, get_bloginfo('title'));
         $authors = $this->get_authors();
         $meta['description'] = wp_sprintf($template, count($wp_query->posts), $authors, $period);
     }
     $custom_title = Jetpack_SEO_Titles::get_custom_title();
     if (!empty($custom_title)) {
         $meta['title'] = $custom_title;
     }
     /**
      * Can be used to edit the default SEO tools meta tags.
      *
      * @module seo-tools
      *
      * @since 4.4.0
      *
      * @param array Array that consists of meta name and meta content pairs.
      */
     $meta = apply_filters('jetpack_seo_meta_tags', $meta);
     // Output them
     foreach ($meta as $name => $content) {
         if (!empty($content)) {
             echo '<meta name="' . esc_attr($name) . '" content="' . esc_attr($content) . '" />' . "\n";
         }
     }
 }
开发者ID:automattic,项目名称:jetpack,代码行数:100,代码来源:jetpack-seo.php


示例19: not_configured_notice

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_star_rating函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_specialchars_decode函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap