Advanced AJAX Product Filters - Version 1.4.0.4

Version Description

  • Fix - Additional tables generation errors
  • Fix - Additional tables incorrect data to hide products
  • Fix - Custom filtering permalink with Product Table plugin
Download this release

Release Info

Developer RazyRx
Plugin Icon wp plugin Advanced AJAX Product Filters
Version 1.4.0.4
Comparing to
See all releases

Code changes from version 1.4.0.3 to 1.4.0.4

addons/additional_tables/add_table.php CHANGED
@@ -119,7 +119,7 @@ class BeRocket_aapf_variations_tables {
119
  global $wpdb;
120
  $parent = wp_get_post_parent_id($product_id);
121
  $stock_status_int = ($stock_status == 'instock' ? 1 : 0);
122
- $sql = "INSERT INTO {$wpdb->prefix}braapf_product_stock_status_parent (post_id, parent_id, stock_status) VALUES({$product_id}, {$parent}, {$stock_status_int}) ON DUPLICATE KEY UPDATE stock_status={$stock_status_int}";
123
  $wpdb->query($sql);
124
 
125
  if ( $product->get_manage_stock() ) {
@@ -130,7 +130,7 @@ class BeRocket_aapf_variations_tables {
130
  $query_in = '(' . implode( ',', $format ) . ')';
131
  $managed_children = array_unique( $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_manage_stock' AND meta_value != 'yes' AND post_id IN {$query_in}", $children ) ) );
132
  foreach ( $managed_children as $managed_child ) {
133
- $sql = "INSERT INTO {$wpdb->prefix}braapf_product_stock_status_parent (post_id, parent_id, stock_status) VALUES({$managed_child}, {$product_id}, {$stock_status_int}) ON DUPLICATE KEY UPDATE stock_status={$stock_status_int}";
134
  $wpdb->query($sql);
135
  }
136
  }
@@ -159,8 +159,10 @@ class BeRocket_aapf_variations_tables {
159
  }
160
  foreach($attributes as $attribute) {
161
  $term = get_term_by('slug', $attribute, $taxonomy);
162
- $sql = "INSERT INTO {$wpdb->prefix}braapf_product_variation_attributes (post_id, parent_id, meta_key, meta_value_id) VALUES({$product_id}, {$parent_id}, '{$taxonomy}', {$term->term_id})";
163
- $wpdb->query($sql);
 
 
164
  }
165
  }
166
  }
@@ -176,7 +178,7 @@ class BeRocket_aapf_variations_tables {
176
  $product_id = $product->get_id();
177
  $sql = "DELETE FROM {$wpdb->prefix}braapf_variation_attributes WHERE post_id={$product_id};";
178
  $wpdb->query($sql);
179
- $sql = "INSERT INTO {$wpdb->prefix}braapf_variation_attributes
180
  SELECT parent_id as post_id, meta_key as taxonomy
181
  FROM {$wpdb->prefix}braapf_product_variation_attributes
182
  WHERE parent_id={$product_id}
@@ -219,7 +221,7 @@ class BeRocket_aapf_variations_tables {
219
  $table_name = $wpdb->prefix . 'braapf_term_taxonomy_hierarchical';
220
  $wpdb->query("DELETE FROM $table_name WHERE taxonomy = '$taxonomy';");
221
  $hierarchy = br_get_taxonomy_hierarchy(array('taxonomy' => $taxonomy, 'return' => 'child'));
222
- $join_query = "INSERT INTO $table_name
223
  SELECT tt1.term_taxonomy_id as term_taxonomy_id, tt1.term_id as term_id,
224
  tt2.term_taxonomy_id as term_taxonomy_child_id, tt2.term_id as term_child_id,
225
  tt1.taxonomy as taxonomy
119
  global $wpdb;
120
  $parent = wp_get_post_parent_id($product_id);
121
  $stock_status_int = ($stock_status == 'instock' ? 1 : 0);
122
+ $sql = "INSERT IGNORE INTO {$wpdb->prefix}braapf_product_stock_status_parent (post_id, parent_id, stock_status) VALUES({$product_id}, {$parent}, {$stock_status_int}) ON DUPLICATE KEY UPDATE stock_status={$stock_status_int}";
123
  $wpdb->query($sql);
124
 
125
  if ( $product->get_manage_stock() ) {
130
  $query_in = '(' . implode( ',', $format ) . ')';
131
  $managed_children = array_unique( $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_manage_stock' AND meta_value != 'yes' AND post_id IN {$query_in}", $children ) ) );
132
  foreach ( $managed_children as $managed_child ) {
133
+ $sql = "INSERT IGNORE INTO {$wpdb->prefix}braapf_product_stock_status_parent (post_id, parent_id, stock_status) VALUES({$managed_child}, {$product_id}, {$stock_status_int}) ON DUPLICATE KEY UPDATE stock_status={$stock_status_int}";
134
  $wpdb->query($sql);
135
  }
136
  }
159
  }
160
  foreach($attributes as $attribute) {
161
  $term = get_term_by('slug', $attribute, $taxonomy);
162
+ if( $term !== false ) {
163
+ $sql = "INSERT IGNORE INTO {$wpdb->prefix}braapf_product_variation_attributes (post_id, parent_id, meta_key, meta_value_id) VALUES({$product_id}, {$parent_id}, '{$taxonomy}', {$term->term_id})";
164
+ $wpdb->query($sql);
165
+ }
166
  }
167
  }
168
  }
178
  $product_id = $product->get_id();
179
  $sql = "DELETE FROM {$wpdb->prefix}braapf_variation_attributes WHERE post_id={$product_id};";
180
  $wpdb->query($sql);
181
+ $sql = "INSERT IGNORE INTO {$wpdb->prefix}braapf_variation_attributes
182
  SELECT parent_id as post_id, meta_key as taxonomy
183
  FROM {$wpdb->prefix}braapf_product_variation_attributes
184
  WHERE parent_id={$product_id}
221
  $table_name = $wpdb->prefix . 'braapf_term_taxonomy_hierarchical';
222
  $wpdb->query("DELETE FROM $table_name WHERE taxonomy = '$taxonomy';");
223
  $hierarchy = br_get_taxonomy_hierarchy(array('taxonomy' => $taxonomy, 'return' => 'child'));
224
+ $join_query = "INSERT IGNORE INTO $table_name
225
  SELECT tt1.term_taxonomy_id as term_taxonomy_id, tt1.term_id as term_id,
226
  tt2.term_taxonomy_id as term_taxonomy_child_id, tt2.term_id as term_child_id,
227
  tt1.taxonomy as taxonomy
addons/additional_tables/additional_tables.php CHANGED
@@ -46,6 +46,8 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
46
  }
47
  }
48
  } else {
 
 
49
  if( ! empty($create_position) ) {
50
  $this->deactivate();
51
  }
@@ -226,16 +228,16 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
226
  taxonomy varchar(32) NOT NULL,
227
  INDEX term_taxonomy_id (term_taxonomy_id),
228
  INDEX term_taxonomy_child_id (term_taxonomy_child_id),
229
- INDEX child_parent_id (term_taxonomy_id, term_taxonomy_child_id)
 
230
  ) $charset_collate;";
231
  $query_status = dbDelta( $sql );
232
  $this->save_query_error($sql, $query_status);
 
233
  $this->set_current_create_position_data(array(
234
  'status' => 0,
235
  'run' => false,
236
  ));
237
- $this->set_current_create_position(2);
238
- $this->activate();
239
  }
240
  function create_table_braapf_product_stock_status_parent() {
241
  $run_data = $this->get_current_create_position_data();
@@ -264,15 +266,8 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
264
  $sql = "SELECT MIN({$wpdb->prefix}wc_product_meta_lookup.product_id) as min, MAX({$wpdb->prefix}wc_product_meta_lookup.product_id) as max FROM {$wpdb->prefix}wc_product_meta_lookup";
265
  $product_data = $wpdb->get_row($sql);
266
  $this->save_query_error($sql, $product_data);
267
- $this->set_current_create_position_data(array('status' => 0));
268
  if( ! empty($product_data) && ! empty($product_data->min) && ! empty($product_data->max) ) {
269
- BeRocket_error_notices::add_plugin_error(1, 'SET CRON', array(
270
- 'time' => (time()+1),
271
- 'hook' => 'berocket_create_table_braapf_product_stock_status_parent',
272
- 'var' => array($product_data->min, $product_data->min, $product_data->max)
273
- ));
274
  $this->set_current_create_position(3);
275
- $this->activate();
276
  $this->set_current_create_position_data(array(
277
  'status' => 0,
278
  'run' => false,
@@ -282,12 +277,11 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
282
  ));
283
  wp_schedule_single_event( time(), 'berocket_create_table_braapf_product_stock_status_parent' );
284
  } else {
 
285
  $this->set_current_create_position_data(array(
286
  'status' => 0,
287
  'run' => false,
288
  ));
289
- $this->set_current_create_position(4);
290
- $this->activate();
291
  }
292
  }
293
  function insert_table_braapf_product_stock_status_parent() {
@@ -297,9 +291,9 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
297
  }
298
  $run_data['run'] = true;
299
  $this->set_current_create_position_data($run_data);
300
- $start_id = $run_data['start_id'];
301
- $min_id = $run_data['min_id'];
302
- $max_id = $run_data['max_id'];
303
  $end_id = $start_id + 5000;
304
  BeRocket_error_notices::add_plugin_error(1, 'insert_table_braapf_product_stock_status_parent', array(
305
  'start_id' => $start_id,
@@ -321,25 +315,28 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
321
  'result' => $test_row,
322
  ));
323
  if( ! empty($test_row) ) {
324
- $sql = "INSERT INTO {$table_name} {$sql_select}";
325
  $query_status = $wpdb->query($sql);
326
  if( $query_status === FALSE ) {
327
  $this->save_query_error($sql);
328
  }
329
  }
330
- $status = max(0, min(100, (($end_id - $min_id) / ($max_id - $min_id) * 100)));
331
- $this->set_current_create_position_data(array(
332
- 'status' => $status,
333
- 'run' => false,
334
- 'start_id' => $end_id,
335
- 'min_id' => $min_id,
336
- 'max_id' => $max_id
337
- ));
338
  if( $end_id <= $max_id ) {
 
 
 
 
 
 
 
339
  wp_schedule_single_event( (time()+1), 'berocket_create_table_braapf_product_stock_status_parent' );
340
  } else {
341
  $this->set_current_create_position(4);
342
- $this->activate();
 
 
 
343
  }
344
  }
345
  function create_table_braapf_product_variation_attributes() {
@@ -360,20 +357,19 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
360
  $sql = "CREATE TABLE $table_name (
361
  post_id bigint(20) NOT NULL,
362
  parent_id bigint(20) NOT NULL,
363
- meta_key varchar(255) NOT NULL,
364
  meta_value_id bigint(20) NOT NULL,
365
  INDEX post_id (post_id),
366
  INDEX meta_key (meta_key),
367
- INDEX meta_value_id (meta_value_id)
 
368
  ) $charset_collate;";
369
  $query_status = dbDelta( $sql );
370
  $this->save_query_error($sql, $query_status);
371
  $sql = "SELECT MIN({$wpdb->postmeta}.meta_id) as min, MAX({$wpdb->postmeta}.meta_id) as max FROM {$wpdb->postmeta}";
372
  $postmeta_data = $wpdb->get_row($sql);
373
- $this->set_current_create_position_data(array('status' => 0));
374
  if( ! empty($postmeta_data) && ! empty($postmeta_data->min) && ! empty($postmeta_data->max) ) {
375
  $this->set_current_create_position(5);
376
- $this->activate();
377
  $this->set_current_create_position_data(array(
378
  'status' => 0,
379
  'run' => false,
@@ -383,12 +379,11 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
383
  ));
384
  wp_schedule_single_event( (time()+1), 'berocket_create_table_braapf_product_variation_attributes' );
385
  } else {
 
386
  $this->set_current_create_position_data(array(
387
  'status' => 0,
388
  'run' => false,
389
  ));
390
- $this->set_current_create_position(6);
391
- $this->activate();
392
  }
393
  }
394
  function insert_table_braapf_product_variation_attributes() {
@@ -398,9 +393,9 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
398
  }
399
  $run_data['run'] = true;
400
  $this->set_current_create_position_data($run_data);
401
- $start_id = $run_data['start_id'];
402
- $min_id = $run_data['min_id'];
403
- $max_id = $run_data['max_id'];
404
  $end_id = $start_id + 10000;
405
  global $wpdb;
406
  $table_name = $wpdb->prefix . 'braapf_product_variation_attributes';
@@ -414,7 +409,7 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
414
  AND {$wpdb->postmeta}.meta_key LIKE 'attribute_pa_%'";
415
  $test_row = $wpdb->get_row($sql_select);
416
  if( ! empty($test_row) ) {
417
- $sql = "INSERT INTO {$table_name} {$sql_select}";
418
  $query_status = $wpdb->query($sql);
419
  if( $query_status === FALSE ) {
420
  $this->save_query_error($sql);
@@ -430,25 +425,28 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
430
  AND {$wpdb->postmeta}.meta_key LIKE 'attribute_pa_%' AND {$wpdb->postmeta}.meta_value = ''";
431
  $test_row = $wpdb->get_row($sql_select);
432
  if( ! empty($test_row) ) {
433
- $sql = "INSERT INTO {$table_name} {$sql_select}";
434
  $query_status = $wpdb->query($sql);
435
  if( $query_status === FALSE ) {
436
  $this->save_query_error($sql);
437
  }
438
  }
439
- $status = max(0, min(100, (($end_id - $min_id) / ($max_id - $min_id) * 100)));
440
- $this->set_current_create_position_data(array(
441
- 'status' => $status,
442
- 'run' => false,
443
- 'start_id' => $end_id,
444
- 'min_id' => $min_id,
445
- 'max_id' => $max_id
446
- ));
447
  if( $end_id <= $max_id ) {
 
 
 
 
 
 
 
448
  wp_schedule_single_event( (time()+1), 'berocket_create_table_braapf_product_variation_attributes' );
449
  } else {
450
  $this->set_current_create_position(6);
451
- $this->activate();
 
 
 
452
  }
453
  }
454
  function create_table_braapf_variation_attributes() {
@@ -470,16 +468,16 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
470
  post_id bigint(20) NOT NULL,
471
  taxonomy varchar(32) NOT NULL,
472
  INDEX post_id (post_id),
473
- INDEX taxonomy (taxonomy)
 
474
  ) $charset_collate;";
475
  $query_status = dbDelta( $sql );
476
  $this->save_query_error($sql, $query_status);
 
477
  $this->set_current_create_position_data(array(
478
  'status' => 0,
479
  'run' => false,
480
  ));
481
- $this->set_current_create_position(7);
482
- $this->activate();
483
  wp_schedule_single_event( (time()+1), 'berocket_create_table_braapf_variation_attributes' );
484
  }
485
  function insert_table_braapf_variation_attributes() {
@@ -500,17 +498,17 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
500
  GROUP BY meta_key, parent_id";
501
  $test_row = $wpdb->get_row($sql_select);
502
  if( ! empty($test_row) ) {
503
- $sql = "INSERT INTO {$table_name} {$sql_select}";
504
  $query_status = $wpdb->query($sql);
505
  if( $query_status === FALSE ) {
506
  $this->save_query_error($sql);
507
  }
508
  }
 
509
  $this->set_current_create_position_data(array(
510
  'status' => 100,
511
  'run' => false,
512
  ));
513
- $this->set_current_create_position(8);
514
  }
515
  function deactivate() {
516
  global $wpdb;
@@ -530,6 +528,10 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
530
  }
531
  $wpdb->query("DELETE FROM {$wpdb->prefix}options WHERE option_name LIKE '%br_custom_table_hierarhical_%';");
532
  $this->set_current_create_position(false);
 
 
 
 
533
  }
534
  }
535
  new BeRocket_aapf_variations_tables_addon();
46
  }
47
  }
48
  } else {
49
+ delete_option('BeRocket_aapf_additional_tables_addon_position');
50
+ delete_option('BeRocket_aapf_additional_tables_addon_position_data');
51
  if( ! empty($create_position) ) {
52
  $this->deactivate();
53
  }
228
  taxonomy varchar(32) NOT NULL,
229
  INDEX term_taxonomy_id (term_taxonomy_id),
230
  INDEX term_taxonomy_child_id (term_taxonomy_child_id),
231
+ INDEX child_parent_id (term_taxonomy_id, term_taxonomy_child_id),
232
+ UNIQUE uniqueid (term_taxonomy_id, term_id, term_taxonomy_child_id, term_child_id)
233
  ) $charset_collate;";
234
  $query_status = dbDelta( $sql );
235
  $this->save_query_error($sql, $query_status);
236
+ $this->set_current_create_position(2);
237
  $this->set_current_create_position_data(array(
238
  'status' => 0,
239
  'run' => false,
240
  ));
 
 
241
  }
242
  function create_table_braapf_product_stock_status_parent() {
243
  $run_data = $this->get_current_create_position_data();
266
  $sql = "SELECT MIN({$wpdb->prefix}wc_product_meta_lookup.product_id) as min, MAX({$wpdb->prefix}wc_product_meta_lookup.product_id) as max FROM {$wpdb->prefix}wc_product_meta_lookup";
267
  $product_data = $wpdb->get_row($sql);
268
  $this->save_query_error($sql, $product_data);
 
269
  if( ! empty($product_data) && ! empty($product_data->min) && ! empty($product_data->max) ) {
 
 
 
 
 
270
  $this->set_current_create_position(3);
 
271
  $this->set_current_create_position_data(array(
272
  'status' => 0,
273
  'run' => false,
277
  ));
278
  wp_schedule_single_event( time(), 'berocket_create_table_braapf_product_stock_status_parent' );
279
  } else {
280
+ $this->set_current_create_position(4);
281
  $this->set_current_create_position_data(array(
282
  'status' => 0,
283
  'run' => false,
284
  ));
 
 
285
  }
286
  }
287
  function insert_table_braapf_product_stock_status_parent() {
291
  }
292
  $run_data['run'] = true;
293
  $this->set_current_create_position_data($run_data);
294
+ $start_id = intval($run_data['start_id']);
295
+ $min_id = intval($run_data['min_id']);
296
+ $max_id = intval($run_data['max_id']);
297
  $end_id = $start_id + 5000;
298
  BeRocket_error_notices::add_plugin_error(1, 'insert_table_braapf_product_stock_status_parent', array(
299
  'start_id' => $start_id,
315
  'result' => $test_row,
316
  ));
317
  if( ! empty($test_row) ) {
318
+ $sql = "INSERT IGNORE INTO {$table_name} {$sql_select}";
319
  $query_status = $wpdb->query($sql);
320
  if( $query_status === FALSE ) {
321
  $this->save_query_error($sql);
322
  }
323
  }
324
+ $status = max(0, min(100, (($end_id - $min_id) / (($max_id - $min_id) == 0 ? 1 : ($max_id - $min_id)) * 100)));
 
 
 
 
 
 
 
325
  if( $end_id <= $max_id ) {
326
+ $this->set_current_create_position_data(array(
327
+ 'status' => $status,
328
+ 'run' => false,
329
+ 'start_id' => $end_id,
330
+ 'min_id' => $min_id,
331
+ 'max_id' => $max_id
332
+ ));
333
  wp_schedule_single_event( (time()+1), 'berocket_create_table_braapf_product_stock_status_parent' );
334
  } else {
335
  $this->set_current_create_position(4);
336
+ $this->set_current_create_position_data(array(
337
+ 'status' => 0,
338
+ 'run' => false
339
+ ));
340
  }
341
  }
342
  function create_table_braapf_product_variation_attributes() {
357
  $sql = "CREATE TABLE $table_name (
358
  post_id bigint(20) NOT NULL,
359
  parent_id bigint(20) NOT NULL,
360
+ meta_key varchar(32) NOT NULL,
361
  meta_value_id bigint(20) NOT NULL,
362
  INDEX post_id (post_id),
363
  INDEX meta_key (meta_key),
364
+ INDEX meta_value_id (meta_value_id),
365
+ UNIQUE uniqueid (post_id, meta_key, meta_value_id)
366
  ) $charset_collate;";
367
  $query_status = dbDelta( $sql );
368
  $this->save_query_error($sql, $query_status);
369
  $sql = "SELECT MIN({$wpdb->postmeta}.meta_id) as min, MAX({$wpdb->postmeta}.meta_id) as max FROM {$wpdb->postmeta}";
370
  $postmeta_data = $wpdb->get_row($sql);
 
371
  if( ! empty($postmeta_data) && ! empty($postmeta_data->min) && ! empty($postmeta_data->max) ) {
372
  $this->set_current_create_position(5);
 
373
  $this->set_current_create_position_data(array(
374
  'status' => 0,
375
  'run' => false,
379
  ));
380
  wp_schedule_single_event( (time()+1), 'berocket_create_table_braapf_product_variation_attributes' );
381
  } else {
382
+ $this->set_current_create_position(6);
383
  $this->set_current_create_position_data(array(
384
  'status' => 0,
385
  'run' => false,
386
  ));
 
 
387
  }
388
  }
389
  function insert_table_braapf_product_variation_attributes() {
393
  }
394
  $run_data['run'] = true;
395
  $this->set_current_create_position_data($run_data);
396
+ $start_id = intval($run_data['start_id']);
397
+ $min_id = intval($run_data['min_id']);
398
+ $max_id = intval($run_data['max_id']);
399
  $end_id = $start_id + 10000;
400
  global $wpdb;
401
  $table_name = $wpdb->prefix . 'braapf_product_variation_attributes';
409
  AND {$wpdb->postmeta}.meta_key LIKE 'attribute_pa_%'";
410
  $test_row = $wpdb->get_row($sql_select);
411
  if( ! empty($test_row) ) {
412
+ $sql = "INSERT IGNORE INTO {$table_name} {$sql_select}";
413
  $query_status = $wpdb->query($sql);
414
  if( $query_status === FALSE ) {
415
  $this->save_query_error($sql);
425
  AND {$wpdb->postmeta}.meta_key LIKE 'attribute_pa_%' AND {$wpdb->postmeta}.meta_value = ''";
426
  $test_row = $wpdb->get_row($sql_select);
427
  if( ! empty($test_row) ) {
428
+ $sql = "INSERT IGNORE INTO {$table_name} {$sql_select}";
429
  $query_status = $wpdb->query($sql);
430
  if( $query_status === FALSE ) {
431
  $this->save_query_error($sql);
432
  }
433
  }
434
+ $status = max(0, min(100, (($end_id - $min_id) / (($max_id - $min_id) == 0 ? 1 : ($max_id - $min_id)) * 100)));
 
 
 
 
 
 
 
435
  if( $end_id <= $max_id ) {
436
+ $this->set_current_create_position_data(array(
437
+ 'status' => $status,
438
+ 'run' => false,
439
+ 'start_id' => $end_id,
440
+ 'min_id' => $min_id,
441
+ 'max_id' => $max_id
442
+ ));
443
  wp_schedule_single_event( (time()+1), 'berocket_create_table_braapf_product_variation_attributes' );
444
  } else {
445
  $this->set_current_create_position(6);
446
+ $this->set_current_create_position_data(array(
447
+ 'status' => 0,
448
+ 'run' => false
449
+ ));
450
  }
451
  }
452
  function create_table_braapf_variation_attributes() {
468
  post_id bigint(20) NOT NULL,
469
  taxonomy varchar(32) NOT NULL,
470
  INDEX post_id (post_id),
471
+ INDEX taxonomy (taxonomy),
472
+ UNIQUE uniqueid (post_id, taxonomy)
473
  ) $charset_collate;";
474
  $query_status = dbDelta( $sql );
475
  $this->save_query_error($sql, $query_status);
476
+ $this->set_current_create_position(7);
477
  $this->set_current_create_position_data(array(
478
  'status' => 0,
479
  'run' => false,
480
  ));
 
 
481
  wp_schedule_single_event( (time()+1), 'berocket_create_table_braapf_variation_attributes' );
482
  }
483
  function insert_table_braapf_variation_attributes() {
498
  GROUP BY meta_key, parent_id";
499
  $test_row = $wpdb->get_row($sql_select);
500
  if( ! empty($test_row) ) {
501
+ $sql = "INSERT IGNORE INTO {$table_name} {$sql_select}";
502
  $query_status = $wpdb->query($sql);
503
  if( $query_status === FALSE ) {
504
  $this->save_query_error($sql);
505
  }
506
  }
507
+ $this->set_current_create_position(8);
508
  $this->set_current_create_position_data(array(
509
  'status' => 100,
510
  'run' => false,
511
  ));
 
512
  }
513
  function deactivate() {
514
  global $wpdb;
528
  }
529
  $wpdb->query("DELETE FROM {$wpdb->prefix}options WHERE option_name LIKE '%br_custom_table_hierarhical_%';");
530
  $this->set_current_create_position(false);
531
+ $this->set_current_create_position_data(array(
532
+ 'status' => 0,
533
+ 'run' => false,
534
+ ));
535
  }
536
  }
537
  new BeRocket_aapf_variations_tables_addon();
includes/addons/woocommerce-variation.php CHANGED
@@ -1,13 +1,62 @@
1
  <?php
2
  class BeRocket_AAPF_compat_woocommerce_variation {
3
  public $limit_post__not_in_where_array = array();
 
4
  function __construct() {
5
- add_filter('berocket_filters_query_already_filtered', array(__CLASS__, 'query_already_filtered'), 10, 3);
6
- add_filter('berocket_add_out_of_stock_variable', array(__CLASS__, 'out_of_stock_variable'), 10, 3);
7
- add_filter('brAAPFcompat_WCvariation_out_of_stock_where', array(__CLASS__, 'out_of_stock_where'), 10, 1);
8
- add_filter('berocket_aapf_recount_terms_query', array($this, 'faster_recount_add_data'), 60, 3);
9
- add_filter('berocket_query_result_recount', array($this, 'faster_recount_query_result'), 60, 3);
10
- add_filter('berocket_recount_cache_key', array($this, 'faster_recount_cache_key'), 60);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
  public static function query_already_filtered($query, $terms, $limits) {
13
  $post_not_in = self::out_of_stock_variable(array(), $terms, $limits, $query);
1
  <?php
2
  class BeRocket_AAPF_compat_woocommerce_variation {
3
  public $limit_post__not_in_where_array = array();
4
+ public $is_init = false;
5
  function __construct() {
6
+ $BeRocket_AAPF = BeRocket_AAPF::getInstance();
7
+ $options = $BeRocket_AAPF->get_option();
8
+ if( berocket_isset($options['out_of_stock_variable']) == 1 ) {
9
+ $this->add_filter();
10
+ } else {
11
+ add_action('br_aapf_args_converter_after', array($this, 'br_aapf_args_converter_after'));
12
+ }
13
+ }
14
+ function br_aapf_args_converter_after() {
15
+ if( ! $this->is_init ) {
16
+ $BeRocket_AAPF = BeRocket_AAPF::getInstance();
17
+ $options = $BeRocket_AAPF->get_option();
18
+ global $br_url_parser_middle_result;
19
+ $is_woocommerce_variation_enabled = apply_filters(
20
+ 'berocket_compat_woocommerce_variation_enabled',
21
+ (berocket_isset($options['out_of_stock_variable']) == 2
22
+ && ! empty($br_url_parser_middle_result['_stock_status'])
23
+ && is_array($br_url_parser_middle_result['_stock_status'])
24
+ && ( in_array('1', $br_url_parser_middle_result['_stock_status']) || in_array('instock', $br_url_parser_middle_result['_stock_status']) )
25
+ ),
26
+ $options
27
+ );
28
+ if( $is_woocommerce_variation_enabled ) {
29
+ $this->add_filter();
30
+ } else {
31
+ add_action('berocket_term_recount_before_action', array($this, 'start_stock_status'), 10, 2);
32
+ add_action('berocket_term_recount_after_action', array($this, 'stop_stock_status'), 10, 3);
33
+ }
34
+ }
35
+ }
36
+ public function add_filter() {
37
+ if( ! $this->is_init ) {
38
+ $this->is_init = true;
39
+ $this->filter_hooks();
40
+ }
41
+ }
42
+ public function filter_hooks($add = true) {
43
+ $action = ($add ? 'add_filter' : 'remove_filter');
44
+ $action('berocket_filters_query_already_filtered', array(__CLASS__, 'query_already_filtered'), 10, 3);
45
+ $action('berocket_add_out_of_stock_variable', array(__CLASS__, 'out_of_stock_variable'), 10, 3);
46
+ $action('brAAPFcompat_WCvariation_out_of_stock_where', array(__CLASS__, 'out_of_stock_where'), 10, 1);
47
+ $action('berocket_aapf_recount_terms_query', array($this, 'faster_recount_add_data'), 60, 3);
48
+ $action('berocket_query_result_recount', array($this, 'faster_recount_query_result'), 60, 3);
49
+ $action('berocket_recount_cache_key', array($this, 'faster_recount_cache_key'), 60);
50
+ }
51
+ public function start_stock_status($terms, $taxonomy_data) {
52
+ if( ! $this->is_init && $taxonomy_data['taxonomy'] == '_stock_status' ) {
53
+ $this->filter_hooks();
54
+ }
55
+ }
56
+ public function stop_stock_status($terms, $taxonomy_data) {
57
+ if( ! $this->is_init && $taxonomy_data['taxonomy'] == '_stock_status' ) {
58
+ $this->filter_hooks(false);
59
+ }
60
  }
61
  public static function query_already_filtered($query, $terms, $limits) {
62
  $post_not_in = self::out_of_stock_variable(array(), $terms, $limits, $query);
includes/compatibility/product-table.php CHANGED
@@ -2,7 +2,11 @@
2
  class BeRocket_AAPF_compat_product_table {
3
  function __construct() {
4
  add_action( 'plugins_loaded', array( __CLASS__, 'plugins_loaded' ), 1 );
 
5
  if(defined('DOING_AJAX') && DOING_AJAX && !empty($_POST['action']) && $_POST['action'] == 'wcpt_load_products') {
 
 
 
6
  $table_id = filter_input( INPUT_POST, 'table_id', FILTER_SANITIZE_STRING );
7
  $table_transient = get_transient( $table_id );
8
  unset($table_transient['total_posts']);
@@ -40,9 +44,6 @@ class BeRocket_AAPF_compat_product_table {
40
  if( empty($table_args['berocket_ajax']) ) {
41
  return $query_vars;
42
  }
43
- if(defined('DOING_AJAX') && DOING_AJAX && !empty($_POST['action']) && $_POST['action'] == 'wcpt_load_products' && ! empty($_POST['filters'])) {
44
- $_GET['filters'] = $_POST['filters'];
45
- }
46
  $BeRocket_AAPF = BeRocket_AAPF::getInstance();
47
  $query_vars = $BeRocket_AAPF->woocommerce_filter_query_vars($query_vars);
48
  return $query_vars;
@@ -53,4 +54,3 @@ class BeRocket_AAPF_compat_product_table {
53
  return $localize;
54
  }
55
  }
56
- new BeRocket_AAPF_compat_product_table();
2
  class BeRocket_AAPF_compat_product_table {
3
  function __construct() {
4
  add_action( 'plugins_loaded', array( __CLASS__, 'plugins_loaded' ), 1 );
5
+ $filter_nn_name = apply_filters('berocket_aapf_filter_variable_name_nn', 'filters');
6
  if(defined('DOING_AJAX') && DOING_AJAX && !empty($_POST['action']) && $_POST['action'] == 'wcpt_load_products') {
7
+ if( ! empty($_POST[$filter_nn_name]) ) {
8
+ $_GET[$filter_nn_name] = $_POST[$filter_nn_name];
9
+ }
10
  $table_id = filter_input( INPUT_POST, 'table_id', FILTER_SANITIZE_STRING );
11
  $table_transient = get_transient( $table_id );
12
  unset($table_transient['total_posts']);
44
  if( empty($table_args['berocket_ajax']) ) {
45
  return $query_vars;
46
  }
 
 
 
47
  $BeRocket_AAPF = BeRocket_AAPF::getInstance();
48
  $query_vars = $BeRocket_AAPF->woocommerce_filter_query_vars($query_vars);
49
  return $query_vars;
54
  return $localize;
55
  }
56
  }
 
includes/faster_recount.php CHANGED
@@ -29,7 +29,9 @@ class BeRocket_AAPF_faster_attribute_recount {
29
  ), $taxonomy_data), $terms);
30
  global $braapf_recount_taxonomy_data;
31
  $braapf_recount_taxonomy_data = $taxonomy_data;
 
32
  $result = $this->recount_terms_without_prepare($terms, $taxonomy_data);
 
33
  $braapf_recount_taxonomy_data = FALSE;
34
  return $result;
35
  }
@@ -44,12 +46,12 @@ class BeRocket_AAPF_faster_attribute_recount {
44
  if( $terms === FALSE ) {
45
  $terms = $this->get_terms($taxonomy);
46
  }
47
- if( empty($terms) ) {
48
  if( BeRocket_AAPF::$debug_mode ) {
49
  $taxonomy_data['error'] = 'Empty terms';
50
  BeRocket_AAPF::$error_log['faster_recount_sql'][] = $taxonomy_data;
51
  }
52
- return $terms;
53
  }
54
  if( $tax_query === FALSE ) {
55
  $tax_query = WC_Query::get_main_tax_query();
@@ -133,7 +135,7 @@ class BeRocket_AAPF_faster_attribute_recount {
133
  $taxonomy_data['result'] = $result;
134
  BeRocket_AAPF::$error_log['faster_recount_sql'][] = $taxonomy_data;
135
  }
136
- return $terms;
137
  }
138
  function child_include($query, $taxonomy_data, $terms) {
139
  global $wpdb;
29
  ), $taxonomy_data), $terms);
30
  global $braapf_recount_taxonomy_data;
31
  $braapf_recount_taxonomy_data = $taxonomy_data;
32
+ do_action('berocket_term_recount_before_action', $terms, $taxonomy_data);
33
  $result = $this->recount_terms_without_prepare($terms, $taxonomy_data);
34
+ do_action('berocket_term_recount_after_action', $terms, $taxonomy_data);
35
  $braapf_recount_taxonomy_data = FALSE;
36
  return $result;
37
  }
46
  if( $terms === FALSE ) {
47
  $terms = $this->get_terms($taxonomy);
48
  }
49
+ if( empty($terms) || is_wp_error($terms) ) {
50
  if( BeRocket_AAPF::$debug_mode ) {
51
  $taxonomy_data['error'] = 'Empty terms';
52
  BeRocket_AAPF::$error_log['faster_recount_sql'][] = $taxonomy_data;
53
  }
54
+ return array();
55
  }
56
  if( $tax_query === FALSE ) {
57
  $tax_query = WC_Query::get_main_tax_query();
135
  $taxonomy_data['result'] = $result;
136
  BeRocket_AAPF::$error_log['faster_recount_sql'][] = $taxonomy_data;
137
  }
138
+ return apply_filters('berocket_terms_recount_return', $terms, $taxonomy_data, $query_imploded);
139
  }
140
  function child_include($query, $taxonomy_data, $terms) {
141
  global $wpdb;
includes/functions.php CHANGED
@@ -677,6 +677,7 @@ if( ! function_exists( 'br_aapf_args_converter' ) ) {
677
  }
678
  }
679
  }
 
680
  }
681
  }
682
 
677
  }
678
  }
679
  }
680
+ do_action('br_aapf_args_converter_after', $query);
681
  }
682
  }
683
 
js/widget.min.js CHANGED
@@ -611,11 +611,11 @@ var berocket_aapf_widget_product_filters = [],
611
  }
612
  $('.hide_products').removeClass('hide_products');
613
  if( is_product_table ) {
614
- $data = $(data);
615
  berocket_aapf_attribute_data.jquery = $data;
616
  } else {
617
  if( the_ajax_script.ajax_request_load && the_ajax_script.ajax_request_load_style == 'jquery' ) {
618
- $data = $(data);
619
  args_ajax = {
620
  pagination:$data.find(the_ajax_script.pagination_class).prop('outerHTML'),
621
  catalog_ordering:$data.find(the_ajax_script.ordering_class).prop('outerHTML'),
611
  }
612
  $('.hide_products').removeClass('hide_products');
613
  if( is_product_table ) {
614
+ $data = $('<div>'+data+'</div>');
615
  berocket_aapf_attribute_data.jquery = $data;
616
  } else {
617
  if( the_ajax_script.ajax_request_load && the_ajax_script.ajax_request_load_style == 'jquery' ) {
618
+ $data = $('<div>'+data+'</div>');
619
  args_ajax = {
620
  pagination:$data.find(the_ajax_script.pagination_class).prop('outerHTML'),
621
  catalog_ordering:$data.find(the_ajax_script.ordering_class).prop('outerHTML'),
main.php CHANGED
@@ -190,6 +190,7 @@ class BeRocket_AAPF extends BeRocket_Framework {
190
  //INIT ADITIONAL CLASSES
191
  BeRocket_AAPF_single_filter::getInstance();
192
  BeRocket_AAPF_group_filters::getInstance();
 
193
  add_action('et_builder_modules_load', 'berocket_filter_et_builder_ready');
194
  add_action('vc_before_init', 'berocket_filter_vc_before_init', 100000);
195
  //----------------------
@@ -754,9 +755,14 @@ class BeRocket_AAPF extends BeRocket_Framework {
754
  "label" => __( 'Hide out of stock variable', "BeRocket_AJAX_domain" ),
755
  "items" => array(
756
  "out_of_stock_variable" => array(
757
- "type" => "checkbox",
758
  "name" => 'out_of_stock_variable',
759
- "value" => '1',
 
 
 
 
 
760
  "class" => "out_of_stock_variable",
761
  'label_for' => __('Hide variable products if variations with selected filters out of stock', 'BeRocket_AJAX_domain') . '<br>',
762
  ),
@@ -1157,7 +1163,7 @@ class BeRocket_AAPF extends BeRocket_Framework {
1157
  $html .= "
1158
  <script>
1159
  function out_of_stock_variable_reload_hide() {
1160
- if( jQuery('.reload_amount_of_products').prop('checked') && jQuery('.out_of_stock_variable').prop('checked') ) {
1161
  jQuery('.out_of_stock_variable_reload').parent().show();
1162
  } else {
1163
  jQuery('.out_of_stock_variable_reload').parent().hide();
@@ -1166,7 +1172,7 @@ function out_of_stock_variable_reload_hide() {
1166
  out_of_stock_variable_reload_hide();
1167
  jQuery('.reload_amount_of_products, .out_of_stock_variable').on('change', out_of_stock_variable_reload_hide);
1168
  function out_of_stock_variable_single_hide() {
1169
- if( jQuery('.reload_amount_of_products').prop('checked') && jQuery('.out_of_stock_variable').prop('checked') && jQuery('.out_of_stock_variable_reload').prop('checked') ) {
1170
  jQuery('.out_of_stock_variable_single').parent().show();
1171
  } else {
1172
  jQuery('.out_of_stock_variable_single').parent().hide();
190
  //INIT ADITIONAL CLASSES
191
  BeRocket_AAPF_single_filter::getInstance();
192
  BeRocket_AAPF_group_filters::getInstance();
193
+ new BeRocket_AAPF_compat_product_table();
194
  add_action('et_builder_modules_load', 'berocket_filter_et_builder_ready');
195
  add_action('vc_before_init', 'berocket_filter_vc_before_init', 100000);
196
  //----------------------
755
  "label" => __( 'Hide out of stock variable', "BeRocket_AJAX_domain" ),
756
  "items" => array(
757
  "out_of_stock_variable" => array(
758
+ "type" => "selectbox",
759
  "name" => 'out_of_stock_variable',
760
+ "options" => apply_filters('berocket_aapf_seo_meta_filters_hooks_list', array(
761
+ array('value' => '0', 'text' => __('Disabled', 'BeRocket_AJAX_domain')),
762
+ array('value' => '1', 'text' => __('Enabled', 'BeRocket_AJAX_domain')),
763
+ array('value' => '2', 'text' => __('Enabled only with selected "Out of stock" filter', 'BeRocket_AJAX_domain')),
764
+ )),
765
+ "value" => '',
766
  "class" => "out_of_stock_variable",
767
  'label_for' => __('Hide variable products if variations with selected filters out of stock', 'BeRocket_AJAX_domain') . '<br>',
768
  ),
1163
  $html .= "
1164
  <script>
1165
  function out_of_stock_variable_reload_hide() {
1166
+ if( jQuery('.reload_amount_of_products').prop('checked') && parseInt(jQuery('.out_of_stock_variable').val()) ) {
1167
  jQuery('.out_of_stock_variable_reload').parent().show();
1168
  } else {
1169
  jQuery('.out_of_stock_variable_reload').parent().hide();
1172
  out_of_stock_variable_reload_hide();
1173
  jQuery('.reload_amount_of_products, .out_of_stock_variable').on('change', out_of_stock_variable_reload_hide);
1174
  function out_of_stock_variable_single_hide() {
1175
+ if( jQuery('.reload_amount_of_products').prop('checked') && parseInt(jQuery('.out_of_stock_variable').val()) && jQuery('.out_of_stock_variable_reload').prop('checked') ) {
1176
  jQuery('.out_of_stock_variable_single').parent().show();
1177
  } else {
1178
  jQuery('.out_of_stock_variable_single').parent().hide();
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://berocket.com/product/woocommerce-ajax-products-filter?utm_s
5
  Tags: filters, product filters, ajax product filters, ajax filter, ajax filter widget, color filter, size filter, product onsale filter, product preview, product category filter, product reset filter, product sort by filter, stock filter, product tag filter, price range filter, price box filter, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce products filter, woocommerce ajax product filters, widget, plugin, woocommerce item filters, filters plugin, ajax filters plugin, filter woocommerce products, filter woocommerce products plugin, wc filters, wc filters products, wc products filters, wc ajax products filters, wc product filters, wc advanced product filters, woocommerce layered nav, woocommerce layered navigation, ajax filtered nav, ajax filtered navigation, price filter, ajax price filter, woocommerce product sorting, sidebar filter, sidebar ajax filter, taxonomy filter, category filter, attribute filter, attributes filter, woocommerce product sort, ajax products filter plugin for woocommerce, rocket, berocket, berocket woocommerce ajax products filter
6
  Requires at least: 4.0
7
  Tested up to: 5.2.4
8
- Stable tag: 1.4.0.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -184,6 +184,11 @@ You can try this plugin's admin side [here](https://berocket.com/product/woocomm
184
 
185
  == Changelog ==
186
 
 
 
 
 
 
187
  = 1.4.0.3 =
188
  * Enhancement - Template optimizations
189
 
5
  Tags: filters, product filters, ajax product filters, ajax filter, ajax filter widget, color filter, size filter, product onsale filter, product preview, product category filter, product reset filter, product sort by filter, stock filter, product tag filter, price range filter, price box filter, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce products filter, woocommerce ajax product filters, widget, plugin, woocommerce item filters, filters plugin, ajax filters plugin, filter woocommerce products, filter woocommerce products plugin, wc filters, wc filters products, wc products filters, wc ajax products filters, wc product filters, wc advanced product filters, woocommerce layered nav, woocommerce layered navigation, ajax filtered nav, ajax filtered navigation, price filter, ajax price filter, woocommerce product sorting, sidebar filter, sidebar ajax filter, taxonomy filter, category filter, attribute filter, attributes filter, woocommerce product sort, ajax products filter plugin for woocommerce, rocket, berocket, berocket woocommerce ajax products filter
6
  Requires at least: 4.0
7
  Tested up to: 5.2.4
8
+ Stable tag: 1.4.0.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
184
 
185
  == Changelog ==
186
 
187
+ = 1.4.0.4 =
188
+ * Fix - Additional tables generation errors
189
+ * Fix - Additional tables incorrect data to hide products
190
+ * Fix - Custom filtering permalink with Product Table plugin
191
+
192
  = 1.4.0.3 =
193
  * Enhancement - Template optimizations
194
 
templates/radio.php CHANGED
@@ -47,12 +47,12 @@ if ( is_array(berocket_isset($terms)) ) {
47
  ?><li class="berocket_term_parent_<?php echo berocket_isset($term, 'parent'); ?> berocket_term_depth_<?php
48
  echo $parent_count;
49
  if( ! empty($hide_o_value) && berocket_isset($term, 'count') == 0 && ( !$is_child_parent || !$is_first ) ) {
50
- echo 'berocket_hide_o_value ';
51
  $hiden_value = true;
52
  }
53
  echo " brw-" . preg_replace( "#^(pa)?_#", "", $attribute ) . "-" . preg_replace( "#^(pa)?_#", "", berocket_isset($term, 'slug') );
54
  if( $hide_sel_value && br_is_term_selected( $term, true, $is_child_parent_or, $child_parent_depth ) != '' ) {
55
- echo 'berocket_hide_sel_value';
56
  $hiden_value = true;
57
  }
58
  if( ! empty($attribute_count) ) {
47
  ?><li class="berocket_term_parent_<?php echo berocket_isset($term, 'parent'); ?> berocket_term_depth_<?php
48
  echo $parent_count;
49
  if( ! empty($hide_o_value) && berocket_isset($term, 'count') == 0 && ( !$is_child_parent || !$is_first ) ) {
50
+ echo ' berocket_hide_o_value ';
51
  $hiden_value = true;
52
  }
53
  echo " brw-" . preg_replace( "#^(pa)?_#", "", $attribute ) . "-" . preg_replace( "#^(pa)?_#", "", berocket_isset($term, 'slug') );
54
  if( $hide_sel_value && br_is_term_selected( $term, true, $is_child_parent_or, $child_parent_depth ) != '' ) {
55
+ echo ' berocket_hide_sel_value';
56
  $hiden_value = true;
57
  }
58
  if( ! empty($attribute_count) ) {
woocommerce-filters.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
5
  * Description: Unlimited AJAX products filters to make your shop perfect
6
- * Version: 1.4.0.3
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
@@ -11,6 +11,6 @@
11
  * Domain Path: /languages/
12
  * WC tested up to: 3.7.1
13
  */
14
- define( "BeRocket_AJAX_filters_version", '1.4.0.3' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');
3
  * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
5
  * Description: Unlimited AJAX products filters to make your shop perfect
6
+ * Version: 1.4.0.4
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
11
  * Domain Path: /languages/
12
  * WC tested up to: 3.7.1
13
  */
14
+ define( "BeRocket_AJAX_filters_version", '1.4.0.4' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');