WPSEO_Option_Titles

Option: wpseo_titles.

Defined (1)

The class is defined in the following location(s).

/inc/options/class-wpseo-option-titles.php  
  1. class WPSEO_Option_Titles extends WPSEO_Option { 
  2.  
  3. /** 
  4. * @var string option name 
  5. */ 
  6. public $option_name = 'wpseo_titles'; 
  7.  
  8. /** 
  9. * @var array Array of defaults for the option 
  10. * Shouldn't be requested directly, use $this->get_defaults(); 
  11. * @internal Note: Some of the default values are added via the translate_defaults() method 
  12. */ 
  13. protected $defaults = array( 
  14. // Non-form fields, set via (ajax) function. 
  15. 'title_test' => 0,  
  16. // Form fields. 
  17. 'forcerewritetitle' => false,  
  18. 'separator' => 'sc-dash',  
  19. 'noodp' => false,  
  20. 'usemetakeywords' => false,  
  21. 'title-home-wpseo' => '%%sitename%% %%page%% %%sep%% %%sitedesc%%', // Text field. 
  22. 'title-author-wpseo' => '', // Text field. 
  23. 'title-archive-wpseo' => '%%date%% %%page%% %%sep%% %%sitename%%', // Text field. 
  24. 'title-search-wpseo' => '', // Text field. 
  25. 'title-404-wpseo' => '', // Text field. 
  26.  
  27. 'metadesc-home-wpseo' => '', // Text area. 
  28. 'metadesc-author-wpseo' => '', // Text area. 
  29. 'metadesc-archive-wpseo' => '', // Text area. 
  30. 'metakey-home-wpseo' => '', // Text field. 
  31. 'metakey-author-wpseo' => '', // Text field. 
  32.  
  33. 'noindex-subpages-wpseo' => false,  
  34. 'noindex-author-wpseo' => false,  
  35. 'noindex-archive-wpseo' => true,  
  36.  
  37. 'disable-author' => false,  
  38. 'disable-date' => false,  
  39. 'disable-post_format' => false,  
  40.  
  41. /** 
  42. * Uses enrich_defaults to add more along the lines of: 
  43. * - 'title-' . $pt->name => ''; // Text field. 
  44. * - 'metadesc-' . $pt->name => ''; // Text field. 
  45. * - 'metakey-' . $pt->name => ''; // Text field. 
  46. * - 'noindex-' . $pt->name => false; 
  47. * - 'showdate-' . $pt->name => false; 
  48. * - 'hideeditbox-' . $pt->name => false; 
  49. * - 'title-ptarchive-' . $pt->name => ''; // Text field. 
  50. * - 'metadesc-ptarchive-' . $pt->name => ''; // Text field. 
  51. * - 'metakey-ptarchive-' . $pt->name => ''; // Text field. 
  52. * - 'bctitle-ptarchive-' . $pt->name => ''; // Text field. 
  53. * - 'noindex-ptarchive-' . $pt->name => false; 
  54. * - 'title-tax-' . $tax->name => '''; // Text field. 
  55. * - 'metadesc-tax-' . $tax->name => ''; // Text field. 
  56. * - 'metakey-tax-' . $tax->name => ''; // Text field. 
  57. * - 'noindex-tax-' . $tax->name => false; 
  58. * - 'hideeditbox-tax-' . $tax->name => false; 
  59. */ 
  60. ); 
  61.  
  62. /** 
  63. * @var array Array of variable option name patterns for the option 
  64. */ 
  65. protected $variable_array_key_patterns = array( 
  66. 'title-',  
  67. 'metadesc-',  
  68. 'metakey-',  
  69. 'noindex-',  
  70. 'showdate-',  
  71. 'hideeditbox-',  
  72. 'bctitle-ptarchive-',  
  73. ); 
  74.  
  75. /** 
  76. * @var array Array of sub-options which should not be overloaded with multi-site defaults 
  77. */ 
  78. public $ms_exclude = array( 
  79. /** theme dependent */ 
  80. 'title_test',  
  81. 'forcerewritetitle',  
  82. ); 
  83.  
  84. /** 
  85. * @var array Array of the separator options. To get these options use WPSEO_Option_Titles::get_instance()->get_separator_options() 
  86. */ 
  87. private $separator_options = array( 
  88. 'sc-dash' => '-',  
  89. 'sc-ndash' => '–',  
  90. 'sc-mdash' => '—',  
  91. 'sc-middot' => '·',  
  92. 'sc-bull' => '•',  
  93. 'sc-star' => '*',  
  94. 'sc-smstar' => '⋆',  
  95. 'sc-pipe' => '|',  
  96. 'sc-tilde' => '~',  
  97. 'sc-laquo' => '«',  
  98. 'sc-raquo' => '»',  
  99. 'sc-lt' => '<',  
  100. 'sc-gt' => '>',  
  101. ); 
  102.  
  103. /** 
  104. * Add the actions and filters for the option 
  105. * @todo [JRF => testers] Check if the extra actions below would run into problems if an option 
  106. * is updated early on and if so, change the call to schedule these for a later action on add/update 
  107. * instead of running them straight away 
  108. * @return \WPSEO_Option_Titles 
  109. */ 
  110. protected function __construct() { 
  111. parent::__construct(); 
  112. add_action( 'update_option_' . $this->option_name, array( 'WPSEO_Utils', 'clear_cache' ) ); 
  113. add_action( 'init', array( $this, 'end_of_init' ), 999 ); 
  114.  
  115.  
  116. /** 
  117. * Make sure we can recognize the right action for the double cleaning 
  118. */ 
  119. public function end_of_init() { 
  120. do_action( 'wpseo_double_clean_titles' ); 
  121.  
  122. /** 
  123. * Get the singleton instance of this class 
  124. * @return object 
  125. */ 
  126. public static function get_instance() { 
  127. if ( ! ( self::$instance instanceof self ) ) { 
  128. self::$instance = new self(); 
  129.  
  130. return self::$instance; 
  131.  
  132. /** 
  133. * Get the available separator options 
  134. * @return array 
  135. */ 
  136. public function get_separator_options() { 
  137. $separators = $this->separator_options; 
  138.  
  139. /** 
  140. * Allow altering the array with separator options 
  141. * @api array $separator_options Array with the separator options 
  142. */ 
  143. $filtered_separators = apply_filters( 'wpseo_separator_options', $separators ); 
  144.  
  145. if ( is_array( $filtered_separators ) && $filtered_separators !== array() ) { 
  146. $separators = array_merge( $separators, $filtered_separators ); 
  147.  
  148. return $separators; 
  149.  
  150. /** 
  151. * Translate strings used in the option defaults 
  152. * @return void 
  153. */ 
  154. public function translate_defaults() { 
  155. /** translators: 1: Author name; 2: Site name. */ 
  156. $this->defaults['title-author-wpseo'] = sprintf( __( '%1$s, Author at %2$s', 'wordpress-seo' ), '%%name%%', '%%sitename%%' ) . ' %%page%% '; 
  157. $this->defaults['title-search-wpseo'] = sprintf( __( 'You searched for %s', 'wordpress-seo' ), '%%searchphrase%%' ) . ' %%page%% %%sep%% %%sitename%%'; 
  158. $this->defaults['title-404-wpseo'] = __( 'Page not found', 'wordpress-seo' ) . ' %%sep%% %%sitename%%'; 
  159.  
  160.  
  161. /** 
  162. * Add dynamically created default options based on available post types and taxonomies 
  163. * @return void 
  164. */ 
  165. public function enrich_defaults() { 
  166.  
  167. // Retrieve all the relevant post type and taxonomy arrays. 
  168. $post_type_names = get_post_types( array( 'public' => true ), 'names' ); 
  169.  
  170. $post_type_objects_custom = get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' ); 
  171.  
  172. $taxonomy_names = get_taxonomies( array( 'public' => true ), 'names' ); 
  173.  
  174.  
  175. if ( $post_type_names !== array() ) { 
  176. foreach ( $post_type_names as $pt ) { 
  177. $this->defaults[ 'title-' . $pt ] = '%%title%% %%page%% %%sep%% %%sitename%%'; // Text field. 
  178. $this->defaults[ 'metadesc-' . $pt ] = ''; // Text area. 
  179. $this->defaults[ 'metakey-' . $pt ] = ''; // Text field. 
  180. $this->defaults[ 'noindex-' . $pt ] = false; 
  181. $this->defaults[ 'showdate-' . $pt ] = false; 
  182. $this->defaults[ 'hideeditbox-' . $pt ] = false; 
  183. unset( $pt ); 
  184.  
  185. if ( $post_type_objects_custom !== array() ) { 
  186. $archive = sprintf( __( '%s Archive', 'wordpress-seo' ), '%%pt_plural%%' ); 
  187. foreach ( $post_type_objects_custom as $pt ) { 
  188. if ( ! $pt->has_archive ) { 
  189. continue; 
  190.  
  191. $this->defaults[ 'title-ptarchive-' . $pt->name ] = $archive . ' %%page%% %%sep%% %%sitename%%'; // Text field. 
  192. $this->defaults[ 'metadesc-ptarchive-' . $pt->name ] = ''; // Text area. 
  193. $this->defaults[ 'metakey-ptarchive-' . $pt->name ] = ''; // Text field. 
  194. $this->defaults[ 'bctitle-ptarchive-' . $pt->name ] = ''; // Text field. 
  195. $this->defaults[ 'noindex-ptarchive-' . $pt->name ] = false; 
  196. unset( $pt ); 
  197.  
  198. if ( $taxonomy_names !== array() ) { 
  199. $archives = sprintf( __( '%s Archives', 'wordpress-seo' ), '%%term_title%%' ); 
  200. foreach ( $taxonomy_names as $tax ) { 
  201. $this->defaults[ 'title-tax-' . $tax ] = $archives . ' %%page%% %%sep%% %%sitename%%'; // Text field. 
  202. $this->defaults[ 'metadesc-tax-' . $tax ] = ''; // Text area. 
  203. $this->defaults[ 'metakey-tax-' . $tax ] = ''; // Text field. 
  204. $this->defaults[ 'hideeditbox-tax-' . $tax ] = false; 
  205.  
  206. if ( $tax !== 'post_format' ) { 
  207. $this->defaults[ 'noindex-tax-' . $tax ] = false; 
  208. else { 
  209. $this->defaults[ 'noindex-tax-' . $tax ] = true; 
  210. unset( $tax ); 
  211.  
  212.  
  213. /** 
  214. * Validate the option 
  215. * @param array $dirty New value for the option. 
  216. * @param array $clean Clean value for the option, normally the defaults. 
  217. * @param array $old Old value of the option. 
  218. * @return array Validated clean value for the option to be saved to the database 
  219. */ 
  220. protected function validate_option( $dirty, $clean, $old ) { 
  221. foreach ( $clean as $key => $value ) { 
  222. $switch_key = $this->get_switch_key( $key ); 
  223.  
  224. switch ( $switch_key ) { 
  225. /** 
  226. Text fields 
  227. */ 
  228.  
  229. /** 
  230. Covers: 
  231. 'title-home-wpseo', 'title-author-wpseo', 'title-archive-wpseo',  
  232. 'title-search-wpseo', 'title-404-wpseo' 
  233. 'title-' . $pt->name 
  234. 'title-ptarchive-' . $pt->name 
  235. 'title-tax-' . $tax->name 
  236. */ 
  237. case 'title-': 
  238. if ( isset( $dirty[ $key ] ) ) { 
  239. $clean[ $key ] = WPSEO_Utils::sanitize_text_field( $dirty[ $key ] ); 
  240. break; 
  241.  
  242. /** 
  243. Covers: 
  244. 'metadesc-home-wpseo', 'metadesc-author-wpseo', 'metadesc-archive-wpseo' 
  245. 'metadesc-' . $pt->name 
  246. 'metadesc-ptarchive-' . $pt->name 
  247. 'metadesc-tax-' . $tax->name 
  248. */ 
  249. case 'metadesc-': 
  250. /** 
  251. Covers: 
  252. 'metakey-home-wpseo', 'metakey-author-wpseo' 
  253. 'metakey-' . $pt->name 
  254. 'metakey-ptarchive-' . $pt->name 
  255. 'metakey-tax-' . $tax->name 
  256. */ 
  257. case 'metakey-': 
  258. /** 
  259. Covers: 
  260. ''bctitle-ptarchive-' . $pt->name 
  261. */ 
  262. case 'bctitle-ptarchive-': 
  263. if ( isset( $dirty[ $key ] ) && $dirty[ $key ] !== '' ) { 
  264. $clean[ $key ] = WPSEO_Utils::sanitize_text_field( $dirty[ $key ] ); 
  265. break; 
  266.  
  267.  
  268. /** integer field - not in form*/ 
  269. case 'title_test': 
  270. if ( isset( $dirty[ $key ] ) ) { 
  271. $int = WPSEO_Utils::validate_int( $dirty[ $key ] ); 
  272. if ( $int !== false && $int >= 0 ) { 
  273. $clean[ $key ] = $int; 
  274. elseif ( isset( $old[ $key ] ) ) { 
  275. $int = WPSEO_Utils::validate_int( $old[ $key ] ); 
  276. if ( $int !== false && $int >= 0 ) { 
  277. $clean[ $key ] = $int; 
  278. break; 
  279.  
  280. /** Separator field - Radio */ 
  281. case 'separator': 
  282. if ( isset( $dirty[ $key ] ) && $dirty[ $key ] !== '' ) { 
  283.  
  284. // Get separator fields. 
  285. $separator_fields = $this->get_separator_options(); 
  286.  
  287. // Check if the given separator is exists. 
  288. if ( isset( $separator_fields[ $dirty[ $key ] ] ) ) { 
  289. $clean[ $key ] = $dirty[ $key ]; 
  290. break; 
  291.  
  292. /** 
  293. Boolean fields 
  294. */ 
  295.  
  296. /** 
  297. Covers: 
  298. * 'noindex-subpages-wpseo', 'noindex-author-wpseo', 'noindex-archive-wpseo' 
  299. * 'noindex-' . $pt->name 
  300. * 'noindex-ptarchive-' . $pt->name 
  301. * 'noindex-tax-' . $tax->name 
  302. * 'forcerewritetitle': 
  303. * 'usemetakeywords': 
  304. * 'noodp': 
  305. * 'noydir': 
  306. * 'disable-author': 
  307. * 'disable-date': 
  308. * 'disable-post_format'; 
  309. * 'noindex-' 
  310. * 'showdate-' 
  311. * 'showdate-'. $pt->name 
  312. * 'hideeditbox-' 
  313. * 'hideeditbox-'. $pt->name 
  314. * 'hideeditbox-tax-' . $tax->name 
  315. */ 
  316. default: 
  317. $clean[ $key ] = ( isset( $dirty[ $key ] ) ? WPSEO_Utils::validate_bool( $dirty[ $key ] ) : false ); 
  318. break; 
  319.  
  320. return $clean; 
  321.  
  322.  
  323. /** 
  324. * Clean a given option value 
  325. * @param array $option_value Old (not merged with defaults or filtered) option value to 
  326. * clean according to the rules for this option. 
  327. * @param string $current_version (optional) Version from which to upgrade, if not set,  
  328. * version specific upgrades will be disregarded. 
  329. * @param array $all_old_option_values (optional) Only used when importing old options to have 
  330. * access to the real old values, in contrast to the saved ones. 
  331. * @return array Cleaned option 
  332. */ 
  333. protected function clean_option( $option_value, $current_version = null, $all_old_option_values = null ) { 
  334. static $original = null; 
  335.  
  336. // Double-run this function to ensure renaming of the taxonomy options will work. 
  337. if ( ! isset( $original ) && has_action( 'wpseo_double_clean_titles', array( 
  338. $this,  
  339. 'clean',  
  340. ) ) === false 
  341. ) { 
  342. add_action( 'wpseo_double_clean_titles', array( $this, 'clean' ) ); 
  343. $original = $option_value; 
  344.  
  345. /** 
  346. Move options from very old option to this one 
  347. @internal Don't rename to the 'current' names straight away as that would prevent 
  348. the rename/unset combi below from working 
  349. @todo [JRF] maybe figure out a smarter way to deal with this 
  350. */ 
  351. $old_option = null; 
  352. if ( isset( $all_old_option_values ) ) { 
  353. // Ok, we have an import. 
  354. if ( isset( $all_old_option_values['wpseo_indexation'] ) && is_array( $all_old_option_values['wpseo_indexation'] ) && $all_old_option_values['wpseo_indexation'] !== array() ) { 
  355. $old_option = $all_old_option_values['wpseo_indexation']; 
  356. else { 
  357. $old_option = get_option( 'wpseo_indexation' ); 
  358. if ( is_array( $old_option ) && $old_option !== array() ) { 
  359. $move = array( 
  360. 'noindexauthor' => 'noindex-author',  
  361. 'disableauthor' => 'disable-author',  
  362. 'noindexdate' => 'noindex-archive',  
  363. 'noindexcat' => 'noindex-category',  
  364. 'noindextag' => 'noindex-post_tag',  
  365. 'noindexpostformat' => 'noindex-post_format',  
  366. 'noindexsubpages' => 'noindex-subpages',  
  367. ); 
  368. foreach ( $move as $old => $new ) { 
  369. if ( isset( $old_option[ $old ] ) && ! isset( $option_value[ $new ] ) ) { 
  370. $option_value[ $new ] = $old_option[ $old ]; 
  371. unset( $move, $old, $new ); 
  372. unset( $old_option ); 
  373.  
  374.  
  375. // Fix wrongness created by buggy version 1.2.2. 
  376. if ( isset( $option_value['title-home'] ) && $option_value['title-home'] === '%%sitename%% - %%sitedesc%% - 12345' ) { 
  377. $option_value['title-home-wpseo'] = '%%sitename%% - %%sitedesc%%'; 
  378.  
  379.  
  380. /** 
  381. Renaming these options to avoid ever overwritting these if a (bloody stupid) user / 
  382. programmer would use any of the following as a custom post type or custom taxonomy: 
  383. 'home', 'author', 'archive', 'search', '404', 'subpages' 
  384.   
  385. Similarly, renaming the tax options to avoid a custom post type and a taxonomy 
  386. with the same name occupying the same option 
  387. */ 
  388. $rename = array( 
  389. 'title-home' => 'title-home-wpseo',  
  390. 'title-author' => 'title-author-wpseo',  
  391. 'title-archive' => 'title-archive-wpseo',  
  392. 'title-search' => 'title-search-wpseo',  
  393. 'title-404' => 'title-404-wpseo',  
  394. 'metadesc-home' => 'metadesc-home-wpseo',  
  395. 'metadesc-author' => 'metadesc-author-wpseo',  
  396. 'metadesc-archive' => 'metadesc-archive-wpseo',  
  397. 'metakey-home' => 'metakey-home-wpseo',  
  398. 'metakey-author' => 'metakey-author-wpseo',  
  399. 'noindex-subpages' => 'noindex-subpages-wpseo',  
  400. 'noindex-author' => 'noindex-author-wpseo',  
  401. 'noindex-archive' => 'noindex-archive-wpseo',  
  402. ); 
  403. foreach ( $rename as $old => $new ) { 
  404. if ( isset( $option_value[ $old ] ) && ! isset( $option_value[ $new ] ) ) { 
  405. $option_value[ $new ] = $option_value[ $old ]; 
  406. unset( $option_value[ $old ] ); 
  407. unset( $rename, $old, $new ); 
  408.  
  409.  
  410. /** 
  411. * @internal This clean-up action can only be done effectively once the taxonomies and post_types 
  412. * have been registered, i.e. at the end of the init action. 
  413. */ 
  414. if ( isset( $original ) && current_filter() === 'wpseo_double_clean_titles' || did_action( 'wpseo_double_clean_titles' ) > 0 ) { 
  415. $rename = array( 
  416. 'title-' => 'title-tax-',  
  417. 'metadesc-' => 'metadesc-tax-',  
  418. 'metakey-' => 'metakey-tax-',  
  419. 'noindex-' => 'noindex-tax-',  
  420. 'tax-hideeditbox-' => 'hideeditbox-tax-',  
  421.  
  422. ); 
  423. $taxonomy_names = get_taxonomies( array( 'public' => true ), 'names' ); 
  424. $post_type_names = get_post_types( array( 'public' => true ), 'names' ); 
  425. $defaults = $this->get_defaults(); 
  426. if ( $taxonomy_names !== array() ) { 
  427. foreach ( $taxonomy_names as $tax ) { 
  428. foreach ( $rename as $old_prefix => $new_prefix ) { 
  429. if ( 
  430. ( isset( $original[ $old_prefix . $tax ] ) && ! isset( $original[ $new_prefix . $tax ] ) ) 
  431. && ( ! isset( $option_value[ $new_prefix . $tax ] ) 
  432. || ( isset( $option_value[ $new_prefix . $tax ] ) 
  433. && $option_value[ $new_prefix . $tax ] === $defaults[ $new_prefix . $tax ] ) ) 
  434. ) { 
  435. $option_value[ $new_prefix . $tax ] = $original[ $old_prefix . $tax ]; 
  436.  
  437. /** 
  438. Check if there is a cpt with the same name as the tax,  
  439. if so, we should make sure that the old setting hasn't been removed 
  440. */ 
  441. if ( ! isset( $post_type_names[ $tax ] ) && isset( $option_value[ $old_prefix . $tax ] ) ) { 
  442. unset( $option_value[ $old_prefix . $tax ] ); 
  443. else { 
  444. if ( isset( $post_type_names[ $tax ] ) && ! isset( $option_value[ $old_prefix . $tax ] ) ) { 
  445. $option_value[ $old_prefix . $tax ] = $original[ $old_prefix . $tax ]; 
  446.  
  447. if ( $old_prefix === 'tax-hideeditbox-' ) { 
  448. unset( $option_value[ $old_prefix . $tax ] ); 
  449. unset( $rename, $taxonomy_names, $post_type_names, $defaults, $tax, $old_prefix, $new_prefix ); 
  450.  
  451.  
  452. /** 
  453. Make sure the values of the variable option key options are cleaned as they 
  454. may be retained and would not be cleaned/validated then 
  455. */ 
  456. if ( is_array( $option_value ) && $option_value !== array() ) { 
  457. foreach ( $option_value as $key => $value ) { 
  458. $switch_key = $this->get_switch_key( $key ); 
  459.  
  460. // Similar to validation routine - any changes made there should be made here too. 
  461. switch ( $switch_key ) { 
  462. /** text fields */ 
  463. case 'title-': 
  464. case 'metadesc-': 
  465. case 'metakey-': 
  466. case 'bctitle-ptarchive-': 
  467. $option_value[ $key ] = WPSEO_Utils::sanitize_text_field( $value ); 
  468. break; 
  469.  
  470. case 'separator': 
  471. if ( ! array_key_exists( $value, $this->get_separator_options() ) ) { 
  472. $option_value[ $key ] = false; 
  473. break; 
  474.  
  475. /** 
  476. Boolean fields 
  477. */ 
  478.  
  479. /** 
  480. Covers: 
  481. * 'noindex-' 
  482. * 'showdate-' 
  483. * 'hideeditbox-' 
  484. */ 
  485. default: 
  486. $option_value[ $key ] = WPSEO_Utils::validate_bool( $value ); 
  487. break; 
  488. unset( $key, $value, $switch_key ); 
  489.  
  490. return $option_value; 
  491.  
  492.  
  493. /** 
  494. * Make sure that any set option values relating to post_types and/or taxonomies are retained,  
  495. * even when that post_type or taxonomy may not yet have been registered. 
  496. * @internal Overrule the abstract class version of this to make sure one extra renamed variable key 
  497. * does not get removed. IMPORTANT: keep this method in line with the parent on which it is based! 
  498. * @param array $dirty Original option as retrieved from the database. 
  499. * @param array $clean Filtered option where any options which shouldn't be in our option 
  500. * have already been removed and any options which weren't set 
  501. * have been set to their defaults. 
  502. * @return array 
  503. */ 
  504. protected function retain_variable_keys( $dirty, $clean ) { 
  505. if ( ( is_array( $this->variable_array_key_patterns ) && $this->variable_array_key_patterns !== array() ) && ( is_array( $dirty ) && $dirty !== array() ) ) { 
  506.  
  507. // Add the extra pattern. 
  508. $patterns = $this->variable_array_key_patterns; 
  509. $patterns[] = 'tax-hideeditbox-'; 
  510.  
  511. /** 
  512. * Allow altering the array with variable array key patterns 
  513. * @api array $patterns Array with the variable array key patterns 
  514. */ 
  515. $patterns = apply_filters( 'wpseo_option_titles_variable_array_key_patterns', $patterns ); 
  516.  
  517. foreach ( $dirty as $key => $value ) { 
  518.  
  519. // Do nothing if already in filtered option array. 
  520. if ( isset( $clean[ $key ] ) ) { 
  521. continue; 
  522.  
  523. foreach ( $patterns as $pattern ) { 
  524. if ( strpos( $key, $pattern ) === 0 ) { 
  525. $clean[ $key ] = $value; 
  526. break; 
  527.  
  528. return $clean;