示例#1
0
文件: base.php 项目: fovoc/make
if (!function_exists('ttfmake_get_builder_base')) {
    /**
     * Instantiate or return the one TTFMAKE_Builder_Base instance.
     *
     * @since  1.0.0.
     *
     * @return TTFMAKE_Builder_Base
     */
    function ttfmake_get_builder_base()
    {
        return TTFMAKE_Builder_Base::instance();
    }
}
// Add the base immediately
if (is_admin()) {
    ttfmake_get_builder_base();
}
if (!function_exists('ttfmake_get_post_types_supporting_builder')) {
    /**
     * Get all post types that support the Make builder.
     *
     * @since  1.2.0.
     *
     * @return array    Array of all post types that support the builder.
     */
    function ttfmake_get_post_types_supporting_builder()
    {
        $post_types_supporting_builder = array();
        // Inspect each post type for builder support
        foreach (get_post_types() as $name => $data) {
            if (post_type_supports($name, 'make-builder')) {
        /**
         * Print out the JS section templates
         *
         * @since  1.0.0.
         *
         * @return void
         */
        public function print_templates()
        {
            global $hook_suffix, $typenow, $ttfmake_is_js_template;
            $ttfmake_is_js_template = true;
            // Only show when adding/editing pages
            if (!ttfmake_post_type_supports_builder($typenow) || !in_array($hook_suffix, array('post.php', 'post-new.php'))) {
                return;
            }
            // Define the templates to print
            $templates = array(array('id' => 'gallery-item', 'builder_template' => 'sections/builder-templates/gallery-item', 'path' => 'inc/builder/'), array('id' => 'banner-slide', 'builder_template' => 'sections/builder-templates/banner-slide', 'path' => 'inc/builder/'));
            // Print the templates
            foreach ($templates as $template) {
                ?>
		<script type="text/html" id="tmpl-ttfmake-<?php 
                echo $template['id'];
                ?>
">
			<?php 
                ob_start();
                ttfmake_get_builder_base()->load_section($template, array());
                $html = ob_get_clean();
                $html = str_replace(array('temp'), array('{{{ id }}}'), $html);
                echo $html;
                ?>
		</script>
		<?php 
            }
            unset($GLOBALS['ttfmake_is_js_template']);
        }
 /**
  * Remove some of the add-on functionality for Make that we are not able to
  * support in the Spine parent theme.
  */
 public function remove_extra_make()
 {
     remove_action('edit_form_after_title', 'ttfmake_plus_quick_start');
     remove_action('post_submitbox_misc_actions', array(ttfmake_get_builder_base(), 'post_submitbox_misc_actions'));
     remove_action('tiny_mce_before_init', array(ttfmake_get_builder_base(), 'tiny_mce_before_init'), 15);
 }
示例#4
0
	<div class="ttfmake-titlediv">
		<input placeholder="<?php 
esc_attr_e('Enter link here', 'make');
?>
" type="text" name="<?php 
echo $section_name;
?>
[link]" class="ttfmake-link code widefat" value="<?php 
echo esc_url($link);
?>
" autocomplete="off" />
	</div>

	<?php 
ttfmake_get_builder_base()->add_uploader($section_name, ttfmake_sanitize_image_id($image_id));
?>

	<div class="ttfmake-titlediv">
		<div class="ttfmake-titlewrap">
			<input placeholder="<?php 
esc_attr_e('Enter title here', 'make');
?>
" type="text" name="<?php 
echo $section_name;
?>
[title]" class="ttfmake-title" value="<?php 
echo esc_attr(htmlspecialchars($title));
?>
" autocomplete="off" />
		</div>
        /**
         * Print out the JS section templates
         *
         * @since  1.0.0.
         *
         * @return void
         */
        public function print_templates()
        {
            global $hook_suffix, $typenow, $ttfmake_is_js_template;
            $ttfmake_is_js_template = true;
            // Only show when adding/editing pages
            if (!ttfmake_post_type_supports_builder($typenow) || !in_array($hook_suffix, array('post.php', 'post-new.php'))) {
                return;
            }
            /**
             * Array of items to print as JS templates in the footer of the Builder screen.
             *
             * Each item is represented as an associative array and includes the following items:
             * - id                  The ID of the template
             * - builder_template    The relative path to the PHP template
             * - path                The path to the base directory
             *
             * @since 1.6.0.
             *
             * @param array    $templates    The
             */
            $templates = apply_filters('make_builder_js_templates', array(array('id' => 'gallery-item', 'builder_template' => 'sections/builder-templates/gallery-item', 'path' => 'inc/builder/'), array('id' => 'banner-slide', 'builder_template' => 'sections/builder-templates/banner-slide', 'path' => 'inc/builder/')));
            // Print the templates
            foreach ($templates as $template) {
                ?>
		<script type="text/html" id="tmpl-ttfmake-<?php 
                echo $template['id'];
                ?>
">
			<?php 
                ob_start();
                ttfmake_get_builder_base()->load_section($template, array());
                $html = ob_get_clean();
                $html = str_replace(array('temp'), array('{{{ id }}}'), $html);
                echo $html;
                ?>
		</script>
		<?php 
            }
            unset($GLOBALS['ttfmake_is_js_template']);
        }
?>
		</span>
	</a>
	<a href="#" class="remove-banner-slide-link ttfmake-banner-slide-remove" title="<?php 
esc_attr_e('Delete slide', 'make');
?>
">
		<span>
			<?php 
_e('Delete slide', 'make');
?>
		</span>
	</a>

	<?php 
ttfmake_get_builder_base()->add_frame($combined_id, $section_name . '[content]', $content, false);
?>

	<?php 
global $ttfmake_overlay_class, $ttfmake_overlay_id, $ttfmake_overlay_title;
$ttfmake_overlay_class = 'ttfmake-configuration-overlay';
$ttfmake_overlay_id = $overlay_id;
$ttfmake_overlay_title = __('Configure slide', 'make');
get_template_part('/inc/builder/core/templates/overlay', 'header');
/**
 * Filter the definitions of the Banner slide configuration inputs.
 *
 * @since 1.4.0.
 *
 * @param array    $inputs    The input definition array.
 */
示例#7
0
_e('Slide content overlay', 'make');
?>
		</h2>

		<?php 
$editor_settings = array('tinymce' => true, 'quicktags' => true, 'textarea_name' => $section_name . '[content]');
if (true === $ttfmake_is_js_template) {
    ?>
			<?php 
    ttfmake_get_builder_base()->wp_editor('', 'ttfmakeeditorbannerslidetemp', $editor_settings);
    ?>
		<?php 
} else {
    ?>
			<?php 
    ttfmake_get_builder_base()->wp_editor($content, 'ttfmakeeditorbannerslide' . $ttfmake_slide_id, $editor_settings);
    ?>
		<?php 
}
?>

		<a href="#" class="ttfmake-banner-slide-remove">
			<?php 
_e('Remove this slide', 'make');
?>
		</a>
	</div>
	<input type="hidden" class="ttfmake-banner-slide-state" name="<?php 
echo $section_name;
?>
[state]" value="<?php 
?>
		</span>
	</a>
	<a href="#" class="remove-gallery-item-link ttfmake-gallery-item-remove" title="<?php 
esc_attr_e('Delete item', 'make');
?>
">
		<span>
			<?php 
_e('Delete item', 'make');
?>
		</span>
	</a>

	<?php 
ttfmake_get_builder_base()->add_frame($combined_id, $section_name . '[description]', $description, false);
?>

	<?php 
global $ttfmake_overlay_class, $ttfmake_overlay_id, $ttfmake_overlay_title;
$ttfmake_overlay_class = 'ttfmake-configuration-overlay';
$ttfmake_overlay_id = $overlay_id;
$ttfmake_overlay_title = __('Configure item', 'make');
get_template_part('/inc/builder/core/templates/overlay', 'header');
/**
 * Filter the definitions of the Gallery item configuration inputs.
 *
 * @since 1.4.0.
 *
 * @param array    $inputs    The input definition array.
 */
示例#9
0
" autocomplete="off" />
			</div>
		</div>

		<?php 
    $editor_settings = array('tinymce' => array('toolbar1' => 'bold,italic,link,ttfmake_mce_button_button', 'toolbar2' => '', 'toolbar3' => '', 'toolbar4' => ''), 'quicktags' => array('buttons' => 'strong,em,link'), 'textarea_name' => $column_name . '[content]');
    if (true === $ttfmake_is_js_template) {
        ?>
			<?php 
        ttfmake_get_builder_base()->wp_editor('', 'ttfmakeeditortextcolumn' . $i . 'temp', $editor_settings);
        ?>
		<?php 
    } else {
        ?>
			<?php 
        ttfmake_get_builder_base()->wp_editor($content, 'ttfmakeeditortextcolumn' . $i . $ttfmake_section_data['data']['id'], $editor_settings);
        ?>
		<?php 
    }
    ?>

		<?php 
    /**
     * Execute code after an individual text column is displayed.
     *
     * @since 1.2.3.
     *
     * @param array    $ttfmake_section_data    The data for the section.
     */
    do_action('make_section_text_after_column', $ttfmake_section_data, $i);
    ?>
示例#10
0
文件: text.php 项目: fovoc/make
>
			<span>
				<?php 
        echo esc_html($button['label']);
        ?>
			</span>
		</a>
		<?php 
    }
    ?>

		<?php 
    echo ttfmake_get_builder_base()->add_uploader($column_name, ttfmake_sanitize_image_id($image_id), __('Set image', 'make'));
    ?>
		<?php 
    ttfmake_get_builder_base()->add_frame($section_id . '-' . $i, $column_name . '[content]', $content);
    ?>

		<?php 
    /**
     * Execute code after an individual text column is displayed.
     *
     * @since 1.2.3.
     *
     * @param array    $ttfmake_section_data    The data for the section.
     */
    do_action('make_section_text_after_column', $ttfmake_section_data, $i);
    ?>

		<?php 
    global $ttfmake_overlay_class, $ttfmake_overlay_id, $ttfmake_overlay_title;
 /**
  * Generate a image uploader input for the configuration overlay.
  *
  * @since  1.4.0.
  *
  * @param  string    $section_name    The section prefix for the input name.
  * @param  array     $args            Arguments for creating the input.
  * @param  array     $section_data    The data for the current section.
  * @return string                     The full input string.
  */
 function ttfmake_create_config_image($section_name, $args, $section_data)
 {
     $current_value = ttfmake_get_current_configuration_value($section_data, $args);
     $name = $section_name . '[' . $args['name'] . ']';
     $label = isset($args['label']) ? '<label for="' . $name . '">' . esc_html($args['label']) . '</label>' : '';
     return $label . ttfmake_get_builder_base()->add_uploader($name, $current_value, __('Set image', 'make'));
 }
示例#12
0
			<input placeholder="<?php 
esc_attr_e('Enter title here', 'make');
?>
" type="text" name="<?php 
echo $section_name;
?>
[title]" class="ttfmake-title ttfmake-section-header-title-input" value="<?php 
echo esc_attr(htmlspecialchars($title));
?>
" autocomplete="off" />
		</div>
	</div>

	<div class="ttfmake-gallery-background-image-wrapper">
		<?php 
ttfmake_get_builder_base()->add_uploader($section_name . '[background-image]', ttfmake_sanitize_image_id($background_image), array('add' => __('Set background image', 'make'), 'remove' => __('Remove background image', 'make'), 'title' => __('Background image', 'make'), 'button' => __('Use as Background Image', 'make')));
?>
	</div>

	<div class="ttfmake-gallery-background-options-wrapper">
		<h4><?php 
_e('Background image', 'make');
?>
</h4>
		<input id="<?php 
echo $section_name;
?>
[darken]" type="checkbox" name="<?php 
echo $section_name;
?>
[darken]" value="1"<?php 
示例#13
0
	<?php 
$editor_settings = array('tinymce' => true, 'quicktags' => true, 'editor_height' => 345, 'textarea_name' => $section_name . '[content]');
if (true === $ttfmake_is_js_template) {
    ?>
		<?php 
    ttfmake_get_builder_base()->wp_editor('', ttfmake_get_wp_editor_id($ttfmake_section_data, $ttfmake_is_js_template), $editor_settings);
    ?>
	<?php 
} else {
    ?>
		<?php 
    $content = isset($ttfmake_section_data['data']['content']) ? $ttfmake_section_data['data']['content'] : '';
    ?>
		<?php 
    ttfmake_get_builder_base()->wp_editor($content, ttfmake_get_wp_editor_id($ttfmake_section_data, $ttfmake_is_js_template), $editor_settings);
    ?>
	<?php 
}
?>

	<input type="hidden" class="ttfmake-section-state" name="<?php 
echo $section_name;
?>
[state]" value="<?php 
if (isset($ttfmake_section_data['data']['state'])) {
    echo esc_attr($ttfmake_section_data['data']['state']);
} else {
    echo 'open';
}
?>