Esempio n. 1
0
     $clicks = 0;
 } else {
     $clicks = $url_data['clicks'] + 1;
 }
 /**
  * Curl the page, returning data as an array
  */
 $page_data = curl_page($url_data['url']);
 /**
  * Calculate the directory of the current page, used to parse relative URLs
  */
 $dir = parse_dir($url_data['url']);
 /**
  * Parse the title of the current page
  */
 $title = parse_title($page_data['html']);
 /**
  * Parse the HTML for links, store in an array
  */
 $links = parse_links($page_data['html']);
 /**
  * Loop through the array of links
  */
 foreach ($links as $key => &$link) {
     /**
      * Uniformly clean the link so we don't have duplicates (absolute, no anchors, add www., etc.)
      */
     $link = clean_link($link, $dir);
     /**
      * If the link is to an image, do not add it
      */
Esempio n. 2
0
function create_id($title, $year, $month, $date) {
	$blogidtitle = parse_title($title);
	$blog_id = $year . "/" . $month . "/" . $date . "/" . $blogidtitle;
	return $blog_id;
}
Esempio n. 3
0
    static function handle_shortcode($atts)
    {
        self::$add_script = true;
        extract(shortcode_atts(array('header' => false, 'type' => false, 'source' => false, 'class' => false, 'amount' => 8, 'show' => 3, 'layout' => 'slick'), $atts, 'boxes'));
        global $post;
        $boxes = new stdClass();
        $boxes->cache = new stdClass();
        $boxes->objects = false;
        $boxes->site_url = site_url();
        $boxes->links_type = 'normal';
        $boxes->post = $post;
        foreach ($atts as $key => $value) {
            $boxes->{$key} = $value;
        }
        //Convert Shortcode attributes to object values
        if (empty($boxes->layout)) {
            $boxes->layout = 'slick';
        }
        $parsed_classes = explode(' ', $class);
        $boxes->child_classes = '';
        if ($boxes->layout === 'masonry') {
            $col_width = 6;
            if ($boxes->show < 5) {
                $col_width = 12 / $boxes->show;
            }
            array_push($parsed_classes, 'thin-padding');
            $boxes->child_classes = 'col-sm-6 col-md-' . $col_width;
            $boxes->srcType = 'src';
            $boxes->amount = $boxes->show;
        }
        $boxes->class = implode(' ', $parsed_classes);
        $props = array();
        foreach ($parsed_classes as $prop) {
            $props[$prop] = true;
        }
        $boxes->props = $props;
        //$debug = $boxes->props;
        //Feed Type
        switch ($type) {
            case 'instagram':
                $boxes->objects = boxesInstagram($boxes);
                $target = '_blank';
                break;
            case 'twitter':
                $boxes->objects = new stdClass();
                //boxesInstagram($boxes);
                $boxes->id = "live";
                $target = '_blank';
                break;
            case 'vimeo':
                $vid_url = parse_url($boxes->source);
                $boxes->source = $vid_url['path'];
                $boxes->id = preg_replace('/[^\\da-z]/i', '', $vid_url['path']);
                $boxes->cache->function_name = 'boxesVimeo';
                $boxes->cache->cache_name = 'vimeo';
                //$boxes->cache->json = true;
                $boxes->objects = cacheHandler($boxes);
                if ($boxes->post->post_name === 'watch') {
                    $boxes->links_type = 'hash';
                }
                $target = '_self';
                break;
            case 'events':
                $boxes->id = $source;
                $boxes->cache->function_name = 'boxesEvents';
                $boxes->cache->cache_name = 'events';
                $boxes->objects = cacheHandler($boxes);
                break;
            case 'category':
                $boxes->id = $source;
                $boxes->cache->function_name = 'boxesCategory';
                $boxes->cache->cache_name = 'category';
                $boxes->objects = cacheHandler($boxes);
                break;
            case 'youtube':
                echo $source;
                break;
            case 'acf':
                echo $source;
                break;
            default:
                echo 'Nothing here';
        }
        ob_start();
        ?>
		
		<?php 
        if (isset($props['double-stacked'])) {
            $boxes->show = $boxes->show * 2;
        }
        $i = 0;
        ?>
			
			<div 
				id="boxes-<?php 
        echo $type;
        ?>
-<?php 
        echo $boxes->id;
        ?>
" 
				class="box-boxes boxes-<?php 
        echo $type;
        ?>
 <?php 
        echo 'boxes-' . $boxes->layout;
        ?>
 <?php 
        echo $boxes->class;
        ?>
"
				data-source="<?php 
        echo $boxes->source;
        ?>
"
			>
			
			<?php 
        if (!empty($boxes->header)) {
            ?>
				<div class="boxes-header">
					<h3 class="spaced"><?php 
            echo $boxes->header;
            ?>
</h3>
					<hr>
				</div>
			<?php 
        }
        ?>

			<div class="frame container-fluid" data-show="<?php 
        echo $boxes->show;
        ?>
">
				<ul class="easecubic row">
					<?php 
        if ($boxes->objects) {
            foreach ($boxes->objects as $key => $box) {
                ?>
					
						<?php 
                //Reset $boxes->child_class to prevent stacking
                $boxes->child_class = $boxes->child_classes;
                if (isset($props['date-format-human'])) {
                    $normal_date = $box->date_unix;
                    if (strtotime($box->title)) {
                        $normal_date = strtotime($box->title);
                    }
                    $box->title = ago($normal_date);
                }
                //Hash Links
                if ($boxes->links_type === 'hash') {
                    $box->link = '#' . $box->id;
                }
                if (empty($boxes->srcType)) {
                    $box->srcType = 'src="' . get_template_directory_uri() . '/assets/img/blank.gif" data-lazy';
                } else {
                    $box->srcType = $boxes->srcType;
                }
                //if( $key < $boxes->show ) $box->srcType = "src";//if is showing don't lazyload
                if ($boxes->layout === 'masonry' && $box->index >= $boxes->amount) {
                    $boxes->child_class = $boxes->child_class . ' box-lazyload ease-opacity';
                    $box->srcType = 'src="' . get_template_directory_uri() . '/assets/img/blank.gif" data-src';
                }
                ?>
						
						
							<?php 
                if (!isset($props['double-stacked']) || $box->index % 2 != 0 || !$box->index) {
                    ?>
<li class="<?php 
                    echo $boxes->child_class;
                    ?>
" ><?php 
                }
                ?>
								
								<div id="box-<?php 
                echo $type;
                ?>
-<?php 
                echo $box->id;
                ?>
" class="box-box box-<?php 
                echo $box->type;
                ?>
 easecubic" style="<?php 
                //BG Color Overlay
                if (isset($box->color)) {
                    ?>
background: <?php 
                    echo $box->color;
                    ?>
; <?php 
                    //#000000
                }
                ?>
">
								
									<a href="<?php 
                echo $box->link;
                ?>
" target="<?php 
                echo $target;
                ?>
" >
										<div class="box-image">
											<img class="easecubic" <?php 
                echo $box->srcType;
                ?>
="<?php 
                echo $box->image_url;
                ?>
" alt="<?php 
                echo $box->title . ' - ' . $box->date;
                ?>
" >
										</div>
										
										<div class="box-header easecubic" style="">
											<div class="box-header-content">
												<h3><?php 
                echo parse_title($box->title);
                ?>
</h3>
												<div class="box-date easecubic"><?php 
                echo $box->date;
                ?>
</div>
											</div>
										</div>
										
										<div class="box-caption easecubic"><p><?php 
                echo parse_title($box->desc);
                ?>
</p></div>
										
									</a>
								</div>
								
							<?php 
                if (!isset($props['double-stacked']) || $box->index % 2 === 0 || !$box->index) {
                    ?>
</li><?php 
                }
                ?>
						
					<?php 
            }
            /* foreach($boxes->objects) */
        }
        /* if( $boxes->objects ) */
        ?>
				</ul>
			</div>
			
		</div>
		<?php 
        $content = ob_get_clean();
        //debug( $debug );
        return $content;
    }
Esempio n. 4
0
function heroOrganism($hero)
{
    switch ($hero->kind) {
        case "text":
            if (empty($hero->color)) {
                $hero->color = "#ffffff";
            }
            ob_start();
            ?>
				
				<!--
				<div class="container">
					<div class="page-header">
						<h1><?php 
            echo $hero->text;
            ?>
</h1>
					</div>
				</div>
				-->
				
				<div class="hero-slide" >
				
					<div class="hero-background">
						<img <?php 
            echo $hero->srcType;
            ?>
="<?php 
            echo $hero->src;
            ?>
" alt="<?php 
            echo $hero->text;
            ?>
">
					</div>
					
					<div class="hero-foreground animated fadeIn animated-3s animated-delay-1s" style="<?php 
            //BG Color Overlay
            ?>
background: <?php 
            echo $hero->color;
            ?>
; <?php 
            //#000000
            ?>
background: rgba(<?php 
            echo hex2rgb($hero->color);
            ?>
,0.85); <?php 
            //rgba(0,0,0,0.8)
            ?>
">
					
						<div class="container">
							<div class="page-header">
								<h1><?php 
            echo $hero->text;
            ?>
</h1>
							</div>
						</div>
						
					</div>
					
				</div>
				
			<?php 
            $hero->output = ob_get_clean();
            break;
        case 'media':
            ob_start();
            ?>
			
			<div class="hero-slide" >
				
				<div class="hero-background">
					<img <?php 
            echo $hero->srcType;
            ?>
="<?php 
            echo $hero->src;
            ?>
" alt="<?php 
            echo $hero->text;
            ?>
">
				</div>
				
				<div class="hero-foreground animated fadeIn animated-3s animated-delay-1s" style="<?php 
            //BG Color Overlay
            if (!empty($hero->color)) {
                ?>
background: <?php 
                echo $hero->color;
                ?>
; <?php 
                //#000000
                ?>
background: rgba(<?php 
                echo hex2rgb($hero->color);
                ?>
,0.85); <?php 
                //rgba(0,0,0,0.8)
            }
            ?>
">
				
					<div class="container">
						<div class="page-header">
							<h1><?php 
            echo parse_title($hero->text);
            ?>
</h1>
							
							<?php 
            if ($hero->ctas !== false) {
                ?>
								<div class="hero-ctas">
									<?php 
                foreach ($hero->ctas as $key => $value) {
                    ?>
										<a href="<?php 
                    echo $value['link'];
                    ?>
">
											<div class="hero-cta"><?php 
                    echo $value['text'];
                    ?>
</div>
										</a>
									<?php 
                }
                ?>
								</div>
							<?php 
            }
            ?>
							
						</div>
					</div>
					
				</div>
				
			</div>
			
			<?php 
            $hero->output = ob_get_clean();
            break;
        case 'post':
            ob_start();
            ?>
			
			<div class="hero-slide" >
				
				<div class="hero-background">
					<img <?php 
            echo $hero->srcType;
            ?>
="<?php 
            echo $hero->src;
            ?>
" alt="<?php 
            echo $hero->text;
            ?>
">
				</div>
				
				<div class="hero-foreground animated fadeIn animated-3s animated-delay-1s" style="<?php 
            //BG Color Overlay
            if (get_field('page_color')) {
                ?>
background: <?php 
                echo get_field('page_color');
                ?>
; <?php 
                //#000000
                ?>
background: rgba(<?php 
                echo hex2rgb(get_field('page_color'));
                ?>
,0.85); <?php 
                //rgba(0,0,0,0.8)
            }
            ?>
">
				
					<div class="container">
						<div class="page-header">
							<h1><?php 
            echo parse_title($hero->text);
            ?>
</h1>
							<div class="hero-content">
								<p class="byline author vcard"><?php 
            echo __('by', 'roots');
            ?>
 <a href="<?php 
            echo get_author_posts_url(get_the_author_meta('ID'));
            ?>
" rel="author" class="fn"><?php 
            echo get_the_author();
            ?>
</a></p>
							</div>
							
						</div>
					</div>
					
				</div>
				
			</div>
			
			<?php 
            $hero->output = ob_get_clean();
            break;
        case "event":
            ob_start();
            ?>
			
			<div class="hero-slide" >
				
				<div class="hero-background">
					<img <?php 
            echo $hero->srcType;
            ?>
="<?php 
            echo $hero->src;
            ?>
" alt="<?php 
            echo strip_tags($hero->text);
            ?>
">
				</div>
				
				<div class="hero-foreground animated fadeIn animated-3s animated-delay-1s" style="<?php 
            //BG Color Overlay
            if (get_field('page_color')) {
                ?>
background: <?php 
                echo get_field('page_color');
                ?>
; <?php 
                //#000000
                ?>
background: rgba(<?php 
                echo hex2rgb(get_field('page_color'));
                ?>
,0.85); <?php 
                //rgba(0,0,0,0.8)
            }
            ?>
">
				
					<div class="container">
						<div class="page-header">
							<h1>
								<?php 
            echo parse_title($hero->text);
            ?>
							</h1>
							
							<div class="hero-content">
								<?php 
            echo get_the_content();
            ?>
							</div>
						</div>
						
					</div>
					
				</div>
				
			</div>
			
			<?php 
            $hero->output = ob_get_clean();
            break;
        case "program":
            ob_start();
            ?>
			
			<div class="hero-slide" >
				
				<div class="hero-background">
					<img <?php 
            echo $hero->srcType;
            ?>
="<?php 
            echo $hero->src;
            ?>
" alt="<?php 
            echo $hero->text;
            ?>
">
				</div>
				
				<div class="hero-foreground animated fadeIn animated-3s animated-delay-1s" style="<?php 
            //BG Color Overlay
            if (get_field('page_color')) {
                ?>
background: <?php 
                echo get_field('page_color');
                ?>
; <?php 
                //#000000
                ?>
background: rgba(<?php 
                echo hex2rgb(get_field('page_color'));
                ?>
,0.85); <?php 
                //rgba(0,0,0,0.8)
            }
            ?>
">
				
					<div class="container">
						<div class="page-header">
							<div class="hero-logo">
								<img src="<?php 
            echo $hero->logo;
            ?>
"> 
							</div>
							<h1>
								<?php 
            echo parse_title($hero->text);
            ?>
							</h1>
							
							<div class="hero-content">
								<?php 
            the_excerpt();
            ?>
							</div>
						</div>
						
					</div>
					
				</div>
				
			</div>
			
			<?php 
            $hero->output = ob_get_clean();
            break;
        case "video":
            //Video BG
            break;
        case "shortcode":
            ob_start();
            ?>
			
			<div class="hero-slide" >
				
				<?php 
            echo do_shortcode($hero->text);
            ?>
				
			</div>
			
			<?php 
            $hero->output = ob_get_clean();
            break;
        case 'welcome':
            ob_start();
            ?>
			
			<div class="hero-slide hero-welcome fadeIn" >
				
				<div class="hero-background">
						<img <?php 
            echo $hero->srcType;
            ?>
="<?php 
            echo $hero->src;
            ?>
" alt="<?php 
            echo $hero->text;
            ?>
">
					</div>
					
					<div class="hero-foreground animated fadeIn animated-3s animated-delay-1s" style="<?php 
            //BG Color Overlay
            ?>
background: <?php 
            echo $hero->color;
            ?>
; <?php 
            //#000000
            ?>
background: rgba(<?php 
            echo hex2rgb($hero->color);
            ?>
,0.85); <?php 
            //rgba(0,0,0,0.8)
            ?>
">
					
						<div class="container">
							<div class="page-header">
								<h1>MORE<span class="brand-color">2</span>LIFE</h1>
							</div>
						</div>
						
					</div>
				
			</div>
			
			<?php 
            $hero->output = ob_get_clean();
            break;
        case 'stream':
            ob_start();
            ?>
			
			<div class="hero-slide hero-welcome fadeIn" >
				
				<div class="hero-background animated fadeIn animated-3s animated-delay-1s">
					
				</div>
				
				<div class="hero-foreground" style="<?php 
            //BG Color Overlay
            if (!empty($hero->color)) {
                ?>
background: <?php 
                echo $hero->color;
                ?>
; <?php 
                //#000000
                ?>
background: rgba(<?php 
                echo hex2rgb($hero->color);
                ?>
,0.85); <?php 
                //rgba(0,0,0,0.8)
            }
            ?>
">
						
						<?php 
            echo do_shortcode('[boxes type="twitter" source="http://tougherthanhell.com/stream/" header="#TougherThanHell" class="text-overlay" amount="32" show="3" layout="masonry"]');
            ?>
											
				</div>
				
			</div>
			
			<?php 
            $hero->output = ob_get_clean();
            break;
        default:
    }
    //Link Wrapper
    /*
    	if( !empty( $hero->link )  && $hero->link !== "" && !$hero->ctas ){ 
    		
    		$hero->output = '<a href="'.$hero->link.'" >'.$hero->output.'</a>';
    		
    	}
    */
    //Organism Wrapper
    if (!empty($hero->output)) {
        $hero->output = '<div class="hero-organism">' . $hero->output . '</div>';
        return $hero->output;
    }
}