Changeset 1749023
- Timestamp:
- 10/19/2017 06:56:34 AM (7 years ago)
- Location:
- simple-schedule-notice/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
simple-schedule-notice/trunk/readme.txt
r1718499 r1749023 4 4 Tags: reminder,notice,notification,schedule,mail 5 5 Requires at least: 6 Tested up to: 4.8. 16 Tested up to: 4.8.2 7 7 Stable tag: trunk 8 8 License: GPLv2 or later -
simple-schedule-notice/trunk/simple-schedule-notice.php
r1708107 r1749023 17 17 var $module_title, $menu_title; 18 18 var $sys_timezone, $wp_timezone, $msg, $system_error; 19 var $actionhooks; 19 20 20 21 //constructor … … 26 27 register_deactivation_hook( __FILE__, array($this, 'simschntc_deactivation' ) ); 27 28 //setup events 28 foreach ( $this->actionhooks() as $hook => $action ) { 29 add_action( $hook, array($this, $action ) ); 29 $this->actionhooks = array( 30 cActionHook => 'simschntc_process_event', 31 cActionHook_immediate => 'simschntc_process_event', 32 cActionHook_test => 'simschntc_process_testevent' 33 ); 34 foreach ( $this->actionhooks as $hook => $action ) { 35 add_action( $hook, array( $this, $action )); 30 36 } 31 37 //omit appending posttype on mail title … … 266 272 <?php 267 273 $shedcnt = 0; 268 foreach ( array_keys( $this->actionhooks ()) as $hook ) {274 foreach ( array_keys( $this->actionhooks ) as $hook ) { 269 275 $shcdinfo = wp_next_scheduled( $hook ); 270 276 if ( $shcdinfo ) { … … 480 486 $maillist = array(); 481 487 if ( !$post_meta_info[ 'suppress_default1' ] ) { 482 $this->array_a dd( $maillist, $base_info[ 'default_mailaddr1' ] );488 $this->array_append( $maillist, $base_info[ 'default_mailaddr1' ] ); 483 489 } 484 490 if ( !$post_meta_info[ 'suppress_default2' ] ) { 485 $this->array_a dd( $maillist, $base_info[ 'default_mailaddr2' ] );486 } 487 $this->array_a dd( $maillist, $post_meta_info[ 'mailaddr1' ] );488 $this->array_a dd( $maillist, $post_meta_info[ 'mailaddr2' ] );491 $this->array_append( $maillist, $base_info[ 'default_mailaddr2' ] ); 492 } 493 $this->array_append( $maillist, $post_meta_info[ 'mailaddr1' ] ); 494 $this->array_append( $maillist, $post_meta_info[ 'mailaddr2' ] ); 489 495 // vv... seems Array doesnt work. ...vv 490 496 //$result = wp_mail($maillist, ($testmode ? __( 'テスト送信:', cPluginID ) : '').$post_title, $post_content); … … 653 659 // or $default value if array value is not defined. 654 660 // if the type of $default is boolean, either 'true', 'on' or 'yes' returns TRUE. 661 $ret = $default; 655 662 if ( isset( $array[ $key ] ) ) { 656 663 $ret = $array[ $key ]; … … 695 702 break; 696 703 } 697 } else {698 $ret = $default;699 704 } 700 705 return $ret; … … 705 710 } 706 711 707 private function array_a dd( &$arr, $newmember) {708 // Add new member to the array, if $ newmemberis not empty.712 private function array_append( &$arr, $memb ) { 713 // Add new member to the array, if $memb is not empty. 709 714 // Returns nothing. 710 if ( !empty( $newmember ) ) { 711 $arr[] = $newmember; 715 if ( ! empty( $memb ) ) { 716 if ( is_array( $memb )) { 717 foreach ( $memb as $elem ) { 718 $arr[] = $elem; 719 } 720 } else { 721 $arr[] = $memb; 722 } 712 723 } 713 724 } … … 823 834 wp_clear_scheduled_hook( $hook ); 824 835 } else { 825 foreach ( array_keys( $this->actionhooks ()) as $hook ) {836 foreach ( array_keys( $this->actionhooks ) as $hook ) { 826 837 $shcdinfo = wp_next_scheduled( $hook ); 827 838 if ( $shcdinfo ) { … … 858 869 } 859 870 860 private function actionhooks() {861 //Returns event hook list862 return array(863 cActionHook => 'simschntc_process_event',864 cActionHook_immediate => 'simschntc_process_event',865 cActionHook_test => 'simschntc_process_testevent'866 );867 }868 869 871 private function cycledef() { 870 872 return array(
Note: See TracChangeset
for help on using the changeset viewer.