Skip to content

Commit

Permalink
Merge pull request #33 from globalis-ms/develop
Browse files Browse the repository at this point in the history
version 1.0.0
  • Loading branch information
Pierre Dargham authored Oct 14, 2019
2 parents 2820a66 + 0ecd759 commit 0ce0fa0
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 69 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ sudo: false
language: php

php:
- 7.0
- 7.1
- 7.2
- 7.3
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ Collection of wp-cubi functions for WordPress
- `flush_cache_all()`
- `flush_cache_wpdb()`
- `flush_cache_object()`
- `get_size_cache_wpdb() : int`
- `get_size_cache_object() : int`
- `get_size_cache_wpdb(): int`
- `get_size_cache_object(): int`
- `reset_cache_wpdb(int $size)`
- `reset_cache_object(int $size)`
- `pop_cache_wpdb()`
- `pop_cache_object()`
- `savequeries_enabled() : bool`
- `savequeries_enabled(): bool`

### Debug

- `mysql_enable_nocache_mod()`
- `mysql_disable_nocache_mod()`
- `query_set_nocache(string $query) : string`
- `time_start(string $timer = 'default') : float`
- `query_set_nocache(string $query): string`
- `time_start(string $timer = 'default'): float`
- `time_elapsed(string $timer = 'default', bool $human = true)`
- `memory_get_usage_kb(bool $human = true, bool $real_usage = false)`
- `memory_get_usage_mb(bool $human = true, bool $real_usage = false)`
Expand All @@ -40,11 +40,11 @@ Collection of wp-cubi functions for WordPress

- `add_filter(string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1)`
- `add_action(string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1)`
- `remove_filter_anonymous_object(string $tag, string $class_name, string $method_name, int $priority = 10) : bool`
- `remove_filter_anonymous_object(string $tag, string $class_name, string $method_name, int $priority = 10): bool`

### Mails

- `wp_mail_html($to, string $subject, string $message, $headers = [], $attachments = []) : bool`
- `wp_mail_html($to, string $subject, string $message, $headers = [], $attachments = []): bool`

### Permalinks

Expand All @@ -56,13 +56,13 @@ Collection of wp-cubi functions for WordPress

### Urls

- `get_current_url(bool $remove_query_args = false) : string`
- `current_url_starts_with(string $search, bool $remove_query_args = false) : bool`
- `current_url_ends_with(string $search, bool $remove_query_args = false) : bool`
- `get_current_url(bool $remove_query_args = false): string`
- `current_url_starts_with(string $search, bool $remove_query_args = false): bool`
- `current_url_ends_with(string $search, bool $remove_query_args = false): bool`

### Utils

- `str_starts_with(string $string, string $search) : bool`
- `str_ends_with(string $string, string $search) : bool`
- `str_starts_with(string $string, string $search): bool`
- `str_ends_with(string $string, string $search): bool`
- `trigger_404(\WP_Query $query = null)`
- `override_php_limits(int $time_limit = 604800, string $memory_limit = '512M')`
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"issues": "https://github.com/globalis-ms/wp-cubi-helpers/issues"
},
"require": {
"php": ">=7.0"
"php": ">=7.1"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.5.1"
"squizlabs/php_codesniffer": "^3.5.0"
},
"autoload": {
"files": [
Expand Down
53 changes: 13 additions & 40 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<!-- Show sniff codes in all reports -->
<arg value="ns"/>

<!-- Use PSR-2 as a base -->
<rule ref="PSR2"/>
<!-- Use PSR-12 as a base -->
<rule ref="PSR12"/>

<!-- Custom rule: disallow long `array()` syntax, use short `[]` syntax instead -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
Expand Down
6 changes: 3 additions & 3 deletions src/functions-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function flush_cache_object()
*
* @return int The size of $wpdb->queries.
*/
function get_size_cache_wpdb() : int
function get_size_cache_wpdb(): int
{
global $wpdb;

Expand All @@ -71,7 +71,7 @@ function get_size_cache_wpdb() : int
*
* @return int The size of $wp_object_cache->cache.
*/
function get_size_cache_object() : int
function get_size_cache_object(): int
{
global $wp_object_cache;

Expand Down Expand Up @@ -157,7 +157,7 @@ function pop_cache_object()
*
* @return bool The state of SAVEQUERIES.
*/
function savequeries_enabled() : bool
function savequeries_enabled(): bool
{
return defined('SAVEQUERIES') && SAVEQUERIES;
}
4 changes: 2 additions & 2 deletions src/functions-debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function mysql_disable_nocache_mod()
*
* @return string The modified query.
*/
function query_set_nocache(string $query) : string
function query_set_nocache(string $query): string
{
return preg_replace('/SELECT(\s)/i', 'SELECT SQL_NO_CACHE$1', $query, 1);
}
Expand All @@ -41,7 +41,7 @@ function query_set_nocache(string $query) : string
*
* @return float The time.
*/
function time_start(string $timer = 'default') : float
function time_start(string $timer = 'default'): float
{
static $start_time = [];

Expand Down
2 changes: 1 addition & 1 deletion src/functions-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function add_action(string $tag, callable $function_to_add, int $priority = 10,
*
* @return boolean Whether filters removed successfully.
*/
function remove_filter_anonymous_object(string $tag, string $class_name, string $method_name, int $priority = 10) : bool
function remove_filter_anonymous_object(string $tag, string $class_name, string $method_name, int $priority = 10): bool
{
global $wp_filter;

Expand Down
2 changes: 1 addition & 1 deletion src/functions-mails.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @return bool Whether the email contents were sent successfully.
*/
function wp_mail_html($to, string $subject, string $message, $headers = [], $attachments = []) : bool
function wp_mail_html($to, string $subject, string $message, $headers = [], $attachments = []): bool
{
$headers = array_merge(['Content-Type: text/html; charset=' . get_bloginfo('charset')], $headers);
return wp_mail($to, $subject, $message, $headers, $attachments);
Expand Down
6 changes: 3 additions & 3 deletions src/functions-urls.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @return string The current url.
*/
function get_current_url(bool $remove_query_args = false) : string
function get_current_url(bool $remove_query_args = false): string
{
if (defined('WP_SCHEME') && defined('WP_DOMAIN')) {
$protocol = WP_SCHEME;
Expand All @@ -36,7 +36,7 @@ function get_current_url(bool $remove_query_args = false) : string
*
* @return bool If the current url starts with searched string.
*/
function current_url_starts_with(string $search, bool $remove_query_args = false) : bool
function current_url_starts_with(string $search, bool $remove_query_args = false): bool
{
return str_starts_with(get_current_url($remove_query_args), $search);
}
Expand All @@ -49,7 +49,7 @@ function current_url_starts_with(string $search, bool $remove_query_args = false
*
* @return bool If the current url ends with searched string.
*/
function current_url_ends_with(string $search, bool $remove_query_args = false) : bool
function current_url_ends_with(string $search, bool $remove_query_args = false): bool
{
return str_ends_with(get_current_url($remove_query_args), $search);
}
4 changes: 2 additions & 2 deletions src/functions-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @return bool
*/
function str_starts_with(string $string, string $search) : bool
function str_starts_with(string $string, string $search): bool
{
return substr($string, 0, strlen($search)) === $search;
}
Expand All @@ -23,7 +23,7 @@ function str_starts_with(string $string, string $search) : bool
*
* @return bool
*/
function str_ends_with(string $string, string $search) : bool
function str_ends_with(string $string, string $search): bool
{
return substr($string, -strlen($search)) === $search;
}
Expand Down

0 comments on commit 0ce0fa0

Please sign in to comment.