@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | |
139 | 139 | foreach ( $this->get() as $component ) { |
140 | 140 | |
141 | - if ( ! $this->is_active( $component['slug'] ) ) { |
|
141 | + if ( ! $this->is_active( $component[ 'slug' ] ) ) { |
|
142 | 142 | continue; |
143 | 143 | } |
144 | 144 | |
145 | - if ( isset( $component['installable'] ) ) { |
|
145 | + if ( isset( $component[ 'installable' ] ) ) { |
|
146 | 146 | |
147 | 147 | $installables->register( |
148 | 148 | 'component' |
149 | - , $component['slug'] |
|
150 | - , $component['installable'] |
|
151 | - , $component['version'] |
|
149 | + , $component[ 'slug' ] |
|
150 | + , $component[ 'installable' ] |
|
151 | + , $component[ 'version' ] |
|
152 | 152 | , is_wordpoints_network_active() |
153 | 153 | ); |
154 | 154 | } |
155 | 155 | |
156 | - include_once $component['file']; |
|
156 | + include_once $component[ 'file' ]; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -276,27 +276,27 @@ discard block |
||
276 | 276 | $component = array_merge( $defaults, $args ); |
277 | 277 | |
278 | 278 | if ( |
279 | - empty( $component['name'] ) |
|
280 | - || empty( $component['file'] ) |
|
281 | - || empty( $component['slug'] ) |
|
282 | - || $this->is_registered( $component['slug'] ) |
|
279 | + empty( $component[ 'name' ] ) |
|
280 | + || empty( $component[ 'file' ] ) |
|
281 | + || empty( $component[ 'slug' ] ) |
|
282 | + || $this->is_registered( $component[ 'slug' ] ) |
|
283 | 283 | ) { |
284 | 284 | return false; |
285 | 285 | } |
286 | 286 | |
287 | - $this->registered[ $component['slug'] ] = array_intersect_key( $component, $defaults ); |
|
287 | + $this->registered[ $component[ 'slug' ] ] = array_intersect_key( $component, $defaults ); |
|
288 | 288 | |
289 | 289 | if ( |
290 | - ! isset( $component['installable'] ) |
|
291 | - && isset( $component['un_installer'] ) |
|
290 | + ! isset( $component[ 'installable' ] ) |
|
291 | + && isset( $component[ 'un_installer' ] ) |
|
292 | 292 | ) { |
293 | 293 | |
294 | 294 | WordPoints_Installables::register( |
295 | 295 | 'component' |
296 | - , $component['slug'] |
|
296 | + , $component[ 'slug' ] |
|
297 | 297 | , array( |
298 | - 'version' => $component['version'], |
|
299 | - 'un_installer' => $component['un_installer'], |
|
298 | + 'version' => $component[ 'version' ], |
|
299 | + 'un_installer' => $component[ 'un_installer' ], |
|
300 | 300 | ) |
301 | 301 | ); |
302 | 302 | } |
@@ -362,11 +362,11 @@ discard block |
||
362 | 362 | return false; |
363 | 363 | } |
364 | 364 | |
365 | - require_once $this->registered[ $slug ]['file']; |
|
365 | + require_once $this->registered[ $slug ][ 'file' ]; |
|
366 | 366 | |
367 | - if ( isset( $this->registered[ $slug ]['installable'] ) ) { |
|
367 | + if ( isset( $this->registered[ $slug ][ 'installable' ] ) ) { |
|
368 | 368 | |
369 | - $installable = $this->registered[ $slug ]['installable']; |
|
369 | + $installable = $this->registered[ $slug ][ 'installable' ]; |
|
370 | 370 | $installable = new $installable(); |
371 | 371 | |
372 | 372 | $installer = new WordPoints_Installer( |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | WordPoints_Installables::get_installer( |
382 | 382 | 'component' |
383 | 383 | , $slug |
384 | - , $this->registered[ $slug ]['version'] |
|
385 | - , $this->registered[ $slug ]['un_installer'] |
|
384 | + , $this->registered[ $slug ][ 'version' ] |
|
385 | + , $this->registered[ $slug ][ 'un_installer' ] |
|
386 | 386 | ) |
387 | 387 | ->install( is_wordpoints_network_active() ); |
388 | 388 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $module_data = wordpoints_get_module_data( wordpoints_extensions_dir() . '/' . $module ); |
90 | 90 | |
91 | - return $module_data['network']; |
|
91 | + return $module_data[ 'network' ]; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | if ( |
210 | 210 | get_site_option( 'wordpoints_legacy_extensions_dir' ) |
211 | 211 | || ( |
212 | - isset( $wordpoints_data['version'] ) |
|
213 | - && version_compare( $wordpoints_data['version'], '2.4.0-alpha-3', '<' ) |
|
212 | + isset( $wordpoints_data[ 'version' ] ) |
|
213 | + && version_compare( $wordpoints_data[ 'version' ], '2.4.0-alpha-3', '<' ) |
|
214 | 214 | ) |
215 | 215 | ) { |
216 | 216 | $path = str_replace( |
@@ -430,36 +430,36 @@ discard block |
||
430 | 430 | |
431 | 431 | $module_data = WordPoints_Modules::get_data( $module_file ); |
432 | 432 | |
433 | - if ( $module_data && wp_normalize_path( $module_file ) === $module_data['raw_file'] ) { |
|
434 | - unset( $module_data['raw'], $module_data['raw_file'] ); |
|
433 | + if ( $module_data && wp_normalize_path( $module_file ) === $module_data[ 'raw_file' ] ) { |
|
434 | + unset( $module_data[ 'raw' ], $module_data[ 'raw_file' ] ); |
|
435 | 435 | } else { |
436 | 436 | $module_data = get_file_data( $module_file, $default_headers, 'wordpoints_module' ); |
437 | 437 | } |
438 | 438 | |
439 | - if ( ! empty( $module_data['update_api'] ) ) { |
|
439 | + if ( ! empty( $module_data[ 'update_api' ] ) ) { |
|
440 | 440 | _deprecated_argument( __FUNCTION__, '1.10.0', 'The "Update API" module header has been deprecated in favor of "Server".' ); |
441 | 441 | } |
442 | 442 | |
443 | - if ( ! empty( $module_data['channel'] ) ) { |
|
443 | + if ( ! empty( $module_data[ 'channel' ] ) ) { |
|
444 | 444 | _deprecated_argument( __FUNCTION__, '2.4.0', 'The "Channel" extension header has been deprecated in favor of "Server".' ); |
445 | - $module_data['server'] = $module_data['channel']; |
|
445 | + $module_data[ 'server' ] = $module_data[ 'channel' ]; |
|
446 | 446 | } |
447 | 447 | |
448 | - if ( ! empty( $module_data['module_name'] ) ) { |
|
448 | + if ( ! empty( $module_data[ 'module_name' ] ) ) { |
|
449 | 449 | _deprecated_argument( __FUNCTION__, '2.4.0', 'The "Module Name" extension header has been deprecated in favor of "Extension Name".' ); |
450 | - $module_data['name'] = $module_data['module_name']; |
|
450 | + $module_data[ 'name' ] = $module_data[ 'module_name' ]; |
|
451 | 451 | } |
452 | 452 | |
453 | - unset( $module_data['module_name'] ); |
|
453 | + unset( $module_data[ 'module_name' ] ); |
|
454 | 454 | |
455 | - if ( ! empty( $module_data['module_uri'] ) ) { |
|
455 | + if ( ! empty( $module_data[ 'module_uri' ] ) ) { |
|
456 | 456 | _deprecated_argument( __FUNCTION__, '2.4.0', 'The "Module URI" extension header has been deprecated in favor of "Extension URI".' ); |
457 | - $module_data['uri'] = $module_data['module_uri']; |
|
457 | + $module_data[ 'uri' ] = $module_data[ 'module_uri' ]; |
|
458 | 458 | } else { |
459 | - $module_data['module_uri'] = $module_data['uri']; |
|
459 | + $module_data[ 'module_uri' ] = $module_data[ 'uri' ]; |
|
460 | 460 | } |
461 | 461 | |
462 | - $module_data['network'] = ( 'true' === strtolower( $module_data['network'] ) ); |
|
462 | + $module_data[ 'network' ] = ( 'true' === strtolower( $module_data[ 'network' ] ) ); |
|
463 | 463 | |
464 | 464 | /** |
465 | 465 | * Filters the header data for an extension. |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | // Translate fields |
480 | 480 | if ( $translate ) { |
481 | 481 | |
482 | - $textdomain = $module_data['text_domain']; |
|
482 | + $textdomain = $module_data[ 'text_domain' ]; |
|
483 | 483 | |
484 | 484 | if ( $textdomain ) { |
485 | 485 | |
@@ -487,8 +487,8 @@ discard block |
||
487 | 487 | |
488 | 488 | $domain_path = dirname( $module_file ); |
489 | 489 | |
490 | - if ( $module_data['domain_path'] ) { |
|
491 | - $domain_path .= $module_data['domain_path']; |
|
490 | + if ( $module_data[ 'domain_path' ] ) { |
|
491 | + $domain_path .= $module_data[ 'domain_path' ]; |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | wordpoints_load_module_textdomain( $textdomain, $domain_path ); |
@@ -511,49 +511,49 @@ discard block |
||
511 | 511 | ); |
512 | 512 | |
513 | 513 | $allowed_tags = $allowed_tags_in_links; |
514 | - $allowed_tags['a'] = array( 'href' => true, 'title' => true ); |
|
514 | + $allowed_tags[ 'a' ] = array( 'href' => true, 'title' => true ); |
|
515 | 515 | |
516 | 516 | // Name and author ar marked up inside <a> tags. Don't allow these. |
517 | - $module_data['name'] = wp_kses( $module_data['name'], $allowed_tags_in_links ); |
|
518 | - $module_data['author'] = wp_kses( $module_data['author'], $allowed_tags_in_links ); |
|
517 | + $module_data[ 'name' ] = wp_kses( $module_data[ 'name' ], $allowed_tags_in_links ); |
|
518 | + $module_data[ 'author' ] = wp_kses( $module_data[ 'author' ], $allowed_tags_in_links ); |
|
519 | 519 | |
520 | - $module_data['description'] = wp_kses( $module_data['description'], $allowed_tags ); |
|
521 | - $module_data['version'] = wp_kses( $module_data['version'], $allowed_tags ); |
|
520 | + $module_data[ 'description' ] = wp_kses( $module_data[ 'description' ], $allowed_tags ); |
|
521 | + $module_data[ 'version' ] = wp_kses( $module_data[ 'version' ], $allowed_tags ); |
|
522 | 522 | |
523 | - $module_data['uri'] = esc_url( $module_data['uri'] ); |
|
524 | - $module_data['module_uri'] = esc_url( $module_data['module_uri'] ); |
|
525 | - $module_data['author_uri'] = esc_url( $module_data['author_uri'] ); |
|
523 | + $module_data[ 'uri' ] = esc_url( $module_data[ 'uri' ] ); |
|
524 | + $module_data[ 'module_uri' ] = esc_url( $module_data[ 'module_uri' ] ); |
|
525 | + $module_data[ 'author_uri' ] = esc_url( $module_data[ 'author_uri' ] ); |
|
526 | 526 | |
527 | - $module_data['title'] = $module_data['name']; |
|
528 | - $module_data['author_name'] = $module_data['author']; |
|
527 | + $module_data[ 'title' ] = $module_data[ 'name' ]; |
|
528 | + $module_data[ 'author_name' ] = $module_data[ 'author' ]; |
|
529 | 529 | |
530 | 530 | // Apply markup. |
531 | 531 | if ( $markup ) { |
532 | 532 | |
533 | - if ( $module_data['uri'] && $module_data['name'] ) { |
|
534 | - $module_data['title'] = '<a href="' . $module_data['uri'] |
|
535 | - . '">' . $module_data['name'] . '</a>'; |
|
533 | + if ( $module_data[ 'uri' ] && $module_data[ 'name' ] ) { |
|
534 | + $module_data[ 'title' ] = '<a href="' . $module_data[ 'uri' ] |
|
535 | + . '">' . $module_data[ 'name' ] . '</a>'; |
|
536 | 536 | } |
537 | 537 | |
538 | - if ( $module_data['author_uri'] && $module_data['author'] ) { |
|
539 | - $module_data['author'] = '<a href="' . $module_data['author_uri'] |
|
540 | - . '">' . $module_data['author'] . '</a>'; |
|
538 | + if ( $module_data[ 'author_uri' ] && $module_data[ 'author' ] ) { |
|
539 | + $module_data[ 'author' ] = '<a href="' . $module_data[ 'author_uri' ] |
|
540 | + . '">' . $module_data[ 'author' ] . '</a>'; |
|
541 | 541 | } |
542 | 542 | |
543 | - $module_data['description'] = wptexturize( $module_data['description'] ); |
|
543 | + $module_data[ 'description' ] = wptexturize( $module_data[ 'description' ] ); |
|
544 | 544 | |
545 | - if ( $module_data['author'] ) { |
|
546 | - $module_data['description'] .= ' <cite>' |
|
545 | + if ( $module_data[ 'author' ] ) { |
|
546 | + $module_data[ 'description' ] .= ' <cite>' |
|
547 | 547 | // translators: Author name. |
548 | - . sprintf( __( 'By %s.', 'wordpoints' ), $module_data['author'] ) |
|
548 | + . sprintf( __( 'By %s.', 'wordpoints' ), $module_data[ 'author' ] ) |
|
549 | 549 | . '</cite>'; |
550 | 550 | } |
551 | 551 | } |
552 | 552 | |
553 | 553 | } else { |
554 | 554 | |
555 | - $module_data['title'] = $module_data['name']; |
|
556 | - $module_data['author_name'] = $module_data['author']; |
|
555 | + $module_data[ 'title' ] = $module_data[ 'name' ]; |
|
556 | + $module_data[ 'author_name' ] = $module_data[ 'author' ]; |
|
557 | 557 | |
558 | 558 | } // End if ( $markup || $translate ) else. |
559 | 559 | |
@@ -574,8 +574,8 @@ discard block |
||
574 | 574 | |
575 | 575 | $server = false; |
576 | 576 | |
577 | - if ( isset( $extension['server'] ) ) { |
|
578 | - $server = $extension['server']; |
|
577 | + if ( isset( $extension[ 'server' ] ) ) { |
|
578 | + $server = $extension[ 'server' ]; |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | /** |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | |
729 | 729 | $module_data = wordpoints_get_module_data( $module_file, $markup, $translate ); |
730 | 730 | |
731 | - if ( empty( $module_data['name'] ) ) { |
|
731 | + if ( empty( $module_data[ 'name' ] ) ) { |
|
732 | 732 | continue; |
733 | 733 | } |
734 | 734 | |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | */ |
828 | 828 | function _wordpoints_sort_uname_callback( $a, $b ) { |
829 | 829 | |
830 | - return strnatcasecmp( $a['name'], $b['name'] ); |
|
830 | + return strnatcasecmp( $a[ 'name' ], $b[ 'name' ] ); |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | /** |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | |
952 | 952 | } else { |
953 | 953 | |
954 | - $current[] = $module; |
|
954 | + $current[ ] = $module; |
|
955 | 955 | sort( $current ); |
956 | 956 | update_option( 'wordpoints_active_modules', $current ); |
957 | 957 | } |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | $checked = array(); |
1118 | 1118 | |
1119 | 1119 | foreach ( $modules as $module ) { |
1120 | - $checked[] = 'checked[]=' . $module; |
|
1120 | + $checked[ ] = 'checked[]=' . $module; |
|
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | ob_start(); |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | $validate = wordpoints_validate_module( $module_file ); |
1183 | 1183 | |
1184 | 1184 | if ( is_wp_error( $validate ) ) { |
1185 | - $errors[] = $module_file; |
|
1185 | + $errors[ ] = $module_file; |
|
1186 | 1186 | continue; |
1187 | 1187 | } |
1188 | 1188 | |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | if ( ! $deleted ) { |
1204 | - $errors[] = $module_file; |
|
1204 | + $errors[ ] = $module_file; |
|
1205 | 1205 | } |
1206 | 1206 | } |
1207 | 1207 | |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | $slug = WordPoints_Modules::get_slug( $module ); |
1266 | 1266 | $data = wordpoints_get_module_data( $module_file, false, false ); |
1267 | 1267 | |
1268 | - $class = "WordPoints_{$data['namespace']}_Installable"; |
|
1268 | + $class = "WordPoints_{$data[ 'namespace' ]}_Installable"; |
|
1269 | 1269 | |
1270 | 1270 | $uninstaller = new WordPoints_Uninstaller( new $class( 'module', $slug ) ); |
1271 | 1271 | $uninstaller->run(); |
@@ -1499,7 +1499,7 @@ discard block |
||
1499 | 1499 | */ |
1500 | 1500 | function wordpoints_recheck_for_extension_updates_after_upgrade( $upgrader, $data ) { |
1501 | 1501 | |
1502 | - if ( isset( $data['type'] ) && 'translation' === $data['type'] ) { |
|
1502 | + if ( isset( $data[ 'type' ] ) && 'translation' === $data[ 'type' ] ) { |
|
1503 | 1503 | return; |
1504 | 1504 | } |
1505 | 1505 | |
@@ -1555,34 +1555,34 @@ discard block |
||
1555 | 1555 | */ |
1556 | 1556 | function wordpoints_extension_update_counts( $update_data ) { |
1557 | 1557 | |
1558 | - $update_data['counts']['wordpoints_extensions'] = 0; |
|
1558 | + $update_data[ 'counts' ][ 'wordpoints_extensions' ] = 0; |
|
1559 | 1559 | |
1560 | 1560 | if ( current_user_can( 'update_wordpoints_extensions' ) ) { |
1561 | 1561 | $extension_updates = wordpoints_get_extension_updates()->get_new_versions(); |
1562 | 1562 | |
1563 | 1563 | if ( ! empty( $extension_updates ) ) { |
1564 | - $update_data['counts']['wordpoints_extensions'] = count( $extension_updates ); |
|
1564 | + $update_data[ 'counts' ][ 'wordpoints_extensions' ] = count( $extension_updates ); |
|
1565 | 1565 | |
1566 | 1566 | $title = sprintf( |
1567 | 1567 | // translators: Number of updates. |
1568 | 1568 | _n( |
1569 | 1569 | '%d WordPoints Extension Update' |
1570 | 1570 | , '%d WordPoints Extension Updates' |
1571 | - , $update_data['counts']['wordpoints_extensions'] |
|
1571 | + , $update_data[ 'counts' ][ 'wordpoints_extensions' ] |
|
1572 | 1572 | , 'wordpoints' |
1573 | 1573 | ) |
1574 | - , $update_data['counts']['wordpoints_extensions'] |
|
1574 | + , $update_data[ 'counts' ][ 'wordpoints_extensions' ] |
|
1575 | 1575 | ); |
1576 | 1576 | |
1577 | - if ( ! empty( $update_data['title'] ) ) { |
|
1578 | - $update_data['title'] .= ', '; |
|
1577 | + if ( ! empty( $update_data[ 'title' ] ) ) { |
|
1578 | + $update_data[ 'title' ] .= ', '; |
|
1579 | 1579 | } |
1580 | 1580 | |
1581 | - $update_data['title'] .= esc_attr( $title ); |
|
1581 | + $update_data[ 'title' ] .= esc_attr( $title ); |
|
1582 | 1582 | } |
1583 | 1583 | } |
1584 | 1584 | |
1585 | - $update_data['counts']['total'] += $update_data['counts']['wordpoints_extensions']; |
|
1585 | + $update_data[ 'counts' ][ 'total' ] += $update_data[ 'counts' ][ 'wordpoints_extensions' ]; |
|
1586 | 1586 | |
1587 | 1587 | return $update_data; |
1588 | 1588 | } |
@@ -1614,12 +1614,12 @@ discard block |
||
1614 | 1614 | ); |
1615 | 1615 | |
1616 | 1616 | if ( |
1617 | - empty( $data['ID'] ) |
|
1618 | - && ( 'J.D. Grimes' === $data['author'] || 'WordPoints' === $data['author'] ) |
|
1619 | - && isset( $missing_headers[ $data['name'] ] ) |
|
1617 | + empty( $data[ 'ID' ] ) |
|
1618 | + && ( 'J.D. Grimes' === $data[ 'author' ] || 'WordPoints' === $data[ 'author' ] ) |
|
1619 | + && isset( $missing_headers[ $data[ 'name' ] ] ) |
|
1620 | 1620 | ) { |
1621 | - $data['server'] = 'wordpoints.org'; |
|
1622 | - $data['ID'] = $missing_headers[ $data['name'] ]; |
|
1621 | + $data[ 'server' ] = 'wordpoints.org'; |
|
1622 | + $data[ 'ID' ] = $missing_headers[ $data[ 'name' ] ]; |
|
1623 | 1623 | } |
1624 | 1624 | |
1625 | 1625 | return $data; |
@@ -39,7 +39,7 @@ |
||
39 | 39 | add_action( 'wordpoints_extensions_loaded', 'wordpoints_installables_maybe_update', 5 ); |
40 | 40 | add_action( 'wpmu_new_blog', 'wordpoints_installables_install_on_new_site' ); |
41 | 41 | |
42 | -if ( isset( $_GET['wordpoints_module_check'], $_GET['check_module'] ) ) { // WPCS: CSRF OK. |
|
42 | +if ( isset( $_GET[ 'wordpoints_module_check' ], $_GET[ 'check_module' ] ) ) { // WPCS: CSRF OK. |
|
43 | 43 | |
44 | 44 | add_action( 'shutdown', 'wordpoints_maintenance_shutdown_print_rand_str' ); |
45 | 45 |
@@ -39,7 +39,8 @@ |
||
39 | 39 | add_action( 'wordpoints_extensions_loaded', 'wordpoints_installables_maybe_update', 5 ); |
40 | 40 | add_action( 'wpmu_new_blog', 'wordpoints_installables_install_on_new_site' ); |
41 | 41 | |
42 | -if ( isset( $_GET['wordpoints_module_check'], $_GET['check_module'] ) ) { // WPCS: CSRF OK. |
|
42 | +if ( isset( $_GET['wordpoints_module_check'], $_GET['check_module'] ) ) { |
|
43 | +// WPCS: CSRF OK. |
|
43 | 44 | |
44 | 45 | add_action( 'shutdown', 'wordpoints_maintenance_shutdown_print_rand_str' ); |
45 | 46 |