Skip to content

Commit

Permalink
4.4.50
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelbart committed Aug 26, 2021
1 parent 5981951 commit d52a103
Show file tree
Hide file tree
Showing 50 changed files with 5,219 additions and 5,185 deletions.
9 changes: 4 additions & 5 deletions core/class-helper.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php
/**
* Provides useful helpers for the other classes of the plugin.
*
* @package Helpful\Core
* @author Pixelbart <[email protected]>
* @version 4.3.0
* @package Helpful
* @subpackage Core
* @version 4.4.50
* @since 4.3.0
*/
namespace Helpful\Core;

Expand Down
5 changes: 2 additions & 3 deletions core/functions/helpers.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php
/**
* Helpful helpers loaded before helpful classes.
*
* @package Helpful
* @author Pixelbart <[email protected]>
* @since 4.4.50
* @since 4.3.0
*/
use Helpful\Core\Helper;
use Helpful\Core\Helpers as Helpers;
Expand Down
7 changes: 2 additions & 5 deletions core/functions/values.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?php
/**
* Helpful Frontend Helpers for retrieving
* values from database
*
* @package helpful
* @author Pixelbart <[email protected]>
* @package Helpful
* @version 4.4.50
* @since 4.0.0
*/
use Helpful\Core\Helpers as Helpers;
Expand Down
115 changes: 57 additions & 58 deletions core/helpers/class-cache.php
Original file line number Diff line number Diff line change
@@ -1,79 +1,78 @@
<?php
/**
* ...
*
* @package Helpful\Core\Helpers
* @author Pixelbart <[email protected]>
* @version 4.3.0
* @package Helpful
* @subpackage Core\Helpers
* @version 4.4.50
* @since 4.3.0
*/
namespace Helpful\Core\Helpers;

use Helpful\Core\Helper;

/* Prevent direct access */
if ( ! defined( 'ABSPATH' ) ) {
exit;
if (!defined('ABSPATH')) {
exit;
}

class Cache
{
/**
* Returns the available times for caching with the Transients API from WordPress.
*
* @param boolean $labels Outputs either the miliseconds or the labels for the options.
*
* @return array
*/
public static function get_cache_times( $labels = true )
{
$times = [];
/**
* Returns the available times for caching with the Transients API from WordPress.
*
* @param boolean $labels Outputs either the miliseconds or the labels for the options.
*
* @return array
*/
public static function get_cache_times($labels = true)
{
$times = [];

$times['minute'] = esc_html_x( 'One minute', 'caching time', 'helpful' );
$times['hour'] = esc_html_x( 'One hour', 'caching time', 'helpful' );
$times['day'] = esc_html_x( 'One day', 'caching time', 'helpful' );
$times['week'] = esc_html_x( 'One week', 'caching time', 'helpful' );
$times['month'] = esc_html_x( 'One month', 'caching time', 'helpful' );
$times['year'] = esc_html_x( 'One year', 'caching time', 'helpful' );
$times['minute'] = esc_html_x('One minute', 'caching time', 'helpful');
$times['hour'] = esc_html_x('One hour', 'caching time', 'helpful');
$times['day'] = esc_html_x('One day', 'caching time', 'helpful');
$times['week'] = esc_html_x('One week', 'caching time', 'helpful');
$times['month'] = esc_html_x('One month', 'caching time', 'helpful');
$times['year'] = esc_html_x('One year', 'caching time', 'helpful');

if ( false === $labels ) {
$times['minute'] = MINUTE_IN_SECONDS;
$times['hour'] = HOUR_IN_SECONDS;
$times['day'] = DAY_IN_SECONDS;
$times['week'] = WEEK_IN_SECONDS;
$times['month'] = MONTH_IN_SECONDS;
$times['year'] = YEAR_IN_SECONDS;
}
if (false === $labels) {
$times['minute'] = MINUTE_IN_SECONDS;
$times['hour'] = HOUR_IN_SECONDS;
$times['day'] = DAY_IN_SECONDS;
$times['week'] = WEEK_IN_SECONDS;
$times['month'] = MONTH_IN_SECONDS;
$times['year'] = YEAR_IN_SECONDS;
}

return $times;
}
return $times;
}

/**
* Deletes all transients related to Helpful and clears the cache of Helpful.
*
* @return integer Amount of deleted entries.
*/
public static function clear_cache()
{
global $wpdb;
/**
* Deletes all transients related to Helpful and clears the cache of Helpful.
*
* @return integer Amount of deleted entries.
*/
public static function clear_cache()
{
global $wpdb;

$table_name = $wpdb->prefix . 'options';
$table_name = $wpdb->prefix . 'options';

$count = 0;
$sql = "SELECT * FROM $table_name WHERE option_name LIKE '_transient_timeout_helpful_%' OR option_name LIKE '_transient_helpful_%'";
$rows = $wpdb->get_results( $sql );
$count = 0;
$sql = "SELECT * FROM $table_name WHERE option_name LIKE '_transient_timeout_helpful_%' OR option_name LIKE '_transient_helpful_%'";
$rows = $wpdb->get_results($sql);

if ( $rows ) {
foreach ( $rows as $row ) :
if ( '_transient_timeout_helpful_updated' === $row->option_name || '_transient_helpful_updated' === $row->option_name ) {
continue;
}
if ($rows) {
foreach ($rows as $row):
if ('_transient_timeout_helpful_updated' === $row->option_name || '_transient_helpful_updated' === $row->option_name) {
continue;
}

$values = [ 'option_name' => $row->option_name ];
$wpdb->delete( $table_name, $values );
$count++;
endforeach;
}
$values = ['option_name' => $row->option_name];
$wpdb->delete($table_name, $values);
$count++;
endforeach;
}

return $count;
}
}
return $count;
}
}
7 changes: 4 additions & 3 deletions core/helpers/class-database.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* @package Helpful\Core\Helpers
* @author Pixelbart <[email protected]>
* @version 4.4.49
* @package Helpful
* @subpackage Core\Helpers
* @version 4.4.50
* @since 4.3.0
*/
namespace Helpful\Core\Helpers;

Expand Down
Loading

0 comments on commit d52a103

Please sign in to comment.