function run_installation_routine($url = '')
 {
     $settings = pl_get_global_settings();
     // Only sets defaults if they are null
     set_default_settings();
     if (!$settings) {
         $this->load_page_templates();
         $this->apply_page_templates();
         // Publish New Templates
         $tpl_handler = new PLCustomTemplates();
         $tpl_handler->update_objects('publish');
     }
     // Add Templates
     $id = $this->page_on_activation();
     // Redirect
     $url = add_query_arg('pl-installed-theme', pl_theme_info('template'), get_permalink($id));
     return $url;
 }
Beispiel #2
0
 function run_installation_routine($url = '')
 {
     set_theme_mod('pl_installed', true);
     $settings = pl_get_global_settings();
     // Only sets defaults if they are null
     set_default_settings();
     if (is_file(trailingslashit(get_stylesheet_directory()) . 'pl-config.json')) {
         $settings_handler = new PageLinesSettings();
         $settings_handler->import_from_child();
     }
     $this->apply_page_templates();
     // Publish New Templates
     $tpl_handler = new PLCustomTemplates();
     $tpl_handler->update_objects('publish');
     // Add Templates
     $id = $this->page_on_activation();
     // Redirect
     $url = add_query_arg('pl-installed-theme', pl_theme_info('template'), get_permalink($id));
     return $url;
 }
Beispiel #3
0
    function pl_custom_bulk_admin_footer()
    {
        global $post_type;
        $custom_template_handler = new PLCustomTemplates();
        if ($post_type == 'page' || $post_type == 'post') {
            $templates = $custom_template_handler->get_all();
            ob_start();
            ?>

		<select class="pl-template-selecter">
			<?php 
            printf('<option class="pl-template-select" value="none">%s</option>', __('Select a PageLines Template', 'pagelines'));
            printf('<option class="pl-template-select" value="none">%s</option>', __('Unset Current Template', 'pagelines'));
            foreach ($custom_template_handler->get_all() as $index => $t) {
                printf('<option class="pl-template-select" data-nicename="%s" value="%s">%s</option>', $t['name'], $index, $t['name']);
            }
            ?>
		</select>	
		<?php 
            $select = str_replace("\n", '', ob_get_clean());
            ?>
	    <script type="text/javascript">
	      jQuery(document).ready(function() {
	        jQuery('<option>').val('pl-template').text('<?php 
            _e('Apply Template', 'pagelines');
            ?>
').appendTo("select[name='action']");
	       	jQuery('<option>').val('pl-template').text('<?php 
            _e('Apply Template', 'pagelines');
            ?>
').appendTo("select[name='action2']");
			jQuery('<input type="hidden" class="selected-template" name="selected-template" value="none" />').appendTo( '#posts-filter')
			jQuery('<input type="hidden" class="selected-template-name" name="selected-template-name" value="none" />').appendTo( '#posts-filter')
			jQuery('<input type="hidden" class="pl-post-type" name="pl-post-type" value="<?php 
            echo $post_type;
            ?>
" />').appendTo( '#posts-filter')
	      });
		jQuery('.bulkactions').after('<?php 
            echo $select;
            ?>
')

		jQuery( '.pl-template-selecter').each( function(e) {
			jQuery(this).on('change', function() {
				var sel = jQuery(this).val()
				var name = jQuery('option:selected', this).attr('data-nicename');
				jQuery('.selected-template').val(sel)
				jQuery('.selected-template-name').val(name)
			})
		})		
	    </script>
	    <?php 
        }
    }
Beispiel #4
0
 function page_attributes_meta_box($post)
 {
     global $pl_custom_template;
     $post_type_object = get_post_type_object($post->post_type);
     ///// CUSTOM PAGE TEMPLATE STUFF /////
     $options = '<option value="">Select Template</option>';
     $set = pl_meta($post->ID, PL_SETTINGS);
     $current = is_array($set) && isset($set['live']['custom-map']['template']['ctemplate']) ? $set['live']['custom-map']['template']['ctemplate'] : '';
     $custom_template_handler = new PLCustomTemplates();
     foreach ($custom_template_handler->get_all() as $index => $t) {
         $sel = '';
         $sel = $current === $index ? 'selected' : '';
         $options .= sprintf('<option value="%s" %s>%s</option>', $index, $sel, $t['name']);
     }
     printf('<p><strong>%1$s</strong></p>', __('Load PageLines Template', 'pagelines'));
     printf('<select name="pagelines_template" id="pagelines_template">%s</select>', $options);
     ///// END TEMPLATE STUFF /////
     if ($post_type_object->hierarchical) {
         $dropdown_args = array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)', 'pagelines'), 'sort_column' => 'menu_order, post_title', 'echo' => 0);
         $dropdown_args = apply_filters('page_attributes_dropdown_pages_args', $dropdown_args, $post);
         $pages = wp_dropdown_pages($dropdown_args);
         if (!empty($pages)) {
             printf('<p><strong>%1$s</strong></p>', __('Parent Page', 'pagelines'));
             echo $pages;
         }
     }
     printf('<p><strong>%1$s</strong></p>', __('Page Order', 'pagelines'));
     printf('<input name="menu_order" type="text" size="4" id="menu_order" value="%s" /></p>', esc_attr($post->menu_order));
 }
Beispiel #5
0
 function save_form($response, $data)
 {
     $form = $data['store'];
     $scope = $data['scope'];
     $key = isset($data['key']) ? $data['key'] : false;
     $uid = isset($data['uid']) && $data['uid'] != 'false' ? $data['uid'] : false;
     if (!empty($uid)) {
         global $sections_data_handler;
         $response['result'] = $sections_data_handler->update_or_insert(array('uid' => $uid, 'draft' => $form[$uid]));
     }
     if ($scope == 'global' || isset($form['settings']) && is_array($form['settings'])) {
         $global_settings = pl_settings();
         // First parse sub settings field
         if (isset($form['settings'])) {
             $form['settings'] = wp_parse_args($form['settings'], $global_settings['settings']);
         }
         $response['form'] = $form;
         $global_settings = wp_parse_args($form, $global_settings);
         pl_settings_update($global_settings);
     }
     if ($scope == 'type' || $scope == 'local') {
         $metaID = $scope == 'type' ? $data['typeID'] : $data['pageID'];
         $meta_settings = pl_settings('draft', $metaID);
         $meta_settings = wp_parse_args($form, $meta_settings);
         pl_settings_update($meta_settings, 'draft', $metaID);
     }
     if ($scope == 'template') {
         $handler = new PLCustomTemplates();
         $old_settings = $handler->retrieve_field($key, 'settings');
         $settings = wp_parse_args($form, $old_settings);
         $handler->update($key, array('settings' => $settings));
     }
     if ($scope == 'section') {
         $handler = new PLCustomSections();
         $old_settings = $handler->retrieve_field($key, 'settings');
         $settings = wp_parse_args($form, $old_settings);
         $handler->update($key, array('settings' => $settings));
         $response['settings'] = $settings;
         $response['new'] = $handler->retrieve($key);
     }
     $response['scope'] = $scope;
     return $response;
 }
Beispiel #6
0
    function export_template()
    {
        ob_start();
        $tpls = new PLCustomTemplates();
        ?>
		<label><?php 
        _e('Select User Templates', 'pagelines');
        ?>
</label>
		
		<?php 
        $btns = sprintf('<div class="checklist-btns">
				<button class="btn btn-mini checklist-tool" data-action="checkall"><i class="icon icon-ok"></i> %s</button> 
				<button class="btn btn-mini checklist-tool" data-action="uncheckall"><i class="icon icon-remove"></i> %s</button>
			</div>', __('Select All', 'pagelines'), __('Deselect All', 'pagelines'));
        $tpl_selects = '';
        foreach ($tpls->get_all() as $index => $template) {
            $tpl_selects .= sprintf('<label class="checklist-label media" for="%s">
					<div class="img"><input name="templates[]%s" id="%s" type="checkbox" checked /></div>
					<div class="bd"><div class="ttl">%s</div><p>%s</p></div>
				</label>', $index, $index, $index, $template['name'], $template['desc']);
        }
        printf('<fieldset>%s%s</fieldset>', $btns, $tpl_selects);
        ?>
		<label><?php 
        _e('Global Settings', 'pagelines');
        ?>
</label>
		<label class="checklist-label media" for="export_global" name="export_global">
			<div class="img"><input name="export_global" id="export_global" type="checkbox" checked /></div>
			<div class="bd">
				<div class="ttl"><?php 
        _e('Export Site Global Settings', 'pagelines');
        ?>
				</div>
				<p><?php 
        _e('This will export your sites global settings. This includes everything in the options panel, as well as settings directed at sections in your "global" regions like your header and footer.', 'pagelines');
        ?>
				</p>
			</div>
		</label>
		
		<label><?php 
        _e('Post Type Settings', 'pagelines');
        ?>
		</label>
		<label class="checklist-label media" for="export_types">
			<div class="img"><input name="export_types" id="export_types" type="checkbox" checked /></div>
			<div class="bd">
				<div class="ttl"><?php 
        _e('Export Post Type Settings', 'pagelines');
        ?>
				</div>
				<p><?php 
        _e('This exports settings such as the template defaults for various post types.', 'pagelines');
        ?>
				</p>
			</div>
		</label>
		
		<label><?php 
        _e('Theme Config Publishing', 'pagelines');
        ?>
		</label>
		<?php 
        $publish_active = is_child_theme() || pl_less_dev() ? true : false;
        ?>
		<label class="checklist-label media <?php 
        echo !$publish_active ? 'disabled' : '';
        ?>
" for="publish_config">
			<div class="img"><input id="publish_config" name="publish_config" type="checkbox" <?php 
        echo !$publish_active ? 'disabled="disabled"' : '';
        ?>
 /></div>
			<div class="bd">
				<div class="ttl"><?php 
        echo !$publish_active ? __('(Disabled! No child theme active)', 'pagelines') : '';
        ?>
 <?php 
        _e('Publish Configuration to Child Theme (No Download File)', 'pagelines');
        ?>
				</div>
				<p><?php 
        _e('Check this to publish your site configuration as a theme configuration file in your themes root directory. When a user activates your theme it will ask if it can overwrite their settings to attain a desired initial experience to the theme.', 'pagelines');
        ?>
				</p>
			</div>
		</label>
		
		<div class="center publish-button">
			<button class="btn btn-primary btn-large settings-action" data-action="opt_dump"><?php 
        _e('Publish', 'pagelines');
        ?>
			 <span class="spamp">&amp;</span> <?php 
        _e('Download DMS Config', 'pagelines');
        ?>
			 </button>
		</div>

		<?php 
        return ob_get_clean();
    }