Permalink
Browse files

Moving from built in designs to child themes

  • Loading branch information...
1 parent 4705c7f commit 4b112f79cf6156afa83ec7a738ed7c004c105443 @ryanhellyer committed Oct 29, 2011
View
@@ -5,12 +5,14 @@
* @since WP Paintbrush 0.9
*
* Comments template
+ *
+ * Much of the code used in this file was lifted directly from the Coraline theme by Automattic
*/
?>
<div id="comments">
<?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 -->
<?php
/* Stop the rest of comments.php from being processed,
@@ -24,12 +26,12 @@
<?php // You can start editing here -- including this comment! ?>
<?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? ?>
<div class="navigation">
- <div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'coraline' ) ); ?></div>
- <div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', '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>', 'wppb_lang' ) ); ?></div>
</div> <!-- .navigation -->
<?php endif; // check for comment navigation ?>
@@ -39,8 +41,8 @@
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
<div class="navigation">
- <div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'coraline' ) ); ?></div>
- <div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', '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>', 'wppb_lang' ) ); ?></div>
</div><!-- .navigation -->
<?php endif; // check for comment navigation ?>
@@ -51,11 +53,11 @@
*/
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 have_comments() ?>
<?php comment_form(); ?>
-</div><!-- #comments -->
+</div><!-- #comments -->
View
@@ -138,7 +138,7 @@ function wppb_convert_published_urls( $css ) {
$css = wppb_convert_css_on_load( $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
* @since 0.1
View
@@ -133,7 +133,6 @@ function wppb_grab_design( $design ) {
if ( !isset( $split[1] ) )
$split[1] = '';
$split = explode( WPPB_NAME_SPLIT_END, $split[1] ); // Splitting data
- //$split[0] . '<br />' . $split[1]; // Echo'ing data
$name = $split[0];
if ( !isset( $split[1] ) )
@@ -153,7 +152,7 @@ function wppb_publish_options( $wppb_design_settings, $css ) {
// Get options ready for publishing
$input = wppb_get_options_for_storing( $wppb_design_settings, $css );
-
+
// Update database with sanitized data
update_option( WPPB_SETTINGS, wppb_settings_options_validate( $input ) );
View
@@ -23,7 +23,7 @@
*/
define( 'WPPB_DIR', get_template_directory() . '/designer/' ); // Designer framework directory
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
@@ -47,8 +47,9 @@
if ( 'on' == get_option( 'wppb_designer_pane' ) && current_user_can( 'manage_options' ) ) {
add_action( 'wp_footer', 'wppb_updatecolours' );
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
* @since 0.1
@@ -27,6 +27,7 @@ function wppb_designs_editor_tab() {
?>
<div class="tab-block" id="content_options">
<div id="blocks_options" class="wide">
+ <?php /*
<div class="section-layout">
<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>
@@ -42,6 +43,7 @@ function wppb_designs_editor_tab() {
?>
<br /><br /><br />
</div>
+ */ ?>
<div class="section-layout">
<h2><?php _e( 'Layout', 'wppb_lang' ); ?></h2>
<p><?php _e( 'You can modify your layout by dragging content boxes around.', 'wppb_lang' ); ?></p>
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -95,7 +95,8 @@ function wppb_sanitize_inputs( $input='' ) {
$input[$opt] = '';
$image_location_initial = explode( '/', $input[$opt] );
$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 );
if ( '/' == $wppb_design_settings[$opt] )
$wppb_design_settings[$opt] = '';
View
@@ -21,14 +21,23 @@
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_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_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_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
+/* 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
* Currently uses numbers, but could easily incorporate text instead
@@ -53,7 +62,6 @@ function wppb_settings_thumbs_array() {
*/
function get_wppb_option( $option='' ) {
- // Grab options from database
$options = get_option( WPPB_SETTINGS );
// Choose which bit to return
@@ -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() . '/designer/index.php' ); // Loading designer interface
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
/**
@@ -105,7 +112,10 @@ function get_wppb_option( $option='' ) {
* Dynamically create CSS file
* @since 0.3
*/
+function bla() {
pixopoint_fallback_css( WPPB_SETTINGS, 'css' );
+}
+add_action( 'init', 'bla');
/**
* Sanitize and validate input
@@ -257,6 +267,28 @@ function wppb_callback_string_in_templates( $v1, $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
* @since 0.1
*/
@@ -267,7 +299,7 @@ function wppb_settings_css() {
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.)
- pixopoint_css( 'wppb_settings' );
+ pixopoint_css( WPPB_SETTINGS );
}
add_action( 'wp_print_styles', 'wppb_settings_css' );
Oops, something went wrong.

0 comments on commit 4b112f7

Please sign in to comment.