Changeset 1708107
- Timestamp:
- 08/04/2017 12:05:47 AM (8 years ago)
- Location:
- simple-schedule-notice/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
simple-schedule-notice/trunk/class-genfset.php
r1704139 r1708107 8 8 9 9 class GenFset_Class { 10 /* 10 /*** sample html generated : 11 11 * <fieldset class="<?$fldclass?>"> 12 12 * <legend>Password / Confirm</legend> … … 69 69 case 'Trident': 70 70 case 'Edge': 71 $stylestr .= $this-> Con( $stylestr, ' ' ) . 'width:' . (integer)$opt[ 'sz' ]*0.6 . 'em;';71 $stylestr .= $this->con( $stylestr, ' ' ) . 'width:' . (integer)$opt[ 'sz' ]*0.6 . 'em;'; 72 72 break; 73 73 default: 74 $stylestr .= $this-> Con( $stylestr, ' ' ) . 'resize:both;';74 $stylestr .= $this->con( $stylestr, ' ' ) . 'resize:both;'; 75 75 break; 76 76 } … … 102 102 case 'st': 103 103 foreach ( $opval as $stval ) { 104 $stylestr .= ' '. $this->strterm( $stval, ';' );104 $stylestr .= $this->con( $stylestr, ' ' ) . $this->strterm( $stval, ';' ); 105 105 } 106 106 break; … … 111 111 break; 112 112 default: 113 $genstr .= ' '. $opkey . '="' . $opval . '"';113 $genstr .= $this->con( $genstr, ' ' ) . $opkey . '="' . $opval . '"'; 114 114 break; 115 115 } … … 167 167 break; 168 168 default: 169 $rbstr .= ' '. $optkey . '="' . $optval . '"';169 $rbstr .= $this->con( $rbstr, ' ' ) . $optkey . '="' . $optval . '"'; 170 170 break; 171 171 } … … 174 174 $rbstr .= '>'; 175 175 $this->fields[] 176 = '<label 177 } 178 } 179 180 function tag( $tag, $param= array(), $pushstack = True ) {176 = '<label' . ( empty( $lbsty ) ? '' : ' style="' . $lbsty . '"') . '>' . $rbstr . $label . '</label>'; 177 } 178 } 179 180 function tag( $tag, $param='', $pushstack = True ) { 181 181 // do not enclose $tag with < > 182 $str = $tag . ' ' . $this->unstruct( $param ); 182 $ret = $tag; 183 if ( ! empty( $param )) { 184 $ret .= ' ' . $param; 185 } 183 186 if ( $pushstack ) { 184 187 $this->tagstack[ $this->tagcnt++ ] = $tag; 185 $this->fields[] = $this->Capsul( $str, '<>' ); 186 } else { 187 $this->plaintext( $str ); 188 } 188 } 189 $this->fields[] = $this->capsul( $ret, '<>' ); 189 190 } 190 191 … … 195 196 $this->fields[] = 'error : tag stack empty.'; 196 197 } else { 197 $this->fields[] = $this-> Capsul( $this->tagstack[ --$this->tagcnt ], array( '</', '>' ));198 $this->fields[] = $this->capsul( $this->tagstack[ --$this->tagcnt ], array( '</', '>' )); 198 199 } 199 200 } … … 254 255 } 255 256 256 //** support functions257 private function unstruct( $param) {258 // do not use nested definition at this version; will not work properly.259 if ( is_array( $param ) ) {260 $str = '';261 if ( array_values( $param ) === $param ) { //simple array262 foreach ( $param as $value ) {263 $str .= $this->unstruct( $value);264 }257 //**** service methods **** 258 private function get_liststr( $msg, $gtag='ul', $ltag='li' ) { 259 //Returns <ul> list from simple array $msg. 260 $ret = ''; 261 if ( ! empty( $msg )) { 262 if ( is_array( $msg )) { 263 $g_opn = $this->capsul( $gtag, '<>' ); $g_cls = $this->capsul( '/' . $gtag, '<>' ); 264 $l_opn = $this->capsul( $ltag, '<>' ); $l_cls = $this->capsul( '/' . $ltag, '<>' ); 265 $ret = $g_opn . $l_opn . implode( $l_cls . $l_opn, $msg ) . $l_cls . $g_cls; 265 266 } else { 266 foreach ( $param as $key => $value ) { //associative array 267 $str .= $key . '=' . $this->Capsul( $this->unstruct( $value ), '"' ); 268 } 269 } 270 } else { 271 $str = $param; 272 } 273 return $str; 274 } 275 276 private function get_liststr( $msg ) { 277 //simple array $msg returns <ul> list. 278 $ret = ''; 279 if ( is_string( $msg )) { 280 $ret = $msg; 281 } elseif ( is_array( $msg )) { 282 if ( !empty( $msg )) { 283 $ret = '<ul>'; 284 foreach ( $msg as $line ) { 285 $ret .= '<li>' . $line . '</li>'; 286 } 287 $ret .= '</ul>'; 267 $ret = $msg; 288 268 } 289 269 } … … 291 271 } 292 272 293 private function Con( $base, $conchar = ' and ', $default = '' ) {273 private function con( $base, $conchar = ' and ', $default = '' ) { 294 274 //Returns concatination string. 295 275 return (empty( $base ) ? $default : $conchar); … … 306 286 } 307 287 308 private function Capsul( $str, $sep="'" ) {288 private function capsul( $str, $sep="'" ) { 309 289 if ( is_array( $sep )) { 310 290 $sep_h = $sep[ 0 ]; … … 312 292 } else { 313 293 $siz = strlen( $sep ); 314 if ( 2 == $siz ) {315 $sep_h = substr( $sep, 0, 1 );294 if ( 2 <= $siz ) { 295 $sep_h = substr( $sep, 0, $siz - 1 ); 316 296 $sep_f = substr( $sep, -1, 1 ); 317 297 } else { //expects 1 normally … … 319 299 } 320 300 } 321 return $sep_h . $str . $sep_f; 301 $siz = strlen( $sep_h ); 302 return ( $sep_h <> substr( $str, 0, $siz ) ? $sep_h . $str . $sep_f : $str ); 322 303 } 323 304 -
simple-schedule-notice/trunk/readme.txt
r1704140 r1708107 4 4 Tags: reminder,notice,notification,schedule,mail 5 5 Requires at least: 6 Tested up to: 4.8 (php 5.6.8)6 Tested up to: 4.8.1 (php 5.6.8) 7 7 Stable tag: trunk 8 8 License: GPLv2 or later … … 45 45 == Changelog == 46 46 47 = 1.0.3 = 48 * Code changes for efficiency. 49 47 50 = 1.0.2 = 48 51 * Fixed the problem that the width of "textarea" is too small on MSIE and Edge. -
simple-schedule-notice/trunk/simple-schedule-notice.php
r1704140 r1708107 8 8 Text Domain: smpl_shcd_notice 9 9 Domain Path: /languages 10 Version: 1.0. 210 Version: 1.0.3 11 11 */ 12 12 include_once 'definitions.php'; … … 108 108 $this->update_baseinfo( $baseinfo ); 109 109 } 110 $suppress_list = $this->gen_setting page( $baseinfo, $err );110 $suppress_list = $this->gen_setting_page( $baseinfo, $err ); 111 111 break; 112 112 case 'new': //show detail screen 113 113 $post_id = 0; 114 114 list( $post_info, $post_meta_info ) = $this->get_defaultdata(); 115 $suppress_list = $this->gen_detail page( $post_id, $post_info, $post_meta_info );115 $suppress_list = $this->gen_detail_page( $post_id, $post_info, $post_meta_info ); 116 116 break; 117 117 case 'edit': 118 118 $post_id = $this->PVal( $dir, 0 ); 119 119 list( $post_info, $post_meta_info ) = $this->get_dbdata( $post_id ); 120 $suppress_list = $this->gen_detail page( $post_id, $post_info, $post_meta_info );120 $suppress_list = $this->gen_detail_page( $post_id, $post_info, $post_meta_info ); 121 121 break; 122 122 case 'delete': … … 134 134 $err = $this->check_detailinput( $post_info, $post_meta_info ); 135 135 if ( !empty( $err ) ) { 136 $suppress_list = $this->gen_detail page( $post_id, $post_info, $post_meta_info, $err );136 $suppress_list = $this->gen_detail_page( $post_id, $post_info, $post_meta_info, $err ); 137 137 } else { 138 138 $this->update_schedule( $post_id, $post_info, $post_meta_info ); … … 158 158 } 159 159 if ( !$suppress_list ) { 160 $this->gen_setting page();160 $this->gen_setting_page(); 161 161 } 162 162 } 163 163 164 164 //generate base info screen 165 private function gen_setting page( $baseinfo = null, $err = array() ) {165 private function gen_setting_page( $baseinfo = null, $err = array() ) { 166 166 global $post, $authordata; //setup_postdata requires "global $post" is used 167 167 … … 195 195 $fset->open( __( 'Notification Time', cPluginID ) ); 196 196 $fid = 'notify_time'; 197 $fset->tag( 'div', array( 'style' => 'display: inline-block;' ));197 $fset->tag( 'div', 'style=display: inline-block;' ); 198 198 $fset->input( $fid, $baseinfo[ $fid ], array( 'sz'=>10, 'ph' => __( 'Enter notification time.', cPluginID ) ) ); 199 $fset->tag( 'span', array( 'style'=>'margin-left: 1em;' ));199 $fset->tag( 'span', 'style=margin-left: 1em;' ); 200 200 $fset->plaintext( '( 00:00:00 .. 23:59:59 )' ); 201 201 $fset->c_tag(); … … 330 330 331 331 //generate detail screen 332 private function gen_detail page( $post_id, $post_info, $post_meta_info, $err = array() ) {332 private function gen_detail_page( $post_id, $post_info, $post_meta_info, $err = array() ) { 333 333 $this->gen_article_hdr( 'shdntc-detail' ); 334 334 … … 348 348 $cycnam = $this->get_cycle($yr, $mo, $da, 'n'); 349 349 $fset->open( __( 'Notification Cycle', cPluginID ) ); 350 $fset->tag( 'p', array( 'style'=>'margin: 0.5em 0em;' ));350 $fset->tag( 'p', 'style=margin: 0.5em 0em;' ); 351 351 $fset->radio('cycle', $this->cycledef(), $cycnam, array( 'onClick'=>'cy_ctl()' )); 352 352 $fset->c_tag(); 353 $fset->tag( 'p', array( 'style'=>'margin: 0.5em 0em;' ));354 $fset->tag( 'span', array( 'style'=>'margin-right: 2em;' ));353 $fset->tag( 'p', 'style=margin: 0.5em 0em;' ); 354 $fset->tag( 'span', 'style=margin-right: 2em;' ); 355 355 $fset->plaintext( __( 'Year :', cPluginID ) . ' ' ); 356 356 $fset->input( 'YR', $yr, array('im' => 'numeric', 'sz' => 4 ) ); 357 357 $fset->c_tag(); 358 $fset->tag( 'span', array( 'style'=>'margin-right: 2em;' ));358 $fset->tag( 'span', 'style=margin-right: 2em;' ); 359 359 $fset->plaintext( __( 'Month :', cPluginID ) . ' ' ); 360 360 $fset->input( 'MO', $mo, array('im' => 'numeric', 'sz' => 2 ) ); … … 369 369 $fset->close(); 370 370 $fset->open( __( 'Common Destinations', cPluginID ) ); 371 $fset->tag( 'span', array( 'class'=>'checkbox_layout' ));371 $fset->tag( 'span', 'class="checkbox_layout"' ); 372 372 $fid = 'suppress_default1'; 373 373 $fset->checkbox( $fid, __( 'Do not send to destination 1', cPluginID ), $this->AVal( $fid, $post_meta_info, False ) ); … … 394 394 $fset->close(); 395 395 $fset->open( __( 'Last Processed Date', cPluginID ) ); 396 $fset->tag( 'span', array( 'style'=>'display: inline; vertical-align: middle;' ));396 $fset->tag( 'span', 'style=display: inline; vertical-align: middle;' ); 397 397 $fid = 'processed'; 398 398 $fset->input( $fid, $this->AVal( $fid, $post_meta_info ), array('ro' => True, 'sz' => 16, 'st'=>array('margin-right: 2em') ) ); … … 920 920 break; 921 921 default : 922 $msg = '( ' . $mid . ' : no translation provided)';922 $msg = '( massage ID ' . $mid . ' is not defined. )'; 923 923 break; 924 924 }
Note: See TracChangeset
for help on using the changeset viewer.