Exemplo n.º 1
0
 function content($block)
 {
     //Use header image if there is one
     if ($header_image_src = parent::get_setting($block, 'header-image')) {
         do_action('headway_before_header_link');
         if (parent::get_setting($block, 'resize-header-image', true)) {
             $block_width = HeadwayBlocksData::get_block_width($block);
             $block_height = HeadwayBlocksData::get_block_height($block);
             $header_image_url = headway_resize_image($header_image_src, $block_width, $block_height);
         } else {
             $header_image_url = $header_image_src;
         }
         echo '<a href="' . home_url() . '" class="banner-image"><img src="' . $header_image_url . '" alt="' . get_bloginfo('name') . '" /></a>';
         do_action('headway_after_header_link');
         //No image present
     } else {
         do_action('headway_before_header_link');
         echo '<span class="banner"><a href="' . home_url() . '">' . get_bloginfo('name') . '</a></span>';
         do_action('headway_after_header_link');
         if (!parent::get_setting($block, 'hide-tagline', false)) {
             if ((is_front_page() || is_home()) && get_option('show_on_front') != 'page') {
                 echo '<h1 class="tagline">' . get_bloginfo('description') . '</h1>' . "\n";
             } else {
                 echo '<span class="tagline">' . get_bloginfo('description') . '</span>' . "\n";
             }
             do_action('headway_after_tagline');
         }
     }
 }
Exemplo n.º 2
0
 function content($block)
 {
     $images = parent::get_setting($block, 'images', array());
     $block_width = HeadwayBlocksData::get_block_width($block);
     $block_height = HeadwayBlocksData::get_block_height($block);
     $has_images = false;
     foreach ($images as $image) {
         if ($image['image']) {
             $has_images = true;
             break;
         }
     }
     if (!$has_images) {
         echo '<div class="alert alert-yellow"><p>There are no images to display.</p></div>';
         return;
     }
     $no_slide_class = count($images) === 1 ? ' flexslider-no-slide' : '';
     echo '<div class="flexslider' . $no_slide_class . '">';
     /* Put in viewport div for sliders that only have 1 image and don't slide */
     if (count($images) === 1) {
         echo '<div class="flex-viewport">';
     }
     echo '<ul class="slides">';
     foreach ($images as $image) {
         if (!$image['image']) {
             continue;
         }
         $output = array('image' => array('src' => parent::get_setting($block, 'crop-resize-images', true) ? headway_resize_image($image['image'], $block_width, $block_height) : $image['image'], 'alt' => headway_fix_data_type(headway_get('image-alt', $image)), 'title' => headway_fix_data_type(headway_get('image-title', $image)), 'caption' => headway_fix_data_type(headway_get('image-description', $image))), 'hyperlink' => array('href' => headway_fix_data_type(headway_get('image-hyperlink', $image)), 'target' => headway_fix_data_type(headway_get('image-open-link-in-new-window', $image, false)) ? ' target="_blank"' : null));
         echo '<li>';
         /* Open hyperlink if user added one for image */
         if ($output['hyperlink']['href']) {
             echo '<a href="' . $output['hyperlink']['href'] . '"' . $output['hyperlink']['target'] . '>';
         }
         /* Don't forget to display the ACTUAL IMAGE */
         echo '<img src="' . $output['image']['src'] . '" alt="' . $output['image']['alt'] . '" title="' . $output['image']['title'] . '" />';
         /* Closing tag for hyperlink */
         if ($output['hyperlink']['href']) {
             echo '</a>';
         }
         /* Caption */
         if (!empty($output['image']['caption'])) {
             echo '<p class="flex-caption">' . $output['image']['caption'] . '</p>';
         }
         echo '</li>';
     }
     echo '</ul>';
     /* Put in viewport div for sliders that only have 1 image and don't slide */
     if (count($images) === 1) {
         echo '</div><!-- .flex-viewport -->';
     }
     echo '</div><!-- .flexslider -->';
 }
Exemplo n.º 3
0
 function content($block)
 {
     if ($embed_url = parent::get_setting($block, 'embed-url', false)) {
         $block_width = HeadwayBlocksData::get_block_width($block);
         $block_height = HeadwayBlocksData::get_block_height($block);
         $embed_code = wp_oembed_get($embed_url, array('width' => $block_width, 'height' => $block_height));
         //Make the width and height exactly what the block's dimensions are.
         $embed_code = preg_replace(array('/width="\\d+"/i', '/height="\\d+"/i'), array('width="' . $block_width . '"', 'height="' . $block_height . '"'), $embed_code);
         echo $embed_code;
     } else {
         echo '<div class="alert alert-yellow"><p>There is no content to display.  Please enter a valid embed URL in the visual editor.</p></div>';
     }
 }
Exemplo n.º 4
0
 /** 
  * Anything in here will be displayed when the block is being displayed.
  **/
 function content($block)
 {
     global $SlideDeckPlugin;
     /* Make sure SlideDeck is activated and working */
     if (!is_object($SlideDeckPlugin)) {
         echo '<div class="alert alert-red"><p>SlideDeck must be installed and activated in order for the SlideDeck block to work properly.</p></div>';
         return;
     }
     /* Get the chosen SlideDeck ID */
     $slidedeck_id = parent::get_setting($block, 'slidedeck-id', null);
     /* Make sure that there's a selected SlideDeck */
     if (empty($slidedeck_id)) {
         echo '<div class="alert alert-red"><p>Please choose a SlideDeck to display.</p></div>';
         return;
     }
     $slidedeck_query = $SlideDeckPlugin->SlideDeck->get($slidedeck_id);
     if (empty($slidedeck_query)) {
         echo '<div class="alert alert-red"><p>The SlideDeck you previously chose must\'ve been deleted or moved elsewhere.  Please select another SlideDeck to display.</p></div>';
         return;
     }
     /* Setup arguments */
     $args = array('id' => $slidedeck_id, 'width' => null, 'height' => null);
     if (parent::get_setting($block, 'use-block-size', true)) {
         $args['width'] = HeadwayBlocksData::get_block_width($block);
         $args['height'] = HeadwayBlocksData::get_block_height($block);
         $args['proportional'] = false;
     }
     if (HeadwayRoute::is_visual_editor_iframe()) {
         $args['iframe'] = true;
     }
     if (!HeadwayRoute::is_visual_editor_iframe() && HeadwayResponsiveGrid::is_active()) {
         $args['ress'] = true;
     }
     /* Work around for iframe dimensions */
     $GLOBALS['slidedeck-width'] = $args['width'];
     $GLOBALS['slidedeck-height'] = $args['height'];
     add_filter('slidedeck_dimensions', array(__CLASS__, 'modify_slidedeck_iframe_size_for_ajax'), 10, 5);
     /* End work around for iframe dimensions */
     /* Show the SlideDeck! */
     echo $SlideDeckPlugin->shortcode($args);
     /* Remove any filters if necessary */
     remove_filter('slidedeck_dimensions', array(__CLASS__, 'modify_slidedeck_iframe_size_for_ajax'));
     if (isset($GLOBALS['slidedeck-width'])) {
         unset($GLOBALS['slidedeck-width']);
     }
     if (isset($GLOBALS['slidedeck-height'])) {
         unset($GLOBALS['slidedeck-height']);
     }
     /* End removing filters */
 }
Exemplo n.º 5
0
    public static function dynamic_css($block_id, $block, $original_block = null)
    {
        $selector = '#block-' . $block_id;
        /* If this block is a mirror, then pull the settings from the block that's mirroring that way the dimensions are correct */
        if (is_array($original_block)) {
            $block_id = $original_block['id'];
            $block = $original_block;
            $selector .= '.block-original-' . $block_id;
        }
        $block_height = HeadwayBlocksData::get_block_height($block);
        return '
			' . $selector . ' .nav-horizontal ul.menu > li > a, 
			' . $selector . ' .nav-search-active .nav-search { 
				height: ' . $block_height . 'px; 
				line-height: ' . $block_height . 'px; 
			}';
    }