Permalink
Browse files

- Add protean_ prefix to all php and js function

- Use init wp action hook instead of call direct to style php file
  • Loading branch information...
1 parent ffa40eb commit 829cd4a82ba8c706f16110ce0b9b2f4387bd8f59 @nblue nblue committed Jun 28, 2011
Showing with 113 additions and 106 deletions.
  1. +0 −1 css/pagestyle.php
  2. +78 −68 functions.php
  3. +3 −3 header.php
  4. +4 −4 inc/admin-functions.php
  5. +7 −7 inc/banner-edit.php
  6. +2 −4 js/file_manager.js
  7. +8 −8 js/page_style.js
  8. +6 −6 js/post_edit.js
  9. +5 −5 js/theme_option.js
View
@@ -1,6 +1,5 @@
<?php
header("Content-type: text/css");
-require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
if(isset($_GET['id']))
$postid = $_GET['id'];
View
@@ -1,71 +1,81 @@
<?php
- require_once(TEMPLATEPATH . '/inc/admin-functions.php');
- require_once(TEMPLATEPATH . '/inc/preset.php');
- require_once(TEMPLATEPATH . '/inc/theme-options.php');
- require_once(TEMPLATEPATH . '/inc/post-options.php');
-
- define('GOOGLE_FONT_URL','http://fonts.googleapis.com/css?family=');
-
- // Add RSS links to <head> section
- add_theme_support( 'automatic-feed-links' );
- add_theme_support( 'menus' );
-
- if ( function_exists( 'register_nav_menu' ) ) {
- register_nav_menu( 'navigation', 'Top Navigation' );
+require_once(TEMPLATEPATH . '/inc/admin-functions.php');
+require_once(TEMPLATEPATH . '/inc/preset.php');
+require_once(TEMPLATEPATH . '/inc/theme-options.php');
+require_once(TEMPLATEPATH . '/inc/post-options.php');
+
+define('GOOGLE_FONT_URL','http://fonts.googleapis.com/css?family=');
+
+// Add RSS links to <head> section
+add_theme_support( 'automatic-feed-links' );
+add_theme_support( 'menus' );
+
+add_action( 'init' , 'protean_generate_style');
+
+if ( function_exists( 'register_nav_menu' ) ) {
+ register_nav_menu( 'navigation', 'Top Navigation' );
+}
+
+// Load jQuery
+if ( !is_admin() ) {
+ wp_deregister_script('jquery');
+ wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"), false);
+ wp_enqueue_script('jquery');
+}
+
+// Clean up the <head>
+function removeHeadLinks() {
+ remove_action('wp_head', 'rsd_link');
+ remove_action('wp_head', 'wlwmanifest_link');
+}
+
+add_action('init', 'removeHeadLinks');
+remove_action('wp_head', 'wp_generator');
+
+if (function_exists('register_sidebar')) {
+ register_sidebar( array(
+ 'name' => __( 'Header Widget Area', 'protean' ),
+ 'id' => 'widget-area-1',
+ 'description' => __( 'Header widget area, full width', 'protean' ),
+ 'before_widget' => '<div id="%1$s" class="widget %2$s">',
+ 'after_widget' => '</div>',
+ 'before_title' => '<span class="widget_title">',
+ 'after_title' => '</span>',
+ ) );
+ register_sidebar(array(
+ 'name' => __( 'Bottom Widget Area 1', 'protean' ),
+ 'id' => 'widget-area-2',
+ 'description' => __( 'Bottom widget area 1, one third, float left', 'protean' ),
+ 'before_widget' => '<div id="%1$s" class="widget %2$s">',
+ 'after_widget' => '</div>',
+ 'before_title' => '<span class="widget_title">',
+ 'after_title' => '</span>',
+ ) );
+ register_sidebar(array(
+ 'name' => __( 'Bottom Widget Area 2', 'protean' ),
+ 'id' => 'widget-area-3',
+ 'description' => __( 'Bottom widget area 2, one third, float left', 'protean' ),
+ 'before_widget' => '<div id="%1$s" class="widget %2$s">',
+ 'after_widget' => '</div>',
+ 'before_title' => '<span class="widget_title">',
+ 'after_title' => '</span>',
+ ) );
+ register_sidebar(array(
+ 'name' => __( 'Bottom Widget Area 3', 'protean' ),
+ 'id' => 'widget-area-4',
+ 'description' => __( 'Bottom widget area 3, one third, float left', 'protean' ),
+ 'before_widget' => '<div id="%1$s" class="widget %2$s">',
+ 'after_widget' => '</div>',
+ 'before_title' => '<span class="widget_title">',
+ 'after_title' => '</span>',
+ ) );
+}
+
+function protean_generate_style(){
+ if(isset($_GET['action']) && $_GET['action']=='protean_style'){
+ require_once(TEMPLATEPATH . '/css/pagestyle.php');
+ die();
}
-
- // Load jQuery
- if ( !is_admin() ) {
- wp_deregister_script('jquery');
- wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"), false);
- wp_enqueue_script('jquery');
- }
-
- // Clean up the <head>
- function removeHeadLinks() {
- remove_action('wp_head', 'rsd_link');
- remove_action('wp_head', 'wlwmanifest_link');
- }
-
- add_action('init', 'removeHeadLinks');
- remove_action('wp_head', 'wp_generator');
-
- if (function_exists('register_sidebar')) {
- register_sidebar( array(
- 'name' => __( 'Header Widget Area', 'protean' ),
- 'id' => 'widget-area-1',
- 'description' => __( 'Header widget area, full width', 'protean' ),
- 'before_widget' => '<div id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<span class="widget_title">',
- 'after_title' => '</span>',
- ) );
- register_sidebar(array(
- 'name' => __( 'Bottom Widget Area 1', 'protean' ),
- 'id' => 'widget-area-2',
- 'description' => __( 'Bottom widget area 1, one third, float left', 'protean' ),
- 'before_widget' => '<div id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<span class="widget_title">',
- 'after_title' => '</span>',
- ) );
- register_sidebar(array(
- 'name' => __( 'Bottom Widget Area 2', 'protean' ),
- 'id' => 'widget-area-3',
- 'description' => __( 'Bottom widget area 2, one third, float left', 'protean' ),
- 'before_widget' => '<div id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<span class="widget_title">',
- 'after_title' => '</span>',
- ) );
- register_sidebar(array(
- 'name' => __( 'Bottom Widget Area 3', 'protean' ),
- 'id' => 'widget-area-4',
- 'description' => __( 'Bottom widget area 3, one third, float left', 'protean' ),
- 'before_widget' => '<div id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<span class="widget_title">',
- 'after_title' => '</span>',
- ) );
- }
+ return true;
+}
?>
View
@@ -38,15 +38,15 @@
<?php
$idstr ='';
if(is_single()){
- $idstr = '?id='.get_the_ID();
+ $idstr = 'id='.get_the_ID();
}else if ( have_posts() ) {
while ( have_posts() ) : the_post();
$postid[] = get_the_ID();
endwhile;// end posts loop
- $idstr = '?ids='.implode(',',$postid);
+ $idstr = 'ids='.implode(',',$postid);
} ?>
- <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/pagestyle.php<?php echo $idstr ?>" type="text/css" />
+ <link rel="stylesheet" href="<?php echo get_bloginfo('url'); ?>?action=protean_style&<?php echo $idstr ?>" type="text/css" />
<?php get_template_part( 'inc/font-import') ?>
View
@@ -52,7 +52,7 @@ function protean_fontsize_option($selected=null){
}
//Generate select options for line-height
-function lineHeightOptions($selected=null){
+function protean_lineHeightOptions($selected=null){
for($i=0;$i<=10;$i++){
$size = (($i+2) * 2)/10;
if($size==$selected)$s="selected='selected'";
@@ -63,7 +63,7 @@ function lineHeightOptions($selected=null){
}
//Generate select options for text-shadow
-function textShadowOptions($selected=null){
+function protean_textShadowOptions($selected=null){
$options = array(
array('Blur dark','0.05em 0.05em 0.1em #222'),
array('Blur light','0.05em 0.05em 0.1em #eee'),
@@ -83,7 +83,7 @@ function textShadowOptions($selected=null){
}
//Generate select option for text-align
-function textAlign($selected=null){
+function protean_textAlign($selected=null){
$options = array(
array('Left align','left'),
array('Right align','right'),
@@ -98,7 +98,7 @@ function textAlign($selected=null){
}
//Generate select option for banner-border size
-function bannerBorder($selected=null){
+function protean_bannerBorder($selected=null){
$options = array(
array('0 px','0'),
array('1 px','1'),
View
@@ -49,7 +49,7 @@
<th valign="middle" scope="row"><label for="link_notes"><strong><?php _e('Border:')?></strong></label></th>
<td>
<select name="<?php echo $paramname; ?>[banner_border]" id="protean_banner_border" class="fl_left" style="width:105px;margin: 0 5px 0 0;">
- <?php echo (isset($options['banner_border']))?bannerBorder($options['banner_border']):bannerBorder() ?>
+ <?php echo (isset($options['banner_border']))?protean_bannerBorder($options['banner_border']):protean_bannerBorder() ?>
</select>
<span class="protean_text_in_form"> in </span>
<div class="protean_color_holder" id="protean_banner_bordercolor">
@@ -75,14 +75,14 @@
</div>
<select name="<?php echo $paramname; ?>[bannertitle_lineheight]" id="protean_bannertitle_lineheight" class="fl_left">
<option value="1.5"><?php _e('Default')?></option>
- <?php echo (isset($options['bannertitle_lineheight']))?lineHeightOptions($options['bannertitle_lineheight']):lineHeightOptions() ?>
+ <?php echo (isset($options['bannertitle_lineheight']))?protean_lineHeightOptions($options['bannertitle_lineheight']):protean_lineHeightOptions() ?>
</select>
<select name="<?php echo $paramname; ?>[bannertitle_shadow]" id="protean_bannertitle_shadow" class="fl_left">
<option value=""><?php _e('None')?></option>
- <?php echo (isset($options['bannertitle_shadow']))?textShadowOptions($options['bannertitle_shadow']):textShadowOptions() ?>
+ <?php echo (isset($options['bannertitle_shadow']))?protean_textShadowOptions($options['bannertitle_shadow']):protean_textShadowOptions() ?>
</select>
<select name="<?php echo $paramname; ?>[bannertitle_align]" id="protean_bannertitle_align" class="fl_left">
- <?php echo (isset($options['bannertitle_align']))?textAlign($options['bannertitle_align']):textAlign() ?>
+ <?php echo (isset($options['bannertitle_align']))?protean_textAlign($options['bannertitle_align']):protean_textAlign() ?>
</select>
</td>
</tr>
@@ -103,14 +103,14 @@
</div>
<select name="<?php echo $paramname; ?>[bannersubtitle_lineheight]" id="protean_bannersubtitle_lineheight" class="fl_left">
<option value="1.5"><?php _e('Default')?></option>
- <?php echo (isset($options['bannersubtitle_lineheight']))?lineHeightOptions($options['bannersubtitle_lineheight']):lineHeightOptions() ?>
+ <?php echo (isset($options['bannersubtitle_lineheight']))?protean_lineHeightOptions($options['bannersubtitle_lineheight']):protean_lineHeightOptions() ?>
</select>
<select name="<?php echo $paramname; ?>[bannersubtitle_shadow]" id="protean_bannersubtitle_shadow" class="fl_left">
<option value=""><?php _e('None')?></option>
- <?php echo (isset($options['bannersubtitle_shadow']))?textShadowOptions($options['bannersubtitle_shadow']):textShadowOptions() ?>
+ <?php echo (isset($options['bannersubtitle_shadow']))?protean_textShadowOptions($options['bannersubtitle_shadow']):protean_textShadowOptions() ?>
</select>
<select name="<?php echo $paramname; ?>[bannersubtitle_align]" id="protean_bannersubtitle_align" class="fl_left">
- <?php echo (isset($options['bannersubtitle_align']))?textAlign($options['bannersubtitle_align']):textAlign() ?>
+ <?php echo (isset($options['bannersubtitle_align']))?protean_textAlign($options['bannersubtitle_align']):protean_textAlign() ?>
</select>
</td>
</tr>
View
@@ -13,8 +13,8 @@ jQuery(document).ready(function(){
if (filemanager_target) {
imgurl = jQuery('img',html).attr('src');
jQuery('#'+filemanager_target).val(imgurl);
- if(typeof window.buildPreview == 'function' && filemanager_target == 'protean_body_image')buildPreview();
- if(typeof window.buildBanner == 'function')buildBanner();
+ if(typeof window.protean_buildPreview == 'function' && filemanager_target == 'protean_body_image')protean_buildPreview();
+ if(typeof window.protean_buildBanner == 'function')protean_buildBanner();
filemanager_target = false;
window.send_to_editor = window.original_send_to_editor;
tb_remove();
@@ -24,6 +24,4 @@ jQuery(document).ready(function(){
}
return false;
});
-
-
});
View
@@ -1,12 +1,12 @@
jQuery(document).ready(function(){
- buildPreview(true);
+ protean_buildPreview(true);
jQuery('#font_options').change(function(){
- buildPreview();
+ protean_buildPreview();
});
jQuery('#fontsize_options').change(function(){
- buildPreview();
+ protean_buildPreview();
});
var thiscol;
@@ -31,16 +31,16 @@ jQuery(document).ready(function(){
onChange: function (hsb, hex, rgb) {
thiscol.children('div').css('backgroundColor', '#' + hex);
thiscol.children('input[type=hidden]').val(hex);
- if(typeof window.buildPreview == 'function')buildPreview();
- if(typeof window.buildBanner == 'function')buildBanner();
+ if(typeof window.protean_buildPreview == 'function')protean_buildPreview();
+ if(typeof window.protean_buildBanner == 'function')protean_buildBanner();
}
});
});
jQuery('#protean_clear_background').click(function(e){
e.preventDefault();
jQuery('#protean_body_image').val('');
- buildPreview();
+ protean_buildPreview();
});
jQuery('#protean_save_as_preset').change(function(){
@@ -78,12 +78,12 @@ jQuery(document).ready(function(){
jQuery(this).children('div').css('background-color','#'+jQuery(this).children('input[type=hidden]').val());
});
- buildPreview(true);
+ protean_buildPreview(true);
}
});
});
-function buildPreview(changepreset){
+function protean_buildPreview(changepreset){
if(!changepreset){
jQuery('#protean_theme_presets option:first-child').attr('selected','selected');
}
View
@@ -1,7 +1,7 @@
var bannerMaxWidth;
jQuery(document).ready(function(){
- initBanner();
- buildBanner();
+ protean_initBanner();
+ protean_buildBanner();
jQuery('#title').keyup(function(){
jQuery('#protean_banner_title h1').text(jQuery(this).val());
@@ -52,17 +52,17 @@ jQuery(document).ready(function(){
});
jQuery('#protean_banner_options select').change(function(){
- buildBanner();
+ protean_buildBanner();
});
jQuery('#protean_clear_bannerbgimage').click(function(e){
e.preventDefault();
jQuery('#protean_banner_bgimage').val('');
- buildBanner();
+ protean_buildBanner();
});
});
-function buildBanner(){
+function protean_buildBanner(){
bannerMaxWidth = 870-(jQuery('#protean_banner_border').val()*2);
jQuery('#protean_banner_background').css('background-image','url('+jQuery('#protean_banner_bgimage').val()+')');
jQuery('#protean_banner_background').css('background-color','#'+jQuery('#protean_banner_bgcolor input').val());
@@ -93,7 +93,7 @@ function buildBanner(){
});
}
-function initBanner(){
+function protean_initBanner(){
jQuery('#protean_banner_title').css('left', jQuery('#protean_bannertitle_posx').val()+'px');
jQuery('#protean_banner_title').css('top', jQuery('#protean_bannertitle_posy').val()+'px');
jQuery('#protean_banner_title').css('width', jQuery('#protean_bannertitle_width').val()+'px');
Oops, something went wrong.

0 comments on commit 829cd4a

Please sign in to comment.