Changeset 1105500
- Timestamp:
- 03/04/2015 10:52:48 PM (11 years ago)
- Location:
- storyform/trunk
- Files:
-
- 5 edited
-
class-storyform-admin-meta-box.php (modified) (2 diffs)
-
class-storyform-options.php (modified) (8 diffs)
-
class-storyform.php (modified) (1 diff)
-
media/storyform-media.js (modified) (1 diff)
-
theme/single-storyform.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
storyform/trunk/class-storyform-admin-meta-box.php
r1092850 r1105500 58 58 </select> 59 59 <div class="storyform-post-options"> 60 <div class="storyform-input-group ">60 <div class="storyform-input-group storyform-improve"> 61 61 <progress class="storyform-improve-progress storyform-improve-low" value="1" max="4" ></progress><span class="storyform-improve-text storyform-improve-low"><span class="storyform-improve-count">0</span> post recommendation(s)</span> 62 62 <ul class="storyform-improve-items"> … … 192 192 $template = ( $template == 'pthemedefault' ) ? null: $template; 193 193 $name = sanitize_text_field( strtolower( $_POST['post_name'] ) ); 194 $layout_type = sanitize_text_field( strtolower( $_POST['storyform-layout-type'] ) );195 $use_featured_image = $ _POST['storyform-use-featured-image'] === 'on';194 $layout_type = $template ? sanitize_text_field( strtolower( $_POST['storyform-layout-type'] ) ) : null; 195 $use_featured_image = $template ? isset( $_POST['storyform-use-featured-image'] ) && $_POST['storyform-use-featured-image'] === 'on' : true; 196 196 $ab = isset( $_POST['storyform-ab'] ); 197 197 -
storyform/trunk/class-storyform-options.php
r1092850 r1105500 40 40 41 41 /** 42 * Gets the Storyform template for a give Post Id or Post name. Id is preferred43 *44 */45 function get_template_for_post( $post_id, $post_name ) {46 return get_post_meta( $post_id, $this->meta_name, true );47 }48 49 /**50 42 * Gets whether template should be Storyform A/B tested 51 43 * … … 60 52 */ 61 53 function update_ab_for_post( $post_id, $value ) { 62 update_post_meta( $post_id, $this->ab_name, $value );54 $this->update_post_meta( $post_id, $this->ab_name, $value ); 63 55 } 64 56 … … 72 64 73 65 /** 66 * Gets the Storyform template for a give Post Id or Post name. Id is preferred 67 * 68 */ 69 function get_template_for_post( $post_id, $post_name ) { 70 return get_post_meta( $post_id, $this->meta_name, true ); 71 } 72 73 /** 74 74 * Sets the options array 75 75 * 76 76 */ 77 77 function update_template_for_post( $post_id, $post_name, $template ) { 78 update_post_meta( $post_id, $this->meta_name, $template );78 $this->update_post_meta( $post_id, $this->meta_name, $template ); 79 79 } 80 80 … … 85 85 function update_layout_type_for_post( $post_id, $value ){ 86 86 if($value !== 'ordered' && $value !== 'slideshow' && $value !== 'freeflow'){ 87 delete_post_meta( $post_id, $this->layout_type_name ); 87 88 return false; 88 89 } … … 110 111 function update_use_featured_image_for_post( $post_id, $value ){ 111 112 // Invert so our default is true 112 update_post_meta( $post_id, $this->featured_image_name, !$value );113 $this->update_post_meta( $post_id, $this->featured_image_name, !$value ); 113 114 } 114 115 … … 142 143 143 144 public function update_crop_area_for_attachment( $attachment_id, $value ){ 144 update_post_meta( $attachment_id, $this->crop_name, $value);145 $this->update_post_meta( $attachment_id, $this->crop_name, $value); 145 146 } 146 147 … … 150 151 151 152 public function update_caption_area_for_attachment( $attachment_id, $value ){ 152 update_post_meta( $attachment_id, 'storyform_text_overlay_areas', $value);153 $this->update_post_meta( $attachment_id, 'storyform_text_overlay_areas', $value); 153 154 } 154 155 … … 501 502 return $functions; 502 503 } 504 505 protected function update_post_meta( $post_id, $meta_key, $meta_value ){ 506 if( !$meta_value ){ 507 delete_post_meta( $post_id, $meta_key ); 508 } else { 509 update_post_meta( $post_id, $meta_key, $meta_value ); 510 } 511 } 503 512 } -
storyform/trunk/class-storyform.php
r1095524 r1105500 100 100 } 101 101 102 /** 103 * Loads our navbar template and allows for it to be overridden. 104 * 105 */ 106 public static function navbar_template() { 107 $navbar_template = dirname( __FILE__ ) . '/navbar.php'; 108 /** 109 * Filter the path to the navbar template file used for the navbar 110 * 111 * 112 * @param string $navbar_template The path to the navbar template file. 113 */ 114 $include = apply_filters( 'storyform_navbar_template', $navbar_template ); 115 if( file_exists( $include ) ){ 116 require ( $include ); 117 } else { 118 require( dirname( __FILE__ ) . '/theme/navbar.php' ); 119 } 120 } 121 102 122 103 123 /** -
storyform/trunk/media/storyform-media.js
r1092850 r1105500 140 140 } 141 141 function checkImprovements(){ 142 if(!jQuery('.storyform-improve').length){ 143 return; 144 } 145 142 146 var items = 0; 143 147 -
storyform/trunk/theme/single-storyform.php
r1052107 r1105500 61 61 62 62 </article> 63 <?php require( dirname( __FILE__ ) . '/navbar.php' );?>63 <?php Storyform::navbar_template() ?> 64 64 <div class="primary-content"> 65 65 <div class="magazine" data-win-control="Controls.FlipView">
Note: See TracChangeset
for help on using the changeset viewer.