예제 #1
0
    function aesop_parallax_shortcode($atts)
    {
        $defaults = array('img' => '', 'height' => 500, 'parallaxbg' => 'on', 'floater' => '', 'floatermedia' => '', 'floaterposition' => 'right', 'floaterdirection' => 'up', 'caption' => '', 'captionposition' => 'bottom-left', 'lightbox' => false);
        $atts = apply_filters('aesop_parallax_defaults', shortcode_atts($defaults, $atts));
        // let this be used multiple times
        static $instance = 0;
        $instance++;
        $unique = sprintf('%s-%s', get_the_ID(), $instance);
        // add a css class if parallax bg is set to on
        $laxclass = 'on' == $atts['parallaxbg'] ? 'is-parallax' : false;
        // add custom css classes through our utility function
        $classes = aesop_component_classes('parallax', '');
        // automatically provide an alt tag for the image based on the name of the image file
        $auto_alt = $atts['img'] ? basename($atts['img']) : null;
        $floater_direction = $atts['floaterdirection'] ? $atts['floaterdirection'] : 'up';
        ob_start();
        do_action('aesop_parallax_before', $atts, $unique);
        // action
        ?>
<div id="aesop-parallax-component-<?php 
        echo esc_attr($unique);
        ?>
" <?php 
        echo aesop_component_data_atts('parallax', $unique, $atts);
        ?>
 class="aesop-component aesop-parallax-component <?php 
        echo sanitize_html_class($classes);
        ?>
"><?php 
        do_action('aesop_parallax_inside_top', $atts, $unique);
        // action
        ?>

			<script>
				jQuery(document).ready(function($){

					var img 	  = $('.aesop-parallax-sc.aesop-parallax-sc-<?php 
        echo esc_attr($unique);
        ?>
 .aesop-parallax-sc-img')
					, 	setHeight = function() {

							img.parent().imagesLoaded( function() {

								var imgHeight 		= img.height()
								,	imgCont     	= img.parent()

								<?php 
        if ('off' == $atts['parallaxbg']) {
            ?>

									imgCont.css('height', imgHeight)

								<?php 
        } else {
            ?>

									imgCont.css('height',Math.round(imgHeight * 0.69))

									if ( $(window).height < 760 ) {
										imgCont.css('height',Math.round(imgHeight * 0.65))
									}

								<?php 
        }
        ?>
							});

						}

					setHeight();

					$(window).resize(function(){
						setHeight();
					})

					<?php 
        if (!wp_is_mobile() && ('on' == $atts['parallaxbg'] || 'on' == $atts['floater'])) {
            if ('on' == $atts['parallaxbg']) {
                ?>

				   			img.parallax({speed: 0.1});

		        		<?php 
            }
            //end if
            if ('on' == $atts['floater']) {
                ?>

							var obj = $('.aesop-parallax-sc.aesop-parallax-sc-<?php 
                echo esc_attr($unique);
                ?>
 .aesop-parallax-sc-floater');

					       	function scrollParallax(){
					       	    var height 			= obj.height(),
		        					offset 			= obj.offset().top,
					       	    	scrollTop 		= $(window).scrollTop(),
					       	    	windowHeight 	= $(window).height(),
					       	    	floater 		= Math.round( (offset - scrollTop) * 0.1);

					       	    // only run parallax if in view
					       	    if (offset >= scrollTop + windowHeight) {
									return;
								}

					       	<?php 
                if ('left' == $floater_direction || 'right' == $floater_direction) {
                    if ('left' == $floater_direction) {
                        ?>

				            		obj.css({'transform':'translate3d(' + floater + 'px, 0px, 0px)'});

				            	<?php 
                    } else {
                        ?>

									obj.css({'transform':'translate3d(-' + floater + 'px, 0px, 0px)'});

				            	<?php 
                    }
                } else {
                    if ('up' == $floater_direction) {
                        ?>

				            		obj.css({'transform':'translate3d(0px,' + floater + 'px, 0px)'});

								<?php 
                    } else {
                        ?>

									obj.css({'transform':'translate3d(0px,-' + floater + 'px, 0px)'});

								<?php 
                    }
                }
                ?>

					   	} // end if on floater

				    	scrollParallax();
				    	$(window).scroll(function() { scrollParallax(); });

					    <?php 
            }
            //end on floater
        }
        //end if is not mobile and parallax is on
        ?>

				}); // end jquery doc ready
			</script>

			<figure class="aesop-parallax-sc aesop-parallax-sc-<?php 
        echo esc_attr($unique);
        ?>
">

				<?php 
        do_action('aesop_parallax_inner_inside_top', $atts, $unique);
        // action
        ?>

				<?php 
        if ('on' == $atts['floater']) {
            ?>
					<div class="aesop-parallax-sc-floater floater-<?php 
            echo sanitize_html_class($atts['floaterposition']);
            ?>
" data-speed="10">
						<?php 
            echo aesop_component_media_filter($atts['floatermedia']);
            ?>
					</div>
				<?php 
        }
        ?>

				<?php 
        if ('on' == $atts['lightbox']) {
            ?>
					<a class="aesop-lb-link aesop-lightbox" rel="lightbox" title="<?php 
            echo esc_attr($atts['caption']);
            ?>
" href="<?php 
            echo esc_url($atts['img']);
            ?>
"><i class="aesopicon aesopicon-search-plus"></i></a>
				<?php 
        }
        ?>

				<img class="aesop-parallax-sc-img <?php 
        echo $laxclass;
        ?>
" src="<?php 
        echo esc_url($atts['img']);
        ?>
" alt="<?php 
        echo esc_attr($auto_alt);
        ?>
" >

				<?php 
        if ($atts['caption']) {
            ?>
					<figcaption class="aesop-parallax-sc-caption-wrap <?php 
            echo sanitize_html_class($atts['captionposition']);
            ?>
">
						<?php 
            echo aesop_component_media_filter(trim($atts['caption']));
            ?>
					</figcaption>
				<?php 
        }
        ?>

				<?php 
        do_action('aesop_parallax_inner_inside_bottom', $atts, $unique);
        // action
        ?>

			</figure>

			<?php 
        do_action('aesop_parallax_inside_bottom', $atts, $unique);
        // action
        ?>

		</div>

		<?php 
        do_action('aesop_parallax_after', $atts, $unique);
        // action
        return ob_get_clean();
    }
예제 #2
0
    function aesop_quote_shortcode($atts)
    {
        $defaults = array('width' => '100%', 'background' => '#222222', 'img' => '', 'text' => '', 'height' => 'auto', 'align' => 'center', 'size' => '1', 'parallax' => '', 'direction' => '', 'quote' => __('People are made of stories, not atoms.', 'aesop-core'), 'cite' => '', 'type' => 'block');
        $atts = apply_filters('aesop_quote_defaults', shortcode_atts($defaults, $atts));
        // let this be used multiple times
        static $instance = 0;
        $instance++;
        $unique = sprintf('%s-%s', get_the_ID(), $instance);
        // set component to content width
        $contentwidth = 'content' == $atts['width'] ? 'aesop-content' : false;
        // set size
        $size_unit = apply_filters('aesop_quote_size_unit', 'em', $unique);
        $size = $atts['size'] ? sprintf('%s%s', $atts['size'], $size_unit) : false;
        // bg img
        $bgimg = $atts['img'] ? sprintf('background-image:url(%s);background-size:cover;background-position:center center;', esc_url($atts['img'])) : false;
        // bg color only if not block style
        $bgcolor = 'block' == $atts['type'] ? sprintf('background-color:%s;', $atts['background']) : false;
        if ('block' == $atts['type']) {
            if ($atts['text'] == '') {
                $atts['text'] = '#FFFFFF';
            }
            $fgcolor = sprintf('color:%s;', esc_attr($atts['text']));
        } else {
            // for non-block quote color is ignored unless it has been changed from the default value
            if ($atts['text'] == '' || !strcasecmp(esc_attr($atts['text']), '#ffffff')) {
                $fgcolor = null;
            } else {
                $fgcolor = sprintf('color:%s;', esc_attr($atts['text']));
            }
        }
        // set styles
        $style = $bgcolor || $fgcolor || $atts['height'] || $atts['width'] ? sprintf('style="%s%s%sheight:%s;width:%s;"', esc_attr($bgcolor), $bgimg, $fgcolor, esc_attr($atts['height']), esc_attr($atts['width'])) : false;
        $isparallax = 'on' == $atts['parallax'] ? 'quote-is-parallax' : false;
        $lrclass = 'left' == $atts['direction'] || 'right' == $atts['direction'] ? 'quote-left-right' : false;
        // has img class
        $imgclass = $atts['img'] ? 'quote-has-image' : false;
        // type
        $type = $atts['type'] ? sprintf(' aesop-quote-type-%s', trim($atts['type'])) : false;
        // align
        $align = $atts['align'] ? sprintf('aesop-component-align-%s', esc_attr($atts['align'])) : null;
        // style/consolidated classes
        $css_class_array = array($align, $type, $contentwidth, $isparallax, $lrclass, $imgclass);
        $css_classes = '';
        if (!empty($css_class_array)) {
            foreach ($css_class_array as $class) {
                $css_classes .= ' ' . $class;
            }
        }
        // core/custom classes
        $core_classes = function_exists('aesop_component_classes') ? aesop_component_classes('quote') : null;
        // cite
        $cite = $atts['cite'] ? apply_filters('aesop_quote_component_cite', sprintf('<cite class="aesop-quote-component-cite">%s</cite>', aesop_component_media_filter($atts['cite']))) : null;
        ob_start();
        do_action('aesop_quote_before', $atts, $unique);
        // action
        ?>
			<div id="aesop-quote-component-<?php 
        echo esc_attr($unique);
        ?>
" <?php 
        echo aesop_component_data_atts('quote', $unique, $atts);
        ?>
 class="aesop-component aesop-quote-component <?php 
        echo $core_classes . ' ' . $css_classes;
        ?>
" <?php 
        echo $style;
        ?>
>

				<?php 
        if ('block' == $atts['type']) {
            ?>
					<!-- Aesop Core | Quote -->
					<script>
						jQuery(document).ready(function($){

							var moving 		= $('#aesop-quote-component-<?php 
            echo esc_attr($unique);
            ?>
 blockquote'),
								component   = $('#aesop-quote-component-<?php 
            echo esc_attr($unique);
            ?>
');

							// if parallax is on and we're not on mobile
							<?php 
            if ('on' == $atts['parallax'] && !wp_is_mobile()) {
                ?>

						       	function scrollParallax(){
						       	    var height 			= $(component).height(),
	        	        				offset 			= $(component).offset().top,
							       	    scrollTop 		= $(window).scrollTop(),
							       	    windowHeight 	= $(window).height(),
							       	    position 		= Math.round( scrollTop * 0.1 );

							       	// only run parallax if in view
							       	if (offset + height <= scrollTop || offset >= scrollTop + windowHeight) {
										return;
									}

						            moving.css({'transform':'translate3d(0px,-' + position + 'px, 0px)'});

						       	    <?php 
                if ('left' == $atts['direction']) {
                    ?>
						            	moving.css({'transform':'translate3d(-' + position + 'px, 0px, 0px)'});
						            <?php 
                } elseif ('right' == $atts['direction']) {
                    ?>
										moving.css({'transform':'translate3d(' + position + 'px, 0px, 0px)'});
						            <?php 
                }
                ?>
						       	}
						       	component.waypoint({
									offset: '100%',
									handler: function(direction){
							   			$(this).toggleClass('aesop-quote-faded');

							   			// fire parallax
							   			scrollParallax();
										$(window).scroll(function() {scrollParallax();});
								   	}
								});

							<?php 
            } else {
                ?>

								moving.waypoint({
									offset: '90%',
									handler: function(direction){
								   		$(this).toggleClass('aesop-quote-faded');

								   	}
								});

							<?php 
            }
            //end if
            ?>

						});
					</script>

				<?php 
        }
        do_action('aesop_quote_inside_top', $atts, $unique);
        // action
        ?>

				<blockquote class="<?php 
        echo sanitize_html_class($align);
        ?>
" style="font-size:<?php 
        echo esc_attr($size);
        ?>
;<?php 
        echo $fgcolor;
        ?>
">
					<span><?php 
        echo esc_html($atts['quote']);
        ?>
</span>

					<?php 
        echo $cite;
        ?>
				</blockquote>

				<?php 
        do_action('aesop_quote_inside_bottom', $atts, $unique);
        // action
        ?>

			</div>
		<?php 
        do_action('aesop_quote_after', $atts, $unique);
        // action
        return ob_get_clean();
    }
예제 #3
0
    function aesop_content_shortcode($atts, $content = null)
    {
        // let this be used multiple times
        static $instance = 0;
        $instance++;
        $unique = sprintf('%s-%s', get_the_ID(), $instance);
        $defaults = array('height' => '', 'width' => '100%', 'columns' => '', 'position' => 'center', 'innerposition' => '', 'img' => '', 'imgrepeat' => 'no-repeat', 'imgposition' => 'center center', 'imgsize' => 'cover', 'floatermedia' => '', 'floaterdirection' => 'down', 'floaterposition' => 'left', 'color' => '#FFFFFF', 'background' => '#222222');
        $atts = apply_filters('aesop_cbox_defaults', shortcode_atts($defaults, $atts));
        // set component to content width
        $contentwidth = 'content' == $atts['width'] ? 'aesop-content' : false;
        // height
        $height = $atts['height'] ? sprintf('min-height:%s;', esc_attr($atts['height'])) : false;
        // inner positioning
        $getinnerposition = $atts['innerposition'] ? preg_split('/[\\s,]+/', $atts['innerposition']) : false;
        $positionArray = array('top' => $getinnerposition[0], 'right' => $getinnerposition[1], 'bottom' => $getinnerposition[2], 'left' => $getinnerposition[3]);
        //$innerposition = is_array( $positionArray ) && $atts['innerposition'] ? sprintf( 'position:absolute;top:%s;right:%s;bottom:%s;left:%s;', $positionArray['top'], $positionArray['right'], $positionArray['bottom'], $positionArray['left'] ) : false;
        $innerposition = is_array($positionArray) && $atts['innerposition'] ? sprintf('top:%s;right:%s;bottom:%s;left:%s;', $positionArray['top'], $positionArray['right'], $positionArray['bottom'], $positionArray['left']) : false;
        // are we doing columns or image and do a clas based on it
        $columns = $atts['columns'] ? sprintf('aesop-content-comp-columns-%s', $atts['columns']) : false;
        $image = $atts['img'] ? 'aesop-content-img' : false;
        $typeclass = $columns . ' ' . $image;
        // image and width inline styles
        $bgcolor = $atts['background'] ? sprintf('background-color:%s;', esc_url($atts['background'])) : false;
        $imgstyle = $atts['img'] ? sprintf('%sbackground-image:url(\'%s\');background-size:%s;background-position:%s;background-repeat:%s;', $bgcolor, esc_url($atts['img']), esc_attr($atts['imgsize']), esc_attr($atts['imgposition']), esc_attr($atts['imgrepeat'])) : false;
        $position = 'left' == $atts['position'] || 'right' == $atts['position'] ? sprintf('float:%s;', esc_attr($atts['position'])) : 'margin-left:auto;margin-right:auto;';
        $widthContentStyle = 'content' == $atts['width'] ? false : sprintf('max-width:%s;', esc_attr($atts['width']));
        $innerstyle = $atts['width'] || $position || $atts['innerposition'] ? sprintf('style="%s%s%s"', $widthContentStyle, $position, $innerposition) : false;
        $txtcolor = $atts['color'] ? sprintf('color:%s;', $atts['color']) : false;
        $itemstyle = $imgstyle !== false || $txtcolor !== false || $height !== false ? sprintf('style="%s%s%s%s"', $imgstyle, $txtcolor, $bgcolor, $height) : false;
        // custom classes
        $classes = function_exists('aesop_component_classes') ? aesop_component_classes('content', '') : false;
        // has image class
        $has_img = $atts['img'] ? 'aesop-content-has-img' : false;
        // has floater
        $has_floater = $atts['floatermedia'] ? 'aesop-content-has-floater' : false;
        // floater positoin
        $floaterposition = $atts['floaterposition'] ? sprintf('floater-%s', $atts['floaterposition']) : false;
        ob_start();
        do_action('aesop_cbox_before', $atts, $unique);
        // action
        ?>
		<div <?php 
        echo aesop_component_data_atts('content', $unique, $atts, true);
        ?>
 class="aesop-component aesop-content-component <?php 
        echo sanitize_html_class($classes) . ' ' . $has_img . ' ' . $has_floater;
        ?>
" style="<?php 
        echo $height;
        ?>
" >

			<?php 
        if ($atts['floatermedia'] && !wp_is_mobile()) {
            ?>
				<!-- Aesop Content Component -->
				<script>
				jQuery(document).ready(function($){

					var obj = $('#aesop-content-component-<?php 
            echo esc_attr($unique);
            ?>
 .aesop-content-component-floater');

			       	function scrollParallax(){

			       	    var height 			= $(obj).height(),
	        				offset 			= $(obj).offset().top,
				       	    scrollTop 		= $(window).scrollTop(),
				       	    windowHeight 	= $(window).height(),
				       	    floater 		= Math.round( (offset - scrollTop) * 0.1);

				    	// only run parallax if in view
			       		if (offset + height <= scrollTop || offset >= scrollTop + windowHeight) {
							return;
						}

			       	    <?php 
            if ('up' == $atts['floaterdirection']) {
                ?>
			            	$(obj).css({'transform':'translate3d(0px,' + floater + 'px, 0px)'});
						<?php 
            } else {
                ?>
							$(obj).css({'transform':'translate3d(0px,-' + floater + 'px, 0px)'});
						<?php 
            }
            ?>
			       	}
			      	scrollParallax();

			        $(window).scroll(function() {scrollParallax();});
				});
				</script>

			<?php 
        }
        //end if
        echo do_action('aesop_cbox_inside_top', $atts, $unique);
        // action
        ?>

			<div id="aesop-content-component-<?php 
        echo $unique;
        ?>
" class="aesop-content-comp-wrap <?php 
        echo $typeclass;
        ?>
" <?php 
        echo $itemstyle;
        ?>
>

				<?php 
        echo do_action('aesop_cbox_content_inside_top', $atts, $unique);
        // action
        if ($atts['floatermedia'] && !wp_is_mobile()) {
            ?>

					<div class="aesop-content-component-floater <?php 
            echo $floaterposition;
            ?>
" data-speed="10"><?php 
            echo aesop_component_media_filter($atts['floatermedia']);
            ?>
</div>

				<?php 
        }
        ?>

				<div class="aesop-component-content-data aesop-content-comp-inner <?php 
        echo $contentwidth;
        ?>
" <?php 
        echo $innerstyle;
        ?>
>

					<?php 
        echo do_action('aesop_cbox_content_inner_inside_top', $atts, $unique);
        // action
        ?>

						<?php 
        echo do_shortcode(wpautop(html_entity_decode($content)));
        ?>

					<?php 
        echo do_action('aesop_cbox_content_inner_inside_bottom', $atts, $unique);
        // action
        ?>

				</div>

				<?php 
        echo do_action('aesop_cbox_content_inside_bottom', $atts, $unique);
        // action
        ?>

			</div>

			<?php 
        echo do_action('aesop_cbox_inside_bottom', $atts, $unique);
        // action
        ?>

				</div>
			<?php 
        do_action('aesop_cbox_after', $atts, $unique);
        // action
        return ob_get_clean();
    }
예제 #4
0
    function aesop_character_shortcode($atts, $content = null)
    {
        $defaults = array('img' => '', 'name' => '', 'caption' => '', 'align' => 'left', 'width' => '');
        // let this be used multiple times
        static $instance = 0;
        $instance++;
        $unique = sprintf('%s-%s', get_the_ID(), $instance);
        $atts = apply_filters('aesop_character_defaults', shortcode_atts($defaults, $atts));
        // custom classes
        $classes = function_exists('aesop_component_classes') ? aesop_component_classes('character', '') : null;
        // width styles
        $styles = $atts['width'] ? sprintf('style="width:%s;"', esc_attr($atts['width'])) : null;
        // wrapper float class
        $float = $atts['align'] ? sprintf('aesop-component-align-%s', esc_attr($atts['align'])) : null;
        // automatic alt tag
        $auto_alt = $atts['img'] ? basename($atts['img']) : null;
        $alt = $auto_alt ? preg_replace('/\\.[^.\\s]{3,4}$/', '', $auto_alt) : null;
        // character wrap
        ob_start();
        do_action('aesop_character_before', $atts, $unique);
        // action
        ?>
				<aside id="aesop-character-component-<?php 
        echo esc_attr($unique);
        ?>
" <?php 
        echo aesop_component_data_atts('character', $unique, $atts);
        ?>
 class="aesop-character-component aesop-component <?php 
        echo sanitize_html_class($classes) . '' . sanitize_html_class($float);
        ?>
 ">

					<?php 
        do_action('aesop_character_inside_top', $atts, $unique);
        // action
        ?>

					<div class="aesop-character-inner aesop-content">
						<div class="aesop-character-float aesop-character-<?php 
        echo esc_attr($atts['align']);
        ?>
" <?php 
        echo $styles;
        ?>
>

							<?php 
        do_action('aesop_character_inner_inside_top', $atts, $unique);
        // action
        ?>

							<?php 
        if ($atts['name']) {
            ?>
								<span class="aesop-character-title"><?php 
            echo aesop_component_media_filter($atts['name']);
            ?>
</span>
							<?php 
        }
        ?>

							<?php 
        if ($atts['img']) {
            ?>
								<img class="aesop-character-avatar" src="<?php 
            echo esc_url($atts['img']);
            ?>
" alt="<?php 
            echo esc_attr_e($alt);
            ?>
">
							<?php 
        }
        ?>

							<?php 
        if ($content) {
            ?>
								<div class="aesop-character-text"><?php 
            echo do_shortcode($content);
            ?>
</div>
							<?php 
        }
        ?>

							<?php 
        if ($atts['caption']) {
            ?>
								<p class="aesop-character-cap"><?php 
            echo aesop_component_media_filter($atts['caption']);
            ?>
</p>
							<?php 
        }
        ?>

							<?php 
        do_action('aesop_character_inner_inside_bottom', $atts, $unique);
        // action
        ?>

						</div>
					</div>

					<?php 
        do_action('aesop_character_inside_bottom', $atts, $unique);
        // action
        ?>

				</aside>
			<?php 
        do_action('aesop_character_after', $atts, $unique);
        // action
        return ob_get_clean();
    }
예제 #5
0
    function aesop_image_shortcode($atts)
    {
        $defaults = array('img' => '', 'imgwidth' => '300px', 'offset' => '', 'alt' => '', 'align' => 'left', 'caption' => '', 'credit' => '', 'captionposition' => 'left', 'lightbox' => 'off');
        $atts = apply_filters('aesop_image_defaults', shortcode_atts($defaults, $atts));
        // offset styles
        $offsetstyle = $atts['offset'] && ('left' == $atts['align'] || 'right' == $atts['align']) ? sprintf('style=margin-%s:%s;width:%s;', $atts['align'], $atts['offset'], $atts['imgwidth']) : 'style=max-width:' . $atts['imgwidth'] . ';';
        // custom classes
        $classes = function_exists('aesop_component_classes') ? aesop_component_classes('image', '') : null;
        // let this be used multiple times
        static $instance = 0;
        $instance++;
        $unique = sprintf('%s-%s', get_the_ID(), $instance);
        // lazy loader class
        $lazy_holder = AI_CORE_URL . '/public/assets/img/aesop-lazy-holder.png';
        $lazy = class_exists('AesopLazyLoader') && !is_user_logged_in() ? sprintf('src="%s" data-src="%s" class="aesop-lazy-img"', $lazy_holder, esc_url($atts['img'])) : sprintf('src="%s"', esc_url($atts['img']));
        // automatic alt tag fallback if none specified
        $auto_alt = $atts['img'] ? basename($atts['img']) : null;
        $alt = $atts['alt'] ? $atts['alt'] : preg_replace('/\\.[^.\\s]{3,4}$/', '', $auto_alt);
        // combine into component shell
        ob_start();
        do_action('aesop_image_before', $atts, $unique);
        // action
        ?>
		<div id="aesop-image-component-<?php 
        echo esc_html($unique);
        ?>
" <?php 
        echo aesop_component_data_atts('image', $unique, $atts);
        ?>
 class="aesop-component aesop-image-component <?php 
        echo sanitize_html_class($classes);
        ?>
" >

			<?php 
        do_action('aesop_image_inside_top', $atts, $unique);
        // action
        ?>

			<div class="aesop-content">
				<figure class="aesop-image-component-image aesop-component-align-<?php 
        echo sanitize_html_class($atts['align']);
        ?>
 aesop-image-component-caption-<?php 
        echo sanitize_html_class($atts['captionposition']);
        ?>
" <?php 
        echo esc_attr($offsetstyle);
        ?>
>
					<?php 
        do_action('aesop_image_inner_inside_top', $atts, $unique);
        // action
        if ('on' == $atts['lightbox']) {
            ?>

						<a class="aesop-lightbox" href="<?php 
            echo $atts['img'];
            ?>
" title="<?php 
            echo $atts['caption'];
            ?>
">
							<p class="aesop-img-enlarge"><i class="aesopicon aesopicon-search-plus"></i> <?php 
            _e('Enlarge', 'aesop-core');
            ?>
</p>
							<img <?php 
            echo $lazy;
            ?>
 alt="<?php 
            echo esc_attr($alt);
            ?>
">
						</a>

					<?php 
        } else {
            ?>

						<img <?php 
            echo $lazy;
            ?>
 alt="<?php 
            echo esc_attr($alt);
            ?>
">

					<?php 
        }
        if ($atts['caption']) {
            ?>

						<figcaption class="aesop-image-component-caption">
							<?php 
            echo aesop_component_media_filter($atts['caption']);
            if ($atts['credit']) {
                ?>
								<p class="aesop-cap-cred"><?php 
                echo esc_html($atts['credit']);
                ?>
</p>
							<?php 
            }
            ?>

						</figcaption>

					<?php 
        }
        ?>

					<?php 
        do_action('aesop_image_inner_inside_bottom', $atts, $unique);
        // action
        ?>

				</figure>
			</div>

			<?php 
        do_action('aesop_image_inside_bottom', $atts, $unique);
        // action
        ?>

		</div>
		<?php 
        do_action('aesop_image_after', $atts, $unique);
        // action
        return ob_get_clean();
    }
예제 #6
0
    function aesop_audio_shortcode($atts)
    {
        $defaults = array('title' => '', 'src' => '', 'viewstart' => 'off', 'viewend' => 'off', 'loop' => 'off', 'hidden' => '');
        $atts = apply_filters('aesop_audio_defaults', shortcode_atts($defaults, $atts));
        // let this be used multiple times
        static $instance = 0;
        $instance++;
        $unique = sprintf('%s-%s', get_the_ID(), $instance);
        // custom classes
        $classes = function_exists('aesop_component_classes') ? aesop_component_classes('audio', '') : null;
        // hidden
        $hidden = 'on' == $atts['hidden'] ? 'style=height:0;z-index:-1;position:absolute;opacity:0;' : null;
        // optional title
        $title = $atts['title'] ? apply_filters('aesop_audio_component_title', sprintf('<h5>%s</h5>', $atts['title'])) : null;
        // loop
        $loop = 'on' == $atts['loop'] ? 'true' : false;
        // waypoint filter
        $point = 'bottom-in-view';
        $waypoint = apply_filters('aesop_audio_component_waypoint', $point, $unique);
        ob_start();
        do_action('aesop_audio_before', $atts, $unique);
        // action
        ?>
<aside id="aesop-audio-<?php 
        echo esc_attr($unique);
        ?>
" <?php 
        echo aesop_component_data_atts('audio', $unique, $atts);
        ?>
 class="aesop-component aesop-audio-component <?php 
        echo sanitize_html_class($classes);
        ?>
" <?php 
        echo esc_attr($hidden);
        ?>
>

			<?php 
        if ('on' == $atts['viewstart']) {
            ?>
				<script>
				jQuery(document).ready(function($){
					$('#aesop-audio-<?php 
            echo esc_attr($unique);
            ?>
').arrive('.mejs-audio', function(){

						$('#aesop-audio-<?php 
            echo esc_attr($unique);
            ?>
').waypoint({
							offset: '<?php 
            echo esc_attr($waypoint);
            ?>
',
							handler: function(direction){
								$('#aesop-audio-<?php 
            echo esc_attr($unique);
            ?>
 .mejs-playpause-button button').css({'cursor':'pointer'}).click();
							}
						});

						<?php 
            if ('on' == $atts['viewend']) {
                ?>
						$('#aesop-audio-<?php 
                echo esc_attr($unique);
                ?>
').waypoint({
							handler: function(direction){
								$('#aesop-audio-<?php 
                echo esc_attr($unique);
                ?>
 .mejs-playpause-button button').css({'cursor':'pointer'}).click();
							}
						});
						<?php 
            }
            ?>

						});
					});
				</script>
			<?php 
        }
        //end if
        do_action('aesop_audio_inside_top', $atts, $unique);
        // action
        if ($title) {
            echo aesop_component_media_filter($title);
        }
        echo wp_audio_shortcode(array('src' => $atts['src'], 'loop' => $loop));
        do_action('aesop_audio_inside_bottom', $atts, $unique);
        // action
        ?>
</aside><?php 
        do_action('aesop_audio_after', $atts, $unique);
        // action
        return ob_get_clean();
    }
예제 #7
0
    /**
     * Draws a gallery with images in sequential order
     *
     * @since    1.0.0
     */
    public function aesop_sequence_gallery($image_ids)
    {
        // image size
        $size = apply_filters('aesop_sequence_gallery_size', 'large');
        // lazy loader class
        $lazy_holder = AI_CORE_URL . '/public/assets/img/aesop-lazy-holder.png';
        foreach ($image_ids as $image_id) {
            $img = wp_get_attachment_image_src($image_id, $size, false, '');
            $alt = get_post_meta($image_id, '_wp_attachment_image_alt', true);
            $caption = get_post($image_id)->post_excerpt;
            $lazy = class_exists('AesopLazyLoader') && !is_user_logged_in() ? sprintf('src="%s" data-src="%s" class="aesop-sequence-img aesop-lazy-img"', $lazy_holder, esc_url($img[0])) : sprintf('src="%s" class="aesop-sequence-img" ', esc_url($img[0]));
            ?>
           	<figure class="aesop-sequence-img-wrap">

           		<img <?php 
            echo $lazy;
            ?>
 alt="<?php 
            echo esc_attr($alt);
            ?>
">

           		<?php 
            if ($caption) {
                ?>
           			<figcaption class="aesop-content aesop-component-caption aesop-sequence-caption"><?php 
                echo aesop_component_media_filter($caption);
                ?>
</figcaption>
           		<?php 
            }
            ?>

           	</figure>
           	<?php 
        }
    }
예제 #8
0
    public function aesop_map_loader()
    {
        global $post;
        $id = isset($post) ? $post->ID : null;
        $markers = isset($post) ? get_post_meta($id, 'ase_map_component_locations', false) : false;
        $start = isset($post) && self::get_map_meta($id, 'ase_map_component_start') ? self::get_map_meta($id, 'ase_map_component_start') : self::start_fallback($markers);
        $zoom = isset($post) && self::get_map_meta($id, 'ase_map_component_zoom') ? self::get_map_meta($id, 'ase_map_component_zoom') : 12;
        $default_location = is_single();
        $location = apply_filters('aesop_map_component_appears', $default_location);
        $tiles = isset($post) ? aesop_map_tile_provider($post->ID) : false;
        if (function_exists('aesop_component_exists') && aesop_component_exists('map') && $location) {
            ?>
			<!-- Aesop Locations -->
			<script>

				<?php 
            if ($markers) {
                ?>

					var map = L.map('aesop-map-component',{
						scrollWheelZoom: false,
						zoom: <?php 
                echo wp_filter_nohtml_kses(round($zoom));
                ?>
,
						center: [<?php 
                echo $start;
                ?>
]
					});

					L.tileLayer('<?php 
                echo $tiles;
                ?>
', {
						maxZoom: 20
					}).addTo(map);

					<?php 
                foreach ($markers as $marker) {
                    $lat = $marker['lat'];
                    $long = $marker['lng'];
                    $text = $marker['title'] ? $marker['title'] : null;
                    $loc = sprintf('%s,%s', esc_attr($lat), esc_attr($long));
                    // if market content is set run a popup
                    if ($text) {
                        ?>

							L.marker([<?php 
                        echo $loc;
                        ?>
]).addTo(map).bindPopup('<?php 
                        echo aesop_component_media_filter($text);
                        ?>
').openPopup();

						<?php 
                    } else {
                        ?>

							L.marker([<?php 
                        echo $loc;
                        ?>
]).addTo(map);

						<?php 
                    }
                }
            } else {
                if (is_user_logged_in()) {
                    $url = admin_url('post.php?post=' . $id . '&action=edit');
                    $editlink = sprintf('<a href="%s">here</a>', $url);
                    ?>
jQuery('#aesop-map-component').append('<div class="aesop-error aesop-content"><?php 
                    echo __("Your map appears to be empty! Setup and configure your map markers in this post {$editlink}.", 'aesop-core');
                    ?>
</div>');<?php 
                }
            }
            ?>
			</script>

		<?php 
        }
        //end if
    }