IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| | 126 | * Get all the options matching an SQL pattern. Optionally retrieve option names only. |
| | 127 | * |
| | 128 | * Newer options appear later. |
| | 129 | * |
| | 130 | * @since 4.2.0 |
| | 131 | * |
| | 132 | * @param string $pattern Option name pattern with SQL wildcard characters. E.g.: '%plugin%'. |
| | 133 | * @param bool $names_only TRUE for retrieving only option names. |
| | 134 | * |
| | 135 | * @return array [name => value, ...] iif $names_only == FALSE (default), else [name, ...]. |
| | 136 | */ |
| | 137 | function get_options_like( $pattern, $names_only = false ) { |
| | 138 | global $wpdb; |
| | 139 | $query = $wpdb->prepare("SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s ORDER BY option_id ASC", $pattern); |
| | 140 | $options = $wpdb->get_col($query); |
| | 141 | $result = array(); |
| | 142 | foreach ($options as $option) { |
| | 143 | if (0 === strpos($option, '_site_transient_timeout_') || |
| | 144 | 0 === strpos($option, '_site_transient_') || |
| | 145 | 0 === strpos($option, '_transient_timeout_') || |
| | 146 | 0 === strpos($option, '_transient_')) { |
| | 147 | continue; |
| | 148 | } else { |
| | 149 | if ($names_only) { |
| | 150 | $result[] = $option; |
| | 151 | } else { |
| | 152 | $result[$option] = get_option($option); |
| | 153 | } |
| | 154 | } |
| | 155 | } |
| | 156 | return $result; |
| | 157 | } |
| | 158 | |
| | 159 | /** |
| 126 | 160 | * Protect WordPress special option from being modified. |
| 127 | 161 | * |
| 128 | 162 | * Will die if $option is in protected list. Protected options are 'alloptions' |
| … |
… |
|
| 608 | 642 | * @param mixed $value Value of transient. |
| 609 | 643 | */ |
| 610 | 644 | return apply_filters( 'transient_' . $transient, $value ); |
| | 645 | } |
| | 646 | |
| | 647 | /** |
| | 648 | * Get all the transients matching an SQL pattern. Optionally retrieve transient names only. |
| | 649 | * |
| | 650 | * Newer transients appear later. |
| | 651 | * |
| | 652 | * @since 4.2.0 |
| | 653 | * |
| | 654 | * @param string $pattern Transient name pattern with SQL wildcard characters. E.g.: '%plugin%'. |
| | 655 | * @param bool $names_only TRUE for retrieving only transient names. |
| | 656 | * |
| | 657 | * @return array [name => value, ...] iif $names_only == FALSE (default), else [name, ...]. |
| | 658 | */ |
| | 659 | function get_transients_like( $pattern, $names_only = false ) { |
| | 660 | global $wpdb; |
| | 661 | $transient = '_transient_' . $pattern; |
| | 662 | $query = $wpdb->prepare("SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s ORDER BY option_id ASC", $transient); |
| | 663 | $options = $wpdb->get_col($query); |
| | 664 | $result = array(); |
| | 665 | foreach ($options as $option) { |
| | 666 | if (0 === strpos($option, '_transient_timeout_')) { |
| | 667 | continue; |
| | 668 | } elseif (0 === strpos($option, '_transient_')) { |
| | 669 | $transient = substr($option, strlen('_transient_')); |
| | 670 | if ($names_only) { |
| | 671 | $result[] = $transient; |
| | 672 | } else { |
| | 673 | $result[$transient] = get_transient($transient); |
| | 674 | } |
| | 675 | } |
| | 676 | } |
| | 677 | return $result; |
| 611 | 678 | } |
| 612 | 679 | |
| 613 | 680 | /** |