Ejemplo n.º 1
0
/**
 * Build the gallery creation and management area shown in panel
 *
 * @since 1.0
 */
function lasso_gallery_editor_module()
{
    $galleries = lasso_editor_galleries_exist();
    ob_start();
    if ($galleries) {
        ?>

		<div class="ase-gallery-opts ase-gallery-opts--edit-gallery" >
			<div class="ase-gallery-opts--single lasso-option">

				<label><?php 
        _e('Manage Images', 'lasso');
        ?>
					<a href="#" id="ase-gallery-add-image" class="lasso-editor-tiny-btn" title="<?php 
        esc_attr_e('Add Images', 'lasso');
        ?>
"><i class="lasso-icon-pencil"></i></a>

					<?php 
        if (lasso_user_can('publish_posts')) {
            ?>
						<a href="#" id="lasso--gallery__create" class="lasso-editor-tiny-btn" title="<?php 
            esc_attr_e('Create Gallery', 'lasso');
            ?>
"><i class="lasso-icon-plus"></i></a>
					<?php 
        }
        ?>

				</label>
				<small class="lasso-option-desc"><?php 
        _e('Rearrange or edit the images in this gallery.', 'lasso');
        ?>
</small>

				<div id="lasso--gallery__images"><span class="lasso-icon-spinner6"></span></div>

			</div>

		</div>

	<?php 
    }
    if (lasso_user_can('publish_posts')) {
        ?>

		<div class="ase-gallery-opts ase-gallery-opts--create-gallery" >

			<div class="ase-gallery-opts--single lasso-option">

				<label><?php 
        _e('Create a Gallery', 'lasso');
        ?>
</label>
				<small class="lasso-option-desc"><?php 
        _e('Select images to create a gallery.', 'lasso');
        ?>
</small>

				<a href="#" class="editor-btn-secondary" id="lasso--gallery__selectImages"><?php 
        _e('Select Images', 'lasso');
        ?>
</a>

				<div id="ase-gallery-images"></div>

				<a style="display:none;" class="editor-btn-secondary" data-post-title="<?php 
        echo esc_attr(strtolower(the_title_attribute()));
        ?>
" id="lasso--gallery__save" href="#"><?php 
        _e('Create Gallery', 'lasso');
        ?>
</a>

			</div>

		</div>

	<?php 
    }
    ?>

	<!-- Gallery Layout/Type Chooser -->
	<div class="ase-gallery-opts ase-gallery-opts--type" >
		<div data-option="gallery-type" class="ase-gallery-opts--single lasso-option">
			<label><?php 
    _e('Gallery Type', 'lasso');
    ?>
</label>
			<small class="lasso-option-desc"><?php 
    _e('Select the type of gallery.', 'lasso');
    ?>
</small>
			<fieldset>
	      		<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="grid"><?php 
    _e('Grid', 'lasso');
    ?>
</label>
	        	<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="thumbnail"><?php 
    _e('Thumbnail', 'lasso');
    ?>
</label>
				<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="sequence">Sequence</label>
				<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="photoset"><?php 
    _e('Photoset', 'lasso');
    ?>
</label>
				<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="stacked"><?php 
    _e('Parallax', 'lasso');
    ?>
</label>
			</fieldset>
		</div>
	</div>

	<!-- Conditionally Loaded Gallery Option - Grid Options -->
	<div class="ase-gallery-opts ase-gallery-opts--grid" style="display:none;">

		<div data-option="itemwidth" class="ase-gallery-opts--single lasso-option">
			<label for="lasso_grid_gallery_width"><?php 
    _e('Grid Item Width', 'lasso');
    ?>
</label>
			<small class="lasso-option-desc"><?php 
    _e('Adjust the width of the individual grid items, only if using Grid gallery style. Default is 400.', 'lasso');
    ?>
</small>
			<input type="text_small" class="lasso-generator-attr" name="lasso_grid_gallery_width" value="">
		</div>

	</div>

	<!-- Conditionally Loaded Gallery Option - Thumb Options -->
	<div class="ase-gallery-opts ase-gallery-opts--thumb" style="display:none;">

		<div data-option="transition" class="ase-gallery-opts--single lasso-option">
			<label for="lasso_thumb_gallery_transition"><?php 
    _e('Gallery Transition', 'lasso');
    ?>
</label>
			<small class="lasso-option-desc"><?php 
    _e('Adjust the transition effect for the Thumbnail gallery. Default is slide.', 'lasso');
    ?>
</small>
		   	<select name="lasso_thumb_gallery_transition" class="lasso-generator-attr">
		      <option value="crossfade"><?php 
    _e('Fade', 'lasso');
    ?>
</option>
		      <option value="slide"><?php 
    _e('Slide', 'lasso');
    ?>
</option>
		      <option value="dissolve"><?php 
    _e('Dissolve', 'lasso');
    ?>
</option>
		    </select>
		</div>

		<div data-option="speed" class="ase-gallery-opts--single lasso-option">
			<label for="lasso_thumb_gallery_transition_speed"><?php 
    _e('Gallery Transition Speed', 'lasso');
    ?>
</label>
			<small class="lasso-option-desc"><?php 
    _e('Activate slideshow by setting a speed for the transition.5000 = 5 seconds.', 'lasso');
    ?>
</small>
			<input type="text" class="lasso-generator-attr" name="lasso_thumb_gallery_transition_speed" value="">
		</div>

		<div data-option="hide-thumbs" class="ase-gallery-opts--single lasso-option">
			<input class="lasso-generator-attr" type="checkbox" name="lasso_thumb_gallery_hide_thumbs">
			<label for="lasso_thumb_gallery_hide_thumbs"><?php 
    _e('Hide Gallery Thumbnails', 'lasso');
    ?>
</label>
		</div>

	</div>

	<!-- Conditionally Loaded Gallery Option - Photoset Options -->
	<div class="ase-gallery-opts ase-gallery-opts--photoset" style="display:none;">

		<div data-option="pslayout" class="ase-gallery-opts--single lasso-option">
			<label for="lasso-photoset-gallery-layout"><?php 
    _e('Gallery Layout', 'lasso');
    ?>
</label>
			<small class="lasso-option-desc"><?php 
    _e('Let\'s say you have 4 images in this gallery. If you enter 121 you will have one image on the top row, two images on the second row, and one image on the third row.', 'lasso');
    ?>
</small>
			<input type="text" class="lasso-generator-attr" name="lasso_photoset_gallery_layout" value="">
		</div>

		<div data-option="pslightbox" class="ase-gallery-opts--single lasso-option">
			<input type="checkbox" class="lasso-generator-attr" name="lasso_photoset_gallery_lightbox">
			<label for="lasso_photoset_gallery_lightbox"><?php 
    _e('Enable Lightbox', 'lasso');
    ?>
</label>
		</div>

	</div>

	<!-- Global Gallery Options -->
	<div class="ase-gallery-opts ase-gallery-opts--global">

		<div data-option="width" class="ase-gallery-opts--single lasso-option">
			<label for="lasso_gallery_width"><?php 
    _e('Main Gallery Width', 'lasso');
    ?>
</label>
			<small class="lasso-option-desc"><?php 
    _e('Adjust the overall width of the grid/thumbnail gallery. Acceptable values include 500px or 50%.', 'lasso');
    ?>
</small>
			<input type="text_small" class="lasso-generator-attr" name="lasso_gallery_width" value="">
		</div>
		<div data-option="caption" class="ase-gallery-opts--single lasso-option">
			<label for="lasso_gallery_caption"><?php 
    _e('Gallery Caption', 'lasso');
    ?>
</label>
			<small class="lasso-option-desc"><?php 
    _e('Add an optional caption for the gallery.', 'lasso');
    ?>
</small>
			<textarea name="lasso_gallery_caption" class="lasso-generator-attr"></textarea>
		</div>

	</div>


	<input type="hidden" id="ase_gallery_ids" name="ase_gallery_ids" value="">
	<input type="hidden" id="ase_gallery_type" name="ase_gallery_type" value="">
	<?php 
    return ob_get_clean();
}
Ejemplo n.º 2
0
/**
 * Draw out the settings field based on the shortcodes array with options foudn in Lasso Story Engine
 *  This was mostly backported from lasso story engine and modified to allow for non lasso shortcodes and components
 *
 * @since 1.0
 */
function lasso_editor_options_blob()
{
    $codes = function_exists('aesop_shortcodes') ? aesop_shortcodes() : apply_filters('lasso_custom_options', '');
    $galleries = function_exists('lasso_editor_galleries_exist') && lasso_editor_galleries_exist() ? 'has-galleries' : 'creating-gallery';
    $nonce = wp_create_nonce('lasso_gallery');
    $blob = array();
    if (empty($codes)) {
        return;
    }
    foreach ($codes as $slug => $shortcode) {
        $return = '';
        // Shortcode has atts
        if (count($shortcode['atts']) && $shortcode['atts']) {
            foreach ($shortcode['atts'] as $attr_name => $attr_info) {
                $prefix = isset($attr_info['prefix']) ? sprintf('<span class="lasso-option-prefix">%s</span>', $attr_info['prefix']) : null;
                $return .= '<form id="lasso--component-settings-form" class="' . $galleries . '" method="post">';
                $return .= '<p data-option="' . $attr_name . '" class="lasso-option lasso-' . $slug . '-' . $attr_name . '">';
                $return .= '<label for="lasso-generator-attr-' . $attr_name . '">' . $attr_info['desc'] . '</label>';
                $return .= '<small class="lasso-option-desc">' . $attr_info['tip'] . '</small>';
                // Select
                if (isset($attr_info['values'])) {
                    $return .= '<select name="' . $attr_name . '" id="lasso-generator-attr-' . $attr_name . '" class="lasso-generator-attr">';
                    $i = 0;
                    foreach ($attr_info['values'] as $attr_value) {
                        $attr_value_selected = $attr_info['default'] == $attr_value ? ' selected="selected"' : '';
                        $return .= '<option value="' . $attr_info['values'][$i]['value'] . '" ' . $attr_value_selected . '>' . $attr_info['values'][$i]['name'] . '</option>';
                        $i++;
                    }
                    $return .= '</select>';
                } else {
                    $attr_field_type = isset($attr_info['type']) ? $attr_info['type'] : 'text';
                    // image upload
                    if ('media_upload' == $attr_info['type']) {
                        $return .= '<input type="' . $attr_field_type . '" name="' . $attr_name . '" value="' . $attr_info['default'] . '" id="lasso-generator-attr-' . $attr_name . '" class="lasso-generator-attr lasso-generator-attr-' . $attr_field_type . '" />';
                        $return .= '<a href="#" id="lasso-upload-img" class="lasso-option-button" /></a>';
                    } elseif ('color' == $attr_info['type']) {
                        $return .= '<input type="color" name="' . $attr_name . '" value="' . $attr_info['default'] . '" id="lasso-generator-attr-' . $attr_name . '" class="lasso-generator-attr lasso-generator-attr-' . $attr_field_type . '" />';
                    } elseif ('text_area' == $attr_info['type']) {
                        $return .= '<textarea name="' . $attr_name . '" id="lasso-generator-attr-' . $attr_name . '" class="lasso-generator-attr lasso-generator-attr-' . $attr_field_type . '" placeholder="' . $attr_info['default'] . '" /></textarea>' . $prefix . '';
                    } else {
                        $return .= '<input type="' . $attr_field_type . '" name="' . $attr_name . '" value="' . $attr_info['default'] . '" id="lasso-generator-attr-' . $attr_name . '" class="lasso-generator-attr lasso-generator-attr-' . $attr_field_type . '" />' . $prefix . '';
                    }
                }
                $return .= '</p>';
            }
        }
        ///////////////////////////
        // START GALLERY AND MAP FRONT END STUFFS
        ///////////////////////////
        if (isset($shortcode['front']) && true == $shortcode['front']) {
            if ('gallery' == $shortcode['front_type']) {
                $return .= lasso_gallery_editor_module();
            }
        }
        ///////////////////////////
        // END GALLERY AND MAP FRONT END STUFFS
        ///////////////////////////
        // Single shortcode (not closed)
        if ('single' == $shortcode['type']) {
            $return .= '<input type="hidden" name="lasso-generator-content" id="lasso-generator-content" value="false" />';
        } else {
            $return .= '<p data-option="content" class="lasso-option lasso-c-comp-text"><label>' . __('Content', 'lasso') . '</label><textarea type="text" name="lasso-generator-content" id="lasso-generator-content" value="' . $shortcode['content'] . '" /></textarea></p>';
        }
        $return .= '<p class="lasso-buttoninsert-wrap"><a href="#" class="lasso-generator-cancel" id="lasso--sidebar__close">Cancel
</a><input type="submit" id="lasso-generator-insert" value="Save Settings"></p>';
        $return .= '<input class="component_type" type="hidden" name="component_type" value="">';
        $return .= '<input type="hidden" name="unique" value="">';
        $return .= '<input type="hidden" name="nonce" id="lasso-generator-nonce" value="' . $nonce . '" />';
        $return .= '</form>';
        $blob[$slug] = $return;
    }
    return $blob;
}