Changeset 1424465
- Timestamp:
- 05/26/2016 04:12:30 AM (10 years ago)
- Location:
- storyform/trunk
- Files:
-
- 4 edited
-
class-storyform-editor-page.php (modified) (24 diffs)
-
class-storyform-settings-page.php (modified) (18 diffs)
-
config.php (modified) (2 diffs)
-
storyform.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
storyform/trunk/class-storyform-editor-page.php
r1404257 r1424465 20 20 add_action( 'wp_ajax_storyform_get_publish_url', array( $this, 'storyform_get_publish_url' ) ); 21 21 add_action( 'wp_ajax_storyform_delete_post', array( $this, 'storyform_delete_post' ) ); 22 add_action( 'wp_ajax_storyform_get_post_types', array( $this, 'storyform_get_post_types' ) ); 22 add_action( 'wp_ajax_storyform_get_post_types', array( $this, 'storyform_get_post_types' ) ); 23 23 add_action( 'wp_ajax_storyform_get_media_sizes', array( $this, 'storyform_get_media_sizes' ) ); 24 add_action( 'wp_ajax_storyform_redirect_admin_edit', array( $this, 'storyform_redirect_admin_edit' ) ); 24 add_action( 'wp_ajax_storyform_redirect_admin_edit', array( $this, 'storyform_redirect_admin_edit' ) ); 25 25 } 26 26 … … 41 41 42 42 add_submenu_page( 43 'storyform-editor', 44 'Add new Storyform', 45 'Add new', 46 'publish_posts', 43 'storyform-editor', 44 'Add new Storyform', 45 'Add new', 46 'publish_posts', 47 47 'storyform-editor' 48 48 ); 49 49 50 50 add_submenu_page( 51 null, 52 'Publish post', 53 'Publish post', 54 'publish_posts', 51 null, 52 'Publish post', 53 'Publish post', 54 'publish_posts', 55 55 'storyform-publish-post', 56 56 array( $this, 'storyform_publish_post' ) … … 74 74 if( $remove && $post_id ){ 75 75 if ( ! wp_verify_nonce( $nonce, 'storyform-post-nonce' ) ) { 76 die( 'Invalid Nonce' ); 76 die( 'Invalid Nonce' ); 77 77 } 78 Storyform_Options::get_instance()->delete_template_for_post( $post_id ); 78 Storyform_Options::get_instance()->delete_template_for_post( $post_id ); 79 79 wp_redirect( get_edit_post_link( $post_id, '&' ) ); 80 80 die(); … … 106 106 107 107 $ajax_nonce = wp_create_nonce( "storyform-post-nonce" ); 108 109 $hostname = Storyform_API::get_instance()->get_ secure_hostname();108 109 $hostname = Storyform_API::get_instance()->get_hostname(); 110 110 111 111 $preview = Storyform_Options::get_instance()->get_preview_next_version(); … … 122 122 $options = Storyform_Options::get_instance(); 123 123 if( !$options->get_template_for_post( $post_id ) ){ 124 $options->update_template_for_post( $post_id, 'Puget' ); 124 $options->update_template_for_post( $post_id, 'Puget' ); 125 125 } 126 126 … … 132 132 $url .= '&preview=true'; 133 133 } 134 134 135 135 ?> 136 136 <script> … … 146 146 check_ajax_referer( 'storyform-post-nonce' ); 147 147 $id = sanitize_text_field( $_POST['id'] ); 148 148 149 149 // Setup main loop to establish is_single() + is_page() for the_content filters to read 150 150 $wp_query = new WP_Query( array( 'p' => $id, 'post_type' => 'any' ) ); … … 176 176 $data['byline'] = get_userdata( $data['post_author'])->display_name; 177 177 $data['display_date'] = get_the_date( get_option('date_format'), $data ); 178 178 179 179 echo json_encode( $data ); 180 181 die(); 180 181 die(); 182 182 } 183 183 … … 193 193 add_filter( 'pre_option_use_balanceTags', array( $this, 'avoid_balance_tags' ) ); 194 194 kses_remove_filters(); 195 195 196 196 $post = array( 197 197 'post_content' => $content, … … 201 201 'post_excerpt' => $excerpt, 202 202 'post_type' => $post_type, 203 ); 203 ); 204 204 $ID = wp_insert_post( $post ); 205 205 … … 208 208 $options->update_template_for_post( $ID, $template ); 209 209 if( $horizontal ){ 210 $options->update_horizontal_for_post( $ID, $horizontal ); 210 $options->update_horizontal_for_post( $ID, $horizontal ); 211 211 } 212 212 … … 245 245 if( count( $revisions ) > 4 ){ 246 246 for( $i = 4; $i < count( $revisions ); $i++ ){ 247 wp_delete_post( $revisions[ $i ]->ID ); 247 wp_delete_post( $revisions[ $i ]->ID ); 248 248 } 249 249 … … 254 254 $post['post_title'] = $revision['post_title']; 255 255 $post['post_excerpt'] = $revision['post_excerpt']; 256 } 256 } 257 257 258 258 } else { … … 271 271 if( isset( $_POST['post_type'] )){ 272 272 $post['post_type'] = sanitize_text_field( $_POST['post_type'] ); 273 } 273 } 274 274 275 275 if( isset( $post['ID'] ) ){ … … 349 349 public function storyform_publish_post(){ 350 350 if( !isset( $_GET['_wpnonce'] ) || !isset( $_GET['id'] ) || !isset( $_GET['name'] ) ) { 351 die( 'Invalid parameters. Nonce, id and name required' ); 351 die( 'Invalid parameters. Nonce, id and name required' ); 352 352 } 353 353 … … 357 357 358 358 if ( ! wp_verify_nonce( $nonce, 'storyform-post-nonce' ) ) { 359 die( 'Invalid Nonce' ); 360 } 359 die( 'Invalid Nonce' ); 360 } 361 361 362 362 add_filter( 'pre_option_use_balanceTags', array( $this, 'avoid_balance_tags' ) ); … … 366 366 $post_obj = get_post( $id ); 367 367 if( !$post_obj ){ 368 die( 'Cannot find post with id: ' . $id ); 368 die( 'Cannot find post with id: ' . $id ); 369 369 } 370 370 … … 397 397 die( 'Unable to update post with changes' ); 398 398 } 399 399 400 400 wp_publish_post( $id ); 401 401 … … 420 420 public function storyform_get_post_types(){ 421 421 check_ajax_referer( 'storyform-post-nonce' ); 422 $post_types = get_post_types(); 422 $post_types = get_post_types(); 423 423 $types = array(); 424 424 $ignore = array( 'attachment', 'revision', 'nav_menu_item' ); … … 440 440 $img_url = wp_get_attachment_url( $id ); 441 441 $img_url_basename = wp_basename( $img_url ); 442 442 443 443 $sizes = array(); 444 444 … … 448 448 } 449 449 $fullAspect = $full[1] / $full[2]; 450 450 451 451 // VIP doesn't store multiple sizes, it generates them on the fly, so we just generate URLs 452 452 if( function_exists( 'wpcom_vip_get_resized_attachment_url' ) ){ 453 $szs = array( 453 $szs = array( 454 454 array( 'width' => 320, 'height' => round( 320 / $fullAspect ) ), 455 455 array( 'width' => 667, 'height' => round( 667 / $fullAspect ) ), … … 476 476 477 477 // Only use scaled images not cropped images (pixel rounding can occur, thus the 0.01) 478 if( $aspect > $fullAspect + 0.01 || $aspect < $fullAspect - 0.01) { 478 if( $aspect > $fullAspect + 0.01 || $aspect < $fullAspect - 0.01) { 479 479 continue; 480 480 } 481 481 482 482 array_push( $sizes, array( 'url' => $url, 'width' => $width, 'height' => $height ) ); 483 483 } … … 486 486 $id_sizes[$id] = $sizes; 487 487 } 488 488 489 489 490 490 echo json_encode( $id_sizes ); … … 499 499 'url' => get_edit_post_link( $id, '&' ) 500 500 ); 501 501 502 502 503 503 echo json_encode( $array ); -
storyform/trunk/class-storyform-settings-page.php
r1404257 r1424465 274 274 StoryformWidgets.init({ 275 275 environment: '<?php echo $storyform_plugin_identifier . " wordpress-" . $wp_version ?>', 276 hostname: '<?php echo Storyform_Api::get_instance()->get_ secure_hostname()?>'276 hostname: '<?php echo Storyform_Api::get_instance()->get_hostname()?>' 277 277 }).then(function(){ 278 278 var dashboard = StoryformWidgets.getControlForElement(document.querySelector('.storyform-settings-dashboard')); 279 279 dashboard.addSite(site); 280 280 jQuery.post(ajaxurl, { action : 'storyform_save_site_registered', _ajax_nonce: '<?php echo $ajax_nonce_site_registered; ?>' }); 281 281 282 282 283 283 var getAppKey = function(){ … … 293 293 }); 294 294 } 295 }); 295 }); 296 296 } 297 297 298 298 dashboard.addEventListener('refresh', getAppKey, false); 299 299 getAppKey(); 300 300 301 301 }); 302 302 … … 316 316 $appKey = sanitize_text_field( $_POST['app_key'] ); 317 317 Storyform_Options::get_instance()->update_application_key( $appKey ); 318 die(); 318 die(); 319 319 } 320 320 … … 326 326 check_ajax_referer( 'storyform-site-registered-save-nonce' ); 327 327 Storyform_Options::get_instance()->update_site_registered( '1' ); 328 die(); 328 die(); 329 329 } 330 330 … … 336 336 check_ajax_referer( 'storyform-reset-all-nonce' ); 337 337 Storyform_Options::get_instance()->reset_all(); 338 die(); 338 die(); 339 339 } 340 340 … … 344 344 public function print_section_navigation() 345 345 { 346 346 347 347 $options = Storyform_Options::get_instance(); 348 348 $width = $options->get_navigation_width(); … … 369 369 <div class="storyform-navigation clearfix"> 370 370 <div class="storyform-navigation-settings clearfix"> 371 <div class="storyform-navigation-group storyform-logo-color"> 371 <div class="storyform-navigation-group storyform-logo-color"> 372 372 <div class="storyform-input-label">Logo</div> 373 373 <div class="storyform-input-group"> … … 375 375 <a href="#" class="button storyform-select-logo" data-uploader-title="Select logo" data-uploader-button-text="Select" title="Add Media">Select logo</a> 376 376 </div> 377 377 378 378 <div class="storyform-input-label">Colors</div> 379 379 <div class="storyform-input-group storyform-navigation-color"> … … 383 383 </div> 384 384 </div> 385 386 <div class="storyform-navigation-group"> 385 386 <div class="storyform-navigation-group"> 387 387 <div class="storyform-input-label">Width</div> 388 388 <div class="storyform-input-group"> … … 390 390 <label><input type="radio" id="storyform-navigation-width-full" class="storyform-navigation-width" name="storyform_settings[storyform_navigation_width]" value="full" <?php echo $width_full ?> />Full width</label> 391 391 </div> 392 392 393 393 <div class="storyform-input-label">Links</div> 394 394 <div class="storyform-input-group"> … … 406 406 </div> 407 407 </div> 408 409 <div class="storyform-navigation-group"> 408 409 <div class="storyform-navigation-group"> 410 410 <div class="storyform-input-label">Border bottom</div> 411 411 <div class="storyform-input-group"> … … 424 424 <input type="checkbox" id="storyform-navigation-title" class="storyform-navigation-title" name="storyform_settings[storyform_navigation_title]" <?php echo $title ?> /><label for="storyform-navigation-title">Display post title</label> 425 425 </div> 426 426 427 427 <div class="storyform-input-label">Controls</div> 428 428 <div class="storyform-input-group"> … … 437 437 </div> 438 438 </div> 439 439 440 440 <div class="storyform-navigation-preview"> 441 441 <div class="storyform-browser"> … … 509 509 %s 510 510 </label> 511 </div>', 511 </div>', 512 512 esc_attr( $handle ), 513 513 esc_attr( $handle ), 514 514 $selected ? 'checked' : '', 515 $description 515 $description 516 516 ); 517 517 } … … 571 571 %s 572 572 </label> 573 </div>', 573 </div>', 574 574 esc_attr( $function['name'] ), 575 575 esc_attr( $function['name'] ), 576 576 $function['selected'] ? 'checked' : '', 577 $description 577 $description 578 578 ); 579 579 } … … 593 593 var storyformAjaxNonce = '<?php echo $ajax_nonce; ?>'; 594 594 </script> 595 <?php 595 <?php 596 596 } 597 597 … … 616 616 $refFunc = new ReflectionClass( $object_parts[0] ); 617 617 } else { 618 $refFunc = new ReflectionFunction( $id ); 618 $refFunc = new ReflectionFunction( $id ); 619 619 } 620 620 } catch (Exception $e){ … … 630 630 return 'WordPress'; 631 631 } 632 632 633 633 return $plugin_dir; 634 634 } -
storyform/trunk/config.php
r1404257 r1424465 24 24 return '//static.storyform.co'; 25 25 } 26 }27 28 function get_secure_hostname(){29 return 'https://storyform.co';30 26 } 31 27 … … 56 52 $version = $this->version; 57 53 } 58 return $this->get_static_hostname() . '/v' . $version . '/js/scroll-analytics.js'; 54 return $this->get_static_hostname() . '/v' . $version . '/js/scroll-analytics.js'; 59 55 } 60 56 -
storyform/trunk/storyform.php
r1404257 r1424465 5 5 Plugin Name: Storyform 6 6 Plugin URI: http://storyform.co/docs/wordpress 7 Version: 0.6.1 37 Version: 0.6.14 8 8 Description: Plugin to enable Storyform on select posts. Works with both SEO and non-SEO permalinks. 9 9 Author: Storyform … … 13 13 14 14 global $storyform_version; 15 $storyform_version = '0.6.1 3'; // The plugin version15 $storyform_version = '0.6.14'; // The plugin version 16 16 17 17 require_once( dirname( __FILE__ ) . '/config.php'); … … 36 36 load_plugin_textdomain( Storyform_Api::get_instance()->get_textdomain(), false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 37 37 } 38 add_action( 'init', 'storyform_init' ); 38 add_action( 'init', 'storyform_init' ); 39 39 40 40 Storyform_Admin_Meta_Box::init(); … … 51 51 if( Storyform::template_in_use() ) { 52 52 add_theme_support( 'automatic-feed-links' ); // Add RSS feed links to <head> for posts and comments. 53 show_admin_bar( false ); 53 show_admin_bar( false ); 54 54 } 55 55 … … 81 81 if ( ! function_exists( 'storyform_layout_type' ) ) : 82 82 function storyform_layout_type() { 83 return Storyform_Options::get_instance()->get_layout_type_for_post( get_the_ID() ); 83 return Storyform_Options::get_instance()->get_layout_type_for_post( get_the_ID() ); 84 84 } 85 85 endif; // storyform_setup
Note: See TracChangeset
for help on using the changeset viewer.