Skip to content

Commit

Permalink
Moving from built in designs to child themes
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhellyer committed Oct 29, 2011
1 parent 4705c7f commit 4b112f7
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 3,546 deletions.
18 changes: 10 additions & 8 deletions comments.php
Expand Up @@ -5,12 +5,14 @@
* @since WP Paintbrush 0.9 * @since WP Paintbrush 0.9
* *
* Comments template * Comments template
*
* Much of the code used in this file was lifted directly from the Coraline theme by Automattic
*/ */
?> ?>


<div id="comments"> <div id="comments">
<?php if ( post_password_required() ) : ?> <?php if ( post_password_required() ) : ?>
<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'coraline' ); ?></p> <p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'wppb_lang' ); ?></p>
</div><!-- #comments --> </div><!-- #comments -->
<?php <?php
/* Stop the rest of comments.php from being processed, /* Stop the rest of comments.php from being processed,
Expand All @@ -24,12 +26,12 @@
<?php // You can start editing here -- including this comment! ?> <?php // You can start editing here -- including this comment! ?>


<?php if ( have_comments() ) : ?> <?php if ( have_comments() ) : ?>
<h3 id="comments-title"><?php printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'coraline' ), number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' ); ?></h3> <h3 id="comments-title"><?php printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'wppb_lang' ), number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' ); ?></h3>


<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
<div class="navigation"> <div class="navigation">
<div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'coraline' ) ); ?></div> <div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'wppb_lang' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'coraline' ) ); ?></div> <div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'wppb_lang' ) ); ?></div>
</div> <!-- .navigation --> </div> <!-- .navigation -->
<?php endif; // check for comment navigation ?> <?php endif; // check for comment navigation ?>


Expand All @@ -39,8 +41,8 @@


<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
<div class="navigation"> <div class="navigation">
<div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'coraline' ) ); ?></div> <div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'wppb_lang' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'coraline' ) ); ?></div> <div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'wppb_lang' ) ); ?></div>
</div><!-- .navigation --> </div><!-- .navigation -->
<?php endif; // check for comment navigation ?> <?php endif; // check for comment navigation ?>


Expand All @@ -51,11 +53,11 @@
*/ */
if ( ! comments_open() ) : if ( ! comments_open() ) :
?> ?>
<p class="nocomments"><?php _e( 'Comments are closed.', 'coraline' ); ?></p> <?php /*<p class="nocomments"><?php _e( 'Comments are closed.', 'wppb_lang' ); ?></p>*/ ?>
<?php endif; // end ! comments_open() ?> <?php endif; // end ! comments_open() ?>


<?php endif; // end have_comments() ?> <?php endif; // end have_comments() ?>


<?php comment_form(); ?> <?php comment_form(); ?>


</div><!-- #comments --> </div><!-- #comments -->
2 changes: 1 addition & 1 deletion designer/css.php
Expand Up @@ -138,7 +138,7 @@ function wppb_convert_published_urls( $css ) {
$css = wppb_convert_css_on_load( $css ); $css = wppb_convert_css_on_load( $css );
return $css; return $css;
} }
add_filter( 'pixopoint_css_filter', 'wppb_convert_published_urls', $css ); add_filter( 'pixopoint_css_filter', 'wppb_convert_published_urls' );


/* Create CSS from editor submit data /* Create CSS from editor submit data
* @since 0.1 * @since 0.1
Expand Down
3 changes: 1 addition & 2 deletions designer/designs.php
Expand Up @@ -133,7 +133,6 @@ function wppb_grab_design( $design ) {
if ( !isset( $split[1] ) ) if ( !isset( $split[1] ) )
$split[1] = ''; $split[1] = '';
$split = explode( WPPB_NAME_SPLIT_END, $split[1] ); // Splitting data $split = explode( WPPB_NAME_SPLIT_END, $split[1] ); // Splitting data
//$split[0] . '<br />' . $split[1]; // Echo'ing data
$name = $split[0]; $name = $split[0];


if ( !isset( $split[1] ) ) if ( !isset( $split[1] ) )
Expand All @@ -153,7 +152,7 @@ function wppb_publish_options( $wppb_design_settings, $css ) {


// Get options ready for publishing // Get options ready for publishing
$input = wppb_get_options_for_storing( $wppb_design_settings, $css ); $input = wppb_get_options_for_storing( $wppb_design_settings, $css );


// Update database with sanitized data // Update database with sanitized data
update_option( WPPB_SETTINGS, wppb_settings_options_validate( $input ) ); update_option( WPPB_SETTINGS, wppb_settings_options_validate( $input ) );


Expand Down
5 changes: 3 additions & 2 deletions designer/index.php
Expand Up @@ -23,7 +23,7 @@
*/ */
define( 'WPPB_DIR', get_template_directory() . '/designer/' ); // Designer framework directory define( 'WPPB_DIR', get_template_directory() . '/designer/' ); // Designer framework directory
define( 'WPPB_URL', get_template_directory_uri() . '/designer/' ); // Designer framework folder URL define( 'WPPB_URL', get_template_directory_uri() . '/designer/' ); // Designer framework folder URL
define( 'WPPB_CSS_GENERATOR', 'http://pressabl.com/wp-content/plugins/pressabl-css-generator/index.php?wppb_css_generator=process' ); // Designer framework folder URL define( 'WPPB_CSS_GENERATOR', 'http://wppaintbrush.com/wp-content/plugins/wppaintbrush-css-generator/index.php?wppb_css_generator=process' ); // Designer framework folder URL


/** /**
* Include required files * Include required files
Expand All @@ -47,8 +47,9 @@
if ( 'on' == get_option( 'wppb_designer_pane' ) && current_user_can( 'manage_options' ) ) { if ( 'on' == get_option( 'wppb_designer_pane' ) && current_user_can( 'manage_options' ) ) {
add_action( 'wp_footer', 'wppb_updatecolours' ); add_action( 'wp_footer', 'wppb_updatecolours' );
add_action( 'wp_head', 'wppb_inline_scripts' ); add_action( 'wp_head', 'wppb_inline_scripts' );
add_action( 'wp_footer', 'wppb_open_editor' );
} }
elseif ( current_user_can( 'manage_options' ) )
add_action( 'wp_footer', 'wppb_open_editor' );


/* Load AJAX content /* Load AJAX content
* @since 0.1 * @since 0.1
Expand Down
2 changes: 2 additions & 0 deletions designer/modules/designs.php
Expand Up @@ -27,6 +27,7 @@ function wppb_designs_editor_tab() {
?> ?>
<div class="tab-block" id="content_options"> <div class="tab-block" id="content_options">
<div id="blocks_options" class="wide"> <div id="blocks_options" class="wide">
<?php /*
<div class="section-layout"> <div class="section-layout">
<h2><?php _e( 'Choose design', 'wppb_lang' ); ?></h2> <h2><?php _e( 'Choose design', 'wppb_lang' ); ?></h2>
<p><?php _e( 'You can select a default design to start from. We will be adding more designs to this area over time.', 'wppb_lang' ); ?></p> <p><?php _e( 'You can select a default design to start from. We will be adding more designs to this area over time.', 'wppb_lang' ); ?></p>
Expand All @@ -42,6 +43,7 @@ function wppb_designs_editor_tab() {
?> ?>
<br /><br /><br /> <br /><br /><br />
</div> </div>
*/ ?>
<div class="section-layout"> <div class="section-layout">
<h2><?php _e( 'Layout', 'wppb_lang' ); ?></h2> <h2><?php _e( 'Layout', 'wppb_lang' ); ?></h2>
<p><?php _e( 'You can modify your layout by dragging content boxes around.', 'wppb_lang' ); ?></p> <p><?php _e( 'You can modify your layout by dragging content boxes around.', 'wppb_lang' ); ?></p>
Expand Down
3,341 changes: 0 additions & 3,341 deletions designer/modules/temp.html

This file was deleted.

3 changes: 2 additions & 1 deletion designer/sanitization.php
Expand Up @@ -95,7 +95,8 @@ function wppb_sanitize_inputs( $input='' ) {
$input[$opt] = ''; $input[$opt] = '';
$image_location_initial = explode( '/', $input[$opt] ); $image_location_initial = explode( '/', $input[$opt] );
$image_location_final[0] = sanitize_file_name( $image_location_initial[0] ); $image_location_final[0] = sanitize_file_name( $image_location_initial[0] );
$image_location_final[1] = sanitize_file_name( $image_location_initial[1] ); if ( isset( $image_location_initial[1] ) )
$image_location_final[1] = sanitize_file_name( $image_location_initial[1] );
$wppb_design_settings[$opt] = implode( '/', $image_location_final ); $wppb_design_settings[$opt] = implode( '/', $image_location_final );
if ( '/' == $wppb_design_settings[$opt] ) if ( '/' == $wppb_design_settings[$opt] )
$wppb_design_settings[$opt] = ''; $wppb_design_settings[$opt] = '';
Expand Down
42 changes: 37 additions & 5 deletions functions.php
Expand Up @@ -21,14 +21,23 @@
define( 'PIXOPOINT_SETTINGS_COPYRIGHT', 'Theme by <a href="http://wppaintbrush.com/">WPPaintbrush.com</a>' ); // Copyright constant define( 'PIXOPOINT_SETTINGS_COPYRIGHT', 'Theme by <a href="http://wppaintbrush.com/">WPPaintbrush.com</a>' ); // Copyright constant
define( 'WPPB_ADMIN_URL', get_template_directory_uri() . '/admin' ); // Admin directory URL define( 'WPPB_ADMIN_URL', get_template_directory_uri() . '/admin' ); // Admin directory URL
define( 'WPPB_TEMPLATES_LABEL', 'Themes' ); // Decides what label to give the templates page (for theme selection page - in development as an addon plugin) define( 'WPPB_TEMPLATES_LABEL', 'Themes' ); // Decides what label to give the templates page (for theme selection page - in development as an addon plugin)
define( 'WPPB_SETTINGS', 'wppb_settings' ); // Label for option used to store template code in database
define( 'WPPB_DESIGNER_SETTINGS', 'wppb_designer_settings' ); // Label for option used to store designer settings in database
define( 'WPPB_STORAGE_FOLDER', 'wppb_storage' ); define( 'WPPB_STORAGE_FOLDER', 'wppb_storage' );
define( 'WPPB_STORAGE_IMAGES_FOLDER', wppb_storage_folder( 'images', 'url' ) ); define( 'WPPB_STORAGE_IMAGES_FOLDER', wppb_storage_folder( 'images', 'url' ) );
define( 'WPPB_BLOCK_SPLITTER', "/* PixoPoint Template option */\n" ); // Strings used to descriminate between differents bits in exported/imported files define( 'WPPB_BLOCK_SPLITTER', "/* PixoPoint Template option */\n" ); // Strings used to descriminate between differents bits in exported/imported files
define( 'WPPB_NAME_SPLIT_START', '[----' ); // Strings used to descriminate between differents bits in exported/imported files define( 'WPPB_NAME_SPLIT_START', '[----' ); // Strings used to descriminate between differents bits in exported/imported files
define( 'WPPB_NAME_SPLIT_END', "----]\n" ); // Strings used to descriminate between differents bits in exported/imported files define( 'WPPB_NAME_SPLIT_END', "----]\n" ); // Strings used to descriminate between differents bits in exported/imported files


/* Set Theme specific Constants
* Defined later due to child themes needing to override these constants (allows child themes to store data separately from core theme)
* @since 1.0.6
*/
function wppb_theme_constants() {
define( 'WPPB_SETTINGS', 'wppb_settings' ); // Label for option used to store template code in database
define( 'WPPB_DESIGNER_SETTINGS', 'wppb_designer_settings' ); // Label for option used to store designer settings in database
}
if ( !defined( 'WPPB_SETTINGS' ) )
add_action( 'init', 'wppb_theme_constants', 1 );

/** /**
* Set widget suffixes * Set widget suffixes
* Currently uses numbers, but could easily incorporate text instead * Currently uses numbers, but could easily incorporate text instead
Expand All @@ -53,7 +62,6 @@ function wppb_settings_thumbs_array() {
*/ */
function get_wppb_option( $option='' ) { function get_wppb_option( $option='' ) {


// Grab options from database
$options = get_option( WPPB_SETTINGS ); $options = get_option( WPPB_SETTINGS );


// Choose which bit to return // Choose which bit to return
Expand Down Expand Up @@ -89,7 +97,6 @@ function get_wppb_option( $option='' ) {
require( get_template_directory() . '/admin_pages.php' ); // Admin specific functions - need loaded for front end of theme roller too require( get_template_directory() . '/admin_pages.php' ); // Admin specific functions - need loaded for front end of theme roller too
require( get_template_directory() . '/designer/index.php' ); // Loading designer interface require( get_template_directory() . '/designer/index.php' ); // Loading designer interface
require( get_template_directory() . '/templating/index.php' ); // Loading PixoPoint emplating framework require( get_template_directory() . '/templating/index.php' ); // Loading PixoPoint emplating framework
require( get_template_directory() . '/import-export.php' ); // Loading Import/Export script
require( get_template_directory() . '/images.php' ); // Loading image uploader functions require( get_template_directory() . '/images.php' ); // Loading image uploader functions


/** /**
Expand All @@ -105,7 +112,10 @@ function get_wppb_option( $option='' ) {
* Dynamically create CSS file * Dynamically create CSS file
* @since 0.3 * @since 0.3
*/ */
function bla() {
pixopoint_fallback_css( WPPB_SETTINGS, 'css' ); pixopoint_fallback_css( WPPB_SETTINGS, 'css' );
}
add_action( 'init', 'bla');


/** /**
* Sanitize and validate input * Sanitize and validate input
Expand Down Expand Up @@ -256,6 +266,28 @@ function wppb_callback_string_in_templates( $v1, $v2 ) {
return $v1 . "\n\n\n\n\n" . $v2; return $v1 . "\n\n\n\n\n" . $v2;
} }


/**
* Utilized within child themes for changing to a new design
* @since 1.0.6
*/
function wppb_child_theme_setup() {
global $pagenow;

$css = get_wppb_option( 'css' ); // Used for checking if data stored
if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" && !isset( $css ) ) {

// Grab design
$wppb_design = wppb_grab_design( WPPB_CHILD_THEME ); // Grab design

// Change the design to the one specified (alters front-end editor settings)
wppb_change_design( $wppb_design );

// Publish theme
wppb_publish_options( $wppb_design, $wppb_design['css'] );

}
}

/** /**
* Load CSS * Load CSS
* @since 0.1 * @since 0.1
Expand All @@ -267,7 +299,7 @@ function wppb_settings_css() {
return; return;


// Load CSS (uses PixoPoint templating framework function as addon plugins for the framework will allow for variations in how the CSS loaded, eg: inline CSS, static cached files etc.) // Load CSS (uses PixoPoint templating framework function as addon plugins for the framework will allow for variations in how the CSS loaded, eg: inline CSS, static cached files etc.)
pixopoint_css( 'wppb_settings' ); pixopoint_css( WPPB_SETTINGS );
} }
add_action( 'wp_print_styles', 'wppb_settings_css' ); add_action( 'wp_print_styles', 'wppb_settings_css' );


Expand Down

0 comments on commit 4b112f7

Please sign in to comment.