本文整理匯總了PHP中is_trackback函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_trackback函數的具體用法?PHP is_trackback怎麽用?PHP is_trackback使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_trackback函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add_snippet
/**
* Add custom javascript within head section.
*
* @since 1.0.0
*/
public function add_snippet()
{
if (\is_admin()) {
return;
}
if (\is_feed()) {
return;
}
if (\is_robots()) {
return;
}
if (\is_trackback()) {
return;
}
$disable_recording = boolval(\get_post_meta(\get_the_id(), 'smartlook_disable_rec', true));
// Disable recording for this content type
if ($disable_recording) {
return;
}
$snippet = trim(\get_option('smartlook_snippet'));
if (empty($snippet)) {
return;
}
echo $snippet;
}
示例2: my_template_redirect
function my_template_redirect()
{
global $wp, $ocmx_post_types;
$wp->query_vars["post_type"] = "";
$ocmx_post_types = array();
$ocmx_post_types[] = "quote";
$ocmx_post_types[] = "info-box";
$ocmx_post_types[] = "portfolio";
if (in_array($wp->query_vars["post_type"], $ocmx_post_types)) {
if (is_robots()) {
do_action('do_robots');
return;
} elseif (is_feed()) {
do_feed();
return;
} elseif (is_trackback()) {
include ABSPATH . 'wp-trackback.php';
return;
} elseif ($wp->query_vars["name"]) {
include TEMPLATEPATH . "/single-" . $wp->query_vars["post_type"] . ".php";
die;
} else {
include TEMPLATEPATH . "/" . $wp->query_vars["post_type"] . ".php";
die;
}
}
}
示例3: bogo_init
function bogo_init()
{
bogo_languages();
if (!(is_admin() || is_robots() || is_feed() || is_trackback())) {
$locale = get_locale();
if (!isset($_COOKIE['lang']) || $_COOKIE['lang'] != $locale) {
setcookie('lang', $locale, 0, '/');
}
}
}
示例4: pt_footer
/**
*
*
* @desc Display blog footer. Show Publishthis logo if needed
*/
function pt_footer()
{
global $publishthis;
if (!is_admin() && !is_feed() && !is_robots() && !is_trackback()) {
try {
echo pt_curated_by(), "\n";
echo "<script type='text/javascript' src='http://curateby.publishthis.com/clients.js'></script>";
} catch (Exception $ex) {
}
}
}
示例5: wp_footer
function wp_footer()
{
if (!is_admin() && !is_feed() && !is_robots() && !is_trackback()) {
$text = get_option('shfs_insert_footer', '');
$text = convert_smilies($text);
$text = do_shortcode($text);
if ($text != '') {
echo $text, "\n";
}
}
}
示例6: stats_template_redirect
function stats_template_redirect()
{
global $wp_the_query, $current_user, $stats_footer;
if (is_feed() || is_robots() || is_trackback()) {
return;
}
$options = stats_get_options();
// Ensure this is always setup for the check below
$options['reg_users'] = empty($options['reg_users']) ? false : true;
if (!$options['reg_users'] && !empty($current_user->ID)) {
return;
}
add_action('wp_footer', 'stats_footer', 101);
add_action('wp_head', 'stats_add_shutdown_action');
$blog = Jetpack::get_option('id');
$tz = get_option('gmt_offset');
$v = 'ext';
$j = sprintf('%s:%s', JETPACK__API_VERSION, JETPACK__VERSION);
if ($wp_the_query->is_single || $wp_the_query->is_page || $wp_the_query->is_posts_page) {
// Store and reset the queried_object and queried_object_id
// Otherwise, redirect_canonical() will redirect to home_url( '/' ) for show_on_front = page sites where home_url() is not all lowercase.
// Repro:
// 1. Set home_url = http://ExamPle.com/
// 2. Set show_on_front = page
// 3. Set page_on_front = something
// 4. Visit http://example.com/
$queried_object = isset($wp_the_query->queried_object) ? $wp_the_query->queried_object : null;
$queried_object_id = isset($wp_the_query->queried_object_id) ? $wp_the_query->queried_object_id : null;
$post = $wp_the_query->get_queried_object_id();
$wp_the_query->queried_object = $queried_object;
$wp_the_query->queried_object_id = $queried_object_id;
} else {
$post = '0';
}
$http = is_ssl() ? 'https' : 'http';
$week = gmdate('YW');
$data = stats_array(compact('v', 'j', 'blog', 'post', 'tz'));
$stats_footer = <<<END
\t<script src="{$http}://stats.wordpress.com/e-{$week}.js" type="text/javascript"></script>
\t<script type="text/javascript">
\tst_go({{$data}});
\tvar load_cmc = function(){linktracker_init({$blog},{$post},2);};
\tif ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc);
\telse load_cmc();
\t</script>
END;
if (isset($options['hide_smile']) && $options['hide_smile']) {
$stats_footer .= "\n<style type='text/css'>img#wpstats{display:none}</style>";
}
}
示例7: add_snippet
/**
* Add custom javascript within head section.
*
* @since 1.0.0
*/
public function add_snippet()
{
if (\is_admin()) {
return;
}
if (\is_feed()) {
return;
}
if (\is_robots()) {
return;
}
if (\is_trackback()) {
return;
}
$snippet = trim(\get_option('jaco_snippet'));
if (empty($snippet)) {
return;
}
echo $snippet;
}
示例8: stats_template_redirect
function stats_template_redirect()
{
global $wp_the_query, $current_user, $stats_footer;
if (is_feed() || is_robots() || is_trackback()) {
return;
}
$options = stats_get_options();
// Ensure this is always setup for the check below
$options['reg_users'] = empty($options['reg_users']) ? false : true;
if (!$options['reg_users'] && !empty($current_user->ID)) {
return;
}
add_action('wp_footer', 'stats_footer', 101);
add_action('wp_head', 'stats_add_shutdown_action');
$blog = Jetpack::get_option('id');
$v = 'ext';
$j = sprintf('%s:%s', JETPACK__API_VERSION, JETPACK__VERSION);
if ($wp_the_query->is_single || $wp_the_query->is_page || $wp_the_query->is_posts_page) {
$post = $wp_the_query->get_queried_object_id();
} else {
$post = '0';
}
$http = is_ssl() ? 'https' : 'http';
$week = gmdate('YW');
$data = stats_array(compact('v', 'j', 'blog', 'post'));
$stats_footer = <<<END
\t<script src="{$http}://stats.wordpress.com/e-{$week}.js" type="text/javascript"></script>
\t<script type="text/javascript">
\tst_go({{$data}});
\tvar load_cmc = function(){linktracker_init({$blog},{$post},2);};
\tif ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc);
\telse load_cmc();
\t</script>
END;
if (isset($options['hide_smile']) && $options['hide_smile']) {
$stats_footer .= "\n<style type='text/css'>img#wpstats{display:none}</style>";
}
}
示例9: add_snippet
/**
* Add custom javascript within footer section.
*
* Note: I'm using double quotes instead of single quotes to maintain the script's original structure.
*
* @since 1.0.0
*/
public function add_snippet()
{
if (\is_admin()) {
return;
}
if (\is_feed()) {
return;
}
if (\is_robots()) {
return;
}
if (\is_trackback()) {
return;
}
echo "<script><!--//--><![CDATA[//><!—\r\n";
/**
* Filter the default netscope analytics variable.
*
* @since 1.1.0
* @param string Default variable name.
* @return string Possibly-modified variable name.
*/
$netscope_var = \apply_filters('wpnetscope_default_netscope_var', 'GEMIUS');
// netScope analytics tag
printf("var %s = '%s';", \esc_html($netscope_var), \esc_html($this->get_netscope_tag()));
// netScope account ID
$identifier = trim(\get_option('netscope_gemius_identifier'));
if (!empty($identifier)) {
printf("var pp_gemius_identifier = '%s';", \esc_html($identifier));
}
// netScope extra parameters
$extraparameters = $netscope_var;
printf("var pp_gemius_extraparameters = new Array('gA='+%s);", \esc_html($extraparameters));
echo "var pp_gemius_event = pp_gemius_event || function() {var x = window.gemius_sevents = window.gemius_sevents || []; x[x.length]=arguments;}; ( function(d,t) { var ex; try { var gt=d.createElement(t),s=d.getElementsByTagName(t)[0],l='http'+((location.protocol=='https:')?'s://secure':'://data'); gt.async='true'; gt.src=l+'.netscope.marktest.pt/netscope-gemius.js'; s.parentNode.appendChild(gt);} catch (ex){}}(document,'script'));";
echo "\r\n//--><!]]></script>";
}
示例10: check_canonical_url
public function check_canonical_url($requested_url = '', $do_redirect = true)
{
global $wp_query, $post, $is_IIS;
// don't redirect in same cases as WP
if (is_trackback() || is_search() || is_comments_popup() || is_admin() || is_preview() || is_robots() || $is_IIS && !iis7_supports_permalinks()) {
return;
}
// don't redirect mysite.com/?attachment_id= to mysite.com/en/?attachment_id=
if (1 == $this->options['force_lang'] && is_attachment() && isset($_GET['attachment_id'])) {
return;
}
// if the default language code is not hidden and the static front page url contains the page name
// the customizer lands here and the code below would redirect to the list of posts
if (isset($_POST['wp_customize'], $_POST['customized'])) {
return;
}
// don't redirect if we are on a static front page
if ($this->options['redirect_lang'] && isset($this->page_on_front) && is_page($this->page_on_front)) {
return;
}
if (empty($requested_url)) {
$requested_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}
if (is_single() || is_page()) {
if (isset($post->ID) && $this->model->is_translated_post_type($post->post_type)) {
$language = $this->model->get_post_language((int) $post->ID);
}
} elseif (is_category() || is_tag() || is_tax()) {
$obj = $wp_query->get_queried_object();
if ($this->model->is_translated_taxonomy($obj->taxonomy)) {
$language = $this->model->get_term_language((int) $obj->term_id);
}
} elseif ($wp_query->is_posts_page) {
$obj = $wp_query->get_queried_object();
$language = $this->model->get_post_language((int) $obj->ID);
}
if (empty($language)) {
$language = $this->curlang;
$redirect_url = $requested_url;
} else {
// first get the canonical url evaluated by WP
$redirect_url = !($redirect_url = redirect_canonical($requested_url, false)) ? $requested_url : $redirect_url;
// then get the right language code in url
$redirect_url = $this->options['force_lang'] ? $this->links_model->switch_language_in_link($redirect_url, $language) : $this->links_model->remove_language_from_link($redirect_url);
// works only for default permalinks
}
// allow plugins to change the redirection or even cancel it by setting $redirect_url to false
$redirect_url = apply_filters('pll_check_canonical_url', $redirect_url, $language);
// the language is not correctly set so let's redirect to the correct url for this object
if ($do_redirect && $redirect_url && $requested_url != $redirect_url) {
wp_redirect($redirect_url, 301);
exit;
}
return $redirect_url;
}
示例11: is_single
/**
* Gets post/page ID if current page is singular
*
* @since 3.1.2
*/
public function is_single()
{
if ((is_single() || is_page()) && !is_front_page() && !is_preview() && !is_trackback() && !is_feed() && !is_robots()) {
global $post;
$this->current_post_id = is_object($post) ? $post->ID : 0;
} else {
$this->current_post_id = 0;
}
}
示例12: redirect_canonical
/**
* Redirects incoming links to the proper URL based on the site url.
*
* Search engines consider www.somedomain.com and somedomain.com to be two
* different URLs when they both go to the same location. This SEO enhancement
* prevents penalty for duplicate content by redirecting all incoming links to
* one or the other.
*
* Prevents redirection for feeds, trackbacks, searches, comment popup, and
* admin URLs. Does not redirect on non-pretty-permalink-supporting IIS 7+,
* page/post previews, WP admin, Trackbacks, robots.txt, searches, or on POST
* requests.
*
* Will also attempt to find the correct link when a user enters a URL that does
* not exist based on exact WordPress query. Will instead try to parse the URL
* or query in an attempt to figure the correct page to go to.
*
* @since 2.3.0
*
* @global WP_Rewrite $wp_rewrite
* @global bool $is_IIS
* @global WP_Query $wp_query
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $requested_url Optional. The URL that was requested, used to
* figure if redirect is needed.
* @param bool $do_redirect Optional. Redirect to the new URL.
* @return string|void The string of the URL, if redirect needed.
*/
function redirect_canonical($requested_url = null, $do_redirect = true)
{
global $wp_rewrite, $is_IIS, $wp_query, $wpdb, $wp;
if (isset($_SERVER['REQUEST_METHOD']) && !in_array(strtoupper($_SERVER['REQUEST_METHOD']), array('GET', 'HEAD'))) {
return;
}
// If we're not in wp-admin and the post has been published and preview nonce
// is non-existent or invalid then no need for preview in query
if (is_preview() && get_query_var('p') && 'publish' == get_post_status(get_query_var('p'))) {
if (!isset($_GET['preview_id']) || !isset($_GET['preview_nonce']) || !wp_verify_nonce($_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'])) {
$wp_query->is_preview = false;
}
}
if (is_trackback() || is_search() || is_comments_popup() || is_admin() || is_preview() || is_robots() || $is_IIS && !iis7_supports_permalinks()) {
return;
}
if (!$requested_url && isset($_SERVER['HTTP_HOST'])) {
// build the URL in the address bar
$requested_url = is_ssl() ? 'https://' : 'http://';
$requested_url .= $_SERVER['HTTP_HOST'];
$requested_url .= $_SERVER['REQUEST_URI'];
}
$original = @parse_url($requested_url);
if (false === $original) {
return;
}
$redirect = $original;
$redirect_url = false;
// Notice fixing
if (!isset($redirect['path'])) {
$redirect['path'] = '';
}
if (!isset($redirect['query'])) {
$redirect['query'] = '';
}
// If the original URL ended with non-breaking spaces, they were almost
// certainly inserted by accident. Let's remove them, so the reader doesn't
// see a 404 error with no obvious cause.
$redirect['path'] = preg_replace('|(%C2%A0)+$|i', '', $redirect['path']);
// It's not a preview, so remove it from URL
if (get_query_var('preview')) {
$redirect['query'] = remove_query_arg('preview', $redirect['query']);
}
if (is_feed() && ($id = get_query_var('p'))) {
if ($redirect_url = get_post_comments_feed_link($id, get_query_var('feed'))) {
$redirect['query'] = _remove_qs_args_if_not_in_url($redirect['query'], array('p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type', 'feed'), $redirect_url);
$redirect['path'] = parse_url($redirect_url, PHP_URL_PATH);
}
}
if (is_singular() && 1 > $wp_query->post_count && ($id = get_query_var('p'))) {
$vars = $wpdb->get_results($wpdb->prepare("SELECT post_type, post_parent FROM {$wpdb->posts} WHERE ID = %d", $id));
if (isset($vars[0]) && ($vars = $vars[0])) {
if ('revision' == $vars->post_type && $vars->post_parent > 0) {
$id = $vars->post_parent;
}
if ($redirect_url = get_permalink($id)) {
$redirect['query'] = _remove_qs_args_if_not_in_url($redirect['query'], array('p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type'), $redirect_url);
}
}
}
// These tests give us a WP-generated permalink
if (is_404()) {
// Redirect ?page_id, ?p=, ?attachment_id= to their respective url's
$id = max(get_query_var('p'), get_query_var('page_id'), get_query_var('attachment_id'));
if ($id && ($redirect_post = get_post($id))) {
$post_type_obj = get_post_type_object($redirect_post->post_type);
if ($post_type_obj->public) {
$redirect_url = get_permalink($redirect_post);
$redirect['query'] = _remove_qs_args_if_not_in_url($redirect['query'], array('p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type'), $redirect_url);
}
}
//.........這裏部分代碼省略.........
示例13: wpcf7_cleanup_upload_files
function wpcf7_cleanup_upload_files()
{
if (is_admin() || 'GET' != $_SERVER['REQUEST_METHOD'] || is_robots() || is_feed() || is_trackback()) {
return;
}
$dir = trailingslashit(wpcf7_upload_tmp_dir());
if (!is_dir($dir) || !is_readable($dir) || !wp_is_writable($dir)) {
return;
}
if ($handle = @opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file == "." || $file == ".." || $file == ".htaccess") {
continue;
}
$mtime = @filemtime($dir . $file);
if ($mtime && time() < $mtime + 60) {
// less than 60 secs old
continue;
}
wpcf7_rmdir_p(path_join($dir, $file));
}
closedir($handle);
}
}
示例14: if
exit;
} else if ( is_date() && get_date_template() ) {
include(get_date_template());
exit;
} else if ( is_archive() && get_archive_template() ) {
include(get_archive_template());
exit;
} else if ( is_comments_popup() && get_comments_popup_template() ) {
include(get_comments_popup_template());
exit;
} else if ( is_paged() && get_paged_template() ) {
include(get_paged_template());
exit;
} else if ( file_exists(TEMPLATEPATH . "/index.php") ) {
include(TEMPLATEPATH . "/index.php");
exit;
}
} else {
// Process feeds and trackbacks even if not using themes.
if ( is_feed() && empty($doing_rss) ) {
include(ABSPATH . '/wp-feed.php');
exit;
} else if ( is_trackback() && empty($doing_trackback) ) {
include(ABSPATH . '/wp-trackback.php');
exit;
}
}
endif;
?>
示例15: mf_change_template
function mf_change_template()
{
global $post;
// Check global post
if (empty($post)) {
return;
}
// Process feeds and trackbacks even if not using themes.
if (is_robots()) {
do_action('do_robots');
return;
} elseif (is_feed()) {
do_feed();
return;
} elseif (is_trackback()) {
include ABSPATH . 'wp-trackback.php';
return;
}
// Check if the post has a special template
$template = get_post_meta($post->ID, '_wp_mf_page_template', true);
if (!$template || $template == 'default') {
return;
}
$template = TEMPLATEPATH . '/' . $template;
if ($template = apply_filters('template_include', $template)) {
include $template;
die;
}
return;
}