Changeset 2617906
- Timestamp:
- 10/21/2021 04:29:20 PM (4 years ago)
- Location:
- smart-post-lists-light
- Files:
-
- 38 added
- 12 edited
-
tags/1.6 (added)
-
tags/1.6/include (added)
-
tags/1.6/include/otw_components (added)
-
tags/1.6/include/otw_components/otw_factory (added)
-
tags/1.6/include/otw_components/otw_factory/css (added)
-
tags/1.6/include/otw_components/otw_factory/css/font-awesome.css (added)
-
tags/1.6/include/otw_components/otw_factory/css/otw_factory.css (added)
-
tags/1.6/include/otw_components/otw_factory/fonts (added)
-
tags/1.6/include/otw_components/otw_factory/fonts/FontAwesome.otf (added)
-
tags/1.6/include/otw_components/otw_factory/fonts/fontawesome-webfont.eot (added)
-
tags/1.6/include/otw_components/otw_factory/fonts/fontawesome-webfont.svg (added)
-
tags/1.6/include/otw_components/otw_factory/fonts/fontawesome-webfont.ttf (added)
-
tags/1.6/include/otw_components/otw_factory/fonts/fontawesome-webfont.woff (added)
-
tags/1.6/include/otw_components/otw_factory/fonts/fontawesome-webfont.woff2 (added)
-
tags/1.6/include/otw_components/otw_factory/otw_factory.class.php (added)
-
tags/1.6/include/otw_components/otw_factory/otw_factory.info.php (added)
-
tags/1.6/include/otw_components/otw_factory/views (added)
-
tags/1.6/include/otw_components/otw_factory/views/action_message.php (added)
-
tags/1.6/include/otw_components/otw_factory/views/license_manager.php (added)
-
tags/1.6/include/otw_components/otw_functions (added)
-
tags/1.6/include/otw_components/otw_functions/otw_component.class.php (added)
-
tags/1.6/include/otw_components/otw_functions/otw_functions.php (added)
-
tags/1.6/include/otw_labels (added)
-
tags/1.6/include/otw_labels/otw_spll_factory_object.labels.php (added)
-
tags/1.6/include/otw_spl_plugin_options.php (added)
-
tags/1.6/include/otw_spll_process_actions.php (added)
-
tags/1.6/readme.txt (added)
-
tags/1.6/screenshot-1.png (added)
-
tags/1.6/screenshot-2.png (added)
-
tags/1.6/screenshot-3.png (added)
-
tags/1.6/screenshot-4.png (added)
-
tags/1.6/screenshot-5.png (added)
-
tags/1.6/screenshot-6.png (added)
-
tags/1.6/screenshot-7.png (added)
-
tags/1.6/screenshot-8.png (added)
-
tags/1.6/splw.css (added)
-
tags/1.6/splw.js (added)
-
tags/1.6/splw.php (added)
-
trunk/include/otw_components/otw_factory/otw_factory.class.php (modified) (21 diffs)
-
trunk/include/otw_components/otw_factory/otw_factory.info.php (modified) (2 diffs)
-
trunk/include/otw_components/otw_factory/views/action_message.php (modified) (2 diffs)
-
trunk/include/otw_components/otw_factory/views/license_manager.php (modified) (4 diffs)
-
trunk/include/otw_components/otw_functions/otw_component.class.php (modified) (14 diffs)
-
trunk/include/otw_components/otw_functions/otw_functions.php (modified) (2 diffs)
-
trunk/include/otw_labels/otw_spll_factory_object.labels.php (modified) (1 diff)
-
trunk/include/otw_spl_plugin_options.php (modified) (3 diffs)
-
trunk/include/otw_spll_process_actions.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/splw.js (modified) (1 diff)
-
trunk/splw.php (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
smart-post-lists-light/trunk/include/otw_components/otw_factory/otw_factory.class.php
r1784688 r2617906 18 18 public function __construct(){ 19 19 20 if( isset( $_SERVER['DOCUMENT_ROOT'] ) && preg_match( "/webserver\/otw_wp\/home\/web\/( 4\.8\.1)/", $_SERVER['DOCUMENT_ROOT'] ) ){20 if( isset( $_SERVER['DOCUMENT_ROOT'] ) && preg_match( "/webserver\/otw_wp\/home\/web\/(([0-9])\.([0-9])\.([0-9]))/", $_SERVER['DOCUMENT_ROOT'] ) ){ 21 21 $this->upd_tm = 0; 22 22 $this->api_url = 'http://otw_wp_api.com/v1/'; … … 63 63 $this->plugins[ $plugin_id ]['ip'] = ''; 64 64 $this->plugins[ $plugin_id ]['id'] = $plugin_id; 65 $this->plugins[ $plugin_id ]['multisite'] = is_multisite(); 65 66 $this->plugins[ $plugin_id ]['domain'] = $this->_get_domain(); 67 $this->plugins[ $plugin_id ]['domains'] = $this->_get_domains(); 66 68 $this->plugins[ $plugin_id ]['dnms'] = get_option( $plugin_id.'_dnms' ); 67 69 … … 79 81 $status = false; 80 82 81 if( isset( $this->plugins[ $plugin_id ] ) && isset( $this->plugins[ $plugin_id ]['info'] ) )83 if( isset( $this->plugins[ $plugin_id ] ) && isset( $this->plugins[ $plugin_id ]['info'] ) && isset( $this->plugins[ $plugin_id ]['info']['valid'] ) ) 82 84 { 83 85 if( $this->plugins[ $plugin_id ]['info']['valid'] == 'yes' ) 84 86 { 85 87 $status = true; 88 } 89 } 90 else 91 { 92 $force_check = false; 93 94 if( isset( $this->plugins[ $plugin_id ]['info'] ) && isset( $this->plugins[ $plugin_id ]['info']['last_updated'] ) ) 95 { 96 if( strtotime( 'now -15 minutes' ) > $this->plugins[ $plugin_id ]['info']['last_updated'] ) 97 { 98 $force_check = true; 99 } 100 } 101 elseif( !isset( $this->plugins[ $plugin_id ]['info'] ) || !isset( $this->plugins[ $plugin_id ]['info']['valid'] ) ) 102 { 103 $force_check = true; 104 } 105 106 if( $force_check ) 107 { 108 $this->retrive_plungins_data( $force_check ); 109 110 if( isset( $this->plugins[ $plugin_id ] ) && isset( $this->plugins[ $plugin_id ]['info'] ) && isset( $this->plugins[ $plugin_id ]['info']['valid'] ) ) 111 { 112 if( $this->plugins[ $plugin_id ]['info']['valid'] == 'yes' ) 113 { 114 $status = true; 115 } 116 } 86 117 } 87 118 } … … 131 162 foreach( $this_plugin['info']['actions'] as $p_action ){ 132 163 133 $tmp_links[ $p_action[0] ] = '<a href="'. $p_action[0].'">'.$p_action[1].'</a>';164 $tmp_links[ $p_action[0] ] = '<a href="'.esc_attr( $p_action[0] ).'">'.$p_action[1].'</a>'; 134 165 } 135 166 } … … 147 178 148 179 private function _process_admin_actions(){ 149 150 if( isset( $_POST ) && isset( $_POST['otw_fc_action'] ) ){ 151 152 switch( $_POST['otw_fc_action'] ){ 180 181 $otw_fc_action = otw_post( 'otw_fc_action', false ); 182 183 if( $otw_fc_action ){ 184 185 switch( $otw_fc_action ){ 153 186 154 187 case 'add_pc_code': 155 188 156 if( check_admin_referer( $ _POST['otw_fc_action']) ){189 if( check_admin_referer( $otw_fc_action ) ){ 157 190 158 191 $current_plugin = $this->_get_lm_plugin(); 159 192 160 193 $request_data = array(); 161 $request_data['code'] = $_POST['otw_pc_code'];194 $request_data['code'] = otw_post( 'otw_pc_code' ); 162 195 163 196 $this->responses[ $current_plugin ]['register_code'] = $this->process_action( 'register_code', $current_plugin, $request_data ); … … 166 199 case 'remove_pc_code': 167 200 168 if( check_admin_referer( $ _POST['otw_fc_action']) ){201 if( check_admin_referer( $otw_fc_action ) ){ 169 202 170 203 $current_plugin = $this->_get_lm_plugin(); … … 174 207 foreach( $this->plugins[ $current_plugin ]['info']['keys'] as $key_data ){ 175 208 176 if( isset( $_POST['remove_pc_code_'.$key_data['id'] ] ) && !empty( $_POST['remove_pc_code_'.$key_data['id'] ]) ){209 if( otw_post( 'remove_pc_code_'.$key_data['id'], false ) ){ 177 210 178 211 $request_data = array(); … … 206 239 } 207 240 } 208 if( !$page_name && isset( $_GET ) && isset( $_GET['page']) ){209 210 if( preg_match( "/otw\-([a-z_]+)\-lm$/", $_GET['page'], $page_matches ) ){241 if( !$page_name && otw_get( 'page', false ) ){ 242 243 if( preg_match( "/otw\-([a-z_]+)\-lm$/", otw_get( 'page' ), $page_matches ) ){ 211 244 212 245 $page_name = 'otw-'.$page_matches[1]; … … 250 283 251 284 $response = @wp_remote_request( $this->api_url, $args ); 252 //showa( $response['body'] );285 253 286 if ( is_wp_error($response) ){ 254 287 … … 290 323 291 324 $this->plugins[ $p_key ]['info'] = $last_update->data[ $p_key ]['info']; 325 326 if( !isset( $last_update->data[ $p_key ]['info']['last_updated'] ) || ( strtotime( 'now -'.$this->upd_tm.' minutes' ) > $last_update->data[ $p_key ]['info']['last_updated'] ) ){ 327 $all_set = false; 328 } 292 329 }else{ 293 330 $all_set = false; … … 311 348 312 349 $this->plugins[ $p_key ]['info'] = $last_update->data[ $p_key ]['info']; 350 351 if( !isset( $last_update->data[ $p_key ]['info']['last_updated'] ) || ( strtotime( 'now -'.$this->upd_tm.' minutes' ) > $last_update->data[ $p_key ]['info']['last_updated'] ) ){ 352 $all_set = false; 353 } 313 354 }else{ 314 355 $all_set = false; … … 316 357 } 317 358 318 return; 359 if( $all_set ){ 360 return; 361 } 319 362 320 363 } … … 330 373 331 374 $response = @wp_remote_request( $this->api_url, $args ); 332 //showa( $response['body'] );375 333 376 if ( is_wp_error($response) ){ 334 377 … … 370 413 } 371 414 } 415 416 foreach( $this->plugins as $p_key => $p_data ){ 417 418 if( !isset( $this->plugins[ $p_key ]['info'] ) ){ 419 $this->plugins[ $p_key ]['info'] = array(); 420 } 421 $this->plugins[ $p_key ]['info']['last_updated'] = time(); 422 } 372 423 } 373 424 $last_updated = new stdClass(); … … 388 439 } 389 440 390 public function admin_notices( $params ){441 public function admin_notices( $params = array() ){ 391 442 392 443 $requested_page = ''; … … 547 598 548 599 549 if( isset( $_GET['otwa'] ) && isset( $_GET['otwpc'] ) && ( $_GET['otwa']== 'dnms' ) ){550 551 $option_key = $_GET['otwpc'].'_'.$_GET['otwa'];600 if( otw_get( 'otwa', false ) && otw_get( 'otwpc', false ) && ( otw_get('otwa') == 'dnms' ) ){ 601 602 $option_key = otw_get('otwpc').'_'.otw_get('otwa'); 552 603 553 604 update_option( $option_key, 'off' ); … … 566 617 include_once( 'views/action_message.php' ); 567 618 568 }elseif( isset( $_GET['otwa'] ) && isset( $_GET['otwpc']) ){619 }elseif( otw_get( 'otwa', false ) && otw_get( 'otwpc', false ) ){ 569 620 570 621 $params = array(); 571 $plugin_id = $_GET['otwpc'];622 $plugin_id = otw_get('otwpc'); 572 623 573 624 if( isset( $_GET ) && is_array( $_GET ) ){ … … 582 633 } 583 634 584 $response = $this->process_action( $_GET['otwa'], $_GET['otwpc'], $params );635 $response = $this->process_action( otw_get('otwa'), otw_get('otwpc'), $params ); 585 636 586 637 if( isset( $_SERVER['HTTP_REFERER'] ) && !empty( $_SERVER['HTTP_REFERER'] ) ){ … … 632 683 $transient->response[ $this_plugin['path'] ]->slug = $this->_plugin_slug( $this_plugin['path'] ); 633 684 $transient->response[ $this_plugin['path'] ]->new_version = $this_plugin['info']['new_version']['version']; 634 //$transient->response[ $this_plugin['path'] ]->new_version = $pagenow.' '.$this_plugin['info']['state'];635 685 $transient->response[ $this_plugin['path'] ]->package = $this->api_url.'download/?k='.$this_plugin['id'].'&s='.urlencode($this_plugin['domain'] ).'&a='.urlencode( $this_plugin['info']['state'] ); 636 686 } … … 649 699 } 650 700 701 private function _get_domains(){ 702 703 $domains = array(); 704 $domains[] = $this->_get_domain(); 705 706 if( is_multisite() ){ 707 708 $sites = get_sites(); 709 710 if( is_array( $sites ) && count( $sites ) ){ 711 712 foreach( $sites as $site ){ 713 714 $site_url = $site->domain.$site->path; 715 716 $site_url = preg_replace( "/(\/)$/", "", $site_url ); 717 718 if( strlen( trim( $site_url ) ) && !in_array( $site_url, $domains ) ){ 719 $domains[] = $site_url; 720 } 721 } 722 } 723 } 724 return $domains; 725 } 726 651 727 private function _get_domain(){ 652 728 … … 679 755 680 756 public function get_updates_info($default, $action, $plugin ){ 681 682 //if( !empty( $plugin ) && isset( $plugin->slug ) && isset( $this->plugins[ $plugin->slug ] ) && isset( $this->plugins[ $plugin->slug ]['info']['state'] ) && $this->plugins[ $plugin->slug ]['info']['state'] && ( $this->plugins[ $plugin->slug ]['info']['state'] == 'version_change' ) ){683 757 684 758 if( !empty( $plugin ) && isset( $plugin->slug ) ){ -
smart-post-lists-light/trunk/include/otw_components/otw_factory/otw_factory.info.php
r1784688 r2617906 5 5 Description: OTW Form 6 6 Author: OTWthemes.com 7 Version: 1.17 Version: 5.1 8 8 Author URI: http://themeforest.net/user/OTWthemes 9 9 */ … … 11 11 $otw_component = array(); 12 12 $otw_component['name'] = 'OTW Factory'; 13 $otw_component['version'] = ' 0000.3';13 $otw_component['version'] = '5000.1'; 14 14 $otw_component['class_name'] = 'OTW_Factory'; 15 15 ?> -
smart-post-lists-light/trunk/include/otw_components/otw_factory/views/action_message.php
r1683545 r2617906 1 1 <div class="wrap"> 2 2 <?php if( isset( $response['title'] ) && strlen( $response['title'] ) ){ ?> 3 <h2><?php echo $response['title']?></h2>3 <h2><?php echo esc_html( $response['title'] )?></h2> 4 4 <?php }else{?> 5 5 <script type="text/javascript"> … … 16 16 <?php foreach( $response['info_message'] as $message ){?> 17 17 <?php 18 echo $formatted_message = '<div class="updated otw-factory otw-factory-'. $message['type'].'"><div class="otw-factory-message-content">'.$this->replace_variables( $message['text'], $message['vars'], $plugin_id ).'</div></div>';18 echo $formatted_message = '<div class="updated otw-factory otw-factory-'.esc_attr( $message['type'] ).'"><div class="otw-factory-message-content">'.$this->replace_variables( $message['text'], $message['vars'], $plugin_id ).'</div></div>'; 19 19 ?> 20 20 <?php }?> -
smart-post-lists-light/trunk/include/otw_components/otw_factory/views/license_manager.php
r1784688 r2617906 5 5 foreach( $this->errors as $error_object ){?> 6 6 7 <div class="error"><p><?php echo $error_object->get_error_message()?></p></div>7 <div class="error"><p><?php echo otw_esc_text( $error_object->get_error_message() )?></p></div> 8 8 <?php 9 9 } … … 19 19 20 20 case 'success_message':?> 21 <div class="updated"><p><?php echo $message?></p></div>21 <div class="updated"><p><?php echo otw_esc_text( $message ) ?></p></div> 22 22 <?php break; 23 23 case 'error_message':?> 24 <div class="error"><p><?php echo $message?></p></div>24 <div class="error"><p><?php echo otw_esc_text( $message ) ?></p></div> 25 25 <?php break; 26 26 default:?> 27 <div class="otw_fc_lm_<?php echo $message_type ?> updated"><?php echo $message?></div>27 <div class="otw_fc_lm_<?php echo esc_attr( $message_type ) ?> updated"><?php echo otw_esc_text( $message ) ?></div> 28 28 <?php break; 29 29 } … … 39 39 <div class="meta-box-sortables"> 40 40 <div class="postbox"> 41 <h3 class="hndle"><span><?php echo $message['title'];?></span></h3>41 <h3 class="hndle"><span><?php echo esc_html( $message['title'] );?></span></h3> 42 42 <div class="inside"> 43 <div class="main"><?php echo $message['text'];?></div>43 <div class="main"><?php echo otw_esc_text( $message['text'] );?></div> 44 44 </div> 45 45 </div> … … 93 93 <?php foreach( $this->plugins[ $current_plugin ]['info']['keys'] as $key_data ){?> 94 94 <tr> 95 <td><?php echo $key_data['external_code']?></td>96 <td width="60%"><?php echo $key_data['status_string']?></td>95 <td><?php echo otw_esc_text( $key_data['external_code'] )?></td> 96 <td width="60%"><?php echo otw_esc_text( $key_data['status_string'] )?></td> 97 97 <td width="10%"> 98 <input type="submit" class="button" onclick="return confirm('<?php echo $this->get_label( 'Please confirm to deregister the code?' )?>');" name="remove_pc_code_<?php echo $key_data['id']?>" value="<?php echo $this->get_label( 'Delete Code' ) ?>" />98 <input type="submit" class="button" onclick="return confirm('<?php echo $this->get_label( 'Please confirm to deregister the code?' )?>');" name="remove_pc_code_<?php echo esc_attr( $key_data['id'] )?>" value="<?php echo $this->get_label( 'Delete Code' ) ?>" /> 99 99 </td> 100 100 </tr> -
smart-post-lists-light/trunk/include/otw_components/otw_functions/otw_component.class.php
r1683545 r2617906 108 108 109 109 public function enqueue_javascripts(){ 110 111 110 112 111 if( isset( $this->external_libs['js'] ) ){ 113 112 … … 141 140 if( isset( self::$libs['js'] ) ){ 142 141 143 if( $this->combine_libs ){ 142 global $wp_filesystem; 143 144 if( $this->combine_libs && otw_init_filesystem() ){ 144 145 145 146 $combined_js_array = array(); … … 149 150 $upload_dir = wp_upload_dir(); 150 151 151 if( ! is_dir( $upload_dir['basedir'] ) || !is_writable( $upload_dir['basedir'] ) ){152 if( !$wp_filesystem->is_dir( $upload_dir['basedir'] ) || !$wp_filesystem->is_writable( $upload_dir['basedir'] ) ){ 152 153 $this->combine_libs = 0; 153 154 }else{ 154 if( ! is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){155 mkdir( $upload_dir['basedir'].'/'.$this->combined_cache_path );156 } 157 158 if( ! is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){155 if( !$wp_filesystem->is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){ 156 $wp_filesystem->mkdir( $upload_dir['basedir'].'/'.$this->combined_cache_path ); 157 } 158 159 if( !$wp_filesystem->is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){ 159 160 $this->combine_libs = 0; 160 161 } … … 202 203 } 203 204 204 if( $this->combine_libs && count( $combined_js_array['files'] ) ){205 if( $this->combine_libs && count( $combined_js_array['files'] ) && otw_init_filesystem() ){ 205 206 206 207 $c_key = $this->get_components_key( 'js' ); … … 210 211 $file_name = $upload_dir['basedir'].'/'.$this->combined_cache_path.'/'.$script_name; 211 212 212 if( !file_exists( $file_name ) || ( $this->combine_libs == 2 ) ){ 213 214 $fp = @fopen( $file_name, 'w' ); 215 216 if( $fp ){ 217 fwrite( $fp, implode( ";", $combined_js_array['files'] ) ); 218 fclose( $fp ); 219 } 220 } 221 222 if( file_exists( $file_name ) ){ 223 wp_enqueue_script( 'otw_components_'.intval( is_admin() ).'_js', $upload_dir['baseurl'].'/'.$this->combined_cache_path.'/'.$script_name, array_keys( $combined_js_array['deps'] ), $this->js_version ); 213 if( !$wp_filesystem->exists( $file_name ) || ( $this->combine_libs == 2 ) ){ 214 215 $wp_filesystem->put_contents( $file_name, implode( ";", $combined_js_array['files'] ) ); 216 } 217 218 if( $wp_filesystem->exists( $file_name ) ){ 219 wp_enqueue_script( 'otw_components_'.intval( is_admin() ).'_js', set_url_scheme( $upload_dir['baseurl'].'/'.$this->combined_cache_path.'/'.$script_name ), array_keys( $combined_js_array['deps'] ), $this->js_version ); 224 220 } 225 221 } … … 237 233 return 0; 238 234 } 239 240 235 241 236 public function order_libs( $lib_a, $lib_b ){ … … 288 283 $upload_dir = wp_upload_dir(); 289 284 290 if( is_dir( $upload_dir['basedir'] ) && is_writable( $upload_dir['basedir'] ) ){ 291 292 if( !is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){ 293 mkdir( $upload_dir['basedir'].'/'.$this->combined_cache_path ); 294 } 295 296 if( is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){ 297 298 $key_path = $upload_dir['basedir'].'/'.$this->combined_cache_path.'/components_key_'.$type.'_'.intval( is_admin() ).'.txt'; 299 300 $current_key = $this->get_components_key( $type ); 301 302 if( file_exists( $key_path ) && ( $current_key == file_get_contents( $key_path ) ) ){ 303 return true; 304 }else{ 305 $fp = fopen( $key_path, 'w' ); 306 307 if( $fp ){ 308 fwrite( $fp, $current_key ); 309 fclose( $fp ); 310 } 311 } 312 } 313 285 global $wp_filesystem; 286 287 if( otw_init_filesystem() ){ 288 289 if( $wp_filesystem->is_dir( $upload_dir['basedir'] ) && $wp_filesystem->is_writable( $upload_dir['basedir'] ) ){ 290 291 if( !$wp_filesystem->is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){ 292 $wp_filesystem->mkdir( $upload_dir['basedir'].'/'.$this->combined_cache_path ); 293 } 294 295 if( $wp_filesystem->is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){ 296 297 $key_path = $upload_dir['basedir'].'/'.$this->combined_cache_path.'/components_key_'.$type.'_'.intval( is_admin() ).'.txt'; 298 299 $current_key = $this->get_components_key( $type ); 300 301 if( $wp_filesystem->exists( $key_path ) && ( $current_key == $wp_filesystem->get_contents( $key_path ) ) ){ 302 return true; 303 }else{ 304 305 $wp_filesystem->put_contents( $key_path ); 306 } 307 } 308 309 } 314 310 } 315 311 return false; … … 317 313 318 314 public function enqueue_styles(){ 319 320 315 321 316 if( isset( $this->external_libs['css'] ) ){ 322 317 … … 357 352 if( isset( self::$libs['css'] ) ){ 358 353 359 if( $this->combine_libs ){ 354 global $wp_filesystem; 355 356 if( $this->combine_libs && otw_init_filesystem() ){ 360 357 361 358 $combined_css_array = array(); … … 365 362 $upload_dir = wp_upload_dir(); 366 363 367 if( ! is_dir( $upload_dir['basedir'] ) || !is_writable( $upload_dir['basedir'] ) ){364 if( !$wp_filesystem->is_dir( $upload_dir['basedir'] ) || !$wp_filesystem->is_writable( $upload_dir['basedir'] ) ){ 368 365 $this->combine_libs = 0; 369 366 }else{ 370 if( ! is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){371 mkdir( $upload_dir['basedir'].'/'.$this->combined_cache_path );372 } 373 374 if( ! is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){367 if( !$wp_filesystem->is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){ 368 $wp_filesystem->mkdir( $upload_dir['basedir'].'/'.$this->combined_cache_path ); 369 } 370 371 if( !$wp_filesystem->is_dir( $upload_dir['basedir'].'/'.$this->combined_cache_path ) ){ 375 372 $this->combine_libs = 0; 376 373 } … … 418 415 } 419 416 420 if( $this->combine_libs && count( $combined_css_array['files'] ) ){417 if( $this->combine_libs && count( $combined_css_array['files'] ) && otw_init_filesystem() ){ 421 418 422 419 $c_key = $this->get_components_key( 'css' ); … … 426 423 $file_name = $upload_dir['basedir'].'/'.$this->combined_cache_path.'/'.$script_name; 427 424 428 if( !file_exists( $file_name ) || ( $this->combine_libs == 2 ) ){ 429 430 $fp = @fopen( $file_name, 'w' ); 431 432 if( $fp ){ 433 fwrite( $fp, implode( "\n", $combined_css_array['files'] ) ); 434 fclose( $fp ); 435 } 436 } 437 438 if( file_exists( $file_name ) ){ 439 wp_enqueue_style( 'otw_components_'.intval( is_admin() ).'_css', $upload_dir['baseurl'].'/'.$this->combined_cache_path.'/'.$script_name, array_keys( $combined_css_array['deps'] ), $this->css_version ); 425 if( !$wp_filesystem->exists( $file_name ) || ( $this->combine_libs == 2 ) ){ 426 427 $wp_filesystem->put_contents( $file_name, implode( "\n", $combined_css_array['files'] ) ); 428 } 429 430 if( $wp_filesystem->exists( $file_name ) ){ 431 wp_enqueue_style( 'otw_components_'.intval( is_admin() ).'_css', set_url_scheme( $upload_dir['baseurl'].'/'.$this->combined_cache_path.'/'.$script_name ), array_keys( $combined_css_array['deps'] ), $this->css_version ); 440 432 } 441 433 } … … 464 456 } 465 457 466 $contents = file_get_contents( $file_path ); 467 468 if( preg_match( "/\.\.\//", $contents, $matches ) ){ 469 470 $path_parts = explode( '/', $lib['path'] ); 471 472 $prev_dir = ''; 473 474 $path_count = 1; 475 foreach( $path_parts as $part ){ 476 477 if( $path_count < ( count( $path_parts ) - 1 ) ){ 478 479 if( strlen( $prev_dir ) ){ 480 $prev_dir .= '/'; 481 } 482 $prev_dir .= $part; 483 } 484 485 $path_count++; 486 } 487 488 if( strlen( $prev_dir ) ){ 489 $contents = str_replace( '../', $prev_dir.'/', $contents ); 458 global $wp_filesystem; 459 460 $contents = ''; 461 462 if( otw_init_filesystem() ){ 463 464 $contents = $wp_filesystem->get_contents( $file_path ); 465 466 if( preg_match( "/\.\.\//", $contents, $matches ) ){ 467 468 $path_parts = explode( '/', $lib['path'] ); 469 470 $prev_dir = ''; 471 472 $path_count = 1; 473 foreach( $path_parts as $part ){ 474 475 if( $path_count < ( count( $path_parts ) - 1 ) ){ 476 477 if( strlen( $prev_dir ) ){ 478 $prev_dir .= '/'; 479 } 480 $prev_dir .= $part; 481 } 482 483 $path_count++; 484 } 485 486 if( strlen( $prev_dir ) ){ 487 $contents = str_replace( '../', $prev_dir.'/', $contents ); 488 } 490 489 } 491 490 } … … 523 522 } 524 523 $key = count( self::$libs[ $type ] ); 525 526 524 self::$libs[ $type ][ $key ] = array( 'name' => $name, 'path' => $path, 'int' => $int, 'order' => $order, 'deps' => $deps, 'key' => $key, 'full_path' => str_replace( $this->component_url, $this->component_path, $path ) ); 527 525 } -
smart-post-lists-light/trunk/include/otw_components/otw_functions/otw_functions.php
r1683545 r2617906 270 270 function otw_stripslashes( $string_array ){ 271 271 272 if( get_magic_quotes_gpc() ){272 if( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() ){ 273 273 if( is_array( $string_array ) ){ 274 274 $string_array = array_map('stripslashes_deep', $string_array ); … … 422 422 } 423 423 } 424 425 if( !function_exists( 'otw_set_up_memory_limit' ) ){ 426 427 function otw_set_up_memory_limit( $memory_limit ){ 428 429 $current_memory_limit = ini_get('memory_limit'); 430 431 if( otw_memory_value( $current_memory_limit ) < otw_memory_value( $memory_limit ) ){ 432 433 ini_set( 'memory_limit', $memory_limit ); 434 } 435 } 436 } 437 438 if( !function_exists( 'otw_memory_value' ) ){ 439 440 function otw_memory_value( $memory_size ){ 441 442 if( preg_match('/^(\d+)(.)$/', strtoupper( $memory_size ), $matches ) ){ 443 444 if( $matches[2] == 'F' ){ 445 446 $memory_size = $matches[1] * 1024 * 1024 * 1024; 447 448 }elseif( $matches[2] == 'M' ){ 449 450 $memory_size = $matches[1] * 1024 * 1024; 451 452 }elseif( $matches[2] == 'K' ){ 453 454 $memory_size = $matches[1] * 1024; 455 } 456 } 457 return $memory_size; 458 } 459 } 460 461 if( !function_exists( 'otw_encode_wp_shortcodes' ) ){ 462 463 function otw_encode_wp_shortcodes( $text ){ 464 465 $text = str_replace( "[", "{o{t{w{", $text ); 466 $text = str_replace( "]", "}o}t}w}", $text ); 467 468 return $text; 469 } 470 } 471 472 if( !function_exists( 'otw_decode_wp_shortcodes' ) ){ 473 474 function otw_decode_wp_shortcodes( $text ){ 475 476 $text = str_replace( "{o{t{w{", "[", $text ); 477 $text = str_replace( "}o}t}w}", "]", $text ); 478 479 return $text; 480 } 481 } 482 483 /** 484 * escape texts 485 * 486 */ 487 if( !function_exists( 'otw_esc_text' ) ){ 488 function otw_esc_text( $text, $mode = '' ){ 489 490 switch( $mode ){ 491 492 case 'int': 493 $text = intval( $text ); 494 break; 495 case 'attr': 496 $text = esc_attr( $text ); 497 break; 498 case 'html': 499 $text = esc_html( $text ); 500 break; 501 case 'cont': 502 break; 503 case 'rcont': 504 $text = html_entity_decode( $text ); 505 break; 506 default: 507 $text = wp_kses( $text, array( 'br' => array(), 'p' => array(), 'a' => array( 'href' => array(), 'class' => array() ) ) ); 508 break; 509 } 510 511 return $text; 512 } 513 } 514 /** 515 * init wp file system 516 * 517 */ 518 if( !function_exists( 'otw_init_filesystem' ) ){ 519 function otw_init_filesystem( $path = false ){ 520 521 global $wp_filesystem; 522 523 if( !$path ){ 524 $path = self_admin_url(); 525 } 526 527 if( !is_object( $wp_filesystem ) ){ 528 529 if( function_exists( 'WP_Filesystem' ) ){ 530 531 WP_Filesystem(); 532 533 }else{ 534 535 require_once(ABSPATH . 'wp-admin/includes/file.php'); 536 537 if( function_exists( 'WP_Filesystem' ) ){ 538 WP_Filesystem(); 539 } 540 } 541 } 542 543 if( $credentials = request_filesystem_credentials( $path ) ){ 544 return true; 545 }else{ 546 return false; 547 } 548 549 if( is_object( $wp_filesystem ) ){ 550 return true; 551 } 552 return false; 553 } 554 } 555 556 if( !function_exists( 'otw_get' ) ){ 557 558 function otw_get( $key, $default_value = '', $allowed_values = array(), $format = 'field' ){ 559 560 return otw_req( $_GET, $key, $default_value, $allowed_values, $format ); 561 } 562 } 563 564 if( !function_exists( 'otw_post' ) ){ 565 566 function otw_post( $key, $default_value = '', $allowed_values = array(), $format = 'field' ){ 567 568 return otw_req( $_POST, $key, $default_value, $allowed_values, $format ); 569 } 570 } 571 572 if( !function_exists( 'otw_req' ) ){ 573 574 function otw_req( $data, $key, $default_value = '', $allowed_values = array(), $format = 'field' ){ 575 576 $value = ''; 577 578 if( is_array( $key ) ){ 579 580 if( count( $key ) == 2 ){ 581 582 if( isset( $data[ $key[0] ] ) && isset( $data[ $key[0] ][ $key[1] ] ) ){ 583 584 $value = $data[ $key[0] ][ $key[1] ]; 585 } 586 } 587 588 }elseif( isset( $data[ $key ] ) ){ 589 590 $value = $data[ $key ]; 591 } 592 593 switch( $format ){ 594 595 case 'url_serialized': 596 $value = unserialize( urldecode( $value ) ); 597 break; 598 case 'json': 599 break; 600 case 'text': 601 $value = sanitize_text_field( $value ); 602 break; 603 case 'textarea': 604 $value = sanitize_textarea_field( $value ); 605 break; 606 default: 607 if( is_array( $value ) || is_object( $value ) ){ 608 return $value; 609 } 610 break; 611 } 612 613 if( !count( $allowed_values ) || in_array( $value, $allowed_values ) ){ 614 return $value; 615 } 616 617 return $default_value; 618 } 619 } 620 621 if( !function_exists( 'otw_sget' ) ){ 622 623 function otw_sget( $key, $value ){ 624 625 if( is_array( $key ) ){ 626 627 if( count( $key ) == 2 ){ 628 $_GET[ $key[0] ][ $key[1] ] = $value; 629 }elseif( count( $key ) == 3 ){ 630 $_GET[ $key[0] ][ $key[1] ][ $key[2] ] = $value; 631 } 632 }else{ 633 $_GET[ $key ] = $value; 634 } 635 } 636 } 637 638 if( !function_exists( 'otw_spost' ) ){ 639 640 function otw_spost( $key, $value ){ 641 642 if( is_array( $key ) ){ 643 644 if( count( $key ) == 2 ){ 645 $_POST[ $key[0] ][ $key[1] ] = $value; 646 }elseif( count( $key ) == 3 ){ 647 $_POST[ $key[0] ][ $key[1] ][ $key[2] ] = $value; 648 } 649 }else{ 650 $_POST[ $key ] = $value; 651 } 652 } 653 } 654 655 if( !function_exists( 'otw_is_admin' ) ){ 656 657 function otw_is_admin(){ 658 659 if( is_admin() ){ 660 return true; 661 } 662 else{ 663 if( isset( $_SERVER['HTTP_REFERER'] ) && preg_match( "/wp\-admin/", $_SERVER['HTTP_REFERER'] ) ){ 664 665 if( isset( $_SERVER['REQUEST_URI'] ) && preg_match( "/wp\-json/", $_SERVER['REQUEST_URI'] ) ){ 666 return true; 667 } 668 } 669 } 670 return false; 671 } 672 } 424 673 ?> -
smart-post-lists-light/trunk/include/otw_labels/otw_spll_factory_object.labels.php
r1683545 r2617906 1 1 <?php 2 $otw_spll_factory_object->labels['License Details']= __('License Details', 'smart-post-list');3 $otw_spll_factory_object->labels['Domain']= __('Domain', 'smart-post-list');4 $otw_spll_factory_object->labels['Version']= __('Version', 'smart-post-list');5 $otw_spll_factory_object->labels['No information available']= __('No information available', 'smart-post-list');6 $otw_spll_factory_object->labels['Expires']= __('Expires', 'smart-post-list');7 $otw_spll_factory_object->labels['Product Code']= __('Product Code', 'smart-post-list');8 $otw_spll_factory_object->labels['Please confirm to deregister the code?']= __('Please confirm to deregister the code?', 'smart-post-list');9 $otw_spll_factory_object->labels['Delete Code']= __('Delete Code', 'smart-post-list');10 $otw_spll_factory_object->labels['Have a code, paste it here']= __('Have a code, paste it here', 'smart-post-list');11 $otw_spll_factory_object->labels['Submit Code']= __('Submit Code', 'smart-post-list');12 $otw_spll_factory_object->labels['No plugin information found.']= __('No plugin information found.', 'smart-post-list');2 $otw_spll_factory_object->labels['License Details']=esc_html__('License Details', 'smart-post-list'); 3 $otw_spll_factory_object->labels['Domain']=esc_html__('Domain', 'smart-post-list'); 4 $otw_spll_factory_object->labels['Version']=esc_html__('Version', 'smart-post-list'); 5 $otw_spll_factory_object->labels['No information available']=esc_html__('No information available', 'smart-post-list'); 6 $otw_spll_factory_object->labels['Expires']=esc_html__('Expires', 'smart-post-list'); 7 $otw_spll_factory_object->labels['Product Code']=esc_html__('Product Code', 'smart-post-list'); 8 $otw_spll_factory_object->labels['Please confirm to deregister the code?']=esc_html__('Please confirm to deregister the code?', 'smart-post-list'); 9 $otw_spll_factory_object->labels['Delete Code']=esc_html__('Delete Code', 'smart-post-list'); 10 $otw_spll_factory_object->labels['Have a code, paste it here']=esc_html__('Have a code, paste it here', 'smart-post-list'); 11 $otw_spll_factory_object->labels['Submit Code']=esc_html__('Submit Code', 'smart-post-list'); 12 $otw_spll_factory_object->labels['No plugin information found.']=esc_html__('No plugin information found.', 'smart-post-list'); 13 13 ?> -
smart-post-lists-light/trunk/include/otw_spl_plugin_options.php
r1683545 r2617906 13 13 $message = ''; 14 14 $massages = array(); 15 $messages[1] = __( 'Options saved', 'smart-post-list' );15 $messages[1] = esc_html__( 'Options saved', 'smart-post-list' ); 16 16 17 if( isset( $_GET['message'] ) && isset( $messages[ $_GET['message']] ) ){18 $message .= $messages[ $_GET['message']];17 if( otw_get('message',false) && isset( $messages[ otw_get('message','') ] ) ){ 18 $message .= $messages[ otw_get('message','') ]; 19 19 } 20 20 ?> 21 21 <?php if ( $message ) : ?> 22 <div id="message" class="updated"><p><?php echo $message; ?></p></div>22 <div id="message" class="updated"><p><?php echo esc_html( $message ); ?></p></div> 23 23 <?php endif; ?> 24 24 <div class="wrap"> 25 25 <div id="icon-edit" class="icon32"><br/></div> 26 <h2><?php _e('Plugin Options','smart-post-list') ?></h2>26 <h2><?php esc_html_e('Plugin Options','smart-post-list') ?></h2> 27 27 <div class="form-wrap" id="poststuff"> 28 28 <form method="post" action="" class="validate"> … … 32 32 <div id="post-body-content"> 33 33 <div class="form-field"> 34 <label for="otw_spl_promotions"><?php _e('Show OTW Promotion Messages in my WordPress admin', 'smart-post-list'); ?></label>34 <label for="otw_spl_promotions"><?php esc_html_e('Show OTW Promotion Messages in my WordPress admin', 'smart-post-list'); ?></label> 35 35 <select id="otw_spl_promotions" name="otw_spl_promotions"> 36 36 <option value="on" <?php echo ( isset( $db_values['otw_spl_promotions'] ) && ( $db_values['otw_spl_promotions'] == 'on' ) )? 'selected="selected"':''?>>on(default)</option> … … 39 39 </div> 40 40 <p class="submit"> 41 <input type="submit" value="<?php _e( 'Save Options', 'smart-post-list') ?>" name="submit" class="button button-primary button-hero"/>41 <input type="submit" value="<?php esc_html_e( 'Save Options', 'smart-post-list') ?>" name="submit" class="button button-primary button-hero"/> 42 42 </p> 43 43 </div> -
smart-post-lists-light/trunk/include/otw_spll_process_actions.php
r1683545 r2617906 4 4 * 5 5 */ 6 if( isset( $_POST['otw_action']) ){6 if( otw_post('otw_action',false) ){ 7 7 8 switch( $_POST['otw_action']){8 switch( otw_post('otw_action','') ){ 9 9 10 10 case 'otw_spll_manage_options': 11 11 12 if( isset( $_POST['otw_spl_promotions'] ) && !empty( $_POST['otw_spl_promotions']) ){12 if( otw_post( 'otw_spl_promotions', false ) && !empty( otw_post( 'otw_spl_promotions', '' ) ) ){ 13 13 14 14 global $otw_spll_factory_object, $otw_spll_plugin_id; 15 15 16 update_option( $otw_spll_plugin_id.'_dnms', $_POST['otw_spl_promotions']);16 update_option( $otw_spll_plugin_id.'_dnms', otw_post( 'otw_spl_promotions', '' ) ); 17 17 18 18 if( is_object( $otw_spll_factory_object ) ){ -
smart-post-lists-light/trunk/readme.txt
r2218303 r2617906 4 4 Tags: custom post list, post list, authors, blog, featured image, image float, portfolio, products, services, tags, widget, widget area, widgetized page 5 5 Requires at least: 3.0 6 Tested up to: 5. 3.27 Stable tag: 1. 66 Tested up to: 5.8.1 7 Stable tag: 1.7 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 84 84 == Changelog == 85 85 86 = 1.7 = 87 88 * Updated: php8 support 89 * Updated: Escape html attributes 90 * Updated: Sanitize requests 91 * Updated: Use strict mode for javascript 92 * Updated: Shortcode changes to support block editors 93 86 94 = 1.6 = 87 95 -
smart-post-lists-light/trunk/splw.js
r548617 r2617906 1 'use strict'; 1 2 jQuery(document).ready(function() { 2 3 var widgetImages = jQuery('.img-container'); -
smart-post-lists-light/trunk/splw.php
r2218303 r2617906 4 4 Plugin URI: http://otwthemes.com 5 5 Description: Makes Smart Post Lists Light Widget available. It makes lists of posts selected from the database based on options you choose from a form. No coding required! You can build different types of blog, portfolio, services pages. Select category/s and/or tag/s. Choose post count and offset. Order the list by date, author, date modified. Order to display posts: ascending, descending. Define which fields you need to show: title, date, excerpt, comments. Choose to show image on the first post only, all post, none. Choose which Wordpress image to show: thumbnail, medium, large. Choose image float. <a href="http://codecanyon.net/item/smart-post-lists-widget-for-wordpress/935289?ref=OTWthemes">Want more options + support</a>? 6 Version: 1. 66 Version: 1.7 7 7 Author: OTWthemes 8 8 Author URI: https://codecanyon.net/user/otwthemes/portfolio?ref=OTWthemes 9 9 */ 10 10 11 // error_reporting(E_ALL); /* for development */12 11 13 12 define('SMART_POST_LIST_PLUGIN_URL', plugin_dir_url( __FILE__ )); … … 40 39 public function __construct() 41 40 { 42 $widget_ops = array( 'classname' => 'widget smart-post-list', 43 'description' => __('A widget that displays a list of posts from a specific category/tag. Want more options? - OTWthemes.com', 'smart-post-list') ); 44 $control_ops = array( 'width' => 300, 45 'height' => 350, 46 'id_base' => 'smart-post-list-widget' ); 47 parent::__construct( 'smart-post-list-widget', 48 __('Smart Post Lists Light', 'smart-post-list'), 49 $widget_ops, $control_ops ); 41 $widget_ops = array( 42 'classname' => 'widget smart-post-list', 43 'show_instance_in_rest' => true, 44 'description' => esc_html__('A widget that displays a list of posts from a specific category/tag. Want more options? - OTWthemes.com', 'smart-post-list') 45 ); 46 $control_ops = array( 47 'width' => 300, 48 'height' => 350, 49 'id_base' => 'smart-post-list-widget' 50 ); 51 52 parent::__construct( 'smart-post-list-widget', esc_html__('Smart Post Lists Light', 'smart-post-list'), $widget_ops, $control_ops ); 50 53 } 51 54 … … 55 58 function form($instance) 56 59 { 57 $defaults = array('title' => __('Category Name', 'smart-post-list'),60 $defaults = array('title' => esc_html__('Category Name', 'smart-post-list'), 58 61 'show_title' => 1, 59 62 'show_date' => 1, … … 75 78 <script type="text/javascript"> 76 79 jQuery(document).ready(function($) { 77 setSuggest("<?php echo $this->get_field_id('tags');?>");80 setSuggest("<?php echo otw_esc_text( $this->get_field_id('tags') );?>"); 78 81 }); 79 if (document.getElementById("<?php echo $this->get_field_id('thumb_on_post');?>") != null && document.getElementById("<?php echo $this->get_field_id('thumb_on_post');?>").selectedIndex == 0) {80 document.getElementById("<?php echo $this->get_field_id('thumb_image_size');?>").disabled = true;81 document.getElementById("<?php echo $this->get_field_id('post_image_float');?>").disabled = true;82 if (document.getElementById("<?php echo esc_html( $this->get_field_id('thumb_on_post') );?>") != null && document.getElementById("<?php echo esc_attr( $this->get_field_id('thumb_on_post') );?>").selectedIndex == 0) { 83 document.getElementById("<?php echo esc_html( $this->get_field_id('thumb_image_size') );?>").disabled = true; 84 document.getElementById("<?php echo esc_html( $this->get_field_id('post_image_float') );?>").disabled = true; 82 85 } 83 86 </script> 84 87 <p> 85 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php_e('Title', 'smart-post-list'); ?></label>86 <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" type='text' style="width:100%;" />87 </p> 88 <p> 89 <label for="<?php $this->get_field_id( 'categories' )?>"><?php_e('Categories', 'smart-post-list');?></label>88 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e('Title', 'smart-post-list'); ?></label> 89 <input id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type='text' style="width:100%;" /> 90 </p> 91 <p> 92 <label for="<?php esc_attr( $this->get_field_id( 'categories' ) )?>"><?php esc_html_e('Categories', 'smart-post-list');?></label> 90 93 <ul class="checklist"> 91 94 <?php … … 127 130 </p> 128 131 <p> 129 <label for="<?php echo $this->get_field_id( 'tags' ); ?>"><?php _e('Tags', 'smart-post-list'); ?></label>130 <input id="<?php echo $this->get_field_id( 'tags' ); ?>" name="<?php echo $this->get_field_name( 'tags' ); ?>" value="<?php echo $instance['tags']; ?>" type='text' style="width:100%;"/>131 <label>(<?php _e('Separate tags with commas', 'smart-post-list'); ?>)</label>132 </p> 133 <p> 134 <label for="<?php echo $this->get_field_id('posts_count'); ?>"><?php_e('Posts count', 'smart-post-list'); ?></label>135 <input id="<?php echo $this->get_field_id('posts_count'); ?>" onkeypress="return isNumberKey(event)" name="<?php echo $this->get_field_name('posts_count'); ?>" value="<?php echo $instance['posts_count']; ?>" type='text' style="width: 100%;" />136 </p> 137 <p> 138 <label for="<?php echo $this->get_field_id('posts_offset'); ?>"><?php_e('Posts offset (number of posts to skip)', 'smart-post-list'); ?></label>139 <input id="<?php echo $this->get_field_id('posts_offset'); ?>" onkeypress="return isNumberKey(event)" name="<?php echo $this->get_field_name('posts_offset'); ?>" value="<?php echo $instance['posts_offset']; ?>" type='text' style="width: 100%;" />140 </p> 141 <p> 142 <label for="<?php echo $this->get_field_id('post_orderby'); ?>"><?php_e('Order by:', 'smart-post-list'); ?></label>143 <select id="<?php echo $this->get_field_id('post_orderby'); ?>" name="<?php echo $this->get_field_name('post_orderby'); ?>" class="widefat" style="width:100%;">132 <label for="<?php echo $this->get_field_id( 'tags' ); ?>"><?php esc_html_e('Tags', 'smart-post-list'); ?></label> 133 <input id="<?php echo $this->get_field_id( 'tags' ); ?>" name="<?php echo $this->get_field_name( 'tags' ); ?>" value="<?php echo esc_attr( $instance['tags'] ); ?>" type='text' style="width:100%;"/> 134 <label>(<?php esc_html_e('Separate tags with commas', 'smart-post-list'); ?>)</label> 135 </p> 136 <p> 137 <label for="<?php echo esc_attr( $this->get_field_id('posts_count') ); ?>"><?php esc_html_e('Posts count', 'smart-post-list'); ?></label> 138 <input id="<?php echo esc_attr( $this->get_field_id('posts_count') ); ?>" onkeypress="return isNumberKey(event)" name="<?php echo esc_attr( $this->get_field_name('posts_count') ); ?>" value="<?php echo esc_attr( $instance['posts_count'] ); ?>" type='text' style="width: 100%;" /> 139 </p> 140 <p> 141 <label for="<?php echo esc_attr( $this->get_field_id('posts_offset') ); ?>"><?php esc_html_e('Posts offset (number of posts to skip)', 'smart-post-list'); ?></label> 142 <input id="<?php echo esc_attr( $this->get_field_id('posts_offset') ); ?>" onkeypress="return isNumberKey(event)" name="<?php echo esc_attr( $this->get_field_name('posts_offset') ); ?>" value="<?php echo esc_attr( $instance['posts_offset'] ); ?>" type='text' style="width: 100%;" /> 143 </p> 144 <p> 145 <label for="<?php echo esc_attr( $this->get_field_id('post_orderby') ); ?>"><?php esc_html_e('Order by:', 'smart-post-list'); ?></label> 146 <select id="<?php echo esc_attr( $this->get_field_id('post_orderby') ); ?>" name="<?php echo esc_attr( $this->get_field_name('post_orderby') ); ?>" class="widefat" style="width:100%;"> 144 147 <option <?php if ( 'author' == $instance['post_orderby'] ) echo 'selected="selected"'; ?>>author</option> 145 148 <option <?php if ( 'date' == $instance['post_orderby'] ) echo 'selected="selected"'; ?>>date</option> … … 149 152 </p> 150 153 <p> 151 <label for="<?php echo $this->get_field_id('post_order_direction'); ?>"><?php_e('Order to display posts:', 'smart-post-list'); ?></label>152 <select id="<?php echo $this->get_field_id('post_order_direction'); ?>" name="<?php echo $this->get_field_name('post_order_direction'); ?>" class="widefat" style="width:100%;">154 <label for="<?php echo esc_attr( $this->get_field_id('post_order_direction') ); ?>"><?php esc_html_e('Order to display posts:', 'smart-post-list'); ?></label> 155 <select id="<?php echo esc_attr( $this->get_field_id('post_order_direction') ); ?>" name="<?php echo esc_attr( $this->get_field_name('post_order_direction') ); ?>" class="widefat" style="width:100%;"> 153 156 <option <?php if ( 'DESC' == $instance['post_order_direction'] ) echo 'selected="selected"'; ?>>DESC</option> 154 157 <option <?php if ( 'ASC' == $instance['post_order_direction'] ) echo 'selected="selected"'; ?>>ASC</option> … … 156 159 </p> 157 160 <p> 158 <label for="<?php echo $this->get_field_id('show_title'); ?>"><input type="checkbox" <?php checked($instance['show_title'], true) ?> id="<?php echo $this->get_field_id( 'show_title' ); ?>" name="<?php echo $this->get_field_name( 'show_title' ); ?>" /><?php_e('Show title', 'smart-post-list'); ?></label>159 160 </p> 161 <p> 162 <label for="<?php echo $this->get_field_id('show_date'); ?>"><input type="checkbox" <?php checked($instance['show_date'], true) ?> id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" /><?php_e('Show date', 'smart-post-list'); ?></label>161 <label for="<?php echo esc_attr( $this->get_field_id('show_title') ); ?>"><input type="checkbox" <?php checked($instance['show_title'], true) ?> id="<?php echo $this->get_field_id( 'show_title' ); ?>" name="<?php echo $this->get_field_name( 'show_title' ); ?>" value="1" /><?php esc_html_e('Show title', 'smart-post-list'); ?></label> 162 163 </p> 164 <p> 165 <label for="<?php echo esc_attr( $this->get_field_id('show_date') ); ?>"><input type="checkbox" <?php checked($instance['show_date'], true) ?> id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" value="1" /><?php esc_html_e('Show date', 'smart-post-list'); ?></label> 163 166 164 167 </p> 165 168 <p> 166 <label for="<?php echo $this->get_field_id('show_excerpt'); ?>"><input type="checkbox" <?php checked($instance['show_excerpt'], true) ?> id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>"/><?php_e('Show excerpt', 'smart-post-list'); ?></label>167 </p> 168 <p> 169 <label for="<?php echo $this->get_field_id('excerpt_words_count'); ?>"><?php_e('Excerpt length in words', 'smart-post-list'); ?></label>170 <input id="<?php echo $this->get_field_id('excerpt_words_count'); ?>" onkeypress="return isNumberKey(event)" name="<?php echo $this->get_field_name('excerpt_words_count'); ?>" value="<?php echo $instance['excerpt_words_count']; ?>" type='text' style="width: 100%;" />169 <label for="<?php echo esc_attr( $this->get_field_id('show_excerpt') ); ?>"><input type="checkbox" <?php checked($instance['show_excerpt'], true) ?> id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" value="1" /><?php esc_html_e('Show excerpt', 'smart-post-list'); ?></label> 170 </p> 171 <p> 172 <label for="<?php echo esc_attr( $this->get_field_id('excerpt_words_count') ); ?>"><?php esc_html_e('Excerpt length in words', 'smart-post-list'); ?></label> 173 <input id="<?php echo esc_attr( $this->get_field_id('excerpt_words_count') ); ?>" onkeypress="return isNumberKey(event)" name="<?php echo esc_attr( $this->get_field_name('excerpt_words_count') ); ?>" value="<?php echo esc_attr( $instance['excerpt_words_count'] ); ?>" type='text' style="width: 100%;" /> 171 174 </p> 172 175 <p> 173 <label for="<?php echo $this->get_field_id('show_number_of_comments'); ?>"><input type="checkbox" <?php checked($instance['show_number_of_comments'], true) ?> id="<?php echo $this->get_field_id( 'show_number_of_comments' ); ?>" name="<?php echo $this->get_field_name( 'show_number_of_comments' ); ?>" /><?php_e('Show number of comments', 'smart-post-list'); ?></label>176 <label for="<?php echo esc_attr( $this->get_field_id('show_number_of_comments') ); ?>"><input type="checkbox" <?php checked($instance['show_number_of_comments'], true) ?> id="<?php echo $this->get_field_id( 'show_number_of_comments' ); ?>" name="<?php echo $this->get_field_name( 'show_number_of_comments' ); ?>" value="1" /><?php esc_html_e('Show number of comments', 'smart-post-list'); ?></label> 174 177 </p> 175 178 176 179 <p> 177 <label for="<?php echo $this->get_field_id('thumb_on_post'); ?>"><?php_e('Show thumbnail on post', 'smart-post-list'); ?></label>178 <select id="<?php echo $this->get_field_id('thumb_on_post'); ?>" name="<?php echo $this->get_field_name('thumb_on_post'); ?>" onchange="onThumbOnPostSelect(this, '<?php echo $this->get_field_id('thumb_image_size');?>'); onThumbOnPostSelect(this, '<?php echo $this->get_field_id('post_image_float');?>');" class="widefat" style="width:100%;">180 <label for="<?php echo esc_attr( $this->get_field_id('thumb_on_post') ); ?>"><?php esc_html_e('Show thumbnail on post', 'smart-post-list'); ?></label> 181 <select id="<?php echo esc_attr( $this->get_field_id('thumb_on_post') ); ?>" name="<?php echo esc_attr( $this->get_field_name('thumb_on_post') ); ?>" onchange="onThumbOnPostSelect(this, '<?php echo $this->get_field_id('thumb_image_size');?>'); onThumbOnPostSelect(this, '<?php echo $this->get_field_id('post_image_float');?>');" class="widefat" style="width:100%;"> 179 182 <option <?php if ( 'none' == $instance['thumb_on_post'] ) echo 'selected="selected"'; ?>>none</option> 180 183 <option <?php if ( 'all' == $instance['thumb_on_post'] ) echo 'selected="selected"'; ?>>all</option> … … 183 186 </p> 184 187 <p> 185 <label for="<?php echo $this->get_field_id('thumb_image_size'); ?>"><?php_e('Image size', 'smart-post-list'); ?></label>186 <select id="<?php echo $this->get_field_id('thumb_image_size'); ?>" name="<?php echo $this->get_field_name('thumb_image_size'); ?>" class="widefat" style="width:100%;">188 <label for="<?php echo esc_attr( $this->get_field_id('thumb_image_size') ); ?>"><?php esc_html_e('Image size', 'smart-post-list'); ?></label> 189 <select id="<?php echo esc_attr( $this->get_field_id('thumb_image_size') ); ?>" name="<?php echo esc_attr( $this->get_field_name('thumb_image_size') ); ?>" class="widefat" style="width:100%;"> 187 190 <option <?php if ( 'thumbnail' == $instance['thumb_image_size'] ) echo 'selected="selected"'; ?>>thumbnail</option> 188 191 <option <?php if ( 'medium' == $instance['thumb_image_size'] ) echo 'selected="selected"'; ?>>medium</option> … … 191 194 </p> 192 195 <p> 193 <label for="<?php echo $this->get_field_id('post_image_float'); ?>"><?php_e('Image float:', 'smart-post-list'); ?></label>194 <select id="<?php echo $this->get_field_id('post_image_float'); ?>" name="<?php echo $this->get_field_name('post_image_float'); ?>" class="widefat" style="width:100%;">195 <option <?php if ( 'top_of_excerpt' == $instance['post_image_float'] ) echo 'selected="selected"'; ?> value="top_of_excerpt"><?php _e('top of excerpt'); ?></option>196 <option <?php if ( 'right_of_excerpt' == $instance['post_image_float'] ) echo 'selected="selected"'; ?> value="right_of_excerpt"><?php _e('right of excerpt'); ?></option>197 <option <?php if ( 'left_of_excerpt' == $instance['post_image_float'] ) echo 'selected="selected"'; ?> value="left_of_excerpt"><?php _e('left of excerpt'); ?></option>196 <label for="<?php echo esc_attr( $this->get_field_id('post_image_float') ); ?>"><?php esc_html_e('Image float:', 'smart-post-list'); ?></label> 197 <select id="<?php echo esc_attr( $this->get_field_id('post_image_float') ); ?>" name="<?php echo esc_attr( $this->get_field_name('post_image_float') ); ?>" class="widefat" style="width:100%;"> 198 <option <?php if ( 'top_of_excerpt' == $instance['post_image_float'] ) echo 'selected="selected"'; ?> value="top_of_excerpt"><?php esc_html_e('top of excerpt'); ?></option> 199 <option <?php if ( 'right_of_excerpt' == $instance['post_image_float'] ) echo 'selected="selected"'; ?> value="right_of_excerpt"><?php esc_html_e('right of excerpt'); ?></option> 200 <option <?php if ( 'left_of_excerpt' == $instance['post_image_float'] ) echo 'selected="selected"'; ?> value="left_of_excerpt"><?php esc_html_e('left of excerpt'); ?></option> 198 201 </select> 199 202 </p> … … 206 209 function update($new_instance, $old_instance) 207 210 { 208 $instance = $old_instance; 211 $instance = $old_instance; 212 209 213 $instance['title'] = strip_tags($new_instance['title']); 210 $instance['show_title'] = ( isset( $new_instance['show_title'] ) ? 1 : 0 ); 211 $instance['show_date'] = ( isset( $new_instance['show_date'] ) ? 1 : 0 ); 212 $instance['show_excerpt'] = ( isset( $new_instance['show_excerpt'] ) ? 1 : 0 ); 213 $instance['show_number_of_comments'] = $new_instance['show_number_of_comments']; 214 215 if( isset( $new_instance['show_title'] ) && ( $new_instance['show_title'] == 1 ) ){ 216 $instance['show_title'] = 1; 217 }else{ 218 $instance['show_title'] = 0; 219 } 220 221 if( isset( $new_instance['show_date'] ) && ( $new_instance['show_date'] == 1 ) ){ 222 $instance['show_date'] = 1; 223 }else{ 224 $instance['show_date'] = 0; 225 } 226 227 if( isset( $new_instance['show_excerpt'] ) && ( $new_instance['show_excerpt'] == 1 ) ){ 228 $instance['show_excerpt'] = 1; 229 }else{ 230 $instance['show_excerpt'] = 0; 231 } 232 233 214 234 $instance['excerpt_words_count'] = $new_instance['excerpt_words_count']; 215 $instance['show_number_of_comments'] = ( isset( $new_instance['show_number_of_comments'] ) ? 1 : 0 ); 235 236 if( isset( $new_instance['show_number_of_comments'] ) && ( $new_instance['show_number_of_comments'] == 1 ) ){ 237 $instance['show_number_of_comments'] = 1; 238 }else{ 239 $instance['show_number_of_comments'] = 0; 240 } 241 216 242 $instance['posts_count'] = $new_instance['posts_count']; 217 243 $instance['posts_offset'] = $new_instance['posts_offset']; … … 219 245 $instance['post_order_direction'] = $new_instance['post_order_direction']; 220 246 $instance['categories'] = $new_instance['categories']; 221 $instance['tags'] = strip_tags($new_instance['tags']);222 $instance['thumb_on_post'] = $new_instance['thumb_on_post'];223 $instance['thumb_image_size'] = $new_instance['thumb_image_size'];247 $instance['tags'] = strip_tags($new_instance['tags']); 248 $instance['thumb_on_post'] = $new_instance['thumb_on_post']; 249 $instance['thumb_image_size'] = $new_instance['thumb_image_size']; 224 250 $instance['post_image_float'] = $new_instance['post_image_float']; 225 251 226 252 return $instance; 227 253 } … … 232 258 function widget($args, $instance) 233 259 { 234 extract($args); 260 261 if( otw_is_admin() ){ 262 echo 'Smart Post Lists Light'; 263 return; 264 } 265 266 extract($args); 267 268 $init_props = array( 'title', 'show_title', 'show_date', 'show_excerpt', 'excerpt_words_count', 'show_number_of_comments', 'posts_count', 'post_orderby', 'post_order_direction', 'posts_offset', 'categories', 'tags', 'thumb_on_post', 'thumb_image_size', 'post_image_float' ); 269 270 foreach( $init_props as $prop ){ 271 if( !isset( $instance[ $prop ] ) ){ 272 $instance[ $prop ] = ''; 273 } 274 } 275 235 276 $title = apply_filters('widget_title', $instance['title'] ); 236 277 $show_title = $instance['show_title']; 237 $show_date = $instance['show_date'];278 $show_date = $instance['show_date']; 238 279 $show_excerpt = $instance['show_excerpt']; 239 280 $excerpt_words_count = $instance['excerpt_words_count']; … … 244 285 $posts_offset = $instance['posts_offset']; 245 286 $categories = $instance['categories']; 246 $tags = $instance['tags'];247 $thumb_on_post = $instance['thumb_on_post'];248 $thumb_image_size = $instance['thumb_image_size'];287 $tags = $instance['tags']; 288 $thumb_on_post = $instance['thumb_on_post']; 289 $thumb_image_size = $instance['thumb_image_size']; 249 290 $post_image_float = $instance['post_image_float']; 250 251 echo $before_widget;291 292 echo $before_widget; 252 293 253 294 if ($title) … … 263 304 $tags_requested = $tags; 264 305 265 if (count($categories) > 0)306 if( is_array( $categories ) && ( count($categories) > 0 ) ) 266 307 { 267 308 foreach ($categories as $category_id) … … 409 450 { 410 451 $result = ''; 411 $result .= '<p class="smart-post-list-date">' . __('Date', 'post-in-category') . ': ' . date(get_option('date_format'), strtotime($post->post_date)) . '</p>';452 $result .= '<p class="smart-post-list-date">' . esc_html__('Date', 'post-in-category') . ': ' . date(get_option('date_format'), strtotime($post->post_date)) . '</p>'; 412 453 413 454 return $result; … … 420 461 { 421 462 $result = ''; 422 $result .= '<p class="smart-post-list-comments"><a href="' . get_permalink($post->ID) . '#comments">' . __('Comments', 'post-in-category') . ': ' . (string)$post->comment_count . '</a></p>';463 $result .= '<p class="smart-post-list-comments"><a href="' . get_permalink($post->ID) . '#comments">' . esc_html__('Comments', 'post-in-category') . ': ' . (string)$post->comment_count . '</a></p>'; 423 464 424 465 return $result; … … 603 644 function otw_spl_admin_menu(){ 604 645 605 add_menu_page( __( 'Smart Post Lists', 'smart-post-list' ),__( 'Smart Post Lists', 'smart-post-list' ), 'manage_options', 'otw-spl', 'otw_spl_info' );606 add_submenu_page( 'otw-spl', __( 'Plugin Options', 'smart-post-list'),__('Plugin Options', 'smart-post-list'), 'manage_options', 'otw-spl', 'otw_spl_info' );646 add_menu_page( esc_html__( 'Smart Post Lists', 'smart-post-list' ), esc_html__( 'Smart Post Lists', 'smart-post-list' ), 'manage_options', 'otw-spl', 'otw_spl_info' ); 647 add_submenu_page( 'otw-spl', esc_html__( 'Plugin Options', 'smart-post-list'), esc_html__('Plugin Options', 'smart-post-list'), 'manage_options', 'otw-spl', 'otw_spl_info' ); 607 648 } 608 649 … … 633 674 $otw_spll_factory_component = otw_load_component( 'otw_factory' ); 634 675 $otw_spll_factory_object = otw_get_component( $otw_spll_factory_component ); 635 $otw_spll_factory_object->add_plugin( $otw_spll_plugin_id, dirname( __FILE__ ).'/splw.php', array( 'menu_parent' => 'otw-spl', 'lc_name' => __( 'License Manager', 'smart-post-list' ), 'menu_key' => 'otw-spl' ) );676 $otw_spll_factory_object->add_plugin( $otw_spll_plugin_id, dirname( __FILE__ ).'/splw.php', array( 'menu_parent' => 'otw-spl', 'lc_name' => esc_html__( 'License Manager', 'smart-post-list' ), 'menu_key' => 'otw-spl' ) ); 636 677 637 678 include_once( plugin_dir_path( __FILE__ ).'include/otw_labels/otw_spll_factory_object.labels.php' );
Note: See TracChangeset
for help on using the changeset viewer.