コード例 #1
0
 public static function updater_move_legacy_templates()
 {
     /* move copy of legacy core templates to the uploads folder and delete from core templates directory */
     $templates_to_move = array('rsvp-envelope', 'super-slick');
     chmod(LANDINGPAGES_UPLOADS_PATH, 0755);
     $template_paths = Landing_Pages_Load_Extensions::get_core_template_ids();
     if (count($template_paths) > 0) {
         foreach ($template_paths as $name) {
             if (in_array($name, $templates_to_move)) {
                 $old_path = LANDINGPAGES_PATH . "templates/{$name}/";
                 $new_path = LANDINGPAGES_UPLOADS_PATH . "{$name}/";
                 /*
                 echo "oldpath: $old_path<br>";
                 echo "newpath: $new_path<br>";
                 */
                 @mkdir($new_path, 0775);
                 chmod($old_path, 0775);
                 self::move_files($old_path, $new_path);
                 rmdir($old_path);
             }
         }
     }
 }
コード例 #2
0
function lp_display_meta_box_select_template_container()
{
    global $post;
    $current_url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "";
    if (isset($post) && $post->post_type != 'landing-page' || !isset($post)) {
        return false;
    }
    !strstr($current_url, 'post-new.php') ? $toggle = "display:none" : ($toggle = "");
    $extension_data = lp_get_extension_data();
    $extension_data_cats = Landing_Pages_Load_Extensions::get_template_categories();
    unset($extension_data['lp']);
    ksort($extension_data_cats);
    $uploads = wp_upload_dir();
    $uploads_path = $uploads['basedir'];
    $extended_path = $uploads_path . '/landing-pages/templates/';
    $template = get_post_meta($post->ID, 'lp-selected-template', true);
    $template = apply_filters('lp_selected_template', $template);
    echo "<div class='lp-template-selector-container' style='{$toggle}'>";
    echo "<div class='lp-selection-heading'>";
    echo "<h1>" . __('Select Your Landing Page Template!', 'landing-pages') . "</h1>";
    echo '<a class="button-secondary" style="display:none;" id="lp-cancel-selection">' . __('Cancel Template Change', 'landing-pages') . '</a>';
    echo "</div>";
    echo '<ul id="template-filter" >';
    echo '<li class="button-primary button"><a href="#" data-filter=".template-item-boxes">' . __('All', 'landing-pages') . '</a></li>';
    echo '<li class="button-primary button"><a href="#" data-filter=".theme">' . __('Theme', 'landing-pages') . '</a></li>';
    $categories = array('Theme');
    foreach ($extension_data_cats as $cat) {
        $slug = str_replace(' ', '-', $cat['value']);
        $slug = strtolower($slug);
        $cat['value'] = ucwords($cat['value']);
        if (!in_array($cat['value'], $categories)) {
            echo '<li class="button"><a href="#" data-filter=".' . $slug . '">' . $cat['value'] . '</a></li>';
            $categories[] = $cat['value'];
        }
    }
    echo "</ul>";
    echo '<div id="templates-container" >';
    foreach ($extension_data as $this_extension => $data) {
        if (substr($this_extension, 0, 4) == 'ext-') {
            continue;
        }
        if (isset($data['info']['data_type']) && $data['info']['data_type'] == 'metabox') {
            continue;
        }
        $cats = explode(',', $data['info']['category']);
        foreach ($cats as $key => $cat) {
            $cat = trim($cat);
            $cat = str_replace(' ', '-', $cat);
            $cats[$key] = trim(strtolower($cat));
        }
        $cat_slug = implode(' ', $cats);
        $thumb = false;
        // Get Thumbnail
        if (file_exists(LANDINGPAGES_PATH . 'templates/' . $this_extension . "/thumbnail.png")) {
            if ($this_extension == 'default') {
                $thumbnail = get_bloginfo('template_directory') . "/screenshot.png";
            } else {
                $thumbnail = LANDINGPAGES_URLPATH . 'templates/' . $this_extension . "/thumbnail.png";
            }
            $thumb = true;
        }
        if (file_exists(LANDINGPAGES_UPLOADS_PATH . $this_extension . "/thumbnail.png")) {
            $thumbnail = LANDINGPAGES_UPLOADS_URLPATH . $this_extension . "/thumbnail.png";
            $thumb = true;
        }
        if ($thumb === false) {
            $thumbnail = LANDINGPAGES_URLPATH . 'templates/default/thumbnail.png';
        }
        $demo_link = isset($data['info']['demo']) ? $data['info']['demo'] : '';
        ?>
			<div id='template-item' class="<?php 
        echo $cat_slug;
        ?>
 template-item-boxes">
				<div id="template-box">
					<div class="lp_tooltip_templates" title="<?php 
        echo $data['info']['description'];
        ?>
"></div>
				<a class='lp_select_template' href='#' label='<?php 
        echo $data['info']['label'];
        ?>
' id='<?php 
        echo $this_extension;
        ?>
'>
					<img src="<?php 
        echo $thumbnail;
        ?>
" class='template-thumbnail' alt="<?php 
        echo $data['info']['label'];
        ?>
" id='lp_<?php 
        echo $this_extension;
        ?>
'>
				</a>
				<p>
					<div id="template-title"><?php 
        echo $data['info']['label'];
        ?>
</div>
					<a href='#' label='<?php 
        echo $data['info']['label'];
        ?>
' id='<?php 
        echo $this_extension;
        ?>
' class='lp_select_template'><?php 
        _e('Select', 'landing-pages');
        ?>
</a> |
					<a class='<?php 
        echo $cat_slug;
        ?>
' target="_blank" href='<?php 
        echo $demo_link;
        ?>
' id='lp_preview_this_template'><?php 
        _e('Preview', 'landing-pages');
        ?>
</a>
				</p>
				</div>
			</div>
			<?php 
    }
    echo '</div>';
    echo "<div class='clear'></div>";
    echo "</div>";
    echo "<div style='display:none;' class='currently_selected'>" . __('This is Currently Selected', 'landing-pages') . "</a></div>";
}
コード例 #3
0
function lp_get_extension_data()
{
    return Landing_Pages_Load_Extensions::get_extended_data();
}