コード例 #1
1
/**
* We're going to override the_content through a filter.
*/
function cap_podcast_player($id = null, $player_type = 'default')
{
    if (empty($id)) {
        $post_id = get_the_ID();
    } else {
        $post_id = $id;
    }
    $episode_number = get_post_meta($post_id, 'episode_number', true);
    // Get Episode Media Source
    $episode_attachment_id = get_post_meta($post_id, 'episode_file', true);
    $episode_external_file = get_post_meta($post_id, 'external_episode_file', true);
    if (!empty($episode_attachment_id)) {
        $player_src = wp_get_attachment_url($episode_attachment_id);
    } elseif (!empty($episode_external_file)) {
        $player_src = $episode_external_file;
    }
    $attr = array('src' => '' . $player_src . '', 'loop' => '', 'autoplay' => '', 'preload' => 'metadata');
    $player = wp_audio_shortcode($attr);
    $download_link = '<small><a href="' . $player_src . '" download="episode' . $episode_number . '.mp3">Download this Episode</a></small>';
    // Get Episode Artwork //
    $episode_artwork_id = get_post_thumbnail_id($post_id);
    $episode_artwork = wp_get_attachment_image_src($episode_artwork_id, 'cap-podcast-thumbnail');
    $episode_artwork_src = $episode_artwork[0];
    if ('default' == $player_type) {
        $episode_title = '
        <div class="episode-info">
            <h4>Episode #' . $episode_number . '</h4>
            <h2>' . get_the_title($post_id) . '</h2>
        </div>
        ';
    } elseif ('large' == $player_type) {
        $post_object = get_post($post_id);
        $episode_title = '
        <a href="' . get_permalink($post_id) . '" class="episode-info">
            <h4>Episode #' . $episode_number . '</h4>
            <h2>' . get_the_title($post_id) . '</h2>
            <span class="description">' . wp_trim_words($post_object->post_content, '60') . '</span>
        </a>
        ';
    } elseif ('mini' == $player_type) {
        $episode_title = '';
    }
    // Construct Markup
    $markup = '
    <div class="episode-header">
        <div class="episode-artwork-container">
            <div class="episode-artwork" style="background-image: url(' . $episode_artwork_src . ');">
                <div id="play-episode" class="maintain-ratio">
                    <span class="dashicons"></span>
                </div>
            </div>
        </div>
        ' . $episode_title . '
    </div>';
    $script = "\n    <script type='text/javascript'>\n    var playerID = jQuery('#episode-" . $episode_number . "-" . $post_id . " audio').attr('id');\n    var player" . $post_id . " = document.getElementById(playerID);\n    jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode').click(function(){\n        jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').toggleClass('paused');\n    });\n\n    jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode').click(function() {\n\n        if ( jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').hasClass('paused') ) {\n            player" . $post_id . ".play();\n        }\n\n        if ( !jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').hasClass('paused') ) {\n            player" . $post_id . ".pause();\n        }\n\n    });\n    </script>\n    ";
    if (function_exists('cap_podcast_player_colors')) {
        $player .= cap_podcast_player_colors($post_id);
    }
    return '<div id="episode-' . $episode_number . '-' . $post_id . '" class="podcast-player ' . $player_type . '">' . $markup . $player . $download_link . $script . '</div>';
}
コード例 #2
0
ファイル: person.php プロジェクト: raducretu/curly-extension
function curly_person($atts, $content = null)
{
    extract(shortcode_atts(array('style' => null, 'picture' => null, 'name' => null, 'facebook' => null, 'twitter' => null, 'linkedin' => null, 'position' => null, 'email' => null), $atts));
    $html = '<div class="person clearfix ' . ($style ? $style : null) . '">';
    $style = is_null($style) ? 'normal' : $style;
    $picture = is_numeric($picture) ? wp_get_attachment_url($picture) : $picture;
    $content = function_exists('wpb_js_remove_wpautop') ? wpb_js_remove_wpautop($content, true) : $content;
    if ($style) {
        if ($style == 'mini') {
            $html .= $picture ? '<img src="' . $picture . '" alt="' . $name . '">' : null;
            $html .= '<div>';
            $html .= $name ? '<strong>' . $name . '</strong><br>' : null;
            $html .= $position ? $position . '<br>' : null;
            $html .= $content ? apply_filters('the_content', $content) : null;
            $html .= '</div>';
        } else {
            $html .= $picture ? '<p class="text-center"><img src="' . $picture . '" alt="' . $name . '"></p>' : null;
            $html .= '<div class="text-center">';
            $html .= $name ? '<h5>' . $name . '</h5>' : null;
            $html .= $position ? $position . '<br><br>' : null;
            $html .= $content ? '<p>' . apply_filters('the_content', $content) . '</p>' : null;
            $html .= $facebook || $twitter || $linkedin || $email ? '<p>' : null;
            $html .= $facebook ? '<a href="' . $facebook . '">' . do_shortcode('[icon icon="facebook" boxed="yes"]') . '</a> ' : null;
            $html .= $twitter ? '<a href="' . $twitter . '">' . do_shortcode('[icon icon="twitter" boxed="yes"]') . '</a> ' : null;
            $html .= $linkedin ? '<a href="' . $linkedin . '">' . do_shortcode('[icon icon="linkedin" boxed="yes"]') . '</a> ' : null;
            $html .= $email ? '<a href="mailto:' . $email . '">' . do_shortcode('[icon icon="envelope" boxed="yes"]') . '</a> ' : null;
            $html .= $facebook || $twitter || $linkedin || $email ? '</p>' : null;
            $html .= '</div>';
        }
    }
    $html .= '</div>';
    return $html;
}
コード例 #3
0
 function get_template_variables($instance, $args)
 {
     static $player_id = 1;
     $poster = '';
     $video_host = $instance['host_type'];
     if ($video_host == 'self') {
         if (!empty($instance['video']['self_video'])) {
             // Handle an attachment video
             $src = wp_get_attachment_url($instance['video']['self_video']);
             $vid_info = wp_get_attachment_metadata($instance['video']['self_video']);
             $video_type = 'video/' . empty($vid_info['fileformat']) ? '' : $vid_info['fileformat'];
         } else {
             if (!empty($instance['video']['self_video_fallback'])) {
                 // Handle an external URL video
                 $src = $instance['video']['self_video_fallback'];
                 $vid_info = wp_check_filetype(basename($instance['video']['self_video_fallback']));
                 $video_type = $vid_info['type'];
             }
         }
         $poster = !empty($instance['video']['self_poster']) ? wp_get_attachment_url($instance['video']['self_poster']) : '';
     } else {
         $video_host = $this->get_host_from_url($instance['video']['external_video']);
         $video_type = 'video/' . $video_host;
         $src = !empty($instance['video']['external_video']) ? $instance['video']['external_video'] : '';
     }
     $return = array('player_id' => 'sow-player-' . $player_id++, 'host_type' => $instance['host_type'], 'src' => $src, 'video_type' => $video_type, 'is_skinnable_video_host' => $this->is_skinnable_video_host($video_host), 'poster' => $poster, 'autoplay' => !empty($instance['playback']['autoplay']), 'skin_class' => 'default');
     // Force oEmbed for this video
     if ($instance['host_type'] == 'external' && $instance['playback']['oembed']) {
         $return['is_skinnable_video_host'] = false;
     }
     return $return;
 }
コード例 #4
0
function banner_simple_height($params = array(), $content = null)
{
    extract(shortcode_atts(array('title' => 'Freeshipping on all order over $75', 'subtitle' => 'Shop Now', 'link_url' => '', 'title_color' => '#fff', 'subtitle_color' => '#fff', 'inner_stroke' => '0px', 'inner_stroke_color' => '#fff', 'bg_color' => '#000', 'bg_image' => '', 'height' => 'auto', 'sep_padding' => '5px', 'sep_color' => 'rgba(255,255,255,0.01)', 'with_bullet' => 'no', 'bullet_text' => 'Bullet Text Goes Here', 'bullet_bg_color' => '', 'bullet_text_color' => ''), $params));
    $banner_with_img = '';
    if (is_numeric($bg_image)) {
        $bg_image = wp_get_attachment_url($bg_image);
        $banner_with_img = 'banner_with_img';
    }
    $content = do_shortcode($content);
    $banner_simple_height = '
		<div class="shortcode_banner_simple_height ' . $banner_with_img . '" onclick="location.href=\'' . $link_url . '\';">
			<div class="shortcode_banner_simple_height_inner">
				<div class="shortcode_banner_simple_height_bkg" style="background-color:' . $bg_color . '; background-image:url(' . $bg_image . ')"></div>
			
				<div class="shortcode_banner_simple_height_inside" style="height:' . $height . '; border: ' . $inner_stroke . ' solid ' . $inner_stroke_color . '">
					<div class="shortcode_banner_simple_height_content">
						<div><h3 style="color:' . $title_color . ' !important">' . $title . '</h3></div>
						<div class="shortcode_banner_simple_height_sep" style="margin:' . $sep_padding . ' auto; background-color:' . $sep_color . ';"></div>
						<div><h4 style="color:' . $subtitle_color . ' !important">' . $subtitle . '</h4></div>
					</div>
				</div>
			</div>';
    if ($with_bullet == 'yes') {
        $banner_simple_height .= '<div class="shortcode_banner_simple_height_bullet" style="background:' . $bullet_bg_color . '; color:' . $bullet_text_color . '"><span>' . $bullet_text . '</span></div>';
    }
    $banner_simple_height .= '</div>';
    return $banner_simple_height;
}
コード例 #5
0
ファイル: Abstract.php プロジェクト: nullify005/shcc-website
 /**
  * Compile the schema.org event data into an array
  */
 public function get_data($post = null, $args = array())
 {
     if (!$post instanceof WP_Post) {
         $post = Tribe__Main::post_id_helper($post);
     }
     $post = get_post($post);
     if (!$post instanceof WP_Post) {
         return array();
     }
     $data = (object) array();
     // We may need to prevent the context to be triggered
     if (!isset($args['context']) || false !== $args['context']) {
         $data->{'@context'} = 'http://schema.org';
     }
     $data->{'@type'} = $this->type;
     $data->name = esc_js(get_the_title($post));
     $data->description = esc_js(tribe_events_get_the_excerpt($post));
     if (has_post_thumbnail($post)) {
         $data->image = wp_get_attachment_url(get_post_thumbnail_id($post));
     }
     $data->url = esc_url_raw(get_permalink($post));
     // Index by ID: this will allow filter code to identify the actual event being referred to
     // without injecting an additional property
     return array($post->ID => $data);
 }
コード例 #6
0
 /**
  * Compile the schema.org event data into an array
  */
 private function build_data()
 {
     global $post;
     $id = $post->ID;
     $events_data = array();
     // Index by ID: this will allow filter code to identify the actual event being referred to
     // without injecting an additional property
     $events_data[$id] = new stdClass();
     $events_data[$id]->{'@context'} = 'http://schema.org';
     $events_data[$id]->{'@type'} = 'Event';
     $events_data[$id]->name = get_the_title();
     if (has_post_thumbnail()) {
         $events_data[$id]->image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
     }
     $events_data[$id]->url = get_the_permalink($post->ID);
     $events_data[$id]->startDate = get_gmt_from_date(tribe_get_start_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
     $events_data[$id]->endDate = get_gmt_from_date(tribe_get_end_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
     if (tribe_has_venue($id)) {
         $events_data[$id]->location = new stdClass();
         $events_data[$id]->location->{'@type'} = 'Place';
         $events_data[$id]->location->name = tribe_get_venue($post->ID);
         $events_data[$id]->location->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID)));
     }
     /**
      * Allows the event data to be modifed by themes and other plugins.
      *
      * @param array $events_data objects representing the Google Markup for each event.
      */
     $events_data = apply_filters('tribe_google_event_data', $events_data);
     // Strip the post ID indexing before returning
     $events_data = array_values($events_data);
     return $events_data;
 }
コード例 #7
0
 function test__valid_attachment_and_dimensions()
 {
     $source = wp_get_attachment_url($this->_attachment_id);
     $expected = array(498, 113);
     $dimensions = AMP_Image_Dimension_Extractor::extract_from_attachment_metadata(false, $source);
     $this->assertEquals($expected, $dimensions);
 }
コード例 #8
0
 function dtwl_woo_get_product_first_thumbnail($size = 'shop_catalog', $deprecated1 = 0, $deprecated2 = 0)
 {
     global $post, $product;
     $html = '';
     $attachment_ids = $product->get_gallery_attachment_ids();
     $i = 0;
     if ($attachment_ids) {
         $i++;
         foreach ($attachment_ids as $attachment_id) {
             $image_link = wp_get_attachment_url($attachment_id);
             if (!$image_link) {
                 continue;
             }
             $image_title = esc_attr(get_the_title($attachment_id));
             $image = wp_get_attachment_image($attachment_id, apply_filters('single_product_small_thumbnail_size', $size), 0, $attr = array('title' => $image_title, 'alt' => $image_title));
             $html = '<div class="dtwl-woo-product-thumbnail dtwl-woo-product-back-thumbnail">';
             $html .= $image;
             $html .= '</div>';
             if ($i == 1) {
                 break;
             }
         }
     }
     return $html;
 }
 /**
  * Prepare a single product category output for response.
  *
  * @param WP_Term $item Term object.
  * @param WP_REST_Request $request
  * @return WP_REST_Response $response
  */
 public function prepare_item_for_response($item, $request)
 {
     // Get category display type.
     $display_type = get_woocommerce_term_meta($item->term_id, 'display_type');
     // Get category order.
     $menu_order = get_woocommerce_term_meta($item->term_id, 'order');
     $data = array('id' => (int) $item->term_id, 'name' => $item->name, 'slug' => $item->slug, 'parent' => (int) $item->parent, 'description' => $item->description, 'display' => $display_type ? $display_type : 'default', 'image' => array(), 'menu_order' => (int) $menu_order, 'count' => (int) $item->count);
     // Get category image.
     if ($image_id = get_woocommerce_term_meta($item->term_id, 'thumbnail_id')) {
         $attachment = get_post($image_id);
         $data['image'] = array('id' => (int) $image_id, 'date_created' => wc_rest_prepare_date_response($attachment->post_date_gmt), 'date_modified' => wc_rest_prepare_date_response($attachment->post_modified_gmt), 'src' => wp_get_attachment_url($image_id), 'title' => get_the_title($attachment), 'alt' => get_post_meta($image_id, '_wp_attachment_image_alt', true));
     }
     $context = !empty($request['context']) ? $request['context'] : 'view';
     $data = $this->add_additional_fields_to_object($data, $request);
     $data = $this->filter_response_by_context($data, $context);
     $response = rest_ensure_response($data);
     $response->add_links($this->prepare_links($item, $request));
     /**
      * Filter a term item returned from the API.
      *
      * Allows modification of the term data right before it is returned.
      *
      * @param WP_REST_Response  $response  The response object.
      * @param object            $item      The original term object.
      * @param WP_REST_Request   $request   Request used to generate the response.
      */
     return apply_filters("woocommerce_rest_prepare_{$this->taxonomy}", $response, $item, $request);
 }
コード例 #10
0
 /**
  * Get attachment-specific data
  *
  * @param array $post
  * @return array
  */
 protected function prepare_post($post, $context = 'single')
 {
     $data = parent::prepare_post($post, $context);
     if (is_wp_error($data) || $post['post_type'] !== 'attachment') {
         return $data;
     }
     // $thumbnail_size = current_theme_supports( 'post-thumbnail' ) ? 'post-thumbnail' : 'thumbnail';
     $data['source'] = wp_get_attachment_url($post['ID']);
     $data['is_image'] = wp_attachment_is_image($post['ID']);
     $data['attachment_meta'] = wp_get_attachment_metadata($post['ID']);
     // Ensure empty meta is an empty object
     if (empty($data['attachment_meta'])) {
         $data['attachment_meta'] = new stdClass();
     } elseif (!empty($data['attachment_meta']['sizes'])) {
         $img_url_basename = wp_basename($data['source']);
         foreach ($data['attachment_meta']['sizes'] as $size => &$size_data) {
             // Use the same method image_downsize() does
             $size_data['url'] = str_replace($img_url_basename, $size_data['file'], $data['source']);
         }
     } else {
         $data['attachment_meta']['sizes'] = new stdClass();
     }
     // Override entity meta keys with the correct links
     $data['meta'] = array('links' => array('self' => json_url('/media/' . $post['ID']), 'author' => json_url('/users/' . $post['post_author']), 'collection' => json_url('/media'), 'replies' => json_url('/media/' . $post['ID'] . '/comments'), 'version-history' => json_url('/media/' . $post['ID'] . '/revisions')));
     if (!empty($post['post_parent'])) {
         $data['meta']['links']['up'] = json_url('/media/' . (int) $post['post_parent']);
     }
     return apply_filters('json_prepare_attachment', $data, $post, $context);
 }
コード例 #11
0
ファイル: blox.php プロジェクト: arkev/IntelligentMode
function blox_shortcode($attributes, $content)
{
    extract(shortcode_atts(array("img" => '', "height" => '', 'padding_top' => 0, 'padding_bottom' => 0, 'bg_attachment' => 'false', 'bg_position' => 'center center', 'bgcover' => 'true', 'repeat' => 'no-repeat', 'dark' => 'false', 'class' => '', 'bgcolor' => '', 'row_pattern' => '', 'row_color' => '', 'id' => ''), $attributes));
    if (is_numeric($img)) {
        $img = wp_get_attachment_url($img);
    }
    $fixed = $bg_attachment == 'true' ? 'fixed' : '';
    $background_style = !empty($img) ? " background: url('{$img}') {$repeat} {$fixed}; background-position: {$bg_position};" : '';
    $background_size = $bgcover == 'true' ? 'background-size: cover;' : '';
    $w_height = ltrim($height);
    if (substr($w_height, -2, 2) == "px") {
        $height_style = " min-height:{$w_height}; ";
    } else {
        $height_style = " min-height:{$w_height}px; ";
    }
    $padding_top = ltrim($padding_top);
    $padding_top = substr($padding_top, -2, 2) == "px" ? $padding_top : $padding_top . 'px';
    $padding_bottom = ltrim($padding_bottom);
    $padding_bottom = substr($padding_bottom, -2, 2) == "px" ? $padding_bottom : $padding_bottom . 'px';
    $padding_style = " padding-top:{$padding_top}; padding-bottom:{$padding_bottom}; ";
    if (!empty($bgcolor)) {
        $bgcolor = ' background-color:' . $bgcolor . ';';
    }
    $is_dark = 'true' == $dark ? ' dark ' : '';
    $color_overlay = 'background-color:' . $row_color;
    if (!empty($id)) {
        $out = '</div></section><section id="' . $id . '" class="blox ' . $is_dark . $class . ' ' . $row_pattern . '" style="' . $padding_style . $background_style . $background_size . $height_style . $bgcolor . '"><div class="max-overlay" style="' . $color_overlay . '"></div><div class="wpb_row vc_row-fluid full-row"><div class="container">';
    } else {
        $out = '</div></section><section class="blox ' . $is_dark . $class . ' ' . $row_pattern . '" style="' . $padding_style . $background_style . $background_size . $height_style . $bgcolor . '"><div class="max-overlay" style="' . $color_overlay . '"></div><div class="wpb_row vc_row-fluid full-row"><div class="container">';
    }
    $out .= do_shortcode($content);
    $out .= '</div></div></section><section class="container"><div class="row-wrapper-x">';
    return $out;
}
コード例 #12
0
 /**
  * Callback for the "image_downsize" filter.
  *
  * @param bool $ignore A value meant to discard unfiltered info returned from this filter.
  * @param int $attachment_id The ID of the attachment for which we want a certain size.
  * @param string $size_name The name of the size desired.
  */
 public function filter_image_downsize($ignore = false, $attachment_id = 0, $size_name = 'thumbnail')
 {
     global $_wp_additional_image_sizes;
     $attachment_id = (int) $attachment_id;
     $size_name = trim($size_name);
     $meta = wp_get_attachment_metadata($attachment_id);
     /* the requested size does not yet exist for this attachment */
     if (empty($meta['sizes']) || empty($meta['sizes'][$size_name])) {
         // let's first see if this is a registered size
         if (isset($_wp_additional_image_sizes[$size_name])) {
             $height = (int) $_wp_additional_image_sizes[$size_name]['height'];
             $width = (int) $_wp_additional_image_sizes[$size_name]['width'];
             $crop = (bool) $_wp_additional_image_sizes[$size_name]['crop'];
             // if not, see if name is of form [width]x[height] and use that to crop
         } else {
             if (preg_match('#^(\\d+)x(\\d+)$#', $size_name, $matches)) {
                 $height = (int) $matches[2];
                 $width = (int) $matches[1];
                 $crop = true;
             }
         }
         if (!empty($height) && !empty($width)) {
             $resized_path = $this->_generate_attachment($attachment_id, $width, $height, $crop);
             $fullsize_url = wp_get_attachment_url($attachment_id);
             $file_name = basename($resized_path);
             $new_url = str_replace(basename($fullsize_url), $file_name, $fullsize_url);
             if (!empty($resized_path)) {
                 $meta['sizes'][$size_name] = array('file' => $file_name, 'width' => $width, 'height' => $height);
                 wp_update_attachment_metadata($attachment_id, $meta);
                 return array($new_url, $width, $height, true);
             }
         }
     }
     return false;
 }
コード例 #13
0
ファイル: portfolio.php プロジェクト: Karpec/geo-mac
function custom_columns_portfolio($column)
{
    global $post;
    switch ($column) {
        case "portfolio_image":
            if (has_post_thumbnail()) {
                $imageurl = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
                ?>
            <img src="<?php 
                echo $imageurl;
                ?>
" height="120"  />
			<?php 
            }
            break;
        case "pcategories":
            $pcategories = get_the_terms(0, "portfolios");
            $pcategories_html = array();
            if ($pcategories) {
                foreach ($pcategories as $pcategory) {
                    array_push($pcategories_html, $pcategory->name);
                }
                echo implode($pcategories_html, ", ");
            }
            break;
    }
}
コード例 #14
0
function flagShowSkin_video_default($args)
{
    extract($args);
    $flag_options = get_option('flag_options');
    $skinID = 'id_' . mt_rand();
    // look up for the path
    $playlistpath = ABSPATH . $flag_options['galleryPath'] . 'playlists/video/' . $playlist . '.xml';
    $data = file_get_contents($playlistpath);
    $flashBackcolor = flagGetBetween($data, '<property1>0x', '</property1>');
    if (empty($width)) {
        $width = flagGetBetween($data, '<width><![CDATA[', ']]></width>');
    }
    if (empty($height)) {
        $height = flagGetBetween($data, '<height><![CDATA[', ']]></height>');
    }
    if (empty($wmode)) {
        $wmode = flagGetBetween($data, '<property0><![CDATA[', ']]></property0>');
    }
    if (empty($flashBackcolor)) {
        $flashBackcolor = $flag_options['flashBackcolor'];
    }
    require_once FLAG_ABSPATH . 'admin/video.functions.php';
    $playlist_data = get_v_playlist_data($playlistpath);
    $alternative = '';
    if (count($playlist_data['items'])) {
        foreach ($playlist_data['items'] as $id) {
            $videoObject = get_post($id);
            $url = wp_get_attachment_url($videoObject->ID);
            $thumb = get_post_meta($videoObject->ID, 'thumbnail', true);
            $aimg = $thumb ? '<img src="' . $thumb . '" style="float:left;margin-right:10px;width:150px;height:auto;" alt="" />' : '';
            $atitle = $videoObject->post_title ? '<strong>' . $videoObject->post_title . '</strong>' : '';
            $acontent = $videoObject->post_content ? '<div style="padding:4px 0;">' . $videoObject->post_content . '</div>' : '';
            $alternative .= '<div id="video_' . $videoObject->ID . '" style="overflow:hidden;padding:7px 0;">' . $aimg . $atitle . $acontent . '<div style="font-size:80%;">This browser does not support flv files! You can <a href="' . $url . '">download the video</a> instead.</div></div>';
        }
    }
    // init the flash output
    $swfobject = new flag_swfobject($flag_options['skinsDirURL'] . $skin . '/gallery.swf', $skinID, $width, $height, '10.1.52', plugins_url('/' . FLAGFOLDER . '/') . 'skins/expressInstall.swf');
    global $swfCounter;
    $swfobject->add_params('wmode', $wmode);
    $swfobject->add_params('allowfullscreen', 'true');
    $swfobject->add_params('allowScriptAccess', 'always');
    $swfobject->add_params('saling', 'lt');
    $swfobject->add_params('scale', 'noScale');
    $swfobject->add_params('menu', 'false');
    $swfobject->add_params('bgcolor', '#' . $flashBackcolor);
    $swfobject->add_attributes('id', $skinID);
    $swfobject->add_attributes('name', $skinID);
    // adding the flash parameter
    $swfobject->add_flashvars('path', $flag_options['skinsDirURL'] . $skin . '/');
    $swfobject->add_flashvars('skinID', $skinID);
    $swfobject->add_flashvars('playlist', $playlist);
    // create the output
    $out = '<div class="grandvideo">' . $swfobject->output($alternative) . '</div>';
    // add now the script code
    $out .= '<script type="text/javascript" defer="defer">';
    $out .= $swfobject->javascript();
    $out .= '</script>';
    $out = apply_filters('flag_show_flash_v_content', $out);
    return $out;
}
コード例 #15
0
ファイル: available-sizes.php プロジェクト: xeiter/timeplannr
 function get_value($id)
 {
     $paths = array();
     $meta = get_post_meta($id, '_wp_attachment_metadata', true);
     if (!isset($meta['sizes'])) {
         return $this->get_empty_char();
     }
     // available sizes
     if ($intersect = array_intersect(array_keys($meta['sizes']), get_intermediate_image_sizes())) {
         $url = wp_get_attachment_url($id);
         $filename = basename($url);
         $paths[] = "<a title='{$filename}' href='{$url}'>" . __('full size', 'codepress-admin-columns') . "</a>";
         foreach ($intersect as $size) {
             $src = wp_get_attachment_image_src($id, $size);
             if (!empty($src[0])) {
                 $filename = basename($src[0]);
                 $paths[] = "<a title='{$filename}' href='{$src[0]}' class='available'>{$size}</a>";
             }
         }
     }
     global $_wp_additional_image_sizes;
     if (!empty($_wp_additional_image_sizes)) {
         if (isset($_wp_additional_image_sizes['post-thumbnail'])) {
             unset($_wp_additional_image_sizes['post-thumbnail']);
         }
         // image does not have these additional sizes rendered yet
         if ($missing = array_diff(array_keys($_wp_additional_image_sizes), array_keys($meta['sizes']))) {
             foreach ($missing as $size) {
                 $paths[] = "<span title='Missing size: Try regenerate thumbnails with the plugin: Force Regenerate Thumbnails' href='javascript:;' class='not-available'>{$size}</span>";
             }
         }
     }
     return "<div class='sizes'>" . implode('<span class="cpac-divider"></span>', $paths) . "</div>";
 }
コード例 #16
0
function sfc_media_find_images($post, $content = '')
{
    if (empty($content)) {
        $content = apply_filters('the_content', $post->post_content);
    }
    $images = array();
    // we get the post thumbnail, put it first in the image list
    if (current_theme_supports('post-thumbnails') && has_post_thumbnail($post->ID)) {
        $thumbid = get_post_thumbnail_id($post->ID);
        $att = wp_get_attachment_image_src($thumbid, 'full');
        if (!empty($att[0])) {
            $images[] = $att[0];
        }
    }
    if (is_attachment() && preg_match('!^image/!', get_post_mime_type($post))) {
        $images[] = wp_get_attachment_url($post->ID);
    }
    // now search for images in the content itself
    if (preg_match_all('/<img\\s+(.+?)>/i', $content, $matches)) {
        foreach ($matches[1] as $match) {
            foreach (wp_kses_hair($match, array('http')) as $attr) {
                $img[strtolower($attr['name'])] = $attr['value'];
            }
            if (isset($img['src'])) {
                if (!isset($img['class']) || isset($img['class']) && false === straipos($img['class'], apply_filters('sfc_img_exclude', array('wp-smiley')))) {
                    // ignore smilies
                    if (!in_array($img['src'], $images) && strpos($img['src'], 'fbcdn.net') === false && strpos($img['src'], '/plugins/') === false) {
                        $images[] = $img['src'];
                    }
                }
            }
        }
    }
    return $images;
}
コード例 #17
0
ファイル: video-bg.php プロジェクト: arkev/IntelligentMode
function webnus_videorow_shortcode($attributes, $content)
{
    extract(shortcode_atts(array("img" => '', "height" => '', 'padding_top' => 0, 'padding_bottom' => 0, 'dark' => 'false', 'class' => '', 'video_pattern' => 'true', 'id' => '', 'video_src' => 'host', 'video_sharing_url' => '', 'mp4_format' => '', 'webm_format' => '', 'ogg_format' => '', 'img_preview_video' => ''), $attributes));
    if (is_numeric($img_preview_video)) {
        $img_preview_video = wp_get_attachment_url($img_preview_video);
    }
    $height_style = $height ? ' min-height: ' . $height . 'px !important; ' : 'min-height: 380px;';
    $padding_style = " padding-top:{$padding_top}; padding-bottom:{$padding_bottom}; ";
    $id = $id ? 'id="' . $id . '"' : '';
    $spattern = $video_pattern == 'true' ? 'class="spattern"' : '';
    $out = '</div></section><section ' . $id . ' class="video-sec ' . $class . '" style="' . $padding_style . $height_style . '">';
    $out .= '<div class="wpb_row vc_row-fluid full-row">';
    $out .= '<div ' . $spattern . '>';
    if ($video_src == 'host') {
        $default_screen_video = 'class="video-item" ';
        $out .= '<video autoplay loop muted preload="auto" ' . $default_screen_video . '>';
        $out .= !empty($mp4_format) ? '<source src="' . $mp4_format . '" type="video/mp4">' : '';
        $out .= !empty($webm_format) ? '<source src="' . $webm_format . '" type="video/webm">' : '';
        $out .= !empty($ogg_format) ? '<source src="' . $ogg_format . '" type="video/ogg">' : '';
        $out .= 'Your browser does not support the video tag. I suggest you upgrade your browser.</video>';
        $out .= '<div style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; background-position: 50% 50%; background-repeat: no-repeat; background-size: auto 100%; background: transparent url(' . $img_preview_video . ') 50% 50% / cover no-repeat ;"></div>';
    } elseif ($video_src == 'video_sharing') {
        $out .= '<div class="youtube-wrap"><div class="yt-player" id="' . $video_sharing_url . '"></div></div>';
        $out .= '<div style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; background-position: 50% 50%; background-repeat: no-repeat; background-size: auto 100%; background: transparent url(' . $img_preview_video . ') 50% 50% / cover no-repeat ;"></div>';
        wp_enqueue_script('youtube-api');
    }
    $dark = $dark == 'true' ? ' dark ' : '';
    $out .= '<article class="slides-content ' . $dark . '">';
    $out .= '<div class="container">';
    $out .= do_shortcode($content);
    $out .= '</div></article>';
    $out .= '</div></div></section><section class="container"><div class="row-wrapper-x">';
    return $out;
}
コード例 #18
0
function get_tour_info()
{
    $tourinfo = array();
    $tour_ID = get_the_ID();
    $tour_title = get_the_title();
    $tour_feat_image_url = get_no_img_url();
    if (has_post_thumbnail()) {
        $tour_feat_image_url = wp_get_attachment_url(get_post_thumbnail_id());
    }
    $tour_excerpt = get_the_excerpt();
    $tour_post_link = get_permalink($tour_ID);
    $tour_departure = get_location_ID(get_post_meta($tour_ID, 'tour_departure', true));
    $tour_arrival = get_location_ID(get_post_meta($tour_ID, 'tour_arrival', true));
    $tour_price = get_post_meta($tour_ID, 'tour_price', true);
    $tour_price_discount = get_post_meta($tour_ID, 'tour_price_discount', true);
    $tour_start = get_post_meta($tour_ID, 'tour_start', true);
    $tour_end = get_post_meta($tour_ID, 'tour_end', true);
    $tour_days = get_post_meta($tour_ID, 'tour_days', true);
    $tourinfo['tour_ID'] = $tour_ID;
    $tourinfo['tour_title'] = $tour_title;
    $tourinfo['tour_feat_image_url'] = $tour_feat_image_url;
    $tourinfo['tour_excerpt'] = $tour_excerpt;
    $tourinfo['tour_post_link'] = $tour_post_link;
    $tourinfo['tour_departure'] = $tour_departure;
    $tourinfo['tour_arrival'] = $tour_arrival;
    $tourinfo['tour_price'] = $tour_price;
    $tourinfo['tour_price_discount'] = $tour_price_discount;
    $tourinfo['tour_start'] = $tour_start;
    $tourinfo['tour_end'] = $tour_end;
    $tourinfo['tour_days'] = $tour_days;
    return $tourinfo;
}
コード例 #19
0
ファイル: custom.php プロジェクト: NeilToor/i4web
function responsive_images($html, $id, $alt, $title, $align, $url, $size)
{
    $url = wp_get_attachment_url($id);
    // Grab the current image URL
    $html = '<a href="' . $url . '" class="img-responsive" rel="your-rel"><img src="..." /></a>';
    return $html;
}
コード例 #20
0
ファイル: Shortcodes.php プロジェクト: rohans/tradeinbooks
 /**
  * Return list of attachments
  * 
  * <code>
  * [attachments]
  * [attachments type=image]
  * [attachments type=video preview=1]
  * </code>
  */
 function attachments($attributes)
 {
     global $post;
     $mimetypes = array('image', 'video', 'audio', 'application');
     if (isset($attributes['type']) && in_array($attributes['type'], $mimetypes)) {
         $mimetype = $attributes['type'];
     } else {
         $mimetype = null;
     }
     $args = array('post_type' => 'attachment', 'numberposts' => null, 'post_status' => null, 'post_parent' => $post->ID, 'post_mime_type' => $mimetype);
     $attachments = get_children($args);
     if (!is_array($attachments) or !sizeof($attachments)) {
         return '';
     }
     if (isset($attributes['preview'])) {
         $output = '<ul class="attachment-list preview ' . $mimetype . '">';
         foreach ($attachments as $attachment) {
             $output .= '<li>' . get_the_attachment_link($attachment->ID, false) . '</li>';
         }
         $output .= '</ul>';
     } else {
         $output = '<ul class="attachment-list ' . $mimetype . '">';
         foreach ($attachments as $attachment) {
             $output .= '<li><a title="' . $attachment->post_title . '" href="' . wp_get_attachment_url($attachment->ID) . '">' . apply_filters('the_title', $attachment->post_title) . '</a></li>';
         }
         $output .= '</ul>';
     }
     return $output;
 }
コード例 #21
0
ファイル: wpap-functions.php プロジェクト: geekpondering/wtg
function wpap_print_meta_upload($args)
{
    $src = '';
    if (!empty($args['value'])) {
        $src = wp_get_attachment_url($args['value']);
    }
    ?>
		
		<input name="<?php 
    echo $args['name'];
    ?>
" type="hidden" id="upload_image_attachment_id" value="<?php 
    echo esc_html($args['value']);
    ?>
" />
		<input id="upload_image_text_meta" type="text" value="<?php 
    echo $src;
    ?>
" style="width:80%" />
		<input class="upload_image_button_meta" type="button" value="Upload" />

		<p><?php 
    echo $args['extra'];
    ?>
</p>
		
		<?php 
}
コード例 #22
0
ファイル: widget.php プロジェクト: joffcrabtree/don8
    /**
     * Fires when displaying the widget on the front-end.
     *
     * Do NOT delete this function, but please modify it.
     *
     * @param array $args The current widget args.
     * @param array $instance The current widget instance.
     */
    public function widget($args, $instance)
    {
        // Echo out anything before the widget, don't mess with this or delete it.
        echo $args['before_widget'];
        // Echo out the title (if it's set), don't mess with this or delete it.
        if (!empty($instance['title'])) {
            echo $args['before_title'];
            echo apply_filters('widget_title', $instance['title']);
            echo $args['after_title'];
        }
        // Everything below here (up until echoing out after_widget) is fully in your control. This is where the display
        // of your widget will be. Add HTML, add PHP, add Javascript, add whatever!
        $email = isset($instance['email']) ? $instance['email'] : '';
        $cause = isset($instance['cause']) ? $instance['cause'] : '';
        $value = isset($instance['value']) ? $instance['value'] : '';
        $currency = isset($instance['currency']) ? $instance['currency'] : '';
        $image = isset($instance['image']) ? $instance['image'] : false;
        $image = !empty($image) ? $image : get_option('don8_button');
        $button = '<form name="_xclick" action="https://www.paypal.com/uk/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="' . esc_html($email) . '">
<input type="hidden" name="item_name" value="' . esc_html($cause) . '">
<input type="hidden" name="currency_code" value="' . esc_html($currency) . '">
<input type="hidden" name="amount" value="' . esc_html($value) . '">
<input type="image" src="' . wp_get_attachment_url($image) . '" border="0" name="submit" alt="Donate to ' . esc_html($cause) . '">
</form>';
        echo $button;
        // Echo out anything after the widget, don't mess with this or delete it.
        echo $args['after_widget'];
    }
コード例 #23
0
function cycloneslider_thumb($original_attachment_id, $width, $height, $refresh = false, $slide_meta = array())
{
    $dir = wp_upload_dir();
    // Get full path to the slide image
    $image_path = get_attached_file($original_attachment_id);
    $image_path = apply_filters('cycloneslider_image_path', $image_path, $slide_meta);
    if (empty($image_path)) {
        return false;
    }
    // Full url to the slide image
    $image_url = wp_get_attachment_url($original_attachment_id);
    $image_url = apply_filters('cycloneslider_image_url', $image_url, $slide_meta);
    if (empty($image_url)) {
        return false;
    }
    $info = pathinfo($image_path);
    $dirname = isset($info['dirname']) ? $info['dirname'] : '';
    // Path to directory
    $ext = isset($info['extension']) ? $info['extension'] : '';
    // File extension Eg. "jpg"
    $thumb = wp_basename($image_path, ".{$ext}") . "-{$width}x{$height}.{$ext}";
    // Thumbname. Eg. [imagename]-[width]x[height].hpg
    // Check if thumb already exists. If it is, return its url, unless refresh is true
    if (file_exists($dirname . '/' . $thumb) and !$refresh) {
        return dirname($image_url) . '/' . $thumb;
        //We used dirname() since we need the URL format not the path
    }
    $resizeObj = new Image_Resizer($image_path);
    $resizeObj->resizeImage($width, $height);
    $resizeObj->saveImage($dirname . '/' . $thumb, 80);
    return dirname($image_url) . '/' . $thumb;
}
コード例 #24
0
ファイル: image.php プロジェクト: fjbeteiligung/development
 function element()
 {
     $style = $this->opt('style') ? $this->opt('style') : '';
     $image = $this->opt('image') ? $this->opt('image') : '';
     $click_action = $this->opt('click_action') ? $this->opt('click_action') : '';
     $image_alignment = $this->opt('image_alignment') ? $this->opt('image_alignment') : '';
     //** Appear animation
     $appear_delay = $this->opt('appear_delay') ? $this->opt('appear_delay') : '0';
     $appear = $this->opt('appear_animation') ? $this->opt('appear_animation') : '';
     if (!empty($appear)) {
         $appear = 'data-appear="fade-in" data-appear-direction="' . $appear . '" data-appear-delay="' . $appear_delay . '"';
     }
     if (empty($image)) {
         echo '<div class="zn-pb-notification">Please configure the element and add an image.</div>';
         return;
     }
     //$link = $this->opt('link');
     //$link_extracted = !empty( $link ) ? zn_extract_link( $this->opt('link') , '' ) : '';
     $link_extracted = zn_extract_link($this->opt('link'));
     if ($click_action === 'popup') {
         $image_src = wp_get_attachment_image($image, 'full', false, array('class' => 'img-responsive animate magPopupImg ' . $image_alignment . '', 'data-mfp-src' => wp_get_attachment_url($image)));
     } else {
         if ($click_action === 'link') {
             $image_src = $link_extracted['start'] . wp_get_attachment_image($image, 'full', false, array('class' => 'img-responsive animate ' . $image_alignment . '')) . $link_extracted['end'];
         } else {
             $image_src = wp_get_attachment_image($image, 'full', false, array('class' => 'img-responsive ' . $image_alignment . ''));
         }
     }
     echo '<div class="znImageContainer clearfix ' . $this->data['uid'] . '" ' . $appear . '>';
     //echo '<img alt="Image" src="'.$image.'" class="img-responsive animate">';
     echo '<div class="znImgSubcontainer ' . (empty($click_action) ? '' : 'scaleRotateImg') . '">';
     echo $image_src;
     echo '</div>';
     echo '</div>';
 }
コード例 #25
0
ファイル: vc.php プロジェクト: EmmaTope/gadafunds
 function buildStyle($bg_image = '', $bg_color = '', $bg_image_repeat = '', $font_color = '', $padding = '', $margin_bottom = '')
 {
     $has_image = false;
     $style = '';
     if ((int) $bg_image > 0 && ($image_url = wp_get_attachment_url($bg_image, 'large')) !== false) {
         $has_image = true;
         $style .= "background-image: url(" . $image_url . ");";
     }
     if (!empty($bg_color)) {
         $style .= vc_get_css_color('background-color', $bg_color);
     }
     if (!empty($bg_image_repeat) && $has_image) {
         if ($bg_image_repeat === 'cover') {
             $style .= "background-repeat:no-repeat;background-size: cover;";
         } elseif ($bg_image_repeat === 'contain') {
             $style .= "background-repeat:no-repeat;background-size: contain;";
         } elseif ($bg_image_repeat === 'no-repeat') {
             $style .= 'background-repeat: no-repeat;';
         }
     }
     if (!empty($font_color)) {
         $style .= vc_get_css_color('color', $font_color);
         // 'color: '.$font_color.';';
     }
     if ($padding != '') {
         $style .= 'padding: ' . (preg_match('/(px|em|\\%|pt|cm)$/', $padding) ? $padding : $padding . 'px') . ';';
     }
     if ($margin_bottom != '') {
         $style .= 'margin-bottom: ' . (preg_match('/(px|em|\\%|pt|cm)$/', $margin_bottom) ? $margin_bottom : $margin_bottom . 'px') . ';';
     }
     return empty($style) ? $style : ' style="' . $style . '"';
 }
コード例 #26
0
ファイル: icon-box.php プロジェクト: Junaid-Farid/gocnex
function icon_box_shortcode($params = array(), $content = null)
{
    extract(shortcode_atts(array('icon' => '', 'icon_position' => 'top', 'icon_style' => 'normal', 'icon_color' => '#000', 'icon_bg_color' => '#ffffff', 'title' => '', 'separator' => '', 'link_name' => '', 'link_url' => ''), $params));
    if (is_numeric($icon)) {
        $icon = wp_get_attachment_url($icon);
    }
    /*switch ($icon_style) {
    		case "normal":
    			break;
    		case "outlined":
    			break;
    		case "bg_color":
    			break;
    	}*/
    $title_markup = "";
    $content_markup = "";
    $button_markup = "";
    if ($title != "") {
        $title_markup = '<h3 class="icon_box_title">' . $title . '</h3>';
    }
    if ($content != "") {
        $content_markup = '<div class="icon_box_content"><p>' . do_shortcode($content) . '</p></div>';
    }
    if ($link_name != "") {
        $button_markup = '<a class="icon_box_read_more" href="' . $link_url . '">' . $link_name . '</a>';
    }
    $icon_box_markup = '		
		<div class="shortcode_icon_box icon_position_' . $icon_position . ' icon_style_' . $icon_style . ' ' . $separator . '">
			<div class="icon_wrapper" style="background-color:' . $icon_bg_color . '; border-color:' . $icon_color . '">
				<div class="icon ' . $icon . '" style="color:' . $icon_color . '"></div>
			</div>' . $title_markup . $content_markup . $button_markup . '</div>
	';
    return $icon_box_markup;
}
コード例 #27
0
 /**
  * Returns HTML string to embed the attachment,
  * or empty string if cannot be embedded.
  *
  * @return string - HTML string to embed.
  */
 public static function get_embedded_attachment()
 {
     include_once ATTACHMENTS_PP_PATH . 'models/class-callable-function.php';
     $post = get_post();
     $url = wp_get_attachment_url($post->ID);
     $filetype = wp_check_filetype(basename($url));
     $ret = '';
     // loop through embedders until we find one that suppports filetype
     foreach (self::get_embedder_mapping() as $embedder) {
         try {
             // if the either function is not valid, skip embedder
             if (!$embedder['function']->is_valid() || !$embedder['exts']->is_valid()) {
                 continue;
             }
             // get supported exts
             $exts = $embedder['exts']->execute();
             // if supported, get embedder and break loop
             if (in_array($filetype['ext'], $exts)) {
                 $ret = self::$comment_header . PHP_EOL . $embedder['function']->execute($url);
                 break;
             }
         } catch (Exception $e) {
             $ret = '<p>An error occured while calling ' . $embedder['function'] . ': ' . '<em>' . $e->getMessage() . '</em></p>';
         }
     }
     return $ret;
 }
コード例 #28
0
 public function large_image_url()
 {
     if (!$this->full_img_url) {
         $this->full_img_url = wp_get_attachment_url($this->attachment_id, 'full');
     }
     return $this->full_img_url;
 }
コード例 #29
0
ファイル: im_mybanner.php プロジェクト: schiz/scrollax
 /**
  *
  */
 public static function im_mybanner($atts = null, $content = null)
 {
     if ($atts == 'generator') {
         return array('name' => __('Banner My', MISS_ADMIN_TEXTDOMAIN), 'base' => 'im_mybanner', 'icon' => 'im-icon-crown', 'category' => __('Theme Short-Codes', MISS_ADMIN_TEXTDOMAIN), 'params' => array(array('heading' => __('Image', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Upload custom image. Please use hi-res image.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'image', 'value' => '', 'type' => 'attach_image'), array('heading' => __('Image position', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select image position type.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'img_pos', 'value' => array(__('Right', MISS_ADMIN_TEXTDOMAIN) => 'right', __('Left', MISS_ADMIN_TEXTDOMAIN) => 'left'), 'type' => 'dropdown'), array('heading' => __('Title', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Enter banner title.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'title', 'value' => '', 'type' => 'textfield'), array('heading' => __('Content', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Enter banner content.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'banner_content', 'value' => '', 'type' => 'textarea'), array('heading' => __('Link', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Enter banner link.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'link', 'value' => '', 'type' => 'textfield'), array("type" => "dropdown", "heading" => __("Viewport Animation", "js_composer"), "param_name" => "animation", "value" => miss_js_composer_css_animation(), "description" => __("Viewport animation will be triggered when this element is being viewed when you scroll page down. you only need to choose the animation style from this option. please note that this only works in moderns. We have disabled this feature in touch devices to increase browsing speed.", "js_composer"))));
     }
     extract(shortcode_atts(array('image' => '', 'img_pos' => '', 'title' => '', 'banner_content' => '', 'link' => '', 'animation' => ''), $atts));
     if ($animation != '') {
         $animation = ' im-animate-element ' . $animation . ' ';
     }
     $shortcode_id = self::_shortcode_id();
     if (isset($image) && $image != '') {
         if (is_numeric($image)) {
             $image = wp_get_attachment_url($image);
         }
     }
     $out = '<section class="row my-banner ' . $animation . '">';
     if ($img_pos == 'left') {
         $out .= '<div class="span6 img"><img src="' . $image . '" alt="" /></div>';
     }
     $out .= '<div class="span6 descr">
             <h1>' . $title . '</h1>
             <div class="text">' . $banner_content . '</div>
             <a class="ribbon-style ribbon-light-style readmore" href="' . $link . '">Read More</a>
          </div>';
     if ($img_pos == 'right') {
         $out .= '<div class="span6 img"><img src="' . $image . '" alt="" /></div>';
     }
     $out .= '</section>';
     return $out;
 }
コード例 #30
0
function lp_library_shareme_js($nature)
{
    global $post;
    if (has_post_thumbnail()) {
        $thumb = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
    } else {
        $thumb = "";
    }
    $page_title = get_the_title();
    $new_page_title = str_replace('"', '\\"', $page_title);
    $newest_page_title = str_replace("'", "\\'", $new_page_title);
    if ($nature != 'vertical') {
        ?>
		<script type="text/javascript">
		jQuery(document).ready(function () {
			jQuery('#shareme').sharrre({
			  share: {
				googlePlus: true,
				twitter: true,
				linkedin: true,
				pinterest: true,
				facebook: true
			  },
			  buttons: {
				googlePlus: {size: 'medium'},
				twitter: {count: 'horizontal'},
				linkedin: {counter: 'right'},
				pinterest: {media: '<?php 
        echo $thumb;
        ?>
', description: '<?php