Ejemplo n.º 1
0
        /**
         * Reusable component for adding an image uploader.
         *
         * @since  1.0.0.
         *
         * @param  string    $section_name    Name of the current section.
         * @param  int       $image_id        ID of the current image.
         * @param  array     $messages        Message to show.
         * @return void
         */
        public function add_uploader($section_name, $image_id = 0, $messages = array())
        {
            $image = ttfmake_get_image($image_id, 'large');
            $add_state = '' === $image ? 'ttfmake-show' : 'ttfmake-hide';
            $remove_state = '' === $image ? 'ttfmake-hide' : 'ttfmake-show';
            // Set default messages. Note that the theme textdomain is not used in some cases
            // because the strings are core i18ns
            $messages['add'] = empty($messages['add']) ? __('Set featured image', 'make') : $messages['add'];
            $messages['remove'] = empty($messages['remove']) ? __('Remove featured image', 'make') : $messages['remove'];
            $messages['title'] = empty($messages['title']) ? __('Featured Image', 'make') : $messages['title'];
            $messages['button'] = empty($messages['button']) ? __('Use as Featured Image', 'make') : $messages['button'];
            ?>
		<div class="ttfmake-uploader">
			<div class="ttfmake-media-uploader-placeholder ttfmake-media-uploader-add">
				<?php 
            if ('' !== $image) {
                ?>
					<?php 
                echo $image;
                ?>
				<?php 
            }
            ?>
			</div>
			<div class="ttfmake-media-link-wrap">
				<a href="#" class="ttfmake-media-uploader-add ttfmake-media-uploader-set-link <?php 
            echo $add_state;
            ?>
" data-title="<?php 
            echo esc_attr($messages['title']);
            ?>
" data-button-text="<?php 
            echo esc_attr($messages['button']);
            ?>
">
					<?php 
            echo $messages['add'];
            ?>
				</a>
				<a href="#" class="ttfmake-media-uploader-remove <?php 
            echo $remove_state;
            ?>
">
					<?php 
            echo $messages['remove'];
            ?>
				</a>
			</div>
			<input type="hidden" name="<?php 
            echo esc_attr($section_name);
            ?>
[image-id]" value="<?php 
            echo ttfmake_sanitize_image_id($image_id);
            ?>
" class="ttfmake-media-uploader-value" />
		</div>
	<?php 
        }
Ejemplo n.º 2
0
            $link_front = '<a href="' . esc_url($column['image-link']) . '">';
            $link_back = '</a>';
        }
        ?>
		<div class="builder-text-column builder-text-column-<?php 
        echo $i;
        ?>
" id="builder-section-<?php 
        echo esc_attr($ttfmake_section_data['id']);
        ?>
-column-<?php 
        echo $i;
        ?>
">
			<?php 
        $image_html = ttfmake_get_image($column['image-id'], 'large');
        ?>
			<?php 
        if ('' !== $image_html) {
            ?>
			<figure class="builder-text-image">
				<?php 
            echo $link_front . $image_html . $link_back;
            ?>
			</figure>
			<?php 
        }
        ?>
			<?php 
        if ('' !== $column['title']) {
            ?>