Changeset 960367
- Timestamp:
- 08/05/2014 08:24:39 AM (12 years ago)
- Location:
- post-status-scheduler
- Files:
-
- 2 added
- 9 edited
-
assets/screenshot-2.png (modified) (previous)
-
assets/screenshot-3.png (modified) (previous)
-
assets/screenshot-4.png (modified) (previous)
-
trunk/classes/event.php (added)
-
trunk/classes/scheduler.php (modified) (14 diffs)
-
trunk/classes/settings.php (modified) (6 diffs)
-
trunk/classes/taxonomy.php (added)
-
trunk/languages/post-status-scheduler-sv_SE.mo (modified) (previous)
-
trunk/languages/post-status-scheduler-sv_SE.pot (modified) (2 diffs)
-
trunk/post-status-scheduler.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
post-status-scheduler/trunk/classes/scheduler.php
r933176 r960367 14 14 15 15 namespace post_status_scheduler; 16 17 require_once( 'event.php' ); 18 require_once( 'taxonomy.php' ); 19 20 use \post_status_scheduler\Event as Event; 21 use \post_status_scheduler\Taxonomy as Taxonomy; 16 22 17 23 class Scheduler { … … 150 156 $date = isset( $postdata['scheduler']['date'] ) && strlen( $postdata['scheduler']['date'] ) == 10 ? $postdata['scheduler']['date'] : null; 151 157 $time = isset( $postdata['scheduler']['time'] ) && strlen( $postdata['scheduler']['time'] ) == 5 ? $postdata['scheduler']['time'] : null; 152 $scheduler_check_status = isset( $postdata['scheduler']['post-status-check'] ) ? true : false; 153 $scheduler_status = isset( $postdata['scheduler']['status'] ) ? $postdata['scheduler']['status'] : null; 158 159 // Create a new event container 160 $event = new Event( $post_id ); 161 162 $event->check_status = isset( $postdata['scheduler']['post-status-check'] ) ? true : false; 163 $event->status = isset( $postdata['scheduler']['status'] ) ? $postdata['scheduler']['status'] : null; 154 164 155 $scheduler_check_category = isset( $postdata['scheduler']['category-check'] ) ? true : false; 156 $scheduler_category_action = isset( $postdata['scheduler']['category-action'] ) ? $postdata['scheduler']['category-action'] : null; 157 $scheduler_category = isset( $postdata['scheduler']['category'] ) ? $postdata['scheduler']['category'] : null; 158 159 $scheduler_check_meta = isset( $postdata['scheduler']['postmeta-check'] ) ? true : false; 160 $scheduler_meta_key = isset( $postdata['scheduler']['meta_key'] ) ? $postdata['scheduler']['meta_key'] : null; 165 // Categories 166 $event->check_category = isset( $postdata['scheduler']['category-check'] ) ? true : false; 167 168 // Adding categories 169 $event->category_action = isset( $postdata['scheduler']['category-action'] ) ? true : false; 170 $event->category = isset( $postdata['scheduler']['category'] ) ? $postdata['scheduler']['category'] : array(); 171 172 $event->check_meta = isset( $postdata['scheduler']['postmeta-check'] ) ? true : false; 173 $event->meta_key = isset( $postdata['scheduler']['meta_key'] ) ? $postdata['scheduler']['meta_key'] : null; 161 174 162 175 // Check if there is an old timestamp to clear away 163 $old_timestamp = get_post_meta( $post->ID, 'post_status_scheduler_date', true ); 176 //$old_timestamp = get_post_meta( $post->ID, 'post_status_scheduler_date', true ); 177 $old_timestamp = Scheduler::previous_schedule( $post->ID ); 164 178 165 179 // Is there a timestamp to save? 166 180 if( !empty( $date ) && !empty( $time ) && isset( $postdata['scheduler']['use'] ) ) { 167 181 168 $new_timestamp = strtotime( $date . ' ' . $time . ':00' ); 169 170 // Abort if not a valid timestamp 171 if( !isset( $new_timestamp ) || !is_int( $new_timestamp ) ) return $post_id; 182 if( !$new_timestamp = Scheduler::create_timestamp( $date, $time ) ) { 183 184 return $post_id; 185 186 } 172 187 173 188 // Remove old scheduled event and post meta tied to the post … … 175 190 176 191 Scheduler::unschedule( $post->ID ); 177 Scheduler::delete_meta( $post->ID ); 178 179 } 180 181 182 // Get the current system time to compare with the new scheduler timestamp 183 $system_time = microtime( true ); 184 $gmt = get_gmt_from_date( date( 'Y-m-d H:i:s', $new_timestamp ),'U'); 185 186 // The gmt needs to be bigger than the current system time 187 if( $gmt <= $system_time ) return $post_id; 192 Event::delete( $post->ID ); 193 194 } 195 196 197 if( !$gmt = Scheduler::check_gmt_against_system_time( $new_timestamp ) ) return $post_id; 188 198 189 199 // Clear old scheduled time if there is one … … 197 207 if( $scheduling_result ) { 198 208 199 update_post_meta( $post->ID, 'scheduler_date', $new_timestamp ); 200 201 // Post status 202 update_post_meta( $post->ID, 'scheduler_check_status', $scheduler_check_status ); 203 update_post_meta( $post->ID, 'scheduler_status', $scheduler_status ); 204 205 // post category 206 update_post_meta( $post->ID, 'scheduler_check_category', $scheduler_check_category ); 207 update_post_meta( $post->ID, 'scheduler_category_action', $scheduler_category_action ); 208 update_post_meta( $post->ID, 'scheduler_category', $scheduler_category ); 209 $event->date = $new_timestamp; 210 $event->save(); 209 211 210 // post meta211 update_post_meta( $post->ID, 'scheduler_check_meta', $scheduler_check_meta );212 update_post_meta( $post->ID, 'scheduler_meta_key', $scheduler_meta_key );213 214 212 apply_filters( 'post_status_scheduler_after_scheduling_success', $post->ID ); 215 213 … … 229 227 230 228 // Remove post meta 231 Scheduler::delete_meta( $post->ID );229 Event::delete( $post->ID ); 232 230 233 231 } … … 245 243 */ 246 244 public function schedule_post_status_change( $post_id ) { 247 245 248 246 // Get all scheduler postmeta data 249 $scheduler_check_status = get_post_meta( $post_id, 'scheduler_check_status', true ); 250 $scheduler_check_status = !empty( $scheduler_check_status ) ? true : false; 251 $scheduler_status = get_post_meta( $post_id, 'scheduler_status', true ); 252 253 $scheduler_check_category = get_post_meta( $post_id, 'scheduler_check_category', true ); 254 $scheduler_check_category = !empty( $scheduler_check_category ) ? true : false; 255 $scheduler_category_action = get_post_meta( $post_id, 'scheduler_category_action', true ); 256 $scheduler_category = get_post_meta( $post_id, 'scheduler_category', true ); 257 258 if( !empty( $scheduler_category ) ) { 259 260 $scheduler_category_splits = explode( '_', $scheduler_category ); 261 if( count( $scheduler_category_splits ) == 2 ) { 262 263 $scheduler_category = $scheduler_category_splits[0]; 264 $scheduler_category_taxonomy = $scheduler_category_splits[1]; 265 266 } 267 268 } 269 270 $scheduler_check_meta = get_post_meta( $post_id, 'scheduler_check_meta', true ); 271 $scheduler_check_meta = !empty( $scheduler_check_meta ) ? true : false; 272 $scheduler_meta_key = get_post_meta( $post_id, 'scheduler_meta_key', true ); 273 247 $event = new Event( $post_id ); 248 274 249 $valid_statuses = array_keys( Scheduler::post_statuses() ); 275 250 276 251 // Add a filter for developers to change the flow 277 $filter_result = apply_filters( 'post_status_scheduler_before_execution', array( 'status' => $ scheduler_status, 'valid_statuses' => $valid_statuses ), $post_id );252 $filter_result = apply_filters( 'post_status_scheduler_before_execution', array( 'status' => $event->status, 'valid_statuses' => $valid_statuses ), $post_id ); 278 253 $scheduler_status = $filter_result['status']; 279 254 $valid_statuses = $filter_result['valid_statuses']; 280 255 281 if( $ scheduler_check_status ) {256 if( $event->check_status ) { 282 257 283 258 // Execute the scheduled status change 284 if( in_array( $ scheduler_status, $valid_statuses ) ) {285 286 switch( $ scheduler_status ) {259 if( in_array( $event->status, $valid_statuses ) ) { 260 261 switch( $event->status ) { 287 262 case 'draft': 288 263 case 'pending': 289 264 case 'private': 290 wp_update_post( array( 'ID' => $post_id, 'post_status' => $ scheduler_status ) );265 wp_update_post( array( 'ID' => $post_id, 'post_status' => $event->status ) ); 291 266 break; 292 267 case 'trash': … … 305 280 306 281 // If user just wish to remove a post meta 307 if( $scheduler_check_meta ) { 308 309 if( !empty( $scheduler_meta_key ) ) { 310 delete_post_meta( $post_id, $scheduler_meta_key ); 311 } 312 313 } 314 315 316 // If user wish to add or remove a category 317 if( $scheduler_check_category ) { 318 319 if( !empty( $scheduler_category_action ) ) { 320 321 if( $scheduler_category_action == 'add' ) { 322 323 wp_set_post_terms( $post_id, array( $scheduler_category ), $scheduler_category_taxonomy, true ); 324 325 } else if( $scheduler_category_action == 'remove' ) { 326 327 $categories = wp_get_post_terms( $post_id, $scheduler_category_taxonomy ); 328 $new_categories = array(); 329 330 if( count( $categories ) > 0 ) { 331 332 foreach( $categories as $key => $category ) { 333 334 array_push( $new_categories, $category->term_id ); 335 282 if( $event->check_meta ) { 283 284 if( !empty( $event->meta_key ) ) { 285 delete_post_meta( $post_id, $event->meta_key ); 286 } 287 288 } 289 290 291 // Add and remove categories 292 if( $event->check_category ) { 293 294 if( is_array( $event->category ) ) { 295 296 if( count( $event->category ) > 0 ) { 297 298 // Reset all categories 299 Taxonomy::reset_all_terms( $post_id ); 300 301 foreach( $event->category as $scheduler_cat ) { 302 303 $scheduler_category_splits = explode( '_', $scheduler_cat ); 304 if( count( $scheduler_category_splits ) >= 2 ) { 305 306 // Get the category id 307 $scheduler_category_to_add = array_shift( $scheduler_category_splits ); 308 // Get the taxonomy of the category 309 $scheduler_category_taxonomy = implode( '_', $scheduler_category_splits ); 310 311 // Update the categories 312 Taxonomy::set_terms( $post_id, array( $scheduler_category_to_add ), $scheduler_category_taxonomy, true ); 313 336 314 } 337 315 338 316 } 339 340 $position = array_search( $scheduler_category, $new_categories ); 341 unset( $new_categories[$position] ); 342 343 wp_set_post_terms( $post_id, $new_categories, $scheduler_category_taxonomy ); 317 } 318 319 } else { // This is here for legacy reasons, versions <= 0.2.1 320 321 if( is_string( $event->category ) && strlen( $event->category ) > 0 ) { 322 323 if( !empty( $event->category_action ) ) { 324 325 $scheduler_category_splits = explode( '_', $event->category ); 326 if( count( $scheduler_category_splits ) >= 2 ) { 327 328 // Get the category id 329 $scheduler_category = array_shift( $scheduler_category_splits ); 330 331 // Get the taxonomy of the category 332 $scheduler_category_taxonomy = implode( '_', $scheduler_category_splits ); 333 334 if( $scheduler_category_action == 'add' ) { 335 336 Taxonomy::set_terms( $post_id, array( $scheduler_category ), $scheduler_category_taxonomy, true ); 337 338 } else if( $event->category_action == 'remove' ) { 339 340 $categories = Taxonomy::get_terms( $post_id, $scheduler_category_taxonomy ); 341 $new_categories = array(); 342 343 if( count( $categories ) > 0 ) { 344 345 foreach( $categories as $key => $category ) { 346 347 array_push( $new_categories, $category->term_id ); 348 349 } 350 351 } 352 353 $position = array_search( $scheduler_category, $new_categories ); 354 unset( $new_categories[$position] ); 355 356 Taxonomy::set_terms( $post_id, $new_categories, $scheduler_category_taxonomy ); 357 358 } 359 360 } 361 362 } 344 363 345 364 } … … 353 372 354 373 // Remove post meta 355 Scheduler::delete_meta( $post_id );374 Event::delete( $post_id ); 356 375 357 376 apply_filters( 'post_status_scheduler_after_execution', array( 'status' => $scheduler_status, 'valid_statuses' => $valid_statuses ), $post_id ); … … 399 418 global $post, $post_type; 400 419 420 $event = new Event( $post->ID ); 421 401 422 // Get valid post types set in module settings page 402 423 $allowed_posttypes = isset( $this->options['allowed_posttypes'] ) ? $this->options['allowed_posttypes'] : array(); 403 424 $meta_keys = isset( $this->options['meta_keys'] ) ? $this->options['meta_keys'] : array(); 404 $categories = Scheduler::get_posttype_categories( $post_type ); 405 406 $scheduler_check_status = get_post_meta( $post->ID, 'scheduler_check_status', true ); 407 $scheduler_check_status = !empty( $scheduler_check_status ) ? true : false; 408 $scheduler_status = get_post_meta( $post->ID, 'scheduler_status', true ); 409 410 $scheduler_check_category = get_post_meta( $post->ID, 'scheduler_check_category', true ); 411 $scheduler_check_category = !empty( $scheduler_check_category ) ? true : false; 412 $scheduler_category_action = get_post_meta( $post->ID, 'scheduler_category_action', true ); 413 if( empty( $scheduler_category_action ) ) $scheduler_category_action = 'add'; 414 $scheduler_category = get_post_meta( $post->ID, 'scheduler_category', true ); 415 416 $scheduler_check_meta = get_post_meta( $post->ID, 'scheduler_check_meta', true ); 417 $scheduler_check_meta = !empty( $scheduler_check_meta ) ? true : false; 418 $scheduler_meta_key = get_post_meta( $post->ID, 'scheduler_meta_key', true ); 425 $categories = Taxonomy::get_posttype_terms( $post_type ); 426 427 $post_categories = Taxonomy::get_all_terms( $post->ID ); 428 $post_categories = Taxonomy::setup_post_terms( $post_categories, $categories ); 419 429 420 430 // Do not show HTML if there are no valid post types or current edit page is not for a valid post type 421 431 if( count( $allowed_posttypes ) && in_array( $post_type, $allowed_posttypes ) ) { 422 432 423 $date = get_post_meta( $post->ID, 'scheduler_date', true );424 $status = get_post_meta( $post->ID, 'scheduler_status', true );433 $date = $event->date; 434 $status = $event->status; 425 435 426 436 $date = isset( $date ) && strlen( $date ) > 0 ? date( 'Y-m-d H:i', $date ) : null; … … 436 446 $show = empty( $date ) ? ' style="display: none;" ' : ''; 437 447 438 $scheduler_check_status_checked = ( $ scheduler_check_status ) ? ' checked="checked" ' : '';439 $scheduler_check_status_show = ( !$ scheduler_check_status ) ? ' style="display: none;" ' : '';440 441 $scheduler_check_category_checked = ( $ scheduler_check_category ) ? ' checked="checked" ' : '';442 $scheduler_check_category_show = ( !$ scheduler_check_category ) ? ' style="display: none;" ' : '';443 444 $scheduler_check_meta_checked = ( $ scheduler_check_meta ) ? ' checked="checked" ' : '';445 $scheduler_check_meta_show = ( !$ scheduler_check_meta ) ? ' style="display: none;" ' : '';448 $scheduler_check_status_checked = ( $event->check_status ) ? ' checked="checked" ' : ''; 449 $scheduler_check_status_show = ( !$event->check_status ) ? ' style="display: none;" ' : ''; 450 451 $scheduler_check_category_checked = ( $event->check_category ) ? ' checked="checked" ' : ''; 452 $scheduler_check_category_show = ( !$event->check_category ) ? ' style="display: none;" ' : ''; 453 454 $scheduler_check_meta_checked = ( $event->check_meta ) ? ' checked="checked" ' : ''; 455 $scheduler_check_meta_show = ( !$event->check_meta ) ? ' style="display: none;" ' : ''; 446 456 447 457 // Write the HTML … … 473 483 if( count( $categories ) > 0 ) { 474 484 475 echo '<input type="checkbox" name="scheduler[category-check]" id="scheduler-category" ' . $scheduler_check_category_checked . ' /> ' . __( ' Add or remove category', 'post-status-scheduler' ) . '<br />'485 echo '<input type="checkbox" name="scheduler[category-check]" id="scheduler-category" ' . $scheduler_check_category_checked . ' /> ' . __( 'Change categories', 'post-status-scheduler' ) . '<br />' 476 486 .'<div id="scheduler-category-box" ' . $scheduler_check_category_show . '>'; 477 echo '<input type="radio" value="add" name="scheduler[category-action]" ' . checked( $scheduler_category_action, 'add', false ) . ' /> ' . __( 'Add', 'post-status-scheduler' ) . '<br />' 478 . '<input type="radio" value="remove" name="scheduler[category-action]" ' . checked( $scheduler_category_action, 'remove', false ) . ' /> ' . __( 'Remove', 'post-status-scheduler' ) . '<br />' 479 . '<select name="scheduler[category]">'; 480 481 if( count( $categories ) > 0 ) { 482 foreach( $categories as $category ) { 483 484 echo sprintf( '<option value="%s">%s</option>', $category->term_id.'_'.$category->taxonomy, $category->name ); 487 echo __( 'The post will have the following categories on scheduled time', 'post-status-scheduler' ); 488 echo '<select name="scheduler[category][]" multiple size="5">'; 489 490 // Need this for legacy reasons. Used to be a string, versions <= 0.2.1 491 if( is_string( $event->category ) ) { 492 493 if( $event->category_action == 'add' ) { 494 495 if( !in_array( $event->category, $post_categories ) ) array_push( $post_categories, $event->category ); 496 497 498 } else if( $event->category_action == 'remove' ) { 499 500 if( ( $key = array_search( $event->category, $post_categories ) ) !== false ) { 501 502 unset( $post_categories[$key] ); 503 504 } else if( in_array( $category->term_id.'_'.$category->taxonomy, $post_categories ) ) { 505 506 $selected = ' selected="selected" '; 507 508 } 485 509 486 510 } 511 487 512 } 488 513 489 echo '</select><br />' 490 . '</div>'; 514 // Loop categories and check if selected 515 foreach( $categories as $category ) { 516 517 if( is_array( $event->category ) ) { 518 519 $selected = in_array( $category->term_id.'_'.$category->taxonomy, $event->category ) ? ' selected="selected" ' : ''; 520 521 } else { 522 523 $selected = in_array( $category->term_id.'_'.$category->taxonomy, $post_categories ) ? ' selected="selected" ' : ''; 524 525 } 526 527 echo sprintf( '<option value="%s"%s>%s</option>', $category->term_id.'_'.$category->taxonomy, $selected, $category->name ); 528 529 } 530 531 echo '</select></div>'; 532 491 533 } 492 534 … … 612 654 613 655 /** 656 * check_gmt_against_system_time 657 * 658 * @param integer $new_timestamp 659 * 660 * @return integer $gmt; 661 */ 662 public static function check_gmt_against_system_time( $new_timestamp ) { 663 664 // Get the current system time to compare with the new scheduler timestamp 665 $system_time = microtime( true ); 666 $gmt = get_gmt_from_date( date( 'Y-m-d H:i:s', $new_timestamp ),'U'); 667 668 // The gmt needs to be bigger than the current system time 669 if( $gmt <= $system_time ) return false; 670 671 return $gmt; 672 673 } 674 675 676 /** 677 * create_timestamp 678 * 679 * Create a new timestamp from given date and time 680 * 681 * @param string $date 682 * @param string $time 683 * 684 * @return boolen|integer 685 */ 686 public static function create_timestamp( $date, $time ) { 687 688 $timestamp = strtotime( $date . ' ' . $time . ':00' ); 689 690 //Abort if not a valid timestamp 691 if( !isset( $timestamp ) || !is_int( $timestamp ) ) return false; 692 693 return $timestamp; 694 695 } 696 697 698 /** 699 * previous_schedule 700 * 701 * Return a previously scheduled time for this post 702 * 703 * @param $post_id 704 * 705 * @return string 706 */ 707 public static function previous_schedule( $post_id ) { 708 709 return get_post_meta( $post->ID, 'post_status_scheduler_date', true ); 710 711 } 712 713 714 /** 614 715 * list_meta_keys 615 716 * … … 665 766 } 666 767 667 668 /**669 * delete_meta670 *671 * Deletes the old postmeta for the post given672 *673 * @param int $postid674 */675 public static function delete_meta( $post_id ) {676 677 // Remove post meta678 delete_post_meta( $post_id, 'scheduler_date' );679 680 // post status681 delete_post_meta( $post_id, 'scheduler_check_status' );682 delete_post_meta( $post_id, 'scheduler_status' );683 684 // post category685 delete_post_meta( $post_id, 'scheduler_check_category' );686 delete_post_meta( $post_id, 'scheduler_category_action' );687 delete_post_meta( $post_id, 'scheduler_category' );688 689 // post meta690 delete_post_meta( $post_id, 'scheduler_check_meta' );691 delete_post_meta( $post_id, 'scheduler_meta_key' );692 693 }694 695 696 /**697 * get_posttype_categories698 *699 * Get all categories registered to a post type700 *701 * @param string $post_type702 * @return array703 */704 public static function get_posttype_categories( $post_type ) {705 706 $taxonomies = get_object_taxonomies( $post_type );707 708 $args = array(709 'type' => $post_type,710 'orderby' => 'name',711 'order' => 'ASC',712 'hide_empty' => false,713 'taxonomy' => $taxonomies,714 );715 716 $categories = get_categories( $args );717 718 return $categories;719 720 }721 768 722 769 … … 741 788 } 742 789 790 743 791 } 744 792 -
post-status-scheduler/trunk/classes/settings.php
r933176 r960367 85 85 ); 86 86 87 /* SECTION POSTTYPES */ 88 87 89 add_settings_section( 88 90 'posttypes', // ID … … 90 92 array( $this, 'print_section_info' ), // Callback 91 93 'post-status-scheduler' // Page 92 ); 94 ); 93 95 94 96 add_settings_field( … … 108 110 ); 109 111 112 113 /* SECTION NOTIFICATION EMAIL */ 114 115 /* Planned for release 0.4.0 */ 116 117 /*add_settings_section( 118 'notifications', // ID 119 __( 'Notification', 'post-status-scheduler' ), // Title 120 array( $this, 'print_notification_section_info' ), // Callback 121 'post-status-scheduler' // Page 122 ); 123 124 add_settings_field( 125 'notification_email_enabled', // ID 126 __( 'Enable email notification option on scheduled changes', 'post-status-scheduler' ), // Title 127 array( $this, 'notification_email_enabled_callback' ), // Callback 128 'post-status-scheduler', // Page 129 'notifications' // Section 130 ); 131 132 add_settings_field( 133 'notification_email_subject', // ID 134 __( 'Email subject', 'post-status-scheduler' ), // Title 135 array( $this, 'notification_email_subject_callback' ), // Callback 136 'post-status-scheduler', // Page 137 'notifications' // Section 138 ); 139 140 add_settings_field( 141 'notification_email_body', // ID 142 __( 'Email body', 'post-status-scheduler' ), // Title 143 array( $this, 'notification_email_body_callback' ), // Callback 144 'post-status-scheduler', // Page 145 'notifications' // Section 146 );*/ 147 148 110 149 } 111 150 … … 147 186 } 148 187 188 /*if( isset( $input['notification_email_enabled'] ) ) { 189 190 $new_input['notification_email_enabled'] = true; 191 192 } else { 193 194 $new_input['notification_email_enabled'] = false; 195 196 } 197 198 if( isset( $input['notification_email_subject'] ) ) { 199 200 $new_input['notification_email_subject'] = esc_attr( $input['notification_email_subject'] ); 201 202 } 203 204 if( isset( $input['notification_email_body'] ) ) { 205 206 $new_input['notification_email_body'] = esc_attr( $input['notification_email_body'] ); 207 208 }*/ 209 149 210 return $new_input; 150 211 … … 157 218 158 219 print __( 'Enter your settings below:', 'post-status-scheduler' ); 220 221 } 222 223 /** 224 * Print the Section text 225 */ 226 public function print_notification_section_info() { 227 228 print __( 'Edit the email settings used by the notification email on a scheduled change:', 'post-status-scheduler' ); 159 229 160 230 } … … 240 310 241 311 312 /** 313 * notification_email_enabled_callback 314 * 315 * Callback for the enabling of notification option 316 */ 317 public function notification_email_enabled_callback() { 318 319 $options = get_option( 'post_status_scheduler' ); 320 $enabled = !empty( $options['notification_email_enabled'] ) ? $options['notification_email_enabled'] : ''; 321 ?> 322 323 <input type="checkbox" name="post_status_scheduler[notification_email_enabled]" <?php checked( $enabled, true ); ?> /> 324 325 <?php 326 } 327 328 329 330 /** 331 * notification_email_subject_callback 332 * 333 * Callback for the subject of the notification email 334 */ 335 public function notification_email_subject_callback() { 336 337 $options = get_option( 'post_status_scheduler' ); 338 $subject = !empty( $options['notification_email_subject'] ) ? $options['notification_email_subject'] : ''; 339 printf( '<input type="text" name="post_status_scheduler[notification_email_subject]" value="%s" />', $subject ); 340 341 } 342 343 344 /** 345 * notification_email_body_callback 346 * 347 * Callback for the body of the notification email 348 */ 349 public function notification_email_body_callback() { 350 351 $options = get_option( 'post_status_scheduler' ); 352 $body = !empty( $options['notification_email_body'] ) ? $options['notification_email_body'] : ''; 353 354 printf( '<textarea name="post_status_scheduler[notification_email_body]">%s</textarea>', $body ); 355 356 } 357 358 242 359 } 243 360 -
post-status-scheduler/trunk/languages/post-status-scheduler-sv_SE.pot
r933176 r960367 2 2 msgstr "" 3 3 "Project-Id-Version: post-status-scheduler\n" 4 "POT-Creation-Date: 2014-0 6-11 17:53+0100\n"5 "PO-Revision-Date: 2014-0 6-11 21:15+0100\n"4 "POT-Creation-Date: 2014-08-05 09:46+0100\n" 5 "PO-Revision-Date: 2014-08-05 09:49+0100\n" 6 6 "Last-Translator: Andeas Färnstrand <[email protected]>\n" 7 7 "Language-Team: <[email protected]>\n" … … 15 15 "X-Poedit-SearchPath-0: .\n" 16 16 17 #: classes/scheduler.php:37 17 #: classes/scheduler.php:460 18 msgid "Schedule Status Change" 19 msgstr "Schemalägg statusändring" 20 21 #: classes/scheduler.php:462 22 msgid "Date" 23 msgstr "Datum" 24 25 #: classes/scheduler.php:464 26 msgid "Time" 27 msgstr "Tid" 28 29 #: classes/scheduler.php:468 30 msgid "Change status" 31 msgstr "Ändra status" 32 33 #: classes/scheduler.php:470 34 msgid "Set status to" 35 msgstr "Ändra status till" 36 37 #: classes/scheduler.php:485 38 msgid "Change categories" 39 msgstr "Ändra kategorier" 40 41 #: classes/scheduler.php:487 42 msgid "The post will have the following categories on scheduled time" 43 msgstr "Följande kategorier kommer att sättas vid schemalagd tid" 44 45 #: classes/scheduler.php:537 46 msgid "Remove postmeta" 47 msgstr "Ta bort postmeta" 48 49 #: classes/scheduler.php:575 50 msgid "Scheduled date" 51 msgstr "Schemalagt datum" 52 53 #: classes/scheduler.php:781 18 54 msgid "Draft" 19 55 msgstr "Utkast" 20 56 21 #: classes/scheduler.php: 3857 #: classes/scheduler.php:782 22 58 msgid "Pending" 23 59 msgstr "Väntar på granskning" 24 60 25 #: classes/scheduler.php: 3961 #: classes/scheduler.php:783 26 62 msgid "Private" 27 63 msgstr "Privat" 28 64 29 #: classes/scheduler.php: 4065 #: classes/scheduler.php:784 30 66 msgid "Trashbin" 31 67 msgstr "Papperskorg" 32 68 33 #: classes/scheduler.php: 4169 #: classes/scheduler.php:785 34 70 msgid "Delete (forced)" 35 71 msgstr "Radera (tvingad)" 36 72 37 #: classes/scheduler.php:468 38 msgid "Schedule Status Change" 39 msgstr "Schemalägg statusändring" 40 41 #: classes/scheduler.php:470 42 msgid "Date" 43 msgstr "Datum" 44 45 #: classes/scheduler.php:472 46 msgid "Time" 47 msgstr "Tid" 48 49 #: classes/scheduler.php:476 50 msgid "Change status" 51 msgstr "Ändra status" 52 53 #: classes/scheduler.php:478 54 msgid "Set status to" 55 msgstr "Ändra status till" 56 57 #: classes/scheduler.php:493 58 msgid "Add or remove category" 59 msgstr "Lägg till eller ta bort kategori" 60 61 #: classes/scheduler.php:495 62 msgid "Add" 63 msgstr "Lägg till" 64 65 #: classes/scheduler.php:496 66 msgid "Remove" 67 msgstr "Ta bort" 68 69 #: classes/scheduler.php:513 70 msgid "Remove postmeta" 71 msgstr "Ta bort postmeta" 72 73 #: classes/scheduler.php:550 74 msgid "Scheduled date" 75 msgstr "Schemalagt datum" 76 77 #: classes/settings.php:43 classes/settings.php:61 73 #: classes/settings.php:44 classes/settings.php:62 78 74 msgid "Post Status Scheduler" 79 75 msgstr "Post Status Scheduler" 80 76 81 #: classes/settings.php: 8877 #: classes/settings.php:91 82 78 msgid "Post Types" 83 79 msgstr "Posttyper" 84 80 85 #: classes/settings.php:9 581 #: classes/settings.php:98 86 82 msgid "Check the post types you wish to display the Scheduler on" 87 83 msgstr "Kryssa i de posttyper som du vill visa schemaläggaren på" 88 84 89 #: classes/settings.php:10 385 #: classes/settings.php:106 90 86 msgid "Mark allowed meta fields to be shown as removable" 91 87 msgstr "Märk de metafält som skall vara valbara för borttagning" 92 88 93 #: classes/settings.php:157 89 #: classes/settings.php:117 90 msgid "Notification" 91 msgstr "Notifikation" 92 93 #: classes/settings.php:124 94 msgid "Enable email notification option on scheduled changes" 95 msgstr "Aktivera epostnotifikation vid schemalagda ändringar" 96 97 #: classes/settings.php:132 98 msgid "Email subject" 99 msgstr "Epostämne" 100 101 #: classes/settings.php:140 102 msgid "Email body" 103 msgstr "Epostmeddelande" 104 105 #: classes/settings.php:217 94 106 msgid "Enter your settings below:" 95 107 msgstr "Ange inställningar nedan:" 108 109 #: classes/settings.php:226 110 msgid "" 111 "Edit the email settings used by the notification email on a scheduled change:" 112 msgstr "Ändra epostinställningarna som används vid notifikationsepost" 113 114 #~ msgid "Add or remove category" 115 #~ msgstr "Lägg till eller ta bort kategori" 116 117 #~ msgid "Add" 118 #~ msgstr "Lägg till" 119 120 #~ msgid "Remove" 121 #~ msgstr "Ta bort" -
post-status-scheduler/trunk/post-status-scheduler.php
r934729 r960367 39 39 define( 'POST_STATUS_SCHEDULER_TEXTDOMAIN', 'post_status_scheduler' ); 40 40 define( 'POST_STATUS_SCHEDULER_TEXTDOMAIN_PATH', dirname( plugin_basename( __FILE__) ) .'/languages' ); 41 define( 'POST_STATUS_SCHEDULER_VERSION', '0.3.1' ); 41 42 42 43 $pss = new \post_status_scheduler\Scheduler(); -
post-status-scheduler/trunk/readme.txt
r934729 r960367 4 4 Requires at least: 3.9 5 5 Tested up to: 3.9.1 6 Stable tag: 0. 2.16 Stable tag: 0.3.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 15 15 removing of postmeta on any given date or time. It can be activated on any post type and shows 16 16 up on the post edit screen in the publish section. 17 18 = Shortcodes = 19 20 * [pss_scheduled_time post_id="<your post id>"] can be used to get the post's scheduled date and time. 17 21 18 22 == Installation == … … 35 39 == Changelog == 36 40 41 = 0.3.0 = 42 * Rewritten to support setting multiple categories on scheduled time. 43 * A little bit of code clean up. 44 37 45 = 0.2.1 = 38 46 * Added shortcode for getting the date and time for the scheduled post change
Note: See TracChangeset
for help on using the changeset viewer.