function bctt_shortcode($atts)
{
    extract(shortcode_atts(array('tweet' => '', 'via' => 'yes', 'url' => 'yes'), $atts));
    $handle = get_option('bctt-twitter-handle');
    if (!empty($handle) && $via != 'no') {
        $handle_code = "&via=" . $handle . "&related=" . $handle;
    } else {
        $handle_code = '';
    }
    $text = $tweet;
    if ($url != 'no') {
        if (get_option('bctt-short-url') != false) {
            $bcttURL = '&url=' . wp_get_shortlink();
        } else {
            $bcttURL = '&url=' . get_permalink();
        }
    } else {
        $bcttURL = '';
    }
    $bcttBttn = sprintf(__('Click To Tweet', 'better-click-to-tweet'));
    $short = bctt_shorten($text, 117 - (6 + mb_strlen($handle)));
    if (!is_feed()) {
        return "<div class='bctt-click-to-tweet'><span class='bctt-ctt-text'><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . $bcttURL . "' target='_blank'>" . $short . "</a></span><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . "&url=" . $bcttURL . "' target='_blank' class='bctt-ctt-btn'>" . $bcttBttn . "</a></div>";
    } else {
        return "<hr /><p><em>" . $short . "</em><br /><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . $bcttURL . "' target='_blank' class='bctt-ctt-btn'>" . $bcttBttn . "</a><br /><hr />";
    }
}
Пример #2
0
 /**
  * Modifying the Title
  *
  * Function tied to the wp_title filter hook.
  * @uses filter wp_title
  */
 function esteem_filter_wp_title($title)
 {
     global $page, $paged;
     // Get the Site Name
     $site_name = get_bloginfo('name');
     // Get the Site Description
     $site_description = get_bloginfo('description');
     $filtered_title = '';
     // For Homepage or Frontpage
     if (is_home() || is_front_page()) {
         $filtered_title .= $site_name;
         if (!empty($site_description)) {
             $filtered_title .= ' &#124; ' . $site_description;
         }
     } elseif (is_feed()) {
         $filtered_title = '';
     } else {
         $filtered_title = $title . $site_name;
     }
     // Add a page number if necessary:
     if ($paged >= 2 || $page >= 2) {
         $filtered_title .= ' &#124; ' . sprintf(__('Page %s', 'esteem'), max($paged, $page));
     }
     // Return the modified title
     return $filtered_title;
 }
Пример #3
0
 public function gallery_shortcode($val, $atts)
 {
     if (!empty($val)) {
         // something else is overriding post_gallery, like a custom VIP shortcode
         return $val;
     }
     global $post;
     $this->set_atts($atts);
     $attachments = $this->get_attachments();
     if (empty($attachments)) {
         return '';
     }
     if (is_feed() || defined('IS_HTML_EMAIL')) {
         return '';
     }
     if (method_exists($this, $this->atts['type'] . '_talavera')) {
         // Enqueue styles and scripts
         $this->default_scripts_and_styles();
         $gallery_html = call_user_func_array(array($this, $this->atts['type'] . '_talavera'), array($attachments));
         if ($gallery_html && class_exists('Jetpack') && class_exists('Jetpack_Photon')) {
             // Tiled Galleries in Jetpack require that Photon be active.
             // If it's not active, run it just on the gallery output.
             if (!in_array('photon', Jetpack::get_active_modules())) {
                 $gallery_html = Jetpack_Photon::filter_the_content($gallery_html);
             }
         }
         return $gallery_html;
     }
     return '';
 }
Пример #4
0
function jetpack_instagram_handler($matches, $atts, $url)
{
    global $content_width;
    static $did_script;
    // keep a copy of the passed-in URL since it's modified below
    $passed_url = $url;
    $max_width = 698;
    $min_width = 320;
    if (is_feed()) {
        $media_url = sprintf('http://instagr.am/p/%s/media/?size=l', $matches[2]);
        return sprintf('<a href="%s" title="%s"><img src="%s" alt="Instagram Photo" /></a>', esc_url($url), esc_attr__('View on Instagram', 'jetpack'), esc_url($media_url));
    }
    $atts = shortcode_atts(array('width' => isset($content_width) ? $content_width : $max_width, 'hidecaption' => false), $atts);
    $atts['width'] = absint($atts['width']);
    if ($atts['width'] > $max_width || $min_width > $atts['width']) {
        $atts['width'] = $max_width;
    }
    // remove the modal param from the URL
    $url = remove_query_arg('modal', $url);
    // force .com instead of .am for https support
    $url = str_replace('instagr.am', 'instagram.com', $url);
    // The oembed endpoint expects HTTP, but HTTP requests 301 to HTTPS
    $instagram_http_url = str_replace('https://', 'http://', $url);
    $instagram_https_url = str_replace('http://', 'https://', $url);
    $url_args = array('url' => $instagram_http_url, 'maxwidth' => $atts['width']);
    if ($atts['hidecaption']) {
        $url_args['hidecaption'] = 'true';
    }
    $url = esc_url_raw(add_query_arg($url_args, 'https://api.instagram.com/oembed/'));
    // Don't use object caching here by default, but give themes ability to turn it on.
    $response_body_use_cache = apply_filters('instagram_cache_oembed_api_response_body', false, $matches, $atts, $passed_url);
    $response_body = false;
    if ($response_body_use_cache) {
        $cache_key = 'oembed_response_body_' . md5($url);
        $response_body = wp_cache_get($cache_key, 'instagram_embeds');
    }
    if (!$response_body) {
        // Not using cache (default case) or cache miss
        $instagram_response = wp_remote_get($url, array('redirection' => 0));
        if (is_wp_error($instagram_response) || 200 != $instagram_response['response']['code'] || empty($instagram_response['body'])) {
            return "<!-- instagram error: invalid oratv resource -->";
        }
        $response_body = json_decode($instagram_response['body']);
        if ($response_body_use_cache) {
            // if caching it is short-lived since this is a "Cache-Control: no-cache" resource
            wp_cache_set($cache_key, $response_body, 'instagram_embeds', HOUR_IN_SECONDS + mt_rand(0, HOUR_IN_SECONDS));
        }
    }
    if (!empty($response_body->html)) {
        if (!$did_script) {
            $did_script = true;
            add_action('wp_footer', 'jetpack_instagram_add_script');
        }
        // there's a script in the response, which we strip on purpose since it's added above
        $ig_embed = preg_replace('@<(script)[^>]*?>.*?</\\1>@si', '', $response_body->html);
    } else {
        $ig_embed = jetpack_instagram_iframe_embed($instagram_https_url, $atts);
    }
    return $ig_embed;
}
Пример #5
0
function rssMsg($content)
{
    if (is_feed()) {
        $content = $content . '<hr /> *The SFMOMA blog feed has moved to a new location! <a href="http://feeds.feedburner.com/sfmoma/blog">http://feeds.feedburner.com/sfmoma/blog</a>  Please update your feed readers and bookmarks.* <hr />';
    }
    return $content;
}
 /**
  * Created early as possible in the wp_footer action this is the string to which we
  * will move JS resources after
  */
 function print_marker()
 {
     // is_feed() is important to not break Wordpress feeds and the WooCommerce api
     if ($this->valid_request && !is_feed()) {
         print $this->marker;
     }
 }
/**
 *
 * Only login users can read the text  shortcode
 * E.g. [member]This content is hiddent from users who are not logged in[/member]
 *
 *
 * @package	 aa_basic_shortcodes
 * @since    1.0.0
 */
function aa_login_users_only_shortcode($atts, $content = null)
{
    if (is_user_logged_in() && !is_feed() && !is_null($content)) {
        return $content;
    }
    return '';
}
Пример #8
0
function add_content_watermark($content)
{
    if (is_feed()) {
        return $content . ' Created by Amy Evans, copyright ' . date('Y') . ' all rights reserved.';
    }
    return $content;
}
Пример #9
0
 /**
  */
 public function get_content()
 {
     if (!is_null(parent::get_content()) && !is_feed() && current_user_can($this->get_att('capability'))) {
         return parent::get_content();
     }
     return null;
 }
Пример #10
0
function themeist_books_add_after_post_content($content)
{
    if (!is_feed() && !is_home() && is_singular() && is_main_query()) {
        $content .= themeist_books_get_details();
    }
    return $content;
}
Пример #11
0
function shot_get_posts($query)
{
    if (is_home() || is_feed()) {
        $query->set('post_type', array('post', 'link', 'attachment'));
    }
    return $query;
}
Пример #12
0
 public function FeedburnerFilter()
 {
     // Check this is active
     if (!$this->IsActive()) {
         return false;
     }
     // Bounce Feed Burner
     if (preg_match('/feedburner/i', $_SERVER['HTTP_USER_AGENT'])) {
         return false;
     }
     // Do nothing if not a feed
     if (!is_feed()) {
         return false;
     }
     // Do nothing if not configured
     if (empty($this->url)) {
         return false;
     }
     if (empty($this->id) && !empty($this->url)) {
         // Probably a Google Feedburner account
         header('Location: http://feeds2.feedburner.com/' . $this->url);
     } else {
         header('Location: ' . $this->url);
     }
     die;
 }
Пример #13
0
function autoptimize_start_buffering()
{
    if (!is_feed()) {
        // Config element
        $conf = autoptimizeConfig::instance();
        // Load our base class
        include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeBase.php';
        // Load extra classes and set some vars
        if ($conf->get('autoptimize_html')) {
            include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeHTML.php';
            @(include WP_PLUGIN_DIR . '/autoptimize/classes/minify-html.php');
        }
        if ($conf->get('autoptimize_js')) {
            include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeScripts.php';
            @(include WP_PLUGIN_DIR . '/autoptimize/classes/jsmin-1.1.1.php');
            define('CONCATENATE_SCRIPTS', false);
            define('COMPRESS_SCRIPTS', false);
        }
        if ($conf->get('autoptimize_css')) {
            include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeStyles.php';
            @(include WP_PLUGIN_DIR . '/autoptimize/classes/minify-css-compressor.php');
            define('COMPRESS_CSS', false);
        }
        if ($conf->get('autoptimize_js_yui') || $conf->get('autoptimize_css_yui')) {
            include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeYUI.php';
        }
        if ($conf->get('autoptimize_cdn_js') || $conf->get('autoptimize_cdn_css')) {
            include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeCDN.php';
        }
        // Now, start the real thing!
        ob_start('autoptimize_end_buffering');
    }
}
Пример #14
0
function sfsi_social_buttons_below($content)
{
    global $post;
    $sfsi_section6 = unserialize(get_option('sfsi_section6_options', false));
    /* check if option activated in admin or not */
    if ($sfsi_section6['sfsi_show_Onposts'] == "yes") {
        $permalink = get_permalink($post->ID);
        $title = get_the_title();
        $sfsiLikeWith = "45px;";
        /* check for counter display */
        if ($sfsi_section6['sfsi_icons_DisplayCounts'] == "yes") {
            $show_count = 1;
            $sfsiLikeWith = "75px;";
        } else {
            $show_count = 0;
        }
        $txt = isset($sfsi_section6['sfsi_textBefor_icons']) ? $sfsi_section6['sfsi_textBefor_icons'] : "Share this Post with :";
        $float = $sfsi_section6['sfsi_icons_alignment'];
        $icons = "<div class='sfsi_Sicons' style='float:" . $float . "'><div style='float:left;margin:5px;'><span>" . $txt . "</span></div>";
        //adding wrapper div
        $icons .= "<div class='sfsi_socialwpr'>";
        $icons .= "<div class='sf_fb' style='width:" . $sfsiLikeWith . "'>" . sfsi_FBlike($permalink, $show_count) . "</div>";
        $icons .= "<div class='sf_google'>" . sfsi_googlePlus($permalink, $show_count) . "</div>";
        $icons .= "<div class='sf_addthis'>" . sfsi_Addthis($show_count) . "</div>";
        $icons .= "</div>";
        //closing wrapper div
        $icons .= "</div>";
        if (!is_feed() && !is_home() && !is_page()) {
            $content = $content . $icons;
        }
    }
    return $content;
}
Пример #15
0
/**
 * Cleans up the default WordPress [caption] shortcode.  The main purpose of this function is to remove the
 * inline styling WP adds, which creates 10px of padding around captioned elements.
 *
 * @since 0.1.0
 * @access private
 * @param string $output The output of the default caption (empty string at this point).
 * @param array $attr Array of arguments for the [caption] shortcode.
 * @param string $content The content placed after the opening [caption] tag and before the closing [/caption] tag.
 * @return string $output The formatted HTML for the caption.
 */
function cleaner_caption($output, $attr, $content)
{
    /* We're not worried abut captions in feeds, so just return the output here. */
    if (is_feed()) {
        return $output;
    }
    /* Set up the default arguments. */
    $defaults = array('id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '');
    /* Allow developers to override the default arguments. */
    $defaults = apply_filters('cleaner_caption_defaults', $defaults);
    /* Apply filters to the arguments. */
    $attr = apply_filters('cleaner_caption_args', $attr);
    /* Merge the defaults with user input. */
    $attr = shortcode_atts($defaults, $attr);
    /* If the width is less than 1 or there is no caption, return the content wrapped between the [caption] tags. */
    if (1 > $attr['width'] || empty($attr['caption'])) {
        return $content;
    }
    /* Set up the attributes for the caption <div>. */
    $attributes = !empty($attr['id']) ? ' id="' . esc_attr($attr['id']) . '"' : '';
    $attributes .= ' class="wp-caption ' . esc_attr($attr['align']) . '"';
    $attributes .= ' style="max-width: ' . esc_attr($attr['width']) . 'px"';
    /* Open the caption <div>. */
    $output = '<figure' . $attributes . '>';
    /* Allow shortcodes for the content the caption was created for. */
    $output .= do_shortcode($content);
    /* Append the caption text. */
    $output .= '<figcaption class="wp-caption-text">' . $attr['caption'] . '</figcaption>';
    /* Close the caption </div>. */
    $output .= '</figure>';
    /* Return the formatted, clean caption. */
    return apply_filters('cleaner_caption', $output);
}
Пример #16
0
function photoline_modified_post_gallery($output, $attr)
{
    global $post;
    static $instance = 0;
    $instance++;
    //disable all filter
    if (empty($attr['type']) || $attr['type'] != 'slider') {
        return;
    }
    if (isset($attr['orderby'])) {
        $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
        if (!$attr['orderby']) {
            unset($attr['orderby']);
        }
    }
    extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'size' => 'photoline-featured', 'include' => '', 'exclude' => ''), $attr));
    $id = intval($id);
    if ('RAND' == $order) {
        $orderby = 'none';
    }
    if (!empty($include)) {
        $include = preg_replace('/[^0-9,]+/', '', $include);
        $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
        $attachments = array();
        foreach ($_attachments as $key => $val) {
            $attachments[$val->ID] = $_attachments[$key];
        }
    } elseif (!empty($exclude)) {
        $exclude = preg_replace('/[^0-9,]+/', '', $exclude);
        $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    } else {
        $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    }
    if (empty($attachments)) {
        return '';
    }
    if (is_feed()) {
        $output = "\n";
        foreach ($attachments as $att_id => $attachment) {
            $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
        }
        return $output;
    }
    $selector = "gallery-{$instance}";
    $size_class = sanitize_html_class($size);
    $gallery_div = "<div id='{$selector}' class='gallery galleryid-{$id} gallery-size-{$size_class} flexslider'>";
    $output = apply_filters('gallery_style', $gallery_div);
    $output .= '<ul class="slides">';
    $i = 0;
    foreach ($attachments as $id => $attachment) {
        $caption = !empty($attachment->post_excerpt) ? '<p class="flex-caption wp-caption-text gallery-caption">' . wptexturize($attachment->post_excerpt) . '</p>' : '';
        $image = wp_get_attachment_image($id, $size);
        $output .= '<li>';
        $output .= $image;
        $output .= $caption;
        $output .= '</li>';
    }
    $output .= "\r\n            </ul><!-- .slides -->\r\n        </div>\n";
    return $output;
}
Пример #17
0
 function filter_the_content($content)
 {
     if (is_feed()) {
         return $content;
     }
     return preg_replace_callback('/(<\\s*img[^>]+)(src\\s*=\\s*"[^"]+")([^>]+>)/i', array($this, 'preg_replace_callback'), $content);
 }
Пример #18
0
function archives_shortcode($attr)
{
    if (is_feed()) {
        return '[archives]';
    }
    global $allowedposttags;
    $default_atts = array('type' => 'postbypost', 'limit' => '', 'format' => 'html', 'showcount' => false, 'before' => '', 'after' => '', 'order' => 'desc');
    extract(shortcode_atts($default_atts, $attr));
    if (!in_array($type, array('yearly', 'monthly', 'daily', 'weekly', 'postbypost'))) {
        $type = 'postbypost';
    }
    if (!in_array($format, array('html', 'option', 'custom'))) {
        $format = 'html';
    }
    if ('' != $limit) {
        $limit = (int) $limit;
    }
    $showcount = (bool) $showcount;
    $before = wp_kses($before, $allowedposttags);
    $after = wp_kses($after, $allowedposttags);
    // Get the archives
    $archives = wp_get_archives('type=' . $type . '&limit=' . $limit . '&format=' . $format . '&echo=0&show_post_count=' . $showcount . '&before=' . $before . '&after=' . $after);
    if ('asc' == $order) {
        $archives = implode("\n", array_reverse(explode("\n", $archives)));
    }
    // Check to see if there are any archives
    if (empty($archives)) {
        $archives = '<p>' . __('Your blog does not currently have any published posts.', 'jetpack') . '</p>';
    } elseif ('option' == $format) {
        $archives = "<select name='archive-dropdown' onchange='document.location.href=this.options[this.selectedIndex].value;'><option value='" . get_permalink() . "'>--</option>" . $archives . "</select>";
    } elseif ('html' == $format) {
        $archives = '<ul>' . $archives . '</ul>';
    }
    return $archives;
}
Пример #19
0
function document_title($title = '', $sep = '-', $seplocation = 'right')
{
    // Remove default seperator and add spacing
    if (trim($sep) === '' || $sep === '&raquo;' || $sep === '&#187;') {
        $sep = '-';
    }
    $sep = ' ' . $sep . ' ';
    // Determine page number, if any
    $page_num = '';
    if (is_paged()) {
        global $page, $paged;
        if ($paged >= 2 || $page >= 2) {
            $page_num = $sep . sprintf(esc_html__('Page %d', 'ubik'), max($paged, $page));
        }
    }
    // Generate the title using our all-purpose title function
    $title = apply_filters('ubik_seo_document_title_raw', ubik_title());
    $name = get_bloginfo('name');
    $desc = get_bloginfo('description');
    // Handle three scenarios: home/front page, archive feeds, and everything else
    if (is_front_page() || is_home()) {
        $title = $name;
        if (!empty($desc) && !is_paged()) {
            $title .= $sep . $desc;
        }
    } elseif (is_feed() && is_archive()) {
        $title = $sep . $title;
        // Adding the separator alters the default archive feed title output
    } else {
        $title = $title . $sep . $name;
    }
    // Sanitize and add page number as needed
    $title = esc_html(strip_tags(stripslashes(preg_replace('/\\s+/', ' ', trim($title . $page_num)))));
    return apply_filters('ubik_seo_document_title_final', $title);
}
Пример #20
0
function member_check_shortcode($atts, $content = null)
{
    if (is_user_logged_in() && !is_null($content) && !is_feed()) {
        return $content;
    }
    return '';
}
Пример #21
0
 /**
  * Translate a 'videopress' or 'wpvideo' shortcode and arguments into a video player display.
  *
  * @link http://codex.wordpress.org/Shortcode_API Shortcode API
  * @param array $attr shortcode attributes
  * @return string HTML markup or blank string on fail
  */
 public function shortcode_callback($attr, $content = '')
 {
     global $content_width;
     $guid = $attr[0];
     if (!$this->is_valid_guid($guid)) {
         return '';
     }
     $attr = shortcode_atts(array('w' => 0, 'freedom' => false, 'flashonly' => false, 'autoplay' => false, 'hd' => false), $attr);
     $attr['forcestatic'] = false;
     $attr['freedom'] = (bool) $attr['freedom'];
     $attr['hd'] = (bool) $attr['hd'];
     $attr['width'] = absint($attr['w']);
     if ($attr['width'] < $this->min_width) {
         $attr['width'] = 0;
     } elseif (isset($content_width) && $content_width > $this->min_width && $attr['width'] > $content_width) {
         $attr['width'] = 0;
     }
     if ($attr['width'] === 0 && isset($content_width) && $content_width > $this->min_width) {
         $attr['width'] = $content_width;
     }
     if ($attr['width'] % 2 === 1) {
         $attr['width']--;
     }
     $options = apply_filters('videopress_shortcode_options', array('freedom' => $attr['freedom'], 'force_flash' => (bool) $attr['flashonly'], 'autoplay' => (bool) $attr['autoplay'], 'forcestatic' => $attr['forcestatic'], 'hd' => (bool) $attr['hd']));
     // Enqueue VideoPress scripts
     self::enqueue_scripts();
     require_once dirname(__FILE__) . '/class.videopress-video.php';
     require_once dirname(__FILE__) . '/class.videopress-player.php';
     $player = new VideoPress_Player($guid, $attr['width'], $options);
     if (is_feed()) {
         return $player->asXML();
     } else {
         return $player->asHTML();
     }
 }
 /**
  * This must be public as it's used in the tool's widget
  *
  * Returns HTML for adding the script onto a page
  *
  * @param array $args     settings for this widget (we only use
  * widget_id)
  * @param array $instance settings for this particular tool, if not
  * being used from the tool settings (a widget instance)
  *
  * @return string this should be valid html
  */
 public function getInlineCode($args = array(), $instance = array())
 {
     if (is_feed()) {
         return '';
     }
     $configs = $this->getFeatureConfigs();
     $addthisWidgetUrl = $this->featureObject->getAddThisWidgetJavaScriptUrl();
     if (!empty($configs['addthis_asynchronous_loading'])) {
         $async = ' async="async"';
     } else {
         $async = '';
     }
     $script = '
         <script
             data-cfasync="false"
             type="text/javascript"
             src="' . admin_url('admin-ajax.php') . '?action=' . $this->featureObject->publicJavaScriptAction . '"' . $async . '
         >
         </script>
         <script
             data-cfasync="false"
             type="text/javascript"
             src="' . $addthisWidgetUrl . '"' . $async . '
         ></script>
     ';
     return $script;
 }
Пример #23
0
 function WPMinify()
 {
     // initialize common functions
     $this->c = new WPMinifyCommon($this);
     // load translation
     $this->c->load_text_domain();
     // register admin scripts
     add_action('admin_init', array($this->c, 'a_register_scripts'));
     add_action('admin_init', array($this->c, 'a_register_styles'));
     // check wp version
     add_action('admin_head', array($this->c, 'a_check_version'));
     // load admin menu
     add_action('admin_menu', array($this, 'a_menu'));
     // register ajax handler
     add_action('wp_ajax_wpm', array($this, 'a_ajax_handler'));
     // No need to minify admin stuff
     if (!is_admin() && !is_feed() && !defined('XMLRPC_REQUEST')) {
         // Don't minify if if user passes wp-minify-off=1 in GET parameter
         if (!(isset($_GET['wp-minify-off']) && $_GET['wp-minify-off'])) {
             add_action('init', array($this, 'pre_content'), 99999);
             add_action('wp_footer', array($this, 'post_content'));
         }
         // advertise hook
         add_action('wp_footer', array($this, 'advertise'));
     }
 }
Пример #24
0
 function uw_feed_shortcode($atts)
 {
     extract(shortcode_atts(array('url' => null, 'number' => 5, 'title' => null, 'heading' => 'h3', 'span' => 4), $atts));
     if ($url == null || is_feed()) {
         return '';
     }
     $content = '';
     $feed = fetch_feed($url);
     if (!is_wp_error($feed)) {
         $url = $feed->get_permalink();
         $feed_items = $feed->get_items(0, $number);
         $feed_items = $feed->get_items(0, $number);
         $pullleft = $span === 4 ? 'pull-left' : '';
         $title = $title == null ? $feed->get_title() : $title;
         $content = "<div class=\"row {$pullleft}\">";
         $content .= "<div class=\"span{$span}\">";
         $content .= "<div class=\"feed-in-body\"><a href=\"{$url}\" title=\"{$title}\"><{$heading}>{$title}</{$heading}></a></div>";
         $content .= "<ul>";
         foreach ($feed_items as $index => $item) {
             $title = $item->get_title();
             $link = $item->get_link();
             $attr = esc_attr(strip_tags($title));
             $content .= "<li><a href=\"{$link}\" title=\"{$attr}\">{$title}</a></li>";
         }
         $span--;
         $content .= "<a href=\"{$url}\" title=\"{$title}\" class=\"offset{$span}\">More</a>";
         $content .= '</ul>';
         $content .= "</div></div>";
     }
     return $content;
 }
Пример #25
0
function builder_filter_wp_title($title, $seperator, $direction)
{
    global $paged, $page;
    if (is_feed()) {
        return $title;
    }
    $seperator = ' ' . trim($seperator) . ' ';
    if (builder_is_home() && apply_filters('builder_filter_flip_title_direction_on_home', true)) {
        $direction = 'right' == $direction ? 'left' : 'right';
    }
    if ($paged >= 2 || $page >= 2) {
        $page_description = sprintf(__('Page %s', 'it-l10n-Builder-Cohen'), max($paged, $page));
        if ('right' == $direction) {
            $title .= $page_description . $seperator;
        } else {
            if (is_rtl()) {
                $title = $seperator . $page_description . $title;
            } else {
                $title .= $seperator . $page_description;
            }
        }
    }
    if ('right' == $direction) {
        $title .= get_bloginfo('name');
    } else {
        $title = get_bloginfo('name') . $title;
    }
    return $title;
}
Пример #26
0
/**
 * Clean up gallery_shortcode()
 *
 * Re-create the [gallery] shortcode and use thumbnails styling from Bootstrap
 *
 * @link http://twitter.github.com/bootstrap/components.html#thumbnails
 */
function roots_gallery($attr)
{
    $post = get_post();
    static $instance = 0;
    $instance++;
    if (!empty($attr['ids'])) {
        if (empty($attr['orderby'])) {
            $attr['orderby'] = 'post__in';
        }
        $attr['include'] = $attr['ids'];
    }
    $output = apply_filters('post_gallery', '', $attr);
    if ($output != '') {
        return $output;
    }
    if (isset($attr['orderby'])) {
        $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
        if (!$attr['orderby']) {
            unset($attr['orderby']);
        }
    }
    extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => '', 'icontag' => '', 'captiontag' => '', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'link' => 'file'), $attr));
    $id = intval($id);
    if ($order === 'RAND') {
        $orderby = 'none';
    }
    if (!empty($include)) {
        $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
        $attachments = array();
        foreach ($_attachments as $key => $val) {
            $attachments[$val->ID] = $_attachments[$key];
        }
    } elseif (!empty($exclude)) {
        $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    } else {
        $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    }
    if (empty($attachments)) {
        return '';
    }
    if (is_feed()) {
        $output = "\n";
        foreach ($attachments as $att_id => $attachment) {
            $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
        }
        return $output;
    }
    $output = '<ul class="thumbnails gallery">';
    $i = 0;
    foreach ($attachments as $id => $attachment) {
        $image = 'file' == $link ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
        $output .= '<li>' . $image;
        if (trim($attachment->post_excerpt)) {
            $output .= '<div class="caption hidden">' . wptexturize($attachment->post_excerpt) . '</div>';
        }
        $output .= '</li>';
    }
    $output .= '</ul>';
    return $output;
}
Пример #27
0
function is_exit()
{
    if (is_admin() || is_feed() || is_preview() || 1 === intval(get_query_var('print')) || 1 === intval(get_query_var('printpage')) || false !== strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini')) {
        return true;
    }
    return false;
}
Пример #28
0
/**
 * OVERRIDES: gallery_shortcode()
 *
 * This implements the functionality of the Gallery Shortcode for displaying
 * WordPress images on a post.
 */
function vanilla_gallery($attr)
{
    global $post, $tpl;
    // BUG: I'm doing something wrong, because $attr is not the array of attributes from gallery_shortcode function. Why not??
    // We're trusting author input, so let's at least make sure it looks like a valid orderby statement
    if (isset($attr['orderby'])) {
        $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
        if (!$attr['orderby']) {
            unset($attr['orderby']);
        }
    }
    extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail'), $attr));
    $id = intval($id);
    $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    if (empty($attachments)) {
        return '';
    }
    if (is_feed()) {
        $output = "\n";
        foreach ($attachments as $id => $attachment) {
            $output .= wp_get_attachment_link($id, $size, true) . "\n";
        }
        return $output;
    }
    $images = array();
    foreach ($attachments as $id => $attachment) {
        $images[] = array("link" => wp_get_attachment_link($id, $size, true), "caption" => $captiontag && trim($attachment->post_excerpt) ? $attachment->post_excerpt : 0);
    }
    // Prepare the template data
    $tpl["gallery"] = array("tpl_file" => "shortcodes/gallery.html", "itemtag" => tag_escape($itemtag), "icontag" => tag_escape($icontag), "captiontag" => tag_escape($captiontag), "columns" => intval($columns), "itemwidth" => $columns > 0 ? floor(100 / $columns) - 1 : 100, "images" => $images);
    // Execute the template
    return vanilla_shortcode("gallery");
}
Пример #29
0
function html_sitemap_shortcode_handler($args, $content = null)
{
    if (is_feed()) {
        return '';
    }
    $args['echo'] = 0;
    $args['title_li'] = '';
    unset($args['link_before']);
    unset($args['link_after']);
    if (isset($args['child_of']) && $args['child_of'] == 'CURRENT') {
        $args['child_of'] = get_the_ID();
    } else {
        if (isset($args['child_of']) && $args['child_of'] == 'PARENT') {
            $post =& get_post(get_the_ID());
            if ($post->post_parent) {
                $args['child_of'] = $post->post_parent;
            } else {
                unset($args['child_of']);
            }
        }
    }
    $html = wp_list_pages($args);
    // Remove the classes added by WordPress
    $html = preg_replace('/( class="[^"]+")/is', '', $html);
    return '<ul>' . $html . '</ul>';
}
 function google_ad_wrap($text)
 {
     if (!is_feed()) {
         return "<!-- google_ad_section_start -->" . $text . "<!-- google_ad_section_end -->";
     }
     return $text;
 }