@@ -34,26 +34,26 @@ discard block |
||
| 34 | 34 | * @return string The SQL needed to create the requested tables. |
| 35 | 35 | */ |
| 36 | 36 | function wp_get_db_schema( $scope = 'all', $blog_id = null ) { |
| 37 | - global $wpdb; |
|
| 37 | + global $wpdb; |
|
| 38 | 38 | |
| 39 | - $charset_collate = $wpdb->get_charset_collate(); |
|
| 39 | + $charset_collate = $wpdb->get_charset_collate(); |
|
| 40 | 40 | |
| 41 | - if ( $blog_id && $blog_id != $wpdb->blogid ) { |
|
| 42 | - $old_blog_id = $wpdb->set_blog_id( $blog_id ); |
|
| 43 | - } |
|
| 41 | + if ( $blog_id && $blog_id != $wpdb->blogid ) { |
|
| 42 | + $old_blog_id = $wpdb->set_blog_id( $blog_id ); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - // Engage multisite if in the middle of turning it on from network.php. |
|
| 46 | - $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); |
|
| 45 | + // Engage multisite if in the middle of turning it on from network.php. |
|
| 46 | + $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); |
|
| 47 | 47 | |
| 48 | - /* |
|
| 48 | + /* |
|
| 49 | 49 | * Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that. |
| 50 | 50 | * As of 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which |
| 51 | 51 | * used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters. |
| 52 | 52 | */ |
| 53 | - $max_index_length = 191; |
|
| 53 | + $max_index_length = 191; |
|
| 54 | 54 | |
| 55 | - // Blog-specific tables. |
|
| 56 | - $blog_tables = "CREATE TABLE $wpdb->termmeta ( |
|
| 55 | + // Blog-specific tables. |
|
| 56 | + $blog_tables = "CREATE TABLE $wpdb->termmeta ( |
|
| 57 | 57 | meta_id bigint(20) unsigned NOT NULL auto_increment, |
| 58 | 58 | term_id bigint(20) unsigned NOT NULL default '0', |
| 59 | 59 | meta_key varchar(255) default NULL, |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | KEY post_author (post_author) |
| 188 | 188 | ) $charset_collate;\n"; |
| 189 | 189 | |
| 190 | - // Single site users table. The multisite flavor of the users table is handled below. |
|
| 191 | - $users_single_table = "CREATE TABLE $wpdb->users ( |
|
| 190 | + // Single site users table. The multisite flavor of the users table is handled below. |
|
| 191 | + $users_single_table = "CREATE TABLE $wpdb->users ( |
|
| 192 | 192 | ID bigint(20) unsigned NOT NULL auto_increment, |
| 193 | 193 | user_login varchar(60) NOT NULL default '', |
| 194 | 194 | user_pass varchar(255) NOT NULL default '', |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | KEY user_email (user_email) |
| 206 | 206 | ) $charset_collate;\n"; |
| 207 | 207 | |
| 208 | - // Multisite users table. |
|
| 209 | - $users_multi_table = "CREATE TABLE $wpdb->users ( |
|
| 208 | + // Multisite users table. |
|
| 209 | + $users_multi_table = "CREATE TABLE $wpdb->users ( |
|
| 210 | 210 | ID bigint(20) unsigned NOT NULL auto_increment, |
| 211 | 211 | user_login varchar(60) NOT NULL default '', |
| 212 | 212 | user_pass varchar(255) NOT NULL default '', |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | KEY user_email (user_email) |
| 226 | 226 | ) $charset_collate;\n"; |
| 227 | 227 | |
| 228 | - // Usermeta. |
|
| 229 | - $usermeta_table = "CREATE TABLE $wpdb->usermeta ( |
|
| 228 | + // Usermeta. |
|
| 229 | + $usermeta_table = "CREATE TABLE $wpdb->usermeta ( |
|
| 230 | 230 | umeta_id bigint(20) unsigned NOT NULL auto_increment, |
| 231 | 231 | user_id bigint(20) unsigned NOT NULL default '0', |
| 232 | 232 | meta_key varchar(255) default NULL, |
@@ -236,15 +236,15 @@ discard block |
||
| 236 | 236 | KEY meta_key (meta_key($max_index_length)) |
| 237 | 237 | ) $charset_collate;\n"; |
| 238 | 238 | |
| 239 | - // Global tables. |
|
| 240 | - if ( $is_multisite ) { |
|
| 241 | - $global_tables = $users_multi_table . $usermeta_table; |
|
| 242 | - } else { |
|
| 243 | - $global_tables = $users_single_table . $usermeta_table; |
|
| 244 | - } |
|
| 239 | + // Global tables. |
|
| 240 | + if ( $is_multisite ) { |
|
| 241 | + $global_tables = $users_multi_table . $usermeta_table; |
|
| 242 | + } else { |
|
| 243 | + $global_tables = $users_single_table . $usermeta_table; |
|
| 244 | + } |
|
| 245 | 245 | |
| 246 | - // Multisite global tables. |
|
| 247 | - $ms_global_tables = "CREATE TABLE $wpdb->blogs ( |
|
| 246 | + // Multisite global tables. |
|
| 247 | + $ms_global_tables = "CREATE TABLE $wpdb->blogs ( |
|
| 248 | 248 | blog_id bigint(20) NOT NULL auto_increment, |
| 249 | 249 | site_id bigint(20) NOT NULL default '0', |
| 250 | 250 | domain varchar(200) NOT NULL default '', |
@@ -314,33 +314,33 @@ discard block |
||
| 314 | 314 | KEY domain_path (domain(140),path(51)) |
| 315 | 315 | ) $charset_collate;"; |
| 316 | 316 | |
| 317 | - switch ( $scope ) { |
|
| 318 | - case 'blog': |
|
| 319 | - $queries = $blog_tables; |
|
| 320 | - break; |
|
| 321 | - case 'global': |
|
| 322 | - $queries = $global_tables; |
|
| 323 | - if ( $is_multisite ) { |
|
| 324 | - $queries .= $ms_global_tables; |
|
| 325 | - } |
|
| 326 | - break; |
|
| 327 | - case 'ms_global': |
|
| 328 | - $queries = $ms_global_tables; |
|
| 329 | - break; |
|
| 330 | - case 'all': |
|
| 331 | - default: |
|
| 332 | - $queries = $global_tables . $blog_tables; |
|
| 333 | - if ( $is_multisite ) { |
|
| 334 | - $queries .= $ms_global_tables; |
|
| 335 | - } |
|
| 336 | - break; |
|
| 337 | - } |
|
| 338 | - |
|
| 339 | - if ( isset( $old_blog_id ) ) { |
|
| 340 | - $wpdb->set_blog_id( $old_blog_id ); |
|
| 341 | - } |
|
| 342 | - |
|
| 343 | - return $queries; |
|
| 317 | + switch ( $scope ) { |
|
| 318 | + case 'blog': |
|
| 319 | + $queries = $blog_tables; |
|
| 320 | + break; |
|
| 321 | + case 'global': |
|
| 322 | + $queries = $global_tables; |
|
| 323 | + if ( $is_multisite ) { |
|
| 324 | + $queries .= $ms_global_tables; |
|
| 325 | + } |
|
| 326 | + break; |
|
| 327 | + case 'ms_global': |
|
| 328 | + $queries = $ms_global_tables; |
|
| 329 | + break; |
|
| 330 | + case 'all': |
|
| 331 | + default: |
|
| 332 | + $queries = $global_tables . $blog_tables; |
|
| 333 | + if ( $is_multisite ) { |
|
| 334 | + $queries .= $ms_global_tables; |
|
| 335 | + } |
|
| 336 | + break; |
|
| 337 | + } |
|
| 338 | + |
|
| 339 | + if ( isset( $old_blog_id ) ) { |
|
| 340 | + $wpdb->set_blog_id( $old_blog_id ); |
|
| 341 | + } |
|
| 342 | + |
|
| 343 | + return $queries; |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | // Populate for back compat. |
@@ -359,342 +359,342 @@ discard block |
||
| 359 | 359 | * @param array $options Optional. Custom option $key => $value pairs to use. Default empty array. |
| 360 | 360 | */ |
| 361 | 361 | function populate_options( array $options = array() ) { |
| 362 | - global $wpdb, $wp_db_version, $wp_current_db_version; |
|
| 363 | - |
|
| 364 | - $guessurl = wp_guess_url(); |
|
| 365 | - /** |
|
| 366 | - * Fires before creating WordPress options and populating their default values. |
|
| 367 | - * |
|
| 368 | - * @since 2.6.0 |
|
| 369 | - */ |
|
| 370 | - do_action( 'populate_options' ); |
|
| 371 | - |
|
| 372 | - // If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme. |
|
| 373 | - $stylesheet = WP_DEFAULT_THEME; |
|
| 374 | - $template = WP_DEFAULT_THEME; |
|
| 375 | - $theme = wp_get_theme( WP_DEFAULT_THEME ); |
|
| 376 | - if ( ! $theme->exists() ) { |
|
| 377 | - $theme = WP_Theme::get_core_default_theme(); |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - // If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do. |
|
| 381 | - if ( $theme ) { |
|
| 382 | - $stylesheet = $theme->get_stylesheet(); |
|
| 383 | - $template = $theme->get_template(); |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - $timezone_string = ''; |
|
| 387 | - $gmt_offset = 0; |
|
| 388 | - /* |
|
| 362 | + global $wpdb, $wp_db_version, $wp_current_db_version; |
|
| 363 | + |
|
| 364 | + $guessurl = wp_guess_url(); |
|
| 365 | + /** |
|
| 366 | + * Fires before creating WordPress options and populating their default values. |
|
| 367 | + * |
|
| 368 | + * @since 2.6.0 |
|
| 369 | + */ |
|
| 370 | + do_action( 'populate_options' ); |
|
| 371 | + |
|
| 372 | + // If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme. |
|
| 373 | + $stylesheet = WP_DEFAULT_THEME; |
|
| 374 | + $template = WP_DEFAULT_THEME; |
|
| 375 | + $theme = wp_get_theme( WP_DEFAULT_THEME ); |
|
| 376 | + if ( ! $theme->exists() ) { |
|
| 377 | + $theme = WP_Theme::get_core_default_theme(); |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + // If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do. |
|
| 381 | + if ( $theme ) { |
|
| 382 | + $stylesheet = $theme->get_stylesheet(); |
|
| 383 | + $template = $theme->get_template(); |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + $timezone_string = ''; |
|
| 387 | + $gmt_offset = 0; |
|
| 388 | + /* |
|
| 389 | 389 | * translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14) |
| 390 | 390 | * or a valid timezone string (America/New_York). See https://www.php.net/manual/en/timezones.php |
| 391 | 391 | * for all timezone strings supported by PHP. |
| 392 | 392 | */ |
| 393 | - $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); |
|
| 394 | - if ( is_numeric( $offset_or_tz ) ) { |
|
| 395 | - $gmt_offset = $offset_or_tz; |
|
| 396 | - } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list(), true ) ) { |
|
| 397 | - $timezone_string = $offset_or_tz; |
|
| 398 | - } |
|
| 399 | - |
|
| 400 | - $defaults = array( |
|
| 401 | - 'siteurl' => $guessurl, |
|
| 402 | - 'home' => $guessurl, |
|
| 403 | - 'blogname' => __( 'My Site' ), |
|
| 404 | - /* translators: Site tagline. */ |
|
| 405 | - 'blogdescription' => __( 'Just another WordPress site' ), |
|
| 406 | - 'users_can_register' => 0, |
|
| 407 | - 'admin_email' => '[email protected]', |
|
| 408 | - /* translators: Default start of the week. 0 = Sunday, 1 = Monday. */ |
|
| 409 | - 'start_of_week' => _x( '1', 'start of week' ), |
|
| 410 | - 'use_balanceTags' => 0, |
|
| 411 | - 'use_smilies' => 1, |
|
| 412 | - 'require_name_email' => 1, |
|
| 413 | - 'comments_notify' => 1, |
|
| 414 | - 'posts_per_rss' => 10, |
|
| 415 | - 'rss_use_excerpt' => 0, |
|
| 416 | - 'mailserver_url' => 'mail.example.com', |
|
| 417 | - 'mailserver_login' => '[email protected]', |
|
| 418 | - 'mailserver_pass' => 'password', |
|
| 419 | - 'mailserver_port' => 110, |
|
| 420 | - 'default_category' => 1, |
|
| 421 | - 'default_comment_status' => 'open', |
|
| 422 | - 'default_ping_status' => 'open', |
|
| 423 | - 'default_pingback_flag' => 1, |
|
| 424 | - 'posts_per_page' => 10, |
|
| 425 | - /* translators: Default date format, see https://www.php.net/manual/datetime.format.php */ |
|
| 426 | - 'date_format' => __( 'F j, Y' ), |
|
| 427 | - /* translators: Default time format, see https://www.php.net/manual/datetime.format.php */ |
|
| 428 | - 'time_format' => __( 'g:i a' ), |
|
| 429 | - /* translators: Links last updated date format, see https://www.php.net/manual/datetime.format.php */ |
|
| 430 | - 'links_updated_date_format' => __( 'F j, Y g:i a' ), |
|
| 431 | - 'comment_moderation' => 0, |
|
| 432 | - 'moderation_notify' => 1, |
|
| 433 | - 'permalink_structure' => '', |
|
| 434 | - 'rewrite_rules' => '', |
|
| 435 | - 'hack_file' => 0, |
|
| 436 | - 'blog_charset' => 'UTF-8', |
|
| 437 | - 'moderation_keys' => '', |
|
| 438 | - 'active_plugins' => array(), |
|
| 439 | - 'category_base' => '', |
|
| 440 | - 'ping_sites' => 'http://rpc.pingomatic.com/', |
|
| 441 | - 'comment_max_links' => 2, |
|
| 442 | - 'gmt_offset' => $gmt_offset, |
|
| 443 | - |
|
| 444 | - // 1.5.0 |
|
| 445 | - 'default_email_category' => 1, |
|
| 446 | - 'recently_edited' => '', |
|
| 447 | - 'template' => $template, |
|
| 448 | - 'stylesheet' => $stylesheet, |
|
| 449 | - 'comment_registration' => 0, |
|
| 450 | - 'html_type' => 'text/html', |
|
| 451 | - |
|
| 452 | - // 1.5.1 |
|
| 453 | - 'use_trackback' => 0, |
|
| 454 | - |
|
| 455 | - // 2.0.0 |
|
| 456 | - 'default_role' => 'subscriber', |
|
| 457 | - 'db_version' => $wp_db_version, |
|
| 458 | - |
|
| 459 | - // 2.0.1 |
|
| 460 | - 'uploads_use_yearmonth_folders' => 1, |
|
| 461 | - 'upload_path' => '', |
|
| 462 | - |
|
| 463 | - // 2.1.0 |
|
| 464 | - 'blog_public' => '1', |
|
| 465 | - 'default_link_category' => 2, |
|
| 466 | - 'show_on_front' => 'posts', |
|
| 467 | - |
|
| 468 | - // 2.2.0 |
|
| 469 | - 'tag_base' => '', |
|
| 470 | - |
|
| 471 | - // 2.5.0 |
|
| 472 | - 'show_avatars' => '1', |
|
| 473 | - 'avatar_rating' => 'G', |
|
| 474 | - 'upload_url_path' => '', |
|
| 475 | - 'thumbnail_size_w' => 150, |
|
| 476 | - 'thumbnail_size_h' => 150, |
|
| 477 | - 'thumbnail_crop' => 1, |
|
| 478 | - 'medium_size_w' => 300, |
|
| 479 | - 'medium_size_h' => 300, |
|
| 480 | - |
|
| 481 | - // 2.6.0 |
|
| 482 | - 'avatar_default' => 'mystery', |
|
| 483 | - |
|
| 484 | - // 2.7.0 |
|
| 485 | - 'large_size_w' => 1024, |
|
| 486 | - 'large_size_h' => 1024, |
|
| 487 | - 'image_default_link_type' => 'none', |
|
| 488 | - 'image_default_size' => '', |
|
| 489 | - 'image_default_align' => '', |
|
| 490 | - 'close_comments_for_old_posts' => 0, |
|
| 491 | - 'close_comments_days_old' => 14, |
|
| 492 | - 'thread_comments' => 1, |
|
| 493 | - 'thread_comments_depth' => 5, |
|
| 494 | - 'page_comments' => 0, |
|
| 495 | - 'comments_per_page' => 50, |
|
| 496 | - 'default_comments_page' => 'newest', |
|
| 497 | - 'comment_order' => 'asc', |
|
| 498 | - 'sticky_posts' => array(), |
|
| 499 | - 'widget_categories' => array(), |
|
| 500 | - 'widget_text' => array(), |
|
| 501 | - 'widget_rss' => array(), |
|
| 502 | - 'uninstall_plugins' => array(), |
|
| 503 | - |
|
| 504 | - // 2.8.0 |
|
| 505 | - 'timezone_string' => $timezone_string, |
|
| 506 | - |
|
| 507 | - // 3.0.0 |
|
| 508 | - 'page_for_posts' => 0, |
|
| 509 | - 'page_on_front' => 0, |
|
| 510 | - |
|
| 511 | - // 3.1.0 |
|
| 512 | - 'default_post_format' => 0, |
|
| 513 | - |
|
| 514 | - // 3.5.0 |
|
| 515 | - 'link_manager_enabled' => 0, |
|
| 516 | - |
|
| 517 | - // 4.3.0 |
|
| 518 | - 'finished_splitting_shared_terms' => 1, |
|
| 519 | - 'site_icon' => 0, |
|
| 520 | - |
|
| 521 | - // 4.4.0 |
|
| 522 | - 'medium_large_size_w' => 768, |
|
| 523 | - 'medium_large_size_h' => 0, |
|
| 524 | - |
|
| 525 | - // 4.9.6 |
|
| 526 | - 'wp_page_for_privacy_policy' => 0, |
|
| 527 | - |
|
| 528 | - // 4.9.8 |
|
| 529 | - 'show_comments_cookies_opt_in' => 1, |
|
| 530 | - |
|
| 531 | - // 5.3.0 |
|
| 532 | - 'admin_email_lifespan' => ( time() + 6 * MONTH_IN_SECONDS ), |
|
| 533 | - |
|
| 534 | - // 5.5.0 |
|
| 535 | - 'disallowed_keys' => '', |
|
| 536 | - 'comment_previously_approved' => 1, |
|
| 537 | - 'auto_plugin_theme_update_emails' => array(), |
|
| 538 | - |
|
| 539 | - // 5.6.0 |
|
| 540 | - 'auto_update_core_dev' => 'enabled', |
|
| 541 | - 'auto_update_core_minor' => 'enabled', |
|
| 542 | - // Default to enabled for new installs. |
|
| 543 | - // See https://core.trac.wordpress.org/ticket/51742. |
|
| 544 | - 'auto_update_core_major' => 'enabled', |
|
| 545 | - |
|
| 546 | - // 5.8.0 |
|
| 547 | - 'wp_force_deactivated_plugins' => array(), |
|
| 548 | - ); |
|
| 549 | - |
|
| 550 | - // 3.3.0 |
|
| 551 | - if ( ! is_multisite() ) { |
|
| 552 | - $defaults['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version |
|
| 553 | - ? $wp_current_db_version : $wp_db_version; |
|
| 554 | - } |
|
| 555 | - |
|
| 556 | - // 3.0.0 multisite. |
|
| 557 | - if ( is_multisite() ) { |
|
| 558 | - /* translators: %s: Network title. */ |
|
| 559 | - $defaults['blogdescription'] = sprintf( __( 'Just another %s site' ), get_network()->site_name ); |
|
| 560 | - $defaults['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/'; |
|
| 561 | - } |
|
| 562 | - |
|
| 563 | - $options = wp_parse_args( $options, $defaults ); |
|
| 564 | - |
|
| 565 | - // Set autoload to no for these options. |
|
| 566 | - $fat_options = array( |
|
| 567 | - 'moderation_keys', |
|
| 568 | - 'recently_edited', |
|
| 569 | - 'disallowed_keys', |
|
| 570 | - 'uninstall_plugins', |
|
| 571 | - 'auto_plugin_theme_update_emails', |
|
| 572 | - ); |
|
| 573 | - |
|
| 574 | - $keys = "'" . implode( "', '", array_keys( $options ) ) . "'"; |
|
| 575 | - $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 576 | - |
|
| 577 | - $insert = ''; |
|
| 578 | - |
|
| 579 | - foreach ( $options as $option => $value ) { |
|
| 580 | - if ( in_array( $option, $existing_options, true ) ) { |
|
| 581 | - continue; |
|
| 582 | - } |
|
| 583 | - |
|
| 584 | - if ( in_array( $option, $fat_options, true ) ) { |
|
| 585 | - $autoload = 'no'; |
|
| 586 | - } else { |
|
| 587 | - $autoload = 'yes'; |
|
| 588 | - } |
|
| 589 | - |
|
| 590 | - if ( is_array( $value ) ) { |
|
| 591 | - $value = serialize( $value ); |
|
| 592 | - } |
|
| 593 | - |
|
| 594 | - if ( ! empty( $insert ) ) { |
|
| 595 | - $insert .= ', '; |
|
| 596 | - } |
|
| 597 | - |
|
| 598 | - $insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload ); |
|
| 599 | - } |
|
| 600 | - |
|
| 601 | - if ( ! empty( $insert ) ) { |
|
| 602 | - $wpdb->query( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 603 | - } |
|
| 604 | - |
|
| 605 | - // In case it is set, but blank, update "home". |
|
| 606 | - if ( ! __get_option( 'home' ) ) { |
|
| 607 | - update_option( 'home', $guessurl ); |
|
| 608 | - } |
|
| 609 | - |
|
| 610 | - // Delete unused options. |
|
| 611 | - $unusedoptions = array( |
|
| 612 | - 'blodotgsping_url', |
|
| 613 | - 'bodyterminator', |
|
| 614 | - 'emailtestonly', |
|
| 615 | - 'phoneemail_separator', |
|
| 616 | - 'smilies_directory', |
|
| 617 | - 'subjectprefix', |
|
| 618 | - 'use_bbcode', |
|
| 619 | - 'use_blodotgsping', |
|
| 620 | - 'use_phoneemail', |
|
| 621 | - 'use_quicktags', |
|
| 622 | - 'use_weblogsping', |
|
| 623 | - 'weblogs_cache_file', |
|
| 624 | - 'use_preview', |
|
| 625 | - 'use_htmltrans', |
|
| 626 | - 'smilies_directory', |
|
| 627 | - 'fileupload_allowedusers', |
|
| 628 | - 'use_phoneemail', |
|
| 629 | - 'default_post_status', |
|
| 630 | - 'default_post_category', |
|
| 631 | - 'archive_mode', |
|
| 632 | - 'time_difference', |
|
| 633 | - 'links_minadminlevel', |
|
| 634 | - 'links_use_adminlevels', |
|
| 635 | - 'links_rating_type', |
|
| 636 | - 'links_rating_char', |
|
| 637 | - 'links_rating_ignore_zero', |
|
| 638 | - 'links_rating_single_image', |
|
| 639 | - 'links_rating_image0', |
|
| 640 | - 'links_rating_image1', |
|
| 641 | - 'links_rating_image2', |
|
| 642 | - 'links_rating_image3', |
|
| 643 | - 'links_rating_image4', |
|
| 644 | - 'links_rating_image5', |
|
| 645 | - 'links_rating_image6', |
|
| 646 | - 'links_rating_image7', |
|
| 647 | - 'links_rating_image8', |
|
| 648 | - 'links_rating_image9', |
|
| 649 | - 'links_recently_updated_time', |
|
| 650 | - 'links_recently_updated_prepend', |
|
| 651 | - 'links_recently_updated_append', |
|
| 652 | - 'weblogs_cacheminutes', |
|
| 653 | - 'comment_allowed_tags', |
|
| 654 | - 'search_engine_friendly_urls', |
|
| 655 | - 'default_geourl_lat', |
|
| 656 | - 'default_geourl_lon', |
|
| 657 | - 'use_default_geourl', |
|
| 658 | - 'weblogs_xml_url', |
|
| 659 | - 'new_users_can_blog', |
|
| 660 | - '_wpnonce', |
|
| 661 | - '_wp_http_referer', |
|
| 662 | - 'Update', |
|
| 663 | - 'action', |
|
| 664 | - 'rich_editing', |
|
| 665 | - 'autosave_interval', |
|
| 666 | - 'deactivated_plugins', |
|
| 667 | - 'can_compress_scripts', |
|
| 668 | - 'page_uris', |
|
| 669 | - 'update_core', |
|
| 670 | - 'update_plugins', |
|
| 671 | - 'update_themes', |
|
| 672 | - 'doing_cron', |
|
| 673 | - 'random_seed', |
|
| 674 | - 'rss_excerpt_length', |
|
| 675 | - 'secret', |
|
| 676 | - 'use_linksupdate', |
|
| 677 | - 'default_comment_status_page', |
|
| 678 | - 'wporg_popular_tags', |
|
| 679 | - 'what_to_show', |
|
| 680 | - 'rss_language', |
|
| 681 | - 'language', |
|
| 682 | - 'enable_xmlrpc', |
|
| 683 | - 'enable_app', |
|
| 684 | - 'embed_autourls', |
|
| 685 | - 'default_post_edit_rows', |
|
| 686 | - 'gzipcompression', |
|
| 687 | - 'advanced_edit', |
|
| 688 | - ); |
|
| 689 | - foreach ( $unusedoptions as $option ) { |
|
| 690 | - delete_option( $option ); |
|
| 691 | - } |
|
| 692 | - |
|
| 693 | - // Delete obsolete magpie stuff. |
|
| 694 | - $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'" ); |
|
| 695 | - |
|
| 696 | - // Clear expired transients. |
|
| 697 | - delete_expired_transients( true ); |
|
| 393 | + $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); |
|
| 394 | + if ( is_numeric( $offset_or_tz ) ) { |
|
| 395 | + $gmt_offset = $offset_or_tz; |
|
| 396 | + } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list(), true ) ) { |
|
| 397 | + $timezone_string = $offset_or_tz; |
|
| 398 | + } |
|
| 399 | + |
|
| 400 | + $defaults = array( |
|
| 401 | + 'siteurl' => $guessurl, |
|
| 402 | + 'home' => $guessurl, |
|
| 403 | + 'blogname' => __( 'My Site' ), |
|
| 404 | + /* translators: Site tagline. */ |
|
| 405 | + 'blogdescription' => __( 'Just another WordPress site' ), |
|
| 406 | + 'users_can_register' => 0, |
|
| 407 | + 'admin_email' => '[email protected]', |
|
| 408 | + /* translators: Default start of the week. 0 = Sunday, 1 = Monday. */ |
|
| 409 | + 'start_of_week' => _x( '1', 'start of week' ), |
|
| 410 | + 'use_balanceTags' => 0, |
|
| 411 | + 'use_smilies' => 1, |
|
| 412 | + 'require_name_email' => 1, |
|
| 413 | + 'comments_notify' => 1, |
|
| 414 | + 'posts_per_rss' => 10, |
|
| 415 | + 'rss_use_excerpt' => 0, |
|
| 416 | + 'mailserver_url' => 'mail.example.com', |
|
| 417 | + 'mailserver_login' => '[email protected]', |
|
| 418 | + 'mailserver_pass' => 'password', |
|
| 419 | + 'mailserver_port' => 110, |
|
| 420 | + 'default_category' => 1, |
|
| 421 | + 'default_comment_status' => 'open', |
|
| 422 | + 'default_ping_status' => 'open', |
|
| 423 | + 'default_pingback_flag' => 1, |
|
| 424 | + 'posts_per_page' => 10, |
|
| 425 | + /* translators: Default date format, see https://www.php.net/manual/datetime.format.php */ |
|
| 426 | + 'date_format' => __( 'F j, Y' ), |
|
| 427 | + /* translators: Default time format, see https://www.php.net/manual/datetime.format.php */ |
|
| 428 | + 'time_format' => __( 'g:i a' ), |
|
| 429 | + /* translators: Links last updated date format, see https://www.php.net/manual/datetime.format.php */ |
|
| 430 | + 'links_updated_date_format' => __( 'F j, Y g:i a' ), |
|
| 431 | + 'comment_moderation' => 0, |
|
| 432 | + 'moderation_notify' => 1, |
|
| 433 | + 'permalink_structure' => '', |
|
| 434 | + 'rewrite_rules' => '', |
|
| 435 | + 'hack_file' => 0, |
|
| 436 | + 'blog_charset' => 'UTF-8', |
|
| 437 | + 'moderation_keys' => '', |
|
| 438 | + 'active_plugins' => array(), |
|
| 439 | + 'category_base' => '', |
|
| 440 | + 'ping_sites' => 'http://rpc.pingomatic.com/', |
|
| 441 | + 'comment_max_links' => 2, |
|
| 442 | + 'gmt_offset' => $gmt_offset, |
|
| 443 | + |
|
| 444 | + // 1.5.0 |
|
| 445 | + 'default_email_category' => 1, |
|
| 446 | + 'recently_edited' => '', |
|
| 447 | + 'template' => $template, |
|
| 448 | + 'stylesheet' => $stylesheet, |
|
| 449 | + 'comment_registration' => 0, |
|
| 450 | + 'html_type' => 'text/html', |
|
| 451 | + |
|
| 452 | + // 1.5.1 |
|
| 453 | + 'use_trackback' => 0, |
|
| 454 | + |
|
| 455 | + // 2.0.0 |
|
| 456 | + 'default_role' => 'subscriber', |
|
| 457 | + 'db_version' => $wp_db_version, |
|
| 458 | + |
|
| 459 | + // 2.0.1 |
|
| 460 | + 'uploads_use_yearmonth_folders' => 1, |
|
| 461 | + 'upload_path' => '', |
|
| 462 | + |
|
| 463 | + // 2.1.0 |
|
| 464 | + 'blog_public' => '1', |
|
| 465 | + 'default_link_category' => 2, |
|
| 466 | + 'show_on_front' => 'posts', |
|
| 467 | + |
|
| 468 | + // 2.2.0 |
|
| 469 | + 'tag_base' => '', |
|
| 470 | + |
|
| 471 | + // 2.5.0 |
|
| 472 | + 'show_avatars' => '1', |
|
| 473 | + 'avatar_rating' => 'G', |
|
| 474 | + 'upload_url_path' => '', |
|
| 475 | + 'thumbnail_size_w' => 150, |
|
| 476 | + 'thumbnail_size_h' => 150, |
|
| 477 | + 'thumbnail_crop' => 1, |
|
| 478 | + 'medium_size_w' => 300, |
|
| 479 | + 'medium_size_h' => 300, |
|
| 480 | + |
|
| 481 | + // 2.6.0 |
|
| 482 | + 'avatar_default' => 'mystery', |
|
| 483 | + |
|
| 484 | + // 2.7.0 |
|
| 485 | + 'large_size_w' => 1024, |
|
| 486 | + 'large_size_h' => 1024, |
|
| 487 | + 'image_default_link_type' => 'none', |
|
| 488 | + 'image_default_size' => '', |
|
| 489 | + 'image_default_align' => '', |
|
| 490 | + 'close_comments_for_old_posts' => 0, |
|
| 491 | + 'close_comments_days_old' => 14, |
|
| 492 | + 'thread_comments' => 1, |
|
| 493 | + 'thread_comments_depth' => 5, |
|
| 494 | + 'page_comments' => 0, |
|
| 495 | + 'comments_per_page' => 50, |
|
| 496 | + 'default_comments_page' => 'newest', |
|
| 497 | + 'comment_order' => 'asc', |
|
| 498 | + 'sticky_posts' => array(), |
|
| 499 | + 'widget_categories' => array(), |
|
| 500 | + 'widget_text' => array(), |
|
| 501 | + 'widget_rss' => array(), |
|
| 502 | + 'uninstall_plugins' => array(), |
|
| 503 | + |
|
| 504 | + // 2.8.0 |
|
| 505 | + 'timezone_string' => $timezone_string, |
|
| 506 | + |
|
| 507 | + // 3.0.0 |
|
| 508 | + 'page_for_posts' => 0, |
|
| 509 | + 'page_on_front' => 0, |
|
| 510 | + |
|
| 511 | + // 3.1.0 |
|
| 512 | + 'default_post_format' => 0, |
|
| 513 | + |
|
| 514 | + // 3.5.0 |
|
| 515 | + 'link_manager_enabled' => 0, |
|
| 516 | + |
|
| 517 | + // 4.3.0 |
|
| 518 | + 'finished_splitting_shared_terms' => 1, |
|
| 519 | + 'site_icon' => 0, |
|
| 520 | + |
|
| 521 | + // 4.4.0 |
|
| 522 | + 'medium_large_size_w' => 768, |
|
| 523 | + 'medium_large_size_h' => 0, |
|
| 524 | + |
|
| 525 | + // 4.9.6 |
|
| 526 | + 'wp_page_for_privacy_policy' => 0, |
|
| 527 | + |
|
| 528 | + // 4.9.8 |
|
| 529 | + 'show_comments_cookies_opt_in' => 1, |
|
| 530 | + |
|
| 531 | + // 5.3.0 |
|
| 532 | + 'admin_email_lifespan' => ( time() + 6 * MONTH_IN_SECONDS ), |
|
| 533 | + |
|
| 534 | + // 5.5.0 |
|
| 535 | + 'disallowed_keys' => '', |
|
| 536 | + 'comment_previously_approved' => 1, |
|
| 537 | + 'auto_plugin_theme_update_emails' => array(), |
|
| 538 | + |
|
| 539 | + // 5.6.0 |
|
| 540 | + 'auto_update_core_dev' => 'enabled', |
|
| 541 | + 'auto_update_core_minor' => 'enabled', |
|
| 542 | + // Default to enabled for new installs. |
|
| 543 | + // See https://core.trac.wordpress.org/ticket/51742. |
|
| 544 | + 'auto_update_core_major' => 'enabled', |
|
| 545 | + |
|
| 546 | + // 5.8.0 |
|
| 547 | + 'wp_force_deactivated_plugins' => array(), |
|
| 548 | + ); |
|
| 549 | + |
|
| 550 | + // 3.3.0 |
|
| 551 | + if ( ! is_multisite() ) { |
|
| 552 | + $defaults['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version |
|
| 553 | + ? $wp_current_db_version : $wp_db_version; |
|
| 554 | + } |
|
| 555 | + |
|
| 556 | + // 3.0.0 multisite. |
|
| 557 | + if ( is_multisite() ) { |
|
| 558 | + /* translators: %s: Network title. */ |
|
| 559 | + $defaults['blogdescription'] = sprintf( __( 'Just another %s site' ), get_network()->site_name ); |
|
| 560 | + $defaults['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/'; |
|
| 561 | + } |
|
| 562 | + |
|
| 563 | + $options = wp_parse_args( $options, $defaults ); |
|
| 564 | + |
|
| 565 | + // Set autoload to no for these options. |
|
| 566 | + $fat_options = array( |
|
| 567 | + 'moderation_keys', |
|
| 568 | + 'recently_edited', |
|
| 569 | + 'disallowed_keys', |
|
| 570 | + 'uninstall_plugins', |
|
| 571 | + 'auto_plugin_theme_update_emails', |
|
| 572 | + ); |
|
| 573 | + |
|
| 574 | + $keys = "'" . implode( "', '", array_keys( $options ) ) . "'"; |
|
| 575 | + $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 576 | + |
|
| 577 | + $insert = ''; |
|
| 578 | + |
|
| 579 | + foreach ( $options as $option => $value ) { |
|
| 580 | + if ( in_array( $option, $existing_options, true ) ) { |
|
| 581 | + continue; |
|
| 582 | + } |
|
| 583 | + |
|
| 584 | + if ( in_array( $option, $fat_options, true ) ) { |
|
| 585 | + $autoload = 'no'; |
|
| 586 | + } else { |
|
| 587 | + $autoload = 'yes'; |
|
| 588 | + } |
|
| 589 | + |
|
| 590 | + if ( is_array( $value ) ) { |
|
| 591 | + $value = serialize( $value ); |
|
| 592 | + } |
|
| 593 | + |
|
| 594 | + if ( ! empty( $insert ) ) { |
|
| 595 | + $insert .= ', '; |
|
| 596 | + } |
|
| 597 | + |
|
| 598 | + $insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload ); |
|
| 599 | + } |
|
| 600 | + |
|
| 601 | + if ( ! empty( $insert ) ) { |
|
| 602 | + $wpdb->query( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 603 | + } |
|
| 604 | + |
|
| 605 | + // In case it is set, but blank, update "home". |
|
| 606 | + if ( ! __get_option( 'home' ) ) { |
|
| 607 | + update_option( 'home', $guessurl ); |
|
| 608 | + } |
|
| 609 | + |
|
| 610 | + // Delete unused options. |
|
| 611 | + $unusedoptions = array( |
|
| 612 | + 'blodotgsping_url', |
|
| 613 | + 'bodyterminator', |
|
| 614 | + 'emailtestonly', |
|
| 615 | + 'phoneemail_separator', |
|
| 616 | + 'smilies_directory', |
|
| 617 | + 'subjectprefix', |
|
| 618 | + 'use_bbcode', |
|
| 619 | + 'use_blodotgsping', |
|
| 620 | + 'use_phoneemail', |
|
| 621 | + 'use_quicktags', |
|
| 622 | + 'use_weblogsping', |
|
| 623 | + 'weblogs_cache_file', |
|
| 624 | + 'use_preview', |
|
| 625 | + 'use_htmltrans', |
|
| 626 | + 'smilies_directory', |
|
| 627 | + 'fileupload_allowedusers', |
|
| 628 | + 'use_phoneemail', |
|
| 629 | + 'default_post_status', |
|
| 630 | + 'default_post_category', |
|
| 631 | + 'archive_mode', |
|
| 632 | + 'time_difference', |
|
| 633 | + 'links_minadminlevel', |
|
| 634 | + 'links_use_adminlevels', |
|
| 635 | + 'links_rating_type', |
|
| 636 | + 'links_rating_char', |
|
| 637 | + 'links_rating_ignore_zero', |
|
| 638 | + 'links_rating_single_image', |
|
| 639 | + 'links_rating_image0', |
|
| 640 | + 'links_rating_image1', |
|
| 641 | + 'links_rating_image2', |
|
| 642 | + 'links_rating_image3', |
|
| 643 | + 'links_rating_image4', |
|
| 644 | + 'links_rating_image5', |
|
| 645 | + 'links_rating_image6', |
|
| 646 | + 'links_rating_image7', |
|
| 647 | + 'links_rating_image8', |
|
| 648 | + 'links_rating_image9', |
|
| 649 | + 'links_recently_updated_time', |
|
| 650 | + 'links_recently_updated_prepend', |
|
| 651 | + 'links_recently_updated_append', |
|
| 652 | + 'weblogs_cacheminutes', |
|
| 653 | + 'comment_allowed_tags', |
|
| 654 | + 'search_engine_friendly_urls', |
|
| 655 | + 'default_geourl_lat', |
|
| 656 | + 'default_geourl_lon', |
|
| 657 | + 'use_default_geourl', |
|
| 658 | + 'weblogs_xml_url', |
|
| 659 | + 'new_users_can_blog', |
|
| 660 | + '_wpnonce', |
|
| 661 | + '_wp_http_referer', |
|
| 662 | + 'Update', |
|
| 663 | + 'action', |
|
| 664 | + 'rich_editing', |
|
| 665 | + 'autosave_interval', |
|
| 666 | + 'deactivated_plugins', |
|
| 667 | + 'can_compress_scripts', |
|
| 668 | + 'page_uris', |
|
| 669 | + 'update_core', |
|
| 670 | + 'update_plugins', |
|
| 671 | + 'update_themes', |
|
| 672 | + 'doing_cron', |
|
| 673 | + 'random_seed', |
|
| 674 | + 'rss_excerpt_length', |
|
| 675 | + 'secret', |
|
| 676 | + 'use_linksupdate', |
|
| 677 | + 'default_comment_status_page', |
|
| 678 | + 'wporg_popular_tags', |
|
| 679 | + 'what_to_show', |
|
| 680 | + 'rss_language', |
|
| 681 | + 'language', |
|
| 682 | + 'enable_xmlrpc', |
|
| 683 | + 'enable_app', |
|
| 684 | + 'embed_autourls', |
|
| 685 | + 'default_post_edit_rows', |
|
| 686 | + 'gzipcompression', |
|
| 687 | + 'advanced_edit', |
|
| 688 | + ); |
|
| 689 | + foreach ( $unusedoptions as $option ) { |
|
| 690 | + delete_option( $option ); |
|
| 691 | + } |
|
| 692 | + |
|
| 693 | + // Delete obsolete magpie stuff. |
|
| 694 | + $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'" ); |
|
| 695 | + |
|
| 696 | + // Clear expired transients. |
|
| 697 | + delete_expired_transients( true ); |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | /** |
@@ -703,14 +703,14 @@ discard block |
||
| 703 | 703 | * @since 2.0.0 |
| 704 | 704 | */ |
| 705 | 705 | function populate_roles() { |
| 706 | - populate_roles_160(); |
|
| 707 | - populate_roles_210(); |
|
| 708 | - populate_roles_230(); |
|
| 709 | - populate_roles_250(); |
|
| 710 | - populate_roles_260(); |
|
| 711 | - populate_roles_270(); |
|
| 712 | - populate_roles_280(); |
|
| 713 | - populate_roles_300(); |
|
| 706 | + populate_roles_160(); |
|
| 707 | + populate_roles_210(); |
|
| 708 | + populate_roles_230(); |
|
| 709 | + populate_roles_250(); |
|
| 710 | + populate_roles_260(); |
|
| 711 | + populate_roles_270(); |
|
| 712 | + populate_roles_280(); |
|
| 713 | + populate_roles_300(); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | /** |
@@ -719,90 +719,90 @@ discard block |
||
| 719 | 719 | * @since 2.0.0 |
| 720 | 720 | */ |
| 721 | 721 | function populate_roles_160() { |
| 722 | - // Add roles. |
|
| 723 | - add_role( 'administrator', 'Administrator' ); |
|
| 724 | - add_role( 'editor', 'Editor' ); |
|
| 725 | - add_role( 'author', 'Author' ); |
|
| 726 | - add_role( 'contributor', 'Contributor' ); |
|
| 727 | - add_role( 'subscriber', 'Subscriber' ); |
|
| 728 | - |
|
| 729 | - // Add caps for Administrator role. |
|
| 730 | - $role = get_role( 'administrator' ); |
|
| 731 | - $role->add_cap( 'switch_themes' ); |
|
| 732 | - $role->add_cap( 'edit_themes' ); |
|
| 733 | - $role->add_cap( 'activate_plugins' ); |
|
| 734 | - $role->add_cap( 'edit_plugins' ); |
|
| 735 | - $role->add_cap( 'edit_users' ); |
|
| 736 | - $role->add_cap( 'edit_files' ); |
|
| 737 | - $role->add_cap( 'manage_options' ); |
|
| 738 | - $role->add_cap( 'moderate_comments' ); |
|
| 739 | - $role->add_cap( 'manage_categories' ); |
|
| 740 | - $role->add_cap( 'manage_links' ); |
|
| 741 | - $role->add_cap( 'upload_files' ); |
|
| 742 | - $role->add_cap( 'import' ); |
|
| 743 | - $role->add_cap( 'unfiltered_html' ); |
|
| 744 | - $role->add_cap( 'edit_posts' ); |
|
| 745 | - $role->add_cap( 'edit_others_posts' ); |
|
| 746 | - $role->add_cap( 'edit_published_posts' ); |
|
| 747 | - $role->add_cap( 'publish_posts' ); |
|
| 748 | - $role->add_cap( 'edit_pages' ); |
|
| 749 | - $role->add_cap( 'read' ); |
|
| 750 | - $role->add_cap( 'level_10' ); |
|
| 751 | - $role->add_cap( 'level_9' ); |
|
| 752 | - $role->add_cap( 'level_8' ); |
|
| 753 | - $role->add_cap( 'level_7' ); |
|
| 754 | - $role->add_cap( 'level_6' ); |
|
| 755 | - $role->add_cap( 'level_5' ); |
|
| 756 | - $role->add_cap( 'level_4' ); |
|
| 757 | - $role->add_cap( 'level_3' ); |
|
| 758 | - $role->add_cap( 'level_2' ); |
|
| 759 | - $role->add_cap( 'level_1' ); |
|
| 760 | - $role->add_cap( 'level_0' ); |
|
| 761 | - |
|
| 762 | - // Add caps for Editor role. |
|
| 763 | - $role = get_role( 'editor' ); |
|
| 764 | - $role->add_cap( 'moderate_comments' ); |
|
| 765 | - $role->add_cap( 'manage_categories' ); |
|
| 766 | - $role->add_cap( 'manage_links' ); |
|
| 767 | - $role->add_cap( 'upload_files' ); |
|
| 768 | - $role->add_cap( 'unfiltered_html' ); |
|
| 769 | - $role->add_cap( 'edit_posts' ); |
|
| 770 | - $role->add_cap( 'edit_others_posts' ); |
|
| 771 | - $role->add_cap( 'edit_published_posts' ); |
|
| 772 | - $role->add_cap( 'publish_posts' ); |
|
| 773 | - $role->add_cap( 'edit_pages' ); |
|
| 774 | - $role->add_cap( 'read' ); |
|
| 775 | - $role->add_cap( 'level_7' ); |
|
| 776 | - $role->add_cap( 'level_6' ); |
|
| 777 | - $role->add_cap( 'level_5' ); |
|
| 778 | - $role->add_cap( 'level_4' ); |
|
| 779 | - $role->add_cap( 'level_3' ); |
|
| 780 | - $role->add_cap( 'level_2' ); |
|
| 781 | - $role->add_cap( 'level_1' ); |
|
| 782 | - $role->add_cap( 'level_0' ); |
|
| 783 | - |
|
| 784 | - // Add caps for Author role. |
|
| 785 | - $role = get_role( 'author' ); |
|
| 786 | - $role->add_cap( 'upload_files' ); |
|
| 787 | - $role->add_cap( 'edit_posts' ); |
|
| 788 | - $role->add_cap( 'edit_published_posts' ); |
|
| 789 | - $role->add_cap( 'publish_posts' ); |
|
| 790 | - $role->add_cap( 'read' ); |
|
| 791 | - $role->add_cap( 'level_2' ); |
|
| 792 | - $role->add_cap( 'level_1' ); |
|
| 793 | - $role->add_cap( 'level_0' ); |
|
| 794 | - |
|
| 795 | - // Add caps for Contributor role. |
|
| 796 | - $role = get_role( 'contributor' ); |
|
| 797 | - $role->add_cap( 'edit_posts' ); |
|
| 798 | - $role->add_cap( 'read' ); |
|
| 799 | - $role->add_cap( 'level_1' ); |
|
| 800 | - $role->add_cap( 'level_0' ); |
|
| 801 | - |
|
| 802 | - // Add caps for Subscriber role. |
|
| 803 | - $role = get_role( 'subscriber' ); |
|
| 804 | - $role->add_cap( 'read' ); |
|
| 805 | - $role->add_cap( 'level_0' ); |
|
| 722 | + // Add roles. |
|
| 723 | + add_role( 'administrator', 'Administrator' ); |
|
| 724 | + add_role( 'editor', 'Editor' ); |
|
| 725 | + add_role( 'author', 'Author' ); |
|
| 726 | + add_role( 'contributor', 'Contributor' ); |
|
| 727 | + add_role( 'subscriber', 'Subscriber' ); |
|
| 728 | + |
|
| 729 | + // Add caps for Administrator role. |
|
| 730 | + $role = get_role( 'administrator' ); |
|
| 731 | + $role->add_cap( 'switch_themes' ); |
|
| 732 | + $role->add_cap( 'edit_themes' ); |
|
| 733 | + $role->add_cap( 'activate_plugins' ); |
|
| 734 | + $role->add_cap( 'edit_plugins' ); |
|
| 735 | + $role->add_cap( 'edit_users' ); |
|
| 736 | + $role->add_cap( 'edit_files' ); |
|
| 737 | + $role->add_cap( 'manage_options' ); |
|
| 738 | + $role->add_cap( 'moderate_comments' ); |
|
| 739 | + $role->add_cap( 'manage_categories' ); |
|
| 740 | + $role->add_cap( 'manage_links' ); |
|
| 741 | + $role->add_cap( 'upload_files' ); |
|
| 742 | + $role->add_cap( 'import' ); |
|
| 743 | + $role->add_cap( 'unfiltered_html' ); |
|
| 744 | + $role->add_cap( 'edit_posts' ); |
|
| 745 | + $role->add_cap( 'edit_others_posts' ); |
|
| 746 | + $role->add_cap( 'edit_published_posts' ); |
|
| 747 | + $role->add_cap( 'publish_posts' ); |
|
| 748 | + $role->add_cap( 'edit_pages' ); |
|
| 749 | + $role->add_cap( 'read' ); |
|
| 750 | + $role->add_cap( 'level_10' ); |
|
| 751 | + $role->add_cap( 'level_9' ); |
|
| 752 | + $role->add_cap( 'level_8' ); |
|
| 753 | + $role->add_cap( 'level_7' ); |
|
| 754 | + $role->add_cap( 'level_6' ); |
|
| 755 | + $role->add_cap( 'level_5' ); |
|
| 756 | + $role->add_cap( 'level_4' ); |
|
| 757 | + $role->add_cap( 'level_3' ); |
|
| 758 | + $role->add_cap( 'level_2' ); |
|
| 759 | + $role->add_cap( 'level_1' ); |
|
| 760 | + $role->add_cap( 'level_0' ); |
|
| 761 | + |
|
| 762 | + // Add caps for Editor role. |
|
| 763 | + $role = get_role( 'editor' ); |
|
| 764 | + $role->add_cap( 'moderate_comments' ); |
|
| 765 | + $role->add_cap( 'manage_categories' ); |
|
| 766 | + $role->add_cap( 'manage_links' ); |
|
| 767 | + $role->add_cap( 'upload_files' ); |
|
| 768 | + $role->add_cap( 'unfiltered_html' ); |
|
| 769 | + $role->add_cap( 'edit_posts' ); |
|
| 770 | + $role->add_cap( 'edit_others_posts' ); |
|
| 771 | + $role->add_cap( 'edit_published_posts' ); |
|
| 772 | + $role->add_cap( 'publish_posts' ); |
|
| 773 | + $role->add_cap( 'edit_pages' ); |
|
| 774 | + $role->add_cap( 'read' ); |
|
| 775 | + $role->add_cap( 'level_7' ); |
|
| 776 | + $role->add_cap( 'level_6' ); |
|
| 777 | + $role->add_cap( 'level_5' ); |
|
| 778 | + $role->add_cap( 'level_4' ); |
|
| 779 | + $role->add_cap( 'level_3' ); |
|
| 780 | + $role->add_cap( 'level_2' ); |
|
| 781 | + $role->add_cap( 'level_1' ); |
|
| 782 | + $role->add_cap( 'level_0' ); |
|
| 783 | + |
|
| 784 | + // Add caps for Author role. |
|
| 785 | + $role = get_role( 'author' ); |
|
| 786 | + $role->add_cap( 'upload_files' ); |
|
| 787 | + $role->add_cap( 'edit_posts' ); |
|
| 788 | + $role->add_cap( 'edit_published_posts' ); |
|
| 789 | + $role->add_cap( 'publish_posts' ); |
|
| 790 | + $role->add_cap( 'read' ); |
|
| 791 | + $role->add_cap( 'level_2' ); |
|
| 792 | + $role->add_cap( 'level_1' ); |
|
| 793 | + $role->add_cap( 'level_0' ); |
|
| 794 | + |
|
| 795 | + // Add caps for Contributor role. |
|
| 796 | + $role = get_role( 'contributor' ); |
|
| 797 | + $role->add_cap( 'edit_posts' ); |
|
| 798 | + $role->add_cap( 'read' ); |
|
| 799 | + $role->add_cap( 'level_1' ); |
|
| 800 | + $role->add_cap( 'level_0' ); |
|
| 801 | + |
|
| 802 | + // Add caps for Subscriber role. |
|
| 803 | + $role = get_role( 'subscriber' ); |
|
| 804 | + $role->add_cap( 'read' ); |
|
| 805 | + $role->add_cap( 'level_0' ); |
|
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | /** |
@@ -811,46 +811,46 @@ discard block |
||
| 811 | 811 | * @since 2.1.0 |
| 812 | 812 | */ |
| 813 | 813 | function populate_roles_210() { |
| 814 | - $roles = array( 'administrator', 'editor' ); |
|
| 815 | - foreach ( $roles as $role ) { |
|
| 816 | - $role = get_role( $role ); |
|
| 817 | - if ( empty( $role ) ) { |
|
| 818 | - continue; |
|
| 819 | - } |
|
| 820 | - |
|
| 821 | - $role->add_cap( 'edit_others_pages' ); |
|
| 822 | - $role->add_cap( 'edit_published_pages' ); |
|
| 823 | - $role->add_cap( 'publish_pages' ); |
|
| 824 | - $role->add_cap( 'delete_pages' ); |
|
| 825 | - $role->add_cap( 'delete_others_pages' ); |
|
| 826 | - $role->add_cap( 'delete_published_pages' ); |
|
| 827 | - $role->add_cap( 'delete_posts' ); |
|
| 828 | - $role->add_cap( 'delete_others_posts' ); |
|
| 829 | - $role->add_cap( 'delete_published_posts' ); |
|
| 830 | - $role->add_cap( 'delete_private_posts' ); |
|
| 831 | - $role->add_cap( 'edit_private_posts' ); |
|
| 832 | - $role->add_cap( 'read_private_posts' ); |
|
| 833 | - $role->add_cap( 'delete_private_pages' ); |
|
| 834 | - $role->add_cap( 'edit_private_pages' ); |
|
| 835 | - $role->add_cap( 'read_private_pages' ); |
|
| 836 | - } |
|
| 837 | - |
|
| 838 | - $role = get_role( 'administrator' ); |
|
| 839 | - if ( ! empty( $role ) ) { |
|
| 840 | - $role->add_cap( 'delete_users' ); |
|
| 841 | - $role->add_cap( 'create_users' ); |
|
| 842 | - } |
|
| 843 | - |
|
| 844 | - $role = get_role( 'author' ); |
|
| 845 | - if ( ! empty( $role ) ) { |
|
| 846 | - $role->add_cap( 'delete_posts' ); |
|
| 847 | - $role->add_cap( 'delete_published_posts' ); |
|
| 848 | - } |
|
| 849 | - |
|
| 850 | - $role = get_role( 'contributor' ); |
|
| 851 | - if ( ! empty( $role ) ) { |
|
| 852 | - $role->add_cap( 'delete_posts' ); |
|
| 853 | - } |
|
| 814 | + $roles = array( 'administrator', 'editor' ); |
|
| 815 | + foreach ( $roles as $role ) { |
|
| 816 | + $role = get_role( $role ); |
|
| 817 | + if ( empty( $role ) ) { |
|
| 818 | + continue; |
|
| 819 | + } |
|
| 820 | + |
|
| 821 | + $role->add_cap( 'edit_others_pages' ); |
|
| 822 | + $role->add_cap( 'edit_published_pages' ); |
|
| 823 | + $role->add_cap( 'publish_pages' ); |
|
| 824 | + $role->add_cap( 'delete_pages' ); |
|
| 825 | + $role->add_cap( 'delete_others_pages' ); |
|
| 826 | + $role->add_cap( 'delete_published_pages' ); |
|
| 827 | + $role->add_cap( 'delete_posts' ); |
|
| 828 | + $role->add_cap( 'delete_others_posts' ); |
|
| 829 | + $role->add_cap( 'delete_published_posts' ); |
|
| 830 | + $role->add_cap( 'delete_private_posts' ); |
|
| 831 | + $role->add_cap( 'edit_private_posts' ); |
|
| 832 | + $role->add_cap( 'read_private_posts' ); |
|
| 833 | + $role->add_cap( 'delete_private_pages' ); |
|
| 834 | + $role->add_cap( 'edit_private_pages' ); |
|
| 835 | + $role->add_cap( 'read_private_pages' ); |
|
| 836 | + } |
|
| 837 | + |
|
| 838 | + $role = get_role( 'administrator' ); |
|
| 839 | + if ( ! empty( $role ) ) { |
|
| 840 | + $role->add_cap( 'delete_users' ); |
|
| 841 | + $role->add_cap( 'create_users' ); |
|
| 842 | + } |
|
| 843 | + |
|
| 844 | + $role = get_role( 'author' ); |
|
| 845 | + if ( ! empty( $role ) ) { |
|
| 846 | + $role->add_cap( 'delete_posts' ); |
|
| 847 | + $role->add_cap( 'delete_published_posts' ); |
|
| 848 | + } |
|
| 849 | + |
|
| 850 | + $role = get_role( 'contributor' ); |
|
| 851 | + if ( ! empty( $role ) ) { |
|
| 852 | + $role->add_cap( 'delete_posts' ); |
|
| 853 | + } |
|
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | /** |
@@ -859,11 +859,11 @@ discard block |
||
| 859 | 859 | * @since 2.3.0 |
| 860 | 860 | */ |
| 861 | 861 | function populate_roles_230() { |
| 862 | - $role = get_role( 'administrator' ); |
|
| 862 | + $role = get_role( 'administrator' ); |
|
| 863 | 863 | |
| 864 | - if ( ! empty( $role ) ) { |
|
| 865 | - $role->add_cap( 'unfiltered_upload' ); |
|
| 866 | - } |
|
| 864 | + if ( ! empty( $role ) ) { |
|
| 865 | + $role->add_cap( 'unfiltered_upload' ); |
|
| 866 | + } |
|
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | /** |
@@ -872,11 +872,11 @@ discard block |
||
| 872 | 872 | * @since 2.5.0 |
| 873 | 873 | */ |
| 874 | 874 | function populate_roles_250() { |
| 875 | - $role = get_role( 'administrator' ); |
|
| 875 | + $role = get_role( 'administrator' ); |
|
| 876 | 876 | |
| 877 | - if ( ! empty( $role ) ) { |
|
| 878 | - $role->add_cap( 'edit_dashboard' ); |
|
| 879 | - } |
|
| 877 | + if ( ! empty( $role ) ) { |
|
| 878 | + $role->add_cap( 'edit_dashboard' ); |
|
| 879 | + } |
|
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | /** |
@@ -885,12 +885,12 @@ discard block |
||
| 885 | 885 | * @since 2.6.0 |
| 886 | 886 | */ |
| 887 | 887 | function populate_roles_260() { |
| 888 | - $role = get_role( 'administrator' ); |
|
| 888 | + $role = get_role( 'administrator' ); |
|
| 889 | 889 | |
| 890 | - if ( ! empty( $role ) ) { |
|
| 891 | - $role->add_cap( 'update_plugins' ); |
|
| 892 | - $role->add_cap( 'delete_plugins' ); |
|
| 893 | - } |
|
| 890 | + if ( ! empty( $role ) ) { |
|
| 891 | + $role->add_cap( 'update_plugins' ); |
|
| 892 | + $role->add_cap( 'delete_plugins' ); |
|
| 893 | + } |
|
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | /** |
@@ -899,12 +899,12 @@ discard block |
||
| 899 | 899 | * @since 2.7.0 |
| 900 | 900 | */ |
| 901 | 901 | function populate_roles_270() { |
| 902 | - $role = get_role( 'administrator' ); |
|
| 902 | + $role = get_role( 'administrator' ); |
|
| 903 | 903 | |
| 904 | - if ( ! empty( $role ) ) { |
|
| 905 | - $role->add_cap( 'install_plugins' ); |
|
| 906 | - $role->add_cap( 'update_themes' ); |
|
| 907 | - } |
|
| 904 | + if ( ! empty( $role ) ) { |
|
| 905 | + $role->add_cap( 'install_plugins' ); |
|
| 906 | + $role->add_cap( 'update_themes' ); |
|
| 907 | + } |
|
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | /** |
@@ -913,11 +913,11 @@ discard block |
||
| 913 | 913 | * @since 2.8.0 |
| 914 | 914 | */ |
| 915 | 915 | function populate_roles_280() { |
| 916 | - $role = get_role( 'administrator' ); |
|
| 916 | + $role = get_role( 'administrator' ); |
|
| 917 | 917 | |
| 918 | - if ( ! empty( $role ) ) { |
|
| 919 | - $role->add_cap( 'install_themes' ); |
|
| 920 | - } |
|
| 918 | + if ( ! empty( $role ) ) { |
|
| 919 | + $role->add_cap( 'install_themes' ); |
|
| 920 | + } |
|
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | /** |
@@ -926,32 +926,32 @@ discard block |
||
| 926 | 926 | * @since 3.0.0 |
| 927 | 927 | */ |
| 928 | 928 | function populate_roles_300() { |
| 929 | - $role = get_role( 'administrator' ); |
|
| 930 | - |
|
| 931 | - if ( ! empty( $role ) ) { |
|
| 932 | - $role->add_cap( 'update_core' ); |
|
| 933 | - $role->add_cap( 'list_users' ); |
|
| 934 | - $role->add_cap( 'remove_users' ); |
|
| 935 | - $role->add_cap( 'promote_users' ); |
|
| 936 | - $role->add_cap( 'edit_theme_options' ); |
|
| 937 | - $role->add_cap( 'delete_themes' ); |
|
| 938 | - $role->add_cap( 'export' ); |
|
| 939 | - } |
|
| 929 | + $role = get_role( 'administrator' ); |
|
| 930 | + |
|
| 931 | + if ( ! empty( $role ) ) { |
|
| 932 | + $role->add_cap( 'update_core' ); |
|
| 933 | + $role->add_cap( 'list_users' ); |
|
| 934 | + $role->add_cap( 'remove_users' ); |
|
| 935 | + $role->add_cap( 'promote_users' ); |
|
| 936 | + $role->add_cap( 'edit_theme_options' ); |
|
| 937 | + $role->add_cap( 'delete_themes' ); |
|
| 938 | + $role->add_cap( 'export' ); |
|
| 939 | + } |
|
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | if ( ! function_exists( 'install_network' ) ) : |
| 943 | - /** |
|
| 944 | - * Install Network. |
|
| 945 | - * |
|
| 946 | - * @since 3.0.0 |
|
| 947 | - */ |
|
| 948 | - function install_network() { |
|
| 949 | - if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) { |
|
| 950 | - define( 'WP_INSTALLING_NETWORK', true ); |
|
| 951 | - } |
|
| 952 | - |
|
| 953 | - dbDelta( wp_get_db_schema( 'global' ) ); |
|
| 954 | - } |
|
| 943 | + /** |
|
| 944 | + * Install Network. |
|
| 945 | + * |
|
| 946 | + * @since 3.0.0 |
|
| 947 | + */ |
|
| 948 | + function install_network() { |
|
| 949 | + if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) { |
|
| 950 | + define( 'WP_INSTALLING_NETWORK', true ); |
|
| 951 | + } |
|
| 952 | + |
|
| 953 | + dbDelta( wp_get_db_schema( 'global' ) ); |
|
| 954 | + } |
|
| 955 | 955 | endif; |
| 956 | 956 | |
| 957 | 957 | /** |
@@ -974,148 +974,148 @@ discard block |
||
| 974 | 974 | * so the error code must be checked) or failure. |
| 975 | 975 | */ |
| 976 | 976 | function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { |
| 977 | - global $wpdb, $current_site, $wp_rewrite; |
|
| 978 | - |
|
| 979 | - $errors = new WP_Error(); |
|
| 980 | - if ( '' === $domain ) { |
|
| 981 | - $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); |
|
| 982 | - } |
|
| 983 | - if ( '' === $site_name ) { |
|
| 984 | - $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); |
|
| 985 | - } |
|
| 986 | - |
|
| 987 | - // Check for network collision. |
|
| 988 | - $network_exists = false; |
|
| 989 | - if ( is_multisite() ) { |
|
| 990 | - if ( get_network( (int) $network_id ) ) { |
|
| 991 | - $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
| 992 | - } |
|
| 993 | - } else { |
|
| 994 | - if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) { |
|
| 995 | - $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
| 996 | - } |
|
| 997 | - } |
|
| 998 | - |
|
| 999 | - if ( ! is_email( $email ) ) { |
|
| 1000 | - $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) ); |
|
| 1001 | - } |
|
| 1002 | - |
|
| 1003 | - if ( $errors->has_errors() ) { |
|
| 1004 | - return $errors; |
|
| 1005 | - } |
|
| 1006 | - |
|
| 1007 | - if ( 1 == $network_id ) { |
|
| 1008 | - $wpdb->insert( |
|
| 1009 | - $wpdb->site, |
|
| 1010 | - array( |
|
| 1011 | - 'domain' => $domain, |
|
| 1012 | - 'path' => $path, |
|
| 1013 | - ) |
|
| 1014 | - ); |
|
| 1015 | - $network_id = $wpdb->insert_id; |
|
| 1016 | - } else { |
|
| 1017 | - $wpdb->insert( |
|
| 1018 | - $wpdb->site, |
|
| 1019 | - array( |
|
| 1020 | - 'domain' => $domain, |
|
| 1021 | - 'path' => $path, |
|
| 1022 | - 'id' => $network_id, |
|
| 1023 | - ) |
|
| 1024 | - ); |
|
| 1025 | - } |
|
| 1026 | - |
|
| 1027 | - populate_network_meta( |
|
| 1028 | - $network_id, |
|
| 1029 | - array( |
|
| 1030 | - 'admin_email' => $email, |
|
| 1031 | - 'site_name' => $site_name, |
|
| 1032 | - 'subdomain_install' => $subdomain_install, |
|
| 1033 | - ) |
|
| 1034 | - ); |
|
| 1035 | - |
|
| 1036 | - $site_user = get_userdata( (int) $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", 'admin_user_id', $network_id ) ) ); |
|
| 1037 | - |
|
| 1038 | - /* |
|
| 977 | + global $wpdb, $current_site, $wp_rewrite; |
|
| 978 | + |
|
| 979 | + $errors = new WP_Error(); |
|
| 980 | + if ( '' === $domain ) { |
|
| 981 | + $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); |
|
| 982 | + } |
|
| 983 | + if ( '' === $site_name ) { |
|
| 984 | + $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); |
|
| 985 | + } |
|
| 986 | + |
|
| 987 | + // Check for network collision. |
|
| 988 | + $network_exists = false; |
|
| 989 | + if ( is_multisite() ) { |
|
| 990 | + if ( get_network( (int) $network_id ) ) { |
|
| 991 | + $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
| 992 | + } |
|
| 993 | + } else { |
|
| 994 | + if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) { |
|
| 995 | + $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
| 996 | + } |
|
| 997 | + } |
|
| 998 | + |
|
| 999 | + if ( ! is_email( $email ) ) { |
|
| 1000 | + $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) ); |
|
| 1001 | + } |
|
| 1002 | + |
|
| 1003 | + if ( $errors->has_errors() ) { |
|
| 1004 | + return $errors; |
|
| 1005 | + } |
|
| 1006 | + |
|
| 1007 | + if ( 1 == $network_id ) { |
|
| 1008 | + $wpdb->insert( |
|
| 1009 | + $wpdb->site, |
|
| 1010 | + array( |
|
| 1011 | + 'domain' => $domain, |
|
| 1012 | + 'path' => $path, |
|
| 1013 | + ) |
|
| 1014 | + ); |
|
| 1015 | + $network_id = $wpdb->insert_id; |
|
| 1016 | + } else { |
|
| 1017 | + $wpdb->insert( |
|
| 1018 | + $wpdb->site, |
|
| 1019 | + array( |
|
| 1020 | + 'domain' => $domain, |
|
| 1021 | + 'path' => $path, |
|
| 1022 | + 'id' => $network_id, |
|
| 1023 | + ) |
|
| 1024 | + ); |
|
| 1025 | + } |
|
| 1026 | + |
|
| 1027 | + populate_network_meta( |
|
| 1028 | + $network_id, |
|
| 1029 | + array( |
|
| 1030 | + 'admin_email' => $email, |
|
| 1031 | + 'site_name' => $site_name, |
|
| 1032 | + 'subdomain_install' => $subdomain_install, |
|
| 1033 | + ) |
|
| 1034 | + ); |
|
| 1035 | + |
|
| 1036 | + $site_user = get_userdata( (int) $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", 'admin_user_id', $network_id ) ) ); |
|
| 1037 | + |
|
| 1038 | + /* |
|
| 1039 | 1039 | * When upgrading from single to multisite, assume the current site will |
| 1040 | 1040 | * become the main site of the network. When using populate_network() |
| 1041 | 1041 | * to create another network in an existing multisite environment, skip |
| 1042 | 1042 | * these steps since the main site of the new network has not yet been |
| 1043 | 1043 | * created. |
| 1044 | 1044 | */ |
| 1045 | - if ( ! is_multisite() ) { |
|
| 1046 | - $current_site = new stdClass; |
|
| 1047 | - $current_site->domain = $domain; |
|
| 1048 | - $current_site->path = $path; |
|
| 1049 | - $current_site->site_name = ucfirst( $domain ); |
|
| 1050 | - $wpdb->insert( |
|
| 1051 | - $wpdb->blogs, |
|
| 1052 | - array( |
|
| 1053 | - 'site_id' => $network_id, |
|
| 1054 | - 'blog_id' => 1, |
|
| 1055 | - 'domain' => $domain, |
|
| 1056 | - 'path' => $path, |
|
| 1057 | - 'registered' => current_time( 'mysql' ), |
|
| 1058 | - ) |
|
| 1059 | - ); |
|
| 1060 | - $current_site->blog_id = $wpdb->insert_id; |
|
| 1061 | - update_user_meta( $site_user->ID, 'source_domain', $domain ); |
|
| 1062 | - update_user_meta( $site_user->ID, 'primary_blog', $current_site->blog_id ); |
|
| 1063 | - |
|
| 1064 | - if ( $subdomain_install ) { |
|
| 1065 | - $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); |
|
| 1066 | - } else { |
|
| 1067 | - $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); |
|
| 1068 | - } |
|
| 1069 | - |
|
| 1070 | - flush_rewrite_rules(); |
|
| 1071 | - |
|
| 1072 | - if ( ! $subdomain_install ) { |
|
| 1073 | - return true; |
|
| 1074 | - } |
|
| 1075 | - |
|
| 1076 | - $vhost_ok = false; |
|
| 1077 | - $errstr = ''; |
|
| 1078 | - $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! |
|
| 1079 | - $page = wp_remote_get( |
|
| 1080 | - 'http://' . $hostname, |
|
| 1081 | - array( |
|
| 1082 | - 'timeout' => 5, |
|
| 1083 | - 'httpversion' => '1.1', |
|
| 1084 | - ) |
|
| 1085 | - ); |
|
| 1086 | - if ( is_wp_error( $page ) ) { |
|
| 1087 | - $errstr = $page->get_error_message(); |
|
| 1088 | - } elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) { |
|
| 1089 | - $vhost_ok = true; |
|
| 1090 | - } |
|
| 1091 | - |
|
| 1092 | - if ( ! $vhost_ok ) { |
|
| 1093 | - $msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>'; |
|
| 1094 | - |
|
| 1095 | - $msg .= '<p>' . sprintf( |
|
| 1096 | - /* translators: %s: Host name. */ |
|
| 1097 | - __( 'The installer attempted to contact a random hostname (%s) on your domain.' ), |
|
| 1098 | - '<code>' . $hostname . '</code>' |
|
| 1099 | - ); |
|
| 1100 | - if ( ! empty( $errstr ) ) { |
|
| 1101 | - /* translators: %s: Error message. */ |
|
| 1102 | - $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' ); |
|
| 1103 | - } |
|
| 1104 | - $msg .= '</p>'; |
|
| 1105 | - |
|
| 1106 | - $msg .= '<p>' . sprintf( |
|
| 1107 | - /* translators: %s: Asterisk symbol (*). */ |
|
| 1108 | - __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.' ), |
|
| 1109 | - '<code>*</code>' |
|
| 1110 | - ) . '</p>'; |
|
| 1111 | - |
|
| 1112 | - $msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>'; |
|
| 1113 | - |
|
| 1114 | - return new WP_Error( 'no_wildcard_dns', $msg ); |
|
| 1115 | - } |
|
| 1116 | - } |
|
| 1117 | - |
|
| 1118 | - return true; |
|
| 1045 | + if ( ! is_multisite() ) { |
|
| 1046 | + $current_site = new stdClass; |
|
| 1047 | + $current_site->domain = $domain; |
|
| 1048 | + $current_site->path = $path; |
|
| 1049 | + $current_site->site_name = ucfirst( $domain ); |
|
| 1050 | + $wpdb->insert( |
|
| 1051 | + $wpdb->blogs, |
|
| 1052 | + array( |
|
| 1053 | + 'site_id' => $network_id, |
|
| 1054 | + 'blog_id' => 1, |
|
| 1055 | + 'domain' => $domain, |
|
| 1056 | + 'path' => $path, |
|
| 1057 | + 'registered' => current_time( 'mysql' ), |
|
| 1058 | + ) |
|
| 1059 | + ); |
|
| 1060 | + $current_site->blog_id = $wpdb->insert_id; |
|
| 1061 | + update_user_meta( $site_user->ID, 'source_domain', $domain ); |
|
| 1062 | + update_user_meta( $site_user->ID, 'primary_blog', $current_site->blog_id ); |
|
| 1063 | + |
|
| 1064 | + if ( $subdomain_install ) { |
|
| 1065 | + $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); |
|
| 1066 | + } else { |
|
| 1067 | + $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); |
|
| 1068 | + } |
|
| 1069 | + |
|
| 1070 | + flush_rewrite_rules(); |
|
| 1071 | + |
|
| 1072 | + if ( ! $subdomain_install ) { |
|
| 1073 | + return true; |
|
| 1074 | + } |
|
| 1075 | + |
|
| 1076 | + $vhost_ok = false; |
|
| 1077 | + $errstr = ''; |
|
| 1078 | + $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! |
|
| 1079 | + $page = wp_remote_get( |
|
| 1080 | + 'http://' . $hostname, |
|
| 1081 | + array( |
|
| 1082 | + 'timeout' => 5, |
|
| 1083 | + 'httpversion' => '1.1', |
|
| 1084 | + ) |
|
| 1085 | + ); |
|
| 1086 | + if ( is_wp_error( $page ) ) { |
|
| 1087 | + $errstr = $page->get_error_message(); |
|
| 1088 | + } elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) { |
|
| 1089 | + $vhost_ok = true; |
|
| 1090 | + } |
|
| 1091 | + |
|
| 1092 | + if ( ! $vhost_ok ) { |
|
| 1093 | + $msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>'; |
|
| 1094 | + |
|
| 1095 | + $msg .= '<p>' . sprintf( |
|
| 1096 | + /* translators: %s: Host name. */ |
|
| 1097 | + __( 'The installer attempted to contact a random hostname (%s) on your domain.' ), |
|
| 1098 | + '<code>' . $hostname . '</code>' |
|
| 1099 | + ); |
|
| 1100 | + if ( ! empty( $errstr ) ) { |
|
| 1101 | + /* translators: %s: Error message. */ |
|
| 1102 | + $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' ); |
|
| 1103 | + } |
|
| 1104 | + $msg .= '</p>'; |
|
| 1105 | + |
|
| 1106 | + $msg .= '<p>' . sprintf( |
|
| 1107 | + /* translators: %s: Asterisk symbol (*). */ |
|
| 1108 | + __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.' ), |
|
| 1109 | + '<code>*</code>' |
|
| 1110 | + ) . '</p>'; |
|
| 1111 | + |
|
| 1112 | + $msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>'; |
|
| 1113 | + |
|
| 1114 | + return new WP_Error( 'no_wildcard_dns', $msg ); |
|
| 1115 | + } |
|
| 1116 | + } |
|
| 1117 | + |
|
| 1118 | + return true; |
|
| 1119 | 1119 | } |
| 1120 | 1120 | |
| 1121 | 1121 | /** |
@@ -1130,71 +1130,71 @@ discard block |
||
| 1130 | 1130 | * @param array $meta Optional. Custom meta $key => $value pairs to use. Default empty array. |
| 1131 | 1131 | */ |
| 1132 | 1132 | function populate_network_meta( $network_id, array $meta = array() ) { |
| 1133 | - global $wpdb, $wp_db_version; |
|
| 1134 | - |
|
| 1135 | - $network_id = (int) $network_id; |
|
| 1136 | - |
|
| 1137 | - $email = ! empty( $meta['admin_email'] ) ? $meta['admin_email'] : ''; |
|
| 1138 | - $subdomain_install = isset( $meta['subdomain_install'] ) ? (int) $meta['subdomain_install'] : 0; |
|
| 1139 | - |
|
| 1140 | - // If a user with the provided email does not exist, default to the current user as the new network admin. |
|
| 1141 | - $site_user = ! empty( $email ) ? get_user_by( 'email', $email ) : false; |
|
| 1142 | - if ( false === $site_user ) { |
|
| 1143 | - $site_user = wp_get_current_user(); |
|
| 1144 | - } |
|
| 1145 | - |
|
| 1146 | - if ( empty( $email ) ) { |
|
| 1147 | - $email = $site_user->user_email; |
|
| 1148 | - } |
|
| 1149 | - |
|
| 1150 | - $template = get_option( 'template' ); |
|
| 1151 | - $stylesheet = get_option( 'stylesheet' ); |
|
| 1152 | - $allowed_themes = array( $stylesheet => true ); |
|
| 1153 | - |
|
| 1154 | - if ( $template != $stylesheet ) { |
|
| 1155 | - $allowed_themes[ $template ] = true; |
|
| 1156 | - } |
|
| 1157 | - |
|
| 1158 | - if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) { |
|
| 1159 | - $allowed_themes[ WP_DEFAULT_THEME ] = true; |
|
| 1160 | - } |
|
| 1161 | - |
|
| 1162 | - // If WP_DEFAULT_THEME doesn't exist, also include the latest core default theme. |
|
| 1163 | - if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) { |
|
| 1164 | - $core_default = WP_Theme::get_core_default_theme(); |
|
| 1165 | - if ( $core_default ) { |
|
| 1166 | - $allowed_themes[ $core_default->get_stylesheet() ] = true; |
|
| 1167 | - } |
|
| 1168 | - } |
|
| 1169 | - |
|
| 1170 | - if ( function_exists( 'clean_network_cache' ) ) { |
|
| 1171 | - clean_network_cache( $network_id ); |
|
| 1172 | - } else { |
|
| 1173 | - wp_cache_delete( $network_id, 'networks' ); |
|
| 1174 | - } |
|
| 1175 | - |
|
| 1176 | - if ( ! is_multisite() ) { |
|
| 1177 | - $site_admins = array( $site_user->user_login ); |
|
| 1178 | - $users = get_users( |
|
| 1179 | - array( |
|
| 1180 | - 'fields' => array( 'user_login' ), |
|
| 1181 | - 'role' => 'administrator', |
|
| 1182 | - ) |
|
| 1183 | - ); |
|
| 1184 | - if ( $users ) { |
|
| 1185 | - foreach ( $users as $user ) { |
|
| 1186 | - $site_admins[] = $user->user_login; |
|
| 1187 | - } |
|
| 1188 | - |
|
| 1189 | - $site_admins = array_unique( $site_admins ); |
|
| 1190 | - } |
|
| 1191 | - } else { |
|
| 1192 | - $site_admins = get_site_option( 'site_admins' ); |
|
| 1193 | - } |
|
| 1194 | - |
|
| 1195 | - /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */ |
|
| 1196 | - $welcome_email = __( |
|
| 1197 | - 'Howdy USERNAME, |
|
| 1133 | + global $wpdb, $wp_db_version; |
|
| 1134 | + |
|
| 1135 | + $network_id = (int) $network_id; |
|
| 1136 | + |
|
| 1137 | + $email = ! empty( $meta['admin_email'] ) ? $meta['admin_email'] : ''; |
|
| 1138 | + $subdomain_install = isset( $meta['subdomain_install'] ) ? (int) $meta['subdomain_install'] : 0; |
|
| 1139 | + |
|
| 1140 | + // If a user with the provided email does not exist, default to the current user as the new network admin. |
|
| 1141 | + $site_user = ! empty( $email ) ? get_user_by( 'email', $email ) : false; |
|
| 1142 | + if ( false === $site_user ) { |
|
| 1143 | + $site_user = wp_get_current_user(); |
|
| 1144 | + } |
|
| 1145 | + |
|
| 1146 | + if ( empty( $email ) ) { |
|
| 1147 | + $email = $site_user->user_email; |
|
| 1148 | + } |
|
| 1149 | + |
|
| 1150 | + $template = get_option( 'template' ); |
|
| 1151 | + $stylesheet = get_option( 'stylesheet' ); |
|
| 1152 | + $allowed_themes = array( $stylesheet => true ); |
|
| 1153 | + |
|
| 1154 | + if ( $template != $stylesheet ) { |
|
| 1155 | + $allowed_themes[ $template ] = true; |
|
| 1156 | + } |
|
| 1157 | + |
|
| 1158 | + if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) { |
|
| 1159 | + $allowed_themes[ WP_DEFAULT_THEME ] = true; |
|
| 1160 | + } |
|
| 1161 | + |
|
| 1162 | + // If WP_DEFAULT_THEME doesn't exist, also include the latest core default theme. |
|
| 1163 | + if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) { |
|
| 1164 | + $core_default = WP_Theme::get_core_default_theme(); |
|
| 1165 | + if ( $core_default ) { |
|
| 1166 | + $allowed_themes[ $core_default->get_stylesheet() ] = true; |
|
| 1167 | + } |
|
| 1168 | + } |
|
| 1169 | + |
|
| 1170 | + if ( function_exists( 'clean_network_cache' ) ) { |
|
| 1171 | + clean_network_cache( $network_id ); |
|
| 1172 | + } else { |
|
| 1173 | + wp_cache_delete( $network_id, 'networks' ); |
|
| 1174 | + } |
|
| 1175 | + |
|
| 1176 | + if ( ! is_multisite() ) { |
|
| 1177 | + $site_admins = array( $site_user->user_login ); |
|
| 1178 | + $users = get_users( |
|
| 1179 | + array( |
|
| 1180 | + 'fields' => array( 'user_login' ), |
|
| 1181 | + 'role' => 'administrator', |
|
| 1182 | + ) |
|
| 1183 | + ); |
|
| 1184 | + if ( $users ) { |
|
| 1185 | + foreach ( $users as $user ) { |
|
| 1186 | + $site_admins[] = $user->user_login; |
|
| 1187 | + } |
|
| 1188 | + |
|
| 1189 | + $site_admins = array_unique( $site_admins ); |
|
| 1190 | + } |
|
| 1191 | + } else { |
|
| 1192 | + $site_admins = get_site_option( 'site_admins' ); |
|
| 1193 | + } |
|
| 1194 | + |
|
| 1195 | + /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */ |
|
| 1196 | + $welcome_email = __( |
|
| 1197 | + 'Howdy USERNAME, |
|
| 1198 | 1198 | |
| 1199 | 1199 | Your new SITE_NAME site has been successfully set up at: |
| 1200 | 1200 | BLOG_URL |
@@ -1208,95 +1208,95 @@ discard block |
||
| 1208 | 1208 | We hope you enjoy your new site. Thanks! |
| 1209 | 1209 | |
| 1210 | 1210 | --The Team @ SITE_NAME' |
| 1211 | - ); |
|
| 1212 | - |
|
| 1213 | - $misc_exts = array( |
|
| 1214 | - // Images. |
|
| 1215 | - 'jpg', |
|
| 1216 | - 'jpeg', |
|
| 1217 | - 'png', |
|
| 1218 | - 'gif', |
|
| 1219 | - 'webp', |
|
| 1220 | - // Video. |
|
| 1221 | - 'mov', |
|
| 1222 | - 'avi', |
|
| 1223 | - 'mpg', |
|
| 1224 | - '3gp', |
|
| 1225 | - '3g2', |
|
| 1226 | - // "audio". |
|
| 1227 | - 'midi', |
|
| 1228 | - 'mid', |
|
| 1229 | - // Miscellaneous. |
|
| 1230 | - 'pdf', |
|
| 1231 | - 'doc', |
|
| 1232 | - 'ppt', |
|
| 1233 | - 'odt', |
|
| 1234 | - 'pptx', |
|
| 1235 | - 'docx', |
|
| 1236 | - 'pps', |
|
| 1237 | - 'ppsx', |
|
| 1238 | - 'xls', |
|
| 1239 | - 'xlsx', |
|
| 1240 | - 'key', |
|
| 1241 | - ); |
|
| 1242 | - $audio_exts = wp_get_audio_extensions(); |
|
| 1243 | - $video_exts = wp_get_video_extensions(); |
|
| 1244 | - $upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) ); |
|
| 1245 | - |
|
| 1246 | - $sitemeta = array( |
|
| 1247 | - 'site_name' => __( 'My Network' ), |
|
| 1248 | - 'admin_email' => $email, |
|
| 1249 | - 'admin_user_id' => $site_user->ID, |
|
| 1250 | - 'registration' => 'none', |
|
| 1251 | - 'upload_filetypes' => implode( ' ', $upload_filetypes ), |
|
| 1252 | - 'blog_upload_space' => 100, |
|
| 1253 | - 'fileupload_maxk' => 1500, |
|
| 1254 | - 'site_admins' => $site_admins, |
|
| 1255 | - 'allowedthemes' => $allowed_themes, |
|
| 1256 | - 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ), |
|
| 1257 | - 'wpmu_upgrade_site' => $wp_db_version, |
|
| 1258 | - 'welcome_email' => $welcome_email, |
|
| 1259 | - /* translators: %s: Site link. */ |
|
| 1260 | - 'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ), |
|
| 1261 | - // @todo - Network admins should have a method of editing the network siteurl (used for cookie hash). |
|
| 1262 | - 'siteurl' => get_option( 'siteurl' ) . '/', |
|
| 1263 | - 'add_new_users' => '0', |
|
| 1264 | - 'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1', |
|
| 1265 | - 'subdomain_install' => $subdomain_install, |
|
| 1266 | - 'global_terms_enabled' => global_terms_enabled() ? '1' : '0', |
|
| 1267 | - 'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0', |
|
| 1268 | - 'user_count' => get_site_option( 'user_count' ), |
|
| 1269 | - 'initial_db_version' => get_option( 'initial_db_version' ), |
|
| 1270 | - 'active_sitewide_plugins' => array(), |
|
| 1271 | - 'WPLANG' => get_locale(), |
|
| 1272 | - ); |
|
| 1273 | - if ( ! $subdomain_install ) { |
|
| 1274 | - $sitemeta['illegal_names'][] = 'blog'; |
|
| 1275 | - } |
|
| 1276 | - |
|
| 1277 | - $sitemeta = wp_parse_args( $meta, $sitemeta ); |
|
| 1278 | - |
|
| 1279 | - /** |
|
| 1280 | - * Filters meta for a network on creation. |
|
| 1281 | - * |
|
| 1282 | - * @since 3.7.0 |
|
| 1283 | - * |
|
| 1284 | - * @param array $sitemeta Associative array of network meta keys and values to be inserted. |
|
| 1285 | - * @param int $network_id ID of network to populate. |
|
| 1286 | - */ |
|
| 1287 | - $sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id ); |
|
| 1288 | - |
|
| 1289 | - $insert = ''; |
|
| 1290 | - foreach ( $sitemeta as $meta_key => $meta_value ) { |
|
| 1291 | - if ( is_array( $meta_value ) ) { |
|
| 1292 | - $meta_value = serialize( $meta_value ); |
|
| 1293 | - } |
|
| 1294 | - if ( ! empty( $insert ) ) { |
|
| 1295 | - $insert .= ', '; |
|
| 1296 | - } |
|
| 1297 | - $insert .= $wpdb->prepare( '( %d, %s, %s)', $network_id, $meta_key, $meta_value ); |
|
| 1298 | - } |
|
| 1299 | - $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 1211 | + ); |
|
| 1212 | + |
|
| 1213 | + $misc_exts = array( |
|
| 1214 | + // Images. |
|
| 1215 | + 'jpg', |
|
| 1216 | + 'jpeg', |
|
| 1217 | + 'png', |
|
| 1218 | + 'gif', |
|
| 1219 | + 'webp', |
|
| 1220 | + // Video. |
|
| 1221 | + 'mov', |
|
| 1222 | + 'avi', |
|
| 1223 | + 'mpg', |
|
| 1224 | + '3gp', |
|
| 1225 | + '3g2', |
|
| 1226 | + // "audio". |
|
| 1227 | + 'midi', |
|
| 1228 | + 'mid', |
|
| 1229 | + // Miscellaneous. |
|
| 1230 | + 'pdf', |
|
| 1231 | + 'doc', |
|
| 1232 | + 'ppt', |
|
| 1233 | + 'odt', |
|
| 1234 | + 'pptx', |
|
| 1235 | + 'docx', |
|
| 1236 | + 'pps', |
|
| 1237 | + 'ppsx', |
|
| 1238 | + 'xls', |
|
| 1239 | + 'xlsx', |
|
| 1240 | + 'key', |
|
| 1241 | + ); |
|
| 1242 | + $audio_exts = wp_get_audio_extensions(); |
|
| 1243 | + $video_exts = wp_get_video_extensions(); |
|
| 1244 | + $upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) ); |
|
| 1245 | + |
|
| 1246 | + $sitemeta = array( |
|
| 1247 | + 'site_name' => __( 'My Network' ), |
|
| 1248 | + 'admin_email' => $email, |
|
| 1249 | + 'admin_user_id' => $site_user->ID, |
|
| 1250 | + 'registration' => 'none', |
|
| 1251 | + 'upload_filetypes' => implode( ' ', $upload_filetypes ), |
|
| 1252 | + 'blog_upload_space' => 100, |
|
| 1253 | + 'fileupload_maxk' => 1500, |
|
| 1254 | + 'site_admins' => $site_admins, |
|
| 1255 | + 'allowedthemes' => $allowed_themes, |
|
| 1256 | + 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ), |
|
| 1257 | + 'wpmu_upgrade_site' => $wp_db_version, |
|
| 1258 | + 'welcome_email' => $welcome_email, |
|
| 1259 | + /* translators: %s: Site link. */ |
|
| 1260 | + 'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ), |
|
| 1261 | + // @todo - Network admins should have a method of editing the network siteurl (used for cookie hash). |
|
| 1262 | + 'siteurl' => get_option( 'siteurl' ) . '/', |
|
| 1263 | + 'add_new_users' => '0', |
|
| 1264 | + 'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1', |
|
| 1265 | + 'subdomain_install' => $subdomain_install, |
|
| 1266 | + 'global_terms_enabled' => global_terms_enabled() ? '1' : '0', |
|
| 1267 | + 'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0', |
|
| 1268 | + 'user_count' => get_site_option( 'user_count' ), |
|
| 1269 | + 'initial_db_version' => get_option( 'initial_db_version' ), |
|
| 1270 | + 'active_sitewide_plugins' => array(), |
|
| 1271 | + 'WPLANG' => get_locale(), |
|
| 1272 | + ); |
|
| 1273 | + if ( ! $subdomain_install ) { |
|
| 1274 | + $sitemeta['illegal_names'][] = 'blog'; |
|
| 1275 | + } |
|
| 1276 | + |
|
| 1277 | + $sitemeta = wp_parse_args( $meta, $sitemeta ); |
|
| 1278 | + |
|
| 1279 | + /** |
|
| 1280 | + * Filters meta for a network on creation. |
|
| 1281 | + * |
|
| 1282 | + * @since 3.7.0 |
|
| 1283 | + * |
|
| 1284 | + * @param array $sitemeta Associative array of network meta keys and values to be inserted. |
|
| 1285 | + * @param int $network_id ID of network to populate. |
|
| 1286 | + */ |
|
| 1287 | + $sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id ); |
|
| 1288 | + |
|
| 1289 | + $insert = ''; |
|
| 1290 | + foreach ( $sitemeta as $meta_key => $meta_value ) { |
|
| 1291 | + if ( is_array( $meta_value ) ) { |
|
| 1292 | + $meta_value = serialize( $meta_value ); |
|
| 1293 | + } |
|
| 1294 | + if ( ! empty( $insert ) ) { |
|
| 1295 | + $insert .= ', '; |
|
| 1296 | + } |
|
| 1297 | + $insert .= $wpdb->prepare( '( %d, %s, %s)', $network_id, $meta_key, $meta_value ); |
|
| 1298 | + } |
|
| 1299 | + $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | 1302 | /** |
@@ -1310,41 +1310,41 @@ discard block |
||
| 1310 | 1310 | * @param array $meta Optional. Custom meta $key => $value pairs to use. Default empty array. |
| 1311 | 1311 | */ |
| 1312 | 1312 | function populate_site_meta( $site_id, array $meta = array() ) { |
| 1313 | - global $wpdb; |
|
| 1314 | - |
|
| 1315 | - $site_id = (int) $site_id; |
|
| 1316 | - |
|
| 1317 | - if ( ! is_site_meta_supported() ) { |
|
| 1318 | - return; |
|
| 1319 | - } |
|
| 1320 | - |
|
| 1321 | - if ( empty( $meta ) ) { |
|
| 1322 | - return; |
|
| 1323 | - } |
|
| 1324 | - |
|
| 1325 | - /** |
|
| 1326 | - * Filters meta for a site on creation. |
|
| 1327 | - * |
|
| 1328 | - * @since 5.2.0 |
|
| 1329 | - * |
|
| 1330 | - * @param array $meta Associative array of site meta keys and values to be inserted. |
|
| 1331 | - * @param int $site_id ID of site to populate. |
|
| 1332 | - */ |
|
| 1333 | - $site_meta = apply_filters( 'populate_site_meta', $meta, $site_id ); |
|
| 1334 | - |
|
| 1335 | - $insert = ''; |
|
| 1336 | - foreach ( $site_meta as $meta_key => $meta_value ) { |
|
| 1337 | - if ( is_array( $meta_value ) ) { |
|
| 1338 | - $meta_value = serialize( $meta_value ); |
|
| 1339 | - } |
|
| 1340 | - if ( ! empty( $insert ) ) { |
|
| 1341 | - $insert .= ', '; |
|
| 1342 | - } |
|
| 1343 | - $insert .= $wpdb->prepare( '( %d, %s, %s)', $site_id, $meta_key, $meta_value ); |
|
| 1344 | - } |
|
| 1345 | - |
|
| 1346 | - $wpdb->query( "INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 1347 | - |
|
| 1348 | - wp_cache_delete( $site_id, 'blog_meta' ); |
|
| 1349 | - wp_cache_set_sites_last_changed(); |
|
| 1313 | + global $wpdb; |
|
| 1314 | + |
|
| 1315 | + $site_id = (int) $site_id; |
|
| 1316 | + |
|
| 1317 | + if ( ! is_site_meta_supported() ) { |
|
| 1318 | + return; |
|
| 1319 | + } |
|
| 1320 | + |
|
| 1321 | + if ( empty( $meta ) ) { |
|
| 1322 | + return; |
|
| 1323 | + } |
|
| 1324 | + |
|
| 1325 | + /** |
|
| 1326 | + * Filters meta for a site on creation. |
|
| 1327 | + * |
|
| 1328 | + * @since 5.2.0 |
|
| 1329 | + * |
|
| 1330 | + * @param array $meta Associative array of site meta keys and values to be inserted. |
|
| 1331 | + * @param int $site_id ID of site to populate. |
|
| 1332 | + */ |
|
| 1333 | + $site_meta = apply_filters( 'populate_site_meta', $meta, $site_id ); |
|
| 1334 | + |
|
| 1335 | + $insert = ''; |
|
| 1336 | + foreach ( $site_meta as $meta_key => $meta_value ) { |
|
| 1337 | + if ( is_array( $meta_value ) ) { |
|
| 1338 | + $meta_value = serialize( $meta_value ); |
|
| 1339 | + } |
|
| 1340 | + if ( ! empty( $insert ) ) { |
|
| 1341 | + $insert .= ', '; |
|
| 1342 | + } |
|
| 1343 | + $insert .= $wpdb->prepare( '( %d, %s, %s)', $site_id, $meta_key, $meta_value ); |
|
| 1344 | + } |
|
| 1345 | + |
|
| 1346 | + $wpdb->query( "INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 1347 | + |
|
| 1348 | + wp_cache_delete( $site_id, 'blog_meta' ); |
|
| 1349 | + wp_cache_set_sites_last_changed(); |
|
| 1350 | 1350 | } |
@@ -33,17 +33,17 @@ discard block |
||
| 33 | 33 | * @param int $blog_id Optional. The site ID for which to retrieve SQL. Default is the current site ID. |
| 34 | 34 | * @return string The SQL needed to create the requested tables. |
| 35 | 35 | */ |
| 36 | -function wp_get_db_schema( $scope = 'all', $blog_id = null ) { |
|
| 36 | +function wp_get_db_schema($scope = 'all', $blog_id = null) { |
|
| 37 | 37 | global $wpdb; |
| 38 | 38 | |
| 39 | 39 | $charset_collate = $wpdb->get_charset_collate(); |
| 40 | 40 | |
| 41 | - if ( $blog_id && $blog_id != $wpdb->blogid ) { |
|
| 42 | - $old_blog_id = $wpdb->set_blog_id( $blog_id ); |
|
| 41 | + if ($blog_id && $blog_id != $wpdb->blogid) { |
|
| 42 | + $old_blog_id = $wpdb->set_blog_id($blog_id); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Engage multisite if in the middle of turning it on from network.php. |
| 46 | - $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); |
|
| 46 | + $is_multisite = is_multisite() || (defined('WP_INSTALLING_NETWORK') && WP_INSTALLING_NETWORK); |
|
| 47 | 47 | |
| 48 | 48 | /* |
| 49 | 49 | * Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that. |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | ) $charset_collate;\n"; |
| 238 | 238 | |
| 239 | 239 | // Global tables. |
| 240 | - if ( $is_multisite ) { |
|
| 240 | + if ($is_multisite) { |
|
| 241 | 241 | $global_tables = $users_multi_table . $usermeta_table; |
| 242 | 242 | } else { |
| 243 | 243 | $global_tables = $users_single_table . $usermeta_table; |
@@ -314,13 +314,13 @@ discard block |
||
| 314 | 314 | KEY domain_path (domain(140),path(51)) |
| 315 | 315 | ) $charset_collate;"; |
| 316 | 316 | |
| 317 | - switch ( $scope ) { |
|
| 317 | + switch ($scope) { |
|
| 318 | 318 | case 'blog': |
| 319 | 319 | $queries = $blog_tables; |
| 320 | 320 | break; |
| 321 | 321 | case 'global': |
| 322 | 322 | $queries = $global_tables; |
| 323 | - if ( $is_multisite ) { |
|
| 323 | + if ($is_multisite) { |
|
| 324 | 324 | $queries .= $ms_global_tables; |
| 325 | 325 | } |
| 326 | 326 | break; |
@@ -330,21 +330,21 @@ discard block |
||
| 330 | 330 | case 'all': |
| 331 | 331 | default: |
| 332 | 332 | $queries = $global_tables . $blog_tables; |
| 333 | - if ( $is_multisite ) { |
|
| 333 | + if ($is_multisite) { |
|
| 334 | 334 | $queries .= $ms_global_tables; |
| 335 | 335 | } |
| 336 | 336 | break; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - if ( isset( $old_blog_id ) ) { |
|
| 340 | - $wpdb->set_blog_id( $old_blog_id ); |
|
| 339 | + if (isset($old_blog_id)) { |
|
| 340 | + $wpdb->set_blog_id($old_blog_id); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | return $queries; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | // Populate for back compat. |
| 347 | -$wp_queries = wp_get_db_schema( 'all' ); |
|
| 347 | +$wp_queries = wp_get_db_schema('all'); |
|
| 348 | 348 | |
| 349 | 349 | /** |
| 350 | 350 | * Create WordPress options and set the default values. |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * |
| 359 | 359 | * @param array $options Optional. Custom option $key => $value pairs to use. Default empty array. |
| 360 | 360 | */ |
| 361 | -function populate_options( array $options = array() ) { |
|
| 361 | +function populate_options(array $options = array()) { |
|
| 362 | 362 | global $wpdb, $wp_db_version, $wp_current_db_version; |
| 363 | 363 | |
| 364 | 364 | $guessurl = wp_guess_url(); |
@@ -367,18 +367,18 @@ discard block |
||
| 367 | 367 | * |
| 368 | 368 | * @since 2.6.0 |
| 369 | 369 | */ |
| 370 | - do_action( 'populate_options' ); |
|
| 370 | + do_action('populate_options'); |
|
| 371 | 371 | |
| 372 | 372 | // If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme. |
| 373 | 373 | $stylesheet = WP_DEFAULT_THEME; |
| 374 | 374 | $template = WP_DEFAULT_THEME; |
| 375 | - $theme = wp_get_theme( WP_DEFAULT_THEME ); |
|
| 376 | - if ( ! $theme->exists() ) { |
|
| 375 | + $theme = wp_get_theme(WP_DEFAULT_THEME); |
|
| 376 | + if (!$theme->exists()) { |
|
| 377 | 377 | $theme = WP_Theme::get_core_default_theme(); |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | // If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do. |
| 381 | - if ( $theme ) { |
|
| 381 | + if ($theme) { |
|
| 382 | 382 | $stylesheet = $theme->get_stylesheet(); |
| 383 | 383 | $template = $theme->get_template(); |
| 384 | 384 | } |
@@ -390,23 +390,23 @@ discard block |
||
| 390 | 390 | * or a valid timezone string (America/New_York). See https://www.php.net/manual/en/timezones.php |
| 391 | 391 | * for all timezone strings supported by PHP. |
| 392 | 392 | */ |
| 393 | - $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); |
|
| 394 | - if ( is_numeric( $offset_or_tz ) ) { |
|
| 393 | + $offset_or_tz = _x('0', 'default GMT offset or timezone string'); |
|
| 394 | + if (is_numeric($offset_or_tz)) { |
|
| 395 | 395 | $gmt_offset = $offset_or_tz; |
| 396 | - } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list(), true ) ) { |
|
| 396 | + } elseif ($offset_or_tz && in_array($offset_or_tz, timezone_identifiers_list(), true)) { |
|
| 397 | 397 | $timezone_string = $offset_or_tz; |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | $defaults = array( |
| 401 | 401 | 'siteurl' => $guessurl, |
| 402 | 402 | 'home' => $guessurl, |
| 403 | - 'blogname' => __( 'My Site' ), |
|
| 403 | + 'blogname' => __('My Site'), |
|
| 404 | 404 | /* translators: Site tagline. */ |
| 405 | - 'blogdescription' => __( 'Just another WordPress site' ), |
|
| 405 | + 'blogdescription' => __('Just another WordPress site'), |
|
| 406 | 406 | 'users_can_register' => 0, |
| 407 | 407 | 'admin_email' => '[email protected]', |
| 408 | 408 | /* translators: Default start of the week. 0 = Sunday, 1 = Monday. */ |
| 409 | - 'start_of_week' => _x( '1', 'start of week' ), |
|
| 409 | + 'start_of_week' => _x('1', 'start of week'), |
|
| 410 | 410 | 'use_balanceTags' => 0, |
| 411 | 411 | 'use_smilies' => 1, |
| 412 | 412 | 'require_name_email' => 1, |
@@ -423,11 +423,11 @@ discard block |
||
| 423 | 423 | 'default_pingback_flag' => 1, |
| 424 | 424 | 'posts_per_page' => 10, |
| 425 | 425 | /* translators: Default date format, see https://www.php.net/manual/datetime.format.php */ |
| 426 | - 'date_format' => __( 'F j, Y' ), |
|
| 426 | + 'date_format' => __('F j, Y'), |
|
| 427 | 427 | /* translators: Default time format, see https://www.php.net/manual/datetime.format.php */ |
| 428 | - 'time_format' => __( 'g:i a' ), |
|
| 428 | + 'time_format' => __('g:i a'), |
|
| 429 | 429 | /* translators: Links last updated date format, see https://www.php.net/manual/datetime.format.php */ |
| 430 | - 'links_updated_date_format' => __( 'F j, Y g:i a' ), |
|
| 430 | + 'links_updated_date_format' => __('F j, Y g:i a'), |
|
| 431 | 431 | 'comment_moderation' => 0, |
| 432 | 432 | 'moderation_notify' => 1, |
| 433 | 433 | 'permalink_structure' => '', |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | 'show_comments_cookies_opt_in' => 1, |
| 530 | 530 | |
| 531 | 531 | // 5.3.0 |
| 532 | - 'admin_email_lifespan' => ( time() + 6 * MONTH_IN_SECONDS ), |
|
| 532 | + 'admin_email_lifespan' => (time() + 6 * MONTH_IN_SECONDS), |
|
| 533 | 533 | |
| 534 | 534 | // 5.5.0 |
| 535 | 535 | 'disallowed_keys' => '', |
@@ -548,19 +548,19 @@ discard block |
||
| 548 | 548 | ); |
| 549 | 549 | |
| 550 | 550 | // 3.3.0 |
| 551 | - if ( ! is_multisite() ) { |
|
| 552 | - $defaults['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version |
|
| 551 | + if (!is_multisite()) { |
|
| 552 | + $defaults['initial_db_version'] = !empty($wp_current_db_version) && $wp_current_db_version < $wp_db_version |
|
| 553 | 553 | ? $wp_current_db_version : $wp_db_version; |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | // 3.0.0 multisite. |
| 557 | - if ( is_multisite() ) { |
|
| 557 | + if (is_multisite()) { |
|
| 558 | 558 | /* translators: %s: Network title. */ |
| 559 | - $defaults['blogdescription'] = sprintf( __( 'Just another %s site' ), get_network()->site_name ); |
|
| 559 | + $defaults['blogdescription'] = sprintf(__('Just another %s site'), get_network()->site_name); |
|
| 560 | 560 | $defaults['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/'; |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | - $options = wp_parse_args( $options, $defaults ); |
|
| 563 | + $options = wp_parse_args($options, $defaults); |
|
| 564 | 564 | |
| 565 | 565 | // Set autoload to no for these options. |
| 566 | 566 | $fat_options = array( |
@@ -571,40 +571,40 @@ discard block |
||
| 571 | 571 | 'auto_plugin_theme_update_emails', |
| 572 | 572 | ); |
| 573 | 573 | |
| 574 | - $keys = "'" . implode( "', '", array_keys( $options ) ) . "'"; |
|
| 575 | - $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 574 | + $keys = "'" . implode("', '", array_keys($options)) . "'"; |
|
| 575 | + $existing_options = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )"); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 576 | 576 | |
| 577 | 577 | $insert = ''; |
| 578 | 578 | |
| 579 | - foreach ( $options as $option => $value ) { |
|
| 580 | - if ( in_array( $option, $existing_options, true ) ) { |
|
| 579 | + foreach ($options as $option => $value) { |
|
| 580 | + if (in_array($option, $existing_options, true)) { |
|
| 581 | 581 | continue; |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - if ( in_array( $option, $fat_options, true ) ) { |
|
| 584 | + if (in_array($option, $fat_options, true)) { |
|
| 585 | 585 | $autoload = 'no'; |
| 586 | 586 | } else { |
| 587 | 587 | $autoload = 'yes'; |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | - if ( is_array( $value ) ) { |
|
| 591 | - $value = serialize( $value ); |
|
| 590 | + if (is_array($value)) { |
|
| 591 | + $value = serialize($value); |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | - if ( ! empty( $insert ) ) { |
|
| 594 | + if (!empty($insert)) { |
|
| 595 | 595 | $insert .= ', '; |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | - $insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload ); |
|
| 598 | + $insert .= $wpdb->prepare('(%s, %s, %s)', $option, $value, $autoload); |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | - if ( ! empty( $insert ) ) { |
|
| 602 | - $wpdb->query( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 601 | + if (!empty($insert)) { |
|
| 602 | + $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | // In case it is set, but blank, update "home". |
| 606 | - if ( ! __get_option( 'home' ) ) { |
|
| 607 | - update_option( 'home', $guessurl ); |
|
| 606 | + if (!__get_option('home')) { |
|
| 607 | + update_option('home', $guessurl); |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | // Delete unused options. |
@@ -686,15 +686,15 @@ discard block |
||
| 686 | 686 | 'gzipcompression', |
| 687 | 687 | 'advanced_edit', |
| 688 | 688 | ); |
| 689 | - foreach ( $unusedoptions as $option ) { |
|
| 690 | - delete_option( $option ); |
|
| 689 | + foreach ($unusedoptions as $option) { |
|
| 690 | + delete_option($option); |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | // Delete obsolete magpie stuff. |
| 694 | - $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'" ); |
|
| 694 | + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'"); |
|
| 695 | 695 | |
| 696 | 696 | // Clear expired transients. |
| 697 | - delete_expired_transients( true ); |
|
| 697 | + delete_expired_transients(true); |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | /** |
@@ -720,89 +720,89 @@ discard block |
||
| 720 | 720 | */ |
| 721 | 721 | function populate_roles_160() { |
| 722 | 722 | // Add roles. |
| 723 | - add_role( 'administrator', 'Administrator' ); |
|
| 724 | - add_role( 'editor', 'Editor' ); |
|
| 725 | - add_role( 'author', 'Author' ); |
|
| 726 | - add_role( 'contributor', 'Contributor' ); |
|
| 727 | - add_role( 'subscriber', 'Subscriber' ); |
|
| 723 | + add_role('administrator', 'Administrator'); |
|
| 724 | + add_role('editor', 'Editor'); |
|
| 725 | + add_role('author', 'Author'); |
|
| 726 | + add_role('contributor', 'Contributor'); |
|
| 727 | + add_role('subscriber', 'Subscriber'); |
|
| 728 | 728 | |
| 729 | 729 | // Add caps for Administrator role. |
| 730 | - $role = get_role( 'administrator' ); |
|
| 731 | - $role->add_cap( 'switch_themes' ); |
|
| 732 | - $role->add_cap( 'edit_themes' ); |
|
| 733 | - $role->add_cap( 'activate_plugins' ); |
|
| 734 | - $role->add_cap( 'edit_plugins' ); |
|
| 735 | - $role->add_cap( 'edit_users' ); |
|
| 736 | - $role->add_cap( 'edit_files' ); |
|
| 737 | - $role->add_cap( 'manage_options' ); |
|
| 738 | - $role->add_cap( 'moderate_comments' ); |
|
| 739 | - $role->add_cap( 'manage_categories' ); |
|
| 740 | - $role->add_cap( 'manage_links' ); |
|
| 741 | - $role->add_cap( 'upload_files' ); |
|
| 742 | - $role->add_cap( 'import' ); |
|
| 743 | - $role->add_cap( 'unfiltered_html' ); |
|
| 744 | - $role->add_cap( 'edit_posts' ); |
|
| 745 | - $role->add_cap( 'edit_others_posts' ); |
|
| 746 | - $role->add_cap( 'edit_published_posts' ); |
|
| 747 | - $role->add_cap( 'publish_posts' ); |
|
| 748 | - $role->add_cap( 'edit_pages' ); |
|
| 749 | - $role->add_cap( 'read' ); |
|
| 750 | - $role->add_cap( 'level_10' ); |
|
| 751 | - $role->add_cap( 'level_9' ); |
|
| 752 | - $role->add_cap( 'level_8' ); |
|
| 753 | - $role->add_cap( 'level_7' ); |
|
| 754 | - $role->add_cap( 'level_6' ); |
|
| 755 | - $role->add_cap( 'level_5' ); |
|
| 756 | - $role->add_cap( 'level_4' ); |
|
| 757 | - $role->add_cap( 'level_3' ); |
|
| 758 | - $role->add_cap( 'level_2' ); |
|
| 759 | - $role->add_cap( 'level_1' ); |
|
| 760 | - $role->add_cap( 'level_0' ); |
|
| 730 | + $role = get_role('administrator'); |
|
| 731 | + $role->add_cap('switch_themes'); |
|
| 732 | + $role->add_cap('edit_themes'); |
|
| 733 | + $role->add_cap('activate_plugins'); |
|
| 734 | + $role->add_cap('edit_plugins'); |
|
| 735 | + $role->add_cap('edit_users'); |
|
| 736 | + $role->add_cap('edit_files'); |
|
| 737 | + $role->add_cap('manage_options'); |
|
| 738 | + $role->add_cap('moderate_comments'); |
|
| 739 | + $role->add_cap('manage_categories'); |
|
| 740 | + $role->add_cap('manage_links'); |
|
| 741 | + $role->add_cap('upload_files'); |
|
| 742 | + $role->add_cap('import'); |
|
| 743 | + $role->add_cap('unfiltered_html'); |
|
| 744 | + $role->add_cap('edit_posts'); |
|
| 745 | + $role->add_cap('edit_others_posts'); |
|
| 746 | + $role->add_cap('edit_published_posts'); |
|
| 747 | + $role->add_cap('publish_posts'); |
|
| 748 | + $role->add_cap('edit_pages'); |
|
| 749 | + $role->add_cap('read'); |
|
| 750 | + $role->add_cap('level_10'); |
|
| 751 | + $role->add_cap('level_9'); |
|
| 752 | + $role->add_cap('level_8'); |
|
| 753 | + $role->add_cap('level_7'); |
|
| 754 | + $role->add_cap('level_6'); |
|
| 755 | + $role->add_cap('level_5'); |
|
| 756 | + $role->add_cap('level_4'); |
|
| 757 | + $role->add_cap('level_3'); |
|
| 758 | + $role->add_cap('level_2'); |
|
| 759 | + $role->add_cap('level_1'); |
|
| 760 | + $role->add_cap('level_0'); |
|
| 761 | 761 | |
| 762 | 762 | // Add caps for Editor role. |
| 763 | - $role = get_role( 'editor' ); |
|
| 764 | - $role->add_cap( 'moderate_comments' ); |
|
| 765 | - $role->add_cap( 'manage_categories' ); |
|
| 766 | - $role->add_cap( 'manage_links' ); |
|
| 767 | - $role->add_cap( 'upload_files' ); |
|
| 768 | - $role->add_cap( 'unfiltered_html' ); |
|
| 769 | - $role->add_cap( 'edit_posts' ); |
|
| 770 | - $role->add_cap( 'edit_others_posts' ); |
|
| 771 | - $role->add_cap( 'edit_published_posts' ); |
|
| 772 | - $role->add_cap( 'publish_posts' ); |
|
| 773 | - $role->add_cap( 'edit_pages' ); |
|
| 774 | - $role->add_cap( 'read' ); |
|
| 775 | - $role->add_cap( 'level_7' ); |
|
| 776 | - $role->add_cap( 'level_6' ); |
|
| 777 | - $role->add_cap( 'level_5' ); |
|
| 778 | - $role->add_cap( 'level_4' ); |
|
| 779 | - $role->add_cap( 'level_3' ); |
|
| 780 | - $role->add_cap( 'level_2' ); |
|
| 781 | - $role->add_cap( 'level_1' ); |
|
| 782 | - $role->add_cap( 'level_0' ); |
|
| 763 | + $role = get_role('editor'); |
|
| 764 | + $role->add_cap('moderate_comments'); |
|
| 765 | + $role->add_cap('manage_categories'); |
|
| 766 | + $role->add_cap('manage_links'); |
|
| 767 | + $role->add_cap('upload_files'); |
|
| 768 | + $role->add_cap('unfiltered_html'); |
|
| 769 | + $role->add_cap('edit_posts'); |
|
| 770 | + $role->add_cap('edit_others_posts'); |
|
| 771 | + $role->add_cap('edit_published_posts'); |
|
| 772 | + $role->add_cap('publish_posts'); |
|
| 773 | + $role->add_cap('edit_pages'); |
|
| 774 | + $role->add_cap('read'); |
|
| 775 | + $role->add_cap('level_7'); |
|
| 776 | + $role->add_cap('level_6'); |
|
| 777 | + $role->add_cap('level_5'); |
|
| 778 | + $role->add_cap('level_4'); |
|
| 779 | + $role->add_cap('level_3'); |
|
| 780 | + $role->add_cap('level_2'); |
|
| 781 | + $role->add_cap('level_1'); |
|
| 782 | + $role->add_cap('level_0'); |
|
| 783 | 783 | |
| 784 | 784 | // Add caps for Author role. |
| 785 | - $role = get_role( 'author' ); |
|
| 786 | - $role->add_cap( 'upload_files' ); |
|
| 787 | - $role->add_cap( 'edit_posts' ); |
|
| 788 | - $role->add_cap( 'edit_published_posts' ); |
|
| 789 | - $role->add_cap( 'publish_posts' ); |
|
| 790 | - $role->add_cap( 'read' ); |
|
| 791 | - $role->add_cap( 'level_2' ); |
|
| 792 | - $role->add_cap( 'level_1' ); |
|
| 793 | - $role->add_cap( 'level_0' ); |
|
| 785 | + $role = get_role('author'); |
|
| 786 | + $role->add_cap('upload_files'); |
|
| 787 | + $role->add_cap('edit_posts'); |
|
| 788 | + $role->add_cap('edit_published_posts'); |
|
| 789 | + $role->add_cap('publish_posts'); |
|
| 790 | + $role->add_cap('read'); |
|
| 791 | + $role->add_cap('level_2'); |
|
| 792 | + $role->add_cap('level_1'); |
|
| 793 | + $role->add_cap('level_0'); |
|
| 794 | 794 | |
| 795 | 795 | // Add caps for Contributor role. |
| 796 | - $role = get_role( 'contributor' ); |
|
| 797 | - $role->add_cap( 'edit_posts' ); |
|
| 798 | - $role->add_cap( 'read' ); |
|
| 799 | - $role->add_cap( 'level_1' ); |
|
| 800 | - $role->add_cap( 'level_0' ); |
|
| 796 | + $role = get_role('contributor'); |
|
| 797 | + $role->add_cap('edit_posts'); |
|
| 798 | + $role->add_cap('read'); |
|
| 799 | + $role->add_cap('level_1'); |
|
| 800 | + $role->add_cap('level_0'); |
|
| 801 | 801 | |
| 802 | 802 | // Add caps for Subscriber role. |
| 803 | - $role = get_role( 'subscriber' ); |
|
| 804 | - $role->add_cap( 'read' ); |
|
| 805 | - $role->add_cap( 'level_0' ); |
|
| 803 | + $role = get_role('subscriber'); |
|
| 804 | + $role->add_cap('read'); |
|
| 805 | + $role->add_cap('level_0'); |
|
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | /** |
@@ -811,45 +811,45 @@ discard block |
||
| 811 | 811 | * @since 2.1.0 |
| 812 | 812 | */ |
| 813 | 813 | function populate_roles_210() { |
| 814 | - $roles = array( 'administrator', 'editor' ); |
|
| 815 | - foreach ( $roles as $role ) { |
|
| 816 | - $role = get_role( $role ); |
|
| 817 | - if ( empty( $role ) ) { |
|
| 814 | + $roles = array('administrator', 'editor'); |
|
| 815 | + foreach ($roles as $role) { |
|
| 816 | + $role = get_role($role); |
|
| 817 | + if (empty($role)) { |
|
| 818 | 818 | continue; |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | - $role->add_cap( 'edit_others_pages' ); |
|
| 822 | - $role->add_cap( 'edit_published_pages' ); |
|
| 823 | - $role->add_cap( 'publish_pages' ); |
|
| 824 | - $role->add_cap( 'delete_pages' ); |
|
| 825 | - $role->add_cap( 'delete_others_pages' ); |
|
| 826 | - $role->add_cap( 'delete_published_pages' ); |
|
| 827 | - $role->add_cap( 'delete_posts' ); |
|
| 828 | - $role->add_cap( 'delete_others_posts' ); |
|
| 829 | - $role->add_cap( 'delete_published_posts' ); |
|
| 830 | - $role->add_cap( 'delete_private_posts' ); |
|
| 831 | - $role->add_cap( 'edit_private_posts' ); |
|
| 832 | - $role->add_cap( 'read_private_posts' ); |
|
| 833 | - $role->add_cap( 'delete_private_pages' ); |
|
| 834 | - $role->add_cap( 'edit_private_pages' ); |
|
| 835 | - $role->add_cap( 'read_private_pages' ); |
|
| 821 | + $role->add_cap('edit_others_pages'); |
|
| 822 | + $role->add_cap('edit_published_pages'); |
|
| 823 | + $role->add_cap('publish_pages'); |
|
| 824 | + $role->add_cap('delete_pages'); |
|
| 825 | + $role->add_cap('delete_others_pages'); |
|
| 826 | + $role->add_cap('delete_published_pages'); |
|
| 827 | + $role->add_cap('delete_posts'); |
|
| 828 | + $role->add_cap('delete_others_posts'); |
|
| 829 | + $role->add_cap('delete_published_posts'); |
|
| 830 | + $role->add_cap('delete_private_posts'); |
|
| 831 | + $role->add_cap('edit_private_posts'); |
|
| 832 | + $role->add_cap('read_private_posts'); |
|
| 833 | + $role->add_cap('delete_private_pages'); |
|
| 834 | + $role->add_cap('edit_private_pages'); |
|
| 835 | + $role->add_cap('read_private_pages'); |
|
| 836 | 836 | } |
| 837 | 837 | |
| 838 | - $role = get_role( 'administrator' ); |
|
| 839 | - if ( ! empty( $role ) ) { |
|
| 840 | - $role->add_cap( 'delete_users' ); |
|
| 841 | - $role->add_cap( 'create_users' ); |
|
| 838 | + $role = get_role('administrator'); |
|
| 839 | + if (!empty($role)) { |
|
| 840 | + $role->add_cap('delete_users'); |
|
| 841 | + $role->add_cap('create_users'); |
|
| 842 | 842 | } |
| 843 | 843 | |
| 844 | - $role = get_role( 'author' ); |
|
| 845 | - if ( ! empty( $role ) ) { |
|
| 846 | - $role->add_cap( 'delete_posts' ); |
|
| 847 | - $role->add_cap( 'delete_published_posts' ); |
|
| 844 | + $role = get_role('author'); |
|
| 845 | + if (!empty($role)) { |
|
| 846 | + $role->add_cap('delete_posts'); |
|
| 847 | + $role->add_cap('delete_published_posts'); |
|
| 848 | 848 | } |
| 849 | 849 | |
| 850 | - $role = get_role( 'contributor' ); |
|
| 851 | - if ( ! empty( $role ) ) { |
|
| 852 | - $role->add_cap( 'delete_posts' ); |
|
| 850 | + $role = get_role('contributor'); |
|
| 851 | + if (!empty($role)) { |
|
| 852 | + $role->add_cap('delete_posts'); |
|
| 853 | 853 | } |
| 854 | 854 | } |
| 855 | 855 | |
@@ -859,10 +859,10 @@ discard block |
||
| 859 | 859 | * @since 2.3.0 |
| 860 | 860 | */ |
| 861 | 861 | function populate_roles_230() { |
| 862 | - $role = get_role( 'administrator' ); |
|
| 862 | + $role = get_role('administrator'); |
|
| 863 | 863 | |
| 864 | - if ( ! empty( $role ) ) { |
|
| 865 | - $role->add_cap( 'unfiltered_upload' ); |
|
| 864 | + if (!empty($role)) { |
|
| 865 | + $role->add_cap('unfiltered_upload'); |
|
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | 868 | |
@@ -872,10 +872,10 @@ discard block |
||
| 872 | 872 | * @since 2.5.0 |
| 873 | 873 | */ |
| 874 | 874 | function populate_roles_250() { |
| 875 | - $role = get_role( 'administrator' ); |
|
| 875 | + $role = get_role('administrator'); |
|
| 876 | 876 | |
| 877 | - if ( ! empty( $role ) ) { |
|
| 878 | - $role->add_cap( 'edit_dashboard' ); |
|
| 877 | + if (!empty($role)) { |
|
| 878 | + $role->add_cap('edit_dashboard'); |
|
| 879 | 879 | } |
| 880 | 880 | } |
| 881 | 881 | |
@@ -885,11 +885,11 @@ discard block |
||
| 885 | 885 | * @since 2.6.0 |
| 886 | 886 | */ |
| 887 | 887 | function populate_roles_260() { |
| 888 | - $role = get_role( 'administrator' ); |
|
| 888 | + $role = get_role('administrator'); |
|
| 889 | 889 | |
| 890 | - if ( ! empty( $role ) ) { |
|
| 891 | - $role->add_cap( 'update_plugins' ); |
|
| 892 | - $role->add_cap( 'delete_plugins' ); |
|
| 890 | + if (!empty($role)) { |
|
| 891 | + $role->add_cap('update_plugins'); |
|
| 892 | + $role->add_cap('delete_plugins'); |
|
| 893 | 893 | } |
| 894 | 894 | } |
| 895 | 895 | |
@@ -899,11 +899,11 @@ discard block |
||
| 899 | 899 | * @since 2.7.0 |
| 900 | 900 | */ |
| 901 | 901 | function populate_roles_270() { |
| 902 | - $role = get_role( 'administrator' ); |
|
| 902 | + $role = get_role('administrator'); |
|
| 903 | 903 | |
| 904 | - if ( ! empty( $role ) ) { |
|
| 905 | - $role->add_cap( 'install_plugins' ); |
|
| 906 | - $role->add_cap( 'update_themes' ); |
|
| 904 | + if (!empty($role)) { |
|
| 905 | + $role->add_cap('install_plugins'); |
|
| 906 | + $role->add_cap('update_themes'); |
|
| 907 | 907 | } |
| 908 | 908 | } |
| 909 | 909 | |
@@ -913,10 +913,10 @@ discard block |
||
| 913 | 913 | * @since 2.8.0 |
| 914 | 914 | */ |
| 915 | 915 | function populate_roles_280() { |
| 916 | - $role = get_role( 'administrator' ); |
|
| 916 | + $role = get_role('administrator'); |
|
| 917 | 917 | |
| 918 | - if ( ! empty( $role ) ) { |
|
| 919 | - $role->add_cap( 'install_themes' ); |
|
| 918 | + if (!empty($role)) { |
|
| 919 | + $role->add_cap('install_themes'); |
|
| 920 | 920 | } |
| 921 | 921 | } |
| 922 | 922 | |
@@ -926,31 +926,31 @@ discard block |
||
| 926 | 926 | * @since 3.0.0 |
| 927 | 927 | */ |
| 928 | 928 | function populate_roles_300() { |
| 929 | - $role = get_role( 'administrator' ); |
|
| 930 | - |
|
| 931 | - if ( ! empty( $role ) ) { |
|
| 932 | - $role->add_cap( 'update_core' ); |
|
| 933 | - $role->add_cap( 'list_users' ); |
|
| 934 | - $role->add_cap( 'remove_users' ); |
|
| 935 | - $role->add_cap( 'promote_users' ); |
|
| 936 | - $role->add_cap( 'edit_theme_options' ); |
|
| 937 | - $role->add_cap( 'delete_themes' ); |
|
| 938 | - $role->add_cap( 'export' ); |
|
| 929 | + $role = get_role('administrator'); |
|
| 930 | + |
|
| 931 | + if (!empty($role)) { |
|
| 932 | + $role->add_cap('update_core'); |
|
| 933 | + $role->add_cap('list_users'); |
|
| 934 | + $role->add_cap('remove_users'); |
|
| 935 | + $role->add_cap('promote_users'); |
|
| 936 | + $role->add_cap('edit_theme_options'); |
|
| 937 | + $role->add_cap('delete_themes'); |
|
| 938 | + $role->add_cap('export'); |
|
| 939 | 939 | } |
| 940 | 940 | } |
| 941 | 941 | |
| 942 | -if ( ! function_exists( 'install_network' ) ) : |
|
| 942 | +if (!function_exists('install_network')) : |
|
| 943 | 943 | /** |
| 944 | 944 | * Install Network. |
| 945 | 945 | * |
| 946 | 946 | * @since 3.0.0 |
| 947 | 947 | */ |
| 948 | 948 | function install_network() { |
| 949 | - if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) { |
|
| 950 | - define( 'WP_INSTALLING_NETWORK', true ); |
|
| 949 | + if (!defined('WP_INSTALLING_NETWORK')) { |
|
| 950 | + define('WP_INSTALLING_NETWORK', true); |
|
| 951 | 951 | } |
| 952 | 952 | |
| 953 | - dbDelta( wp_get_db_schema( 'global' ) ); |
|
| 953 | + dbDelta(wp_get_db_schema('global')); |
|
| 954 | 954 | } |
| 955 | 955 | endif; |
| 956 | 956 | |
@@ -973,38 +973,38 @@ discard block |
||
| 973 | 973 | * @return bool|WP_Error True on success, or WP_Error on warning (with the installation otherwise successful, |
| 974 | 974 | * so the error code must be checked) or failure. |
| 975 | 975 | */ |
| 976 | -function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { |
|
| 976 | +function populate_network($network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false) { |
|
| 977 | 977 | global $wpdb, $current_site, $wp_rewrite; |
| 978 | 978 | |
| 979 | 979 | $errors = new WP_Error(); |
| 980 | - if ( '' === $domain ) { |
|
| 981 | - $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); |
|
| 980 | + if ('' === $domain) { |
|
| 981 | + $errors->add('empty_domain', __('You must provide a domain name.')); |
|
| 982 | 982 | } |
| 983 | - if ( '' === $site_name ) { |
|
| 984 | - $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); |
|
| 983 | + if ('' === $site_name) { |
|
| 984 | + $errors->add('empty_sitename', __('You must provide a name for your network of sites.')); |
|
| 985 | 985 | } |
| 986 | 986 | |
| 987 | 987 | // Check for network collision. |
| 988 | 988 | $network_exists = false; |
| 989 | - if ( is_multisite() ) { |
|
| 990 | - if ( get_network( (int) $network_id ) ) { |
|
| 991 | - $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
| 989 | + if (is_multisite()) { |
|
| 990 | + if (get_network((int) $network_id)) { |
|
| 991 | + $errors->add('siteid_exists', __('The network already exists.')); |
|
| 992 | 992 | } |
| 993 | 993 | } else { |
| 994 | - if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) { |
|
| 995 | - $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
| 994 | + if ($network_id == $wpdb->get_var($wpdb->prepare("SELECT id FROM $wpdb->site WHERE id = %d", $network_id))) { |
|
| 995 | + $errors->add('siteid_exists', __('The network already exists.')); |
|
| 996 | 996 | } |
| 997 | 997 | } |
| 998 | 998 | |
| 999 | - if ( ! is_email( $email ) ) { |
|
| 1000 | - $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) ); |
|
| 999 | + if (!is_email($email)) { |
|
| 1000 | + $errors->add('invalid_email', __('You must provide a valid email address.')); |
|
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | - if ( $errors->has_errors() ) { |
|
| 1003 | + if ($errors->has_errors()) { |
|
| 1004 | 1004 | return $errors; |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | - if ( 1 == $network_id ) { |
|
| 1007 | + if (1 == $network_id) { |
|
| 1008 | 1008 | $wpdb->insert( |
| 1009 | 1009 | $wpdb->site, |
| 1010 | 1010 | array( |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | ) |
| 1034 | 1034 | ); |
| 1035 | 1035 | |
| 1036 | - $site_user = get_userdata( (int) $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", 'admin_user_id', $network_id ) ) ); |
|
| 1036 | + $site_user = get_userdata((int) $wpdb->get_var($wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", 'admin_user_id', $network_id))); |
|
| 1037 | 1037 | |
| 1038 | 1038 | /* |
| 1039 | 1039 | * When upgrading from single to multisite, assume the current site will |
@@ -1042,11 +1042,11 @@ discard block |
||
| 1042 | 1042 | * these steps since the main site of the new network has not yet been |
| 1043 | 1043 | * created. |
| 1044 | 1044 | */ |
| 1045 | - if ( ! is_multisite() ) { |
|
| 1045 | + if (!is_multisite()) { |
|
| 1046 | 1046 | $current_site = new stdClass; |
| 1047 | 1047 | $current_site->domain = $domain; |
| 1048 | 1048 | $current_site->path = $path; |
| 1049 | - $current_site->site_name = ucfirst( $domain ); |
|
| 1049 | + $current_site->site_name = ucfirst($domain); |
|
| 1050 | 1050 | $wpdb->insert( |
| 1051 | 1051 | $wpdb->blogs, |
| 1052 | 1052 | array( |
@@ -1054,28 +1054,28 @@ discard block |
||
| 1054 | 1054 | 'blog_id' => 1, |
| 1055 | 1055 | 'domain' => $domain, |
| 1056 | 1056 | 'path' => $path, |
| 1057 | - 'registered' => current_time( 'mysql' ), |
|
| 1057 | + 'registered' => current_time('mysql'), |
|
| 1058 | 1058 | ) |
| 1059 | 1059 | ); |
| 1060 | 1060 | $current_site->blog_id = $wpdb->insert_id; |
| 1061 | - update_user_meta( $site_user->ID, 'source_domain', $domain ); |
|
| 1062 | - update_user_meta( $site_user->ID, 'primary_blog', $current_site->blog_id ); |
|
| 1061 | + update_user_meta($site_user->ID, 'source_domain', $domain); |
|
| 1062 | + update_user_meta($site_user->ID, 'primary_blog', $current_site->blog_id); |
|
| 1063 | 1063 | |
| 1064 | - if ( $subdomain_install ) { |
|
| 1065 | - $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); |
|
| 1064 | + if ($subdomain_install) { |
|
| 1065 | + $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/'); |
|
| 1066 | 1066 | } else { |
| 1067 | - $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); |
|
| 1067 | + $wp_rewrite->set_permalink_structure('/blog/%year%/%monthnum%/%day%/%postname%/'); |
|
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | flush_rewrite_rules(); |
| 1071 | 1071 | |
| 1072 | - if ( ! $subdomain_install ) { |
|
| 1072 | + if (!$subdomain_install) { |
|
| 1073 | 1073 | return true; |
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | 1076 | $vhost_ok = false; |
| 1077 | 1077 | $errstr = ''; |
| 1078 | - $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! |
|
| 1078 | + $hostname = substr(md5(time()), 0, 6) . '.' . $domain; // Very random hostname! |
|
| 1079 | 1079 | $page = wp_remote_get( |
| 1080 | 1080 | 'http://' . $hostname, |
| 1081 | 1081 | array( |
@@ -1083,35 +1083,35 @@ discard block |
||
| 1083 | 1083 | 'httpversion' => '1.1', |
| 1084 | 1084 | ) |
| 1085 | 1085 | ); |
| 1086 | - if ( is_wp_error( $page ) ) { |
|
| 1086 | + if (is_wp_error($page)) { |
|
| 1087 | 1087 | $errstr = $page->get_error_message(); |
| 1088 | - } elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) { |
|
| 1088 | + } elseif (200 == wp_remote_retrieve_response_code($page)) { |
|
| 1089 | 1089 | $vhost_ok = true; |
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | - if ( ! $vhost_ok ) { |
|
| 1093 | - $msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>'; |
|
| 1092 | + if (!$vhost_ok) { |
|
| 1093 | + $msg = '<p><strong>' . __('Warning! Wildcard DNS may not be configured correctly!') . '</strong></p>'; |
|
| 1094 | 1094 | |
| 1095 | 1095 | $msg .= '<p>' . sprintf( |
| 1096 | 1096 | /* translators: %s: Host name. */ |
| 1097 | - __( 'The installer attempted to contact a random hostname (%s) on your domain.' ), |
|
| 1097 | + __('The installer attempted to contact a random hostname (%s) on your domain.'), |
|
| 1098 | 1098 | '<code>' . $hostname . '</code>' |
| 1099 | 1099 | ); |
| 1100 | - if ( ! empty( $errstr ) ) { |
|
| 1100 | + if (!empty($errstr)) { |
|
| 1101 | 1101 | /* translators: %s: Error message. */ |
| 1102 | - $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' ); |
|
| 1102 | + $msg .= ' ' . sprintf(__('This resulted in an error message: %s'), '<code>' . $errstr . '</code>'); |
|
| 1103 | 1103 | } |
| 1104 | 1104 | $msg .= '</p>'; |
| 1105 | 1105 | |
| 1106 | 1106 | $msg .= '<p>' . sprintf( |
| 1107 | 1107 | /* translators: %s: Asterisk symbol (*). */ |
| 1108 | - __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.' ), |
|
| 1108 | + __('To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.'), |
|
| 1109 | 1109 | '<code>*</code>' |
| 1110 | 1110 | ) . '</p>'; |
| 1111 | 1111 | |
| 1112 | - $msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>'; |
|
| 1112 | + $msg .= '<p>' . __('You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.') . '</p>'; |
|
| 1113 | 1113 | |
| 1114 | - return new WP_Error( 'no_wildcard_dns', $msg ); |
|
| 1114 | + return new WP_Error('no_wildcard_dns', $msg); |
|
| 1115 | 1115 | } |
| 1116 | 1116 | } |
| 1117 | 1117 | |
@@ -1129,67 +1129,67 @@ discard block |
||
| 1129 | 1129 | * @param int $network_id Network ID to populate meta for. |
| 1130 | 1130 | * @param array $meta Optional. Custom meta $key => $value pairs to use. Default empty array. |
| 1131 | 1131 | */ |
| 1132 | -function populate_network_meta( $network_id, array $meta = array() ) { |
|
| 1132 | +function populate_network_meta($network_id, array $meta = array()) { |
|
| 1133 | 1133 | global $wpdb, $wp_db_version; |
| 1134 | 1134 | |
| 1135 | 1135 | $network_id = (int) $network_id; |
| 1136 | 1136 | |
| 1137 | - $email = ! empty( $meta['admin_email'] ) ? $meta['admin_email'] : ''; |
|
| 1138 | - $subdomain_install = isset( $meta['subdomain_install'] ) ? (int) $meta['subdomain_install'] : 0; |
|
| 1137 | + $email = !empty($meta['admin_email']) ? $meta['admin_email'] : ''; |
|
| 1138 | + $subdomain_install = isset($meta['subdomain_install']) ? (int) $meta['subdomain_install'] : 0; |
|
| 1139 | 1139 | |
| 1140 | 1140 | // If a user with the provided email does not exist, default to the current user as the new network admin. |
| 1141 | - $site_user = ! empty( $email ) ? get_user_by( 'email', $email ) : false; |
|
| 1142 | - if ( false === $site_user ) { |
|
| 1141 | + $site_user = !empty($email) ? get_user_by('email', $email) : false; |
|
| 1142 | + if (false === $site_user) { |
|
| 1143 | 1143 | $site_user = wp_get_current_user(); |
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | - if ( empty( $email ) ) { |
|
| 1146 | + if (empty($email)) { |
|
| 1147 | 1147 | $email = $site_user->user_email; |
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | - $template = get_option( 'template' ); |
|
| 1151 | - $stylesheet = get_option( 'stylesheet' ); |
|
| 1152 | - $allowed_themes = array( $stylesheet => true ); |
|
| 1150 | + $template = get_option('template'); |
|
| 1151 | + $stylesheet = get_option('stylesheet'); |
|
| 1152 | + $allowed_themes = array($stylesheet => true); |
|
| 1153 | 1153 | |
| 1154 | - if ( $template != $stylesheet ) { |
|
| 1155 | - $allowed_themes[ $template ] = true; |
|
| 1154 | + if ($template != $stylesheet) { |
|
| 1155 | + $allowed_themes[$template] = true; |
|
| 1156 | 1156 | } |
| 1157 | 1157 | |
| 1158 | - if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) { |
|
| 1159 | - $allowed_themes[ WP_DEFAULT_THEME ] = true; |
|
| 1158 | + if (WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template) { |
|
| 1159 | + $allowed_themes[WP_DEFAULT_THEME] = true; |
|
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | 1162 | // If WP_DEFAULT_THEME doesn't exist, also include the latest core default theme. |
| 1163 | - if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) { |
|
| 1163 | + if (!wp_get_theme(WP_DEFAULT_THEME)->exists()) { |
|
| 1164 | 1164 | $core_default = WP_Theme::get_core_default_theme(); |
| 1165 | - if ( $core_default ) { |
|
| 1166 | - $allowed_themes[ $core_default->get_stylesheet() ] = true; |
|
| 1165 | + if ($core_default) { |
|
| 1166 | + $allowed_themes[$core_default->get_stylesheet()] = true; |
|
| 1167 | 1167 | } |
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | - if ( function_exists( 'clean_network_cache' ) ) { |
|
| 1171 | - clean_network_cache( $network_id ); |
|
| 1170 | + if (function_exists('clean_network_cache')) { |
|
| 1171 | + clean_network_cache($network_id); |
|
| 1172 | 1172 | } else { |
| 1173 | - wp_cache_delete( $network_id, 'networks' ); |
|
| 1173 | + wp_cache_delete($network_id, 'networks'); |
|
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | - if ( ! is_multisite() ) { |
|
| 1177 | - $site_admins = array( $site_user->user_login ); |
|
| 1176 | + if (!is_multisite()) { |
|
| 1177 | + $site_admins = array($site_user->user_login); |
|
| 1178 | 1178 | $users = get_users( |
| 1179 | 1179 | array( |
| 1180 | - 'fields' => array( 'user_login' ), |
|
| 1180 | + 'fields' => array('user_login'), |
|
| 1181 | 1181 | 'role' => 'administrator', |
| 1182 | 1182 | ) |
| 1183 | 1183 | ); |
| 1184 | - if ( $users ) { |
|
| 1185 | - foreach ( $users as $user ) { |
|
| 1184 | + if ($users) { |
|
| 1185 | + foreach ($users as $user) { |
|
| 1186 | 1186 | $site_admins[] = $user->user_login; |
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | - $site_admins = array_unique( $site_admins ); |
|
| 1189 | + $site_admins = array_unique($site_admins); |
|
| 1190 | 1190 | } |
| 1191 | 1191 | } else { |
| 1192 | - $site_admins = get_site_option( 'site_admins' ); |
|
| 1192 | + $site_admins = get_site_option('site_admins'); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */ |
@@ -1210,7 +1210,7 @@ discard block |
||
| 1210 | 1210 | --The Team @ SITE_NAME' |
| 1211 | 1211 | ); |
| 1212 | 1212 | |
| 1213 | - $misc_exts = array( |
|
| 1213 | + $misc_exts = array( |
|
| 1214 | 1214 | // Images. |
| 1215 | 1215 | 'jpg', |
| 1216 | 1216 | 'jpeg', |
@@ -1241,40 +1241,40 @@ discard block |
||
| 1241 | 1241 | ); |
| 1242 | 1242 | $audio_exts = wp_get_audio_extensions(); |
| 1243 | 1243 | $video_exts = wp_get_video_extensions(); |
| 1244 | - $upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) ); |
|
| 1244 | + $upload_filetypes = array_unique(array_merge($misc_exts, $audio_exts, $video_exts)); |
|
| 1245 | 1245 | |
| 1246 | 1246 | $sitemeta = array( |
| 1247 | - 'site_name' => __( 'My Network' ), |
|
| 1247 | + 'site_name' => __('My Network'), |
|
| 1248 | 1248 | 'admin_email' => $email, |
| 1249 | 1249 | 'admin_user_id' => $site_user->ID, |
| 1250 | 1250 | 'registration' => 'none', |
| 1251 | - 'upload_filetypes' => implode( ' ', $upload_filetypes ), |
|
| 1251 | + 'upload_filetypes' => implode(' ', $upload_filetypes), |
|
| 1252 | 1252 | 'blog_upload_space' => 100, |
| 1253 | 1253 | 'fileupload_maxk' => 1500, |
| 1254 | 1254 | 'site_admins' => $site_admins, |
| 1255 | 1255 | 'allowedthemes' => $allowed_themes, |
| 1256 | - 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ), |
|
| 1256 | + 'illegal_names' => array('www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files'), |
|
| 1257 | 1257 | 'wpmu_upgrade_site' => $wp_db_version, |
| 1258 | 1258 | 'welcome_email' => $welcome_email, |
| 1259 | 1259 | /* translators: %s: Site link. */ |
| 1260 | - 'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ), |
|
| 1260 | + 'first_post' => __('Welcome to %s. This is your first post. Edit or delete it, then start writing!'), |
|
| 1261 | 1261 | // @todo - Network admins should have a method of editing the network siteurl (used for cookie hash). |
| 1262 | - 'siteurl' => get_option( 'siteurl' ) . '/', |
|
| 1262 | + 'siteurl' => get_option('siteurl') . '/', |
|
| 1263 | 1263 | 'add_new_users' => '0', |
| 1264 | - 'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1', |
|
| 1264 | + 'upload_space_check_disabled' => is_multisite() ? get_site_option('upload_space_check_disabled') : '1', |
|
| 1265 | 1265 | 'subdomain_install' => $subdomain_install, |
| 1266 | 1266 | 'global_terms_enabled' => global_terms_enabled() ? '1' : '0', |
| 1267 | - 'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0', |
|
| 1268 | - 'user_count' => get_site_option( 'user_count' ), |
|
| 1269 | - 'initial_db_version' => get_option( 'initial_db_version' ), |
|
| 1267 | + 'ms_files_rewriting' => is_multisite() ? get_site_option('ms_files_rewriting') : '0', |
|
| 1268 | + 'user_count' => get_site_option('user_count'), |
|
| 1269 | + 'initial_db_version' => get_option('initial_db_version'), |
|
| 1270 | 1270 | 'active_sitewide_plugins' => array(), |
| 1271 | 1271 | 'WPLANG' => get_locale(), |
| 1272 | 1272 | ); |
| 1273 | - if ( ! $subdomain_install ) { |
|
| 1273 | + if (!$subdomain_install) { |
|
| 1274 | 1274 | $sitemeta['illegal_names'][] = 'blog'; |
| 1275 | 1275 | } |
| 1276 | 1276 | |
| 1277 | - $sitemeta = wp_parse_args( $meta, $sitemeta ); |
|
| 1277 | + $sitemeta = wp_parse_args($meta, $sitemeta); |
|
| 1278 | 1278 | |
| 1279 | 1279 | /** |
| 1280 | 1280 | * Filters meta for a network on creation. |
@@ -1284,19 +1284,19 @@ discard block |
||
| 1284 | 1284 | * @param array $sitemeta Associative array of network meta keys and values to be inserted. |
| 1285 | 1285 | * @param int $network_id ID of network to populate. |
| 1286 | 1286 | */ |
| 1287 | - $sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id ); |
|
| 1287 | + $sitemeta = apply_filters('populate_network_meta', $sitemeta, $network_id); |
|
| 1288 | 1288 | |
| 1289 | 1289 | $insert = ''; |
| 1290 | - foreach ( $sitemeta as $meta_key => $meta_value ) { |
|
| 1291 | - if ( is_array( $meta_value ) ) { |
|
| 1292 | - $meta_value = serialize( $meta_value ); |
|
| 1290 | + foreach ($sitemeta as $meta_key => $meta_value) { |
|
| 1291 | + if (is_array($meta_value)) { |
|
| 1292 | + $meta_value = serialize($meta_value); |
|
| 1293 | 1293 | } |
| 1294 | - if ( ! empty( $insert ) ) { |
|
| 1294 | + if (!empty($insert)) { |
|
| 1295 | 1295 | $insert .= ', '; |
| 1296 | 1296 | } |
| 1297 | - $insert .= $wpdb->prepare( '( %d, %s, %s)', $network_id, $meta_key, $meta_value ); |
|
| 1297 | + $insert .= $wpdb->prepare('( %d, %s, %s)', $network_id, $meta_key, $meta_value); |
|
| 1298 | 1298 | } |
| 1299 | - $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 1299 | + $wpdb->query("INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | 1302 | /** |
@@ -1309,16 +1309,16 @@ discard block |
||
| 1309 | 1309 | * @param int $site_id Site ID to populate meta for. |
| 1310 | 1310 | * @param array $meta Optional. Custom meta $key => $value pairs to use. Default empty array. |
| 1311 | 1311 | */ |
| 1312 | -function populate_site_meta( $site_id, array $meta = array() ) { |
|
| 1312 | +function populate_site_meta($site_id, array $meta = array()) { |
|
| 1313 | 1313 | global $wpdb; |
| 1314 | 1314 | |
| 1315 | 1315 | $site_id = (int) $site_id; |
| 1316 | 1316 | |
| 1317 | - if ( ! is_site_meta_supported() ) { |
|
| 1317 | + if (!is_site_meta_supported()) { |
|
| 1318 | 1318 | return; |
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | - if ( empty( $meta ) ) { |
|
| 1321 | + if (empty($meta)) { |
|
| 1322 | 1322 | return; |
| 1323 | 1323 | } |
| 1324 | 1324 | |
@@ -1330,21 +1330,21 @@ discard block |
||
| 1330 | 1330 | * @param array $meta Associative array of site meta keys and values to be inserted. |
| 1331 | 1331 | * @param int $site_id ID of site to populate. |
| 1332 | 1332 | */ |
| 1333 | - $site_meta = apply_filters( 'populate_site_meta', $meta, $site_id ); |
|
| 1333 | + $site_meta = apply_filters('populate_site_meta', $meta, $site_id); |
|
| 1334 | 1334 | |
| 1335 | 1335 | $insert = ''; |
| 1336 | - foreach ( $site_meta as $meta_key => $meta_value ) { |
|
| 1337 | - if ( is_array( $meta_value ) ) { |
|
| 1338 | - $meta_value = serialize( $meta_value ); |
|
| 1336 | + foreach ($site_meta as $meta_key => $meta_value) { |
|
| 1337 | + if (is_array($meta_value)) { |
|
| 1338 | + $meta_value = serialize($meta_value); |
|
| 1339 | 1339 | } |
| 1340 | - if ( ! empty( $insert ) ) { |
|
| 1340 | + if (!empty($insert)) { |
|
| 1341 | 1341 | $insert .= ', '; |
| 1342 | 1342 | } |
| 1343 | - $insert .= $wpdb->prepare( '( %d, %s, %s)', $site_id, $meta_key, $meta_value ); |
|
| 1343 | + $insert .= $wpdb->prepare('( %d, %s, %s)', $site_id, $meta_key, $meta_value); |
|
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | - $wpdb->query( "INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 1346 | + $wpdb->query("INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
| 1347 | 1347 | |
| 1348 | - wp_cache_delete( $site_id, 'blog_meta' ); |
|
| 1348 | + wp_cache_delete($site_id, 'blog_meta'); |
|
| 1349 | 1349 | wp_cache_set_sites_last_changed(); |
| 1350 | 1350 | } |
@@ -24,21 +24,21 @@ discard block |
||
| 24 | 24 | * @return string|null Comment post ID on success. |
| 25 | 25 | */ |
| 26 | 26 | function comment_exists( $comment_author, $comment_date, $timezone = 'blog' ) { |
| 27 | - global $wpdb; |
|
| 27 | + global $wpdb; |
|
| 28 | 28 | |
| 29 | - $date_field = 'comment_date'; |
|
| 30 | - if ( 'gmt' === $timezone ) { |
|
| 31 | - $date_field = 'comment_date_gmt'; |
|
| 32 | - } |
|
| 29 | + $date_field = 'comment_date'; |
|
| 30 | + if ( 'gmt' === $timezone ) { |
|
| 31 | + $date_field = 'comment_date_gmt'; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - return $wpdb->get_var( |
|
| 35 | - $wpdb->prepare( |
|
| 36 | - "SELECT comment_post_ID FROM $wpdb->comments |
|
| 34 | + return $wpdb->get_var( |
|
| 35 | + $wpdb->prepare( |
|
| 36 | + "SELECT comment_post_ID FROM $wpdb->comments |
|
| 37 | 37 | WHERE comment_author = %s AND $date_field = %s", |
| 38 | - stripslashes( $comment_author ), |
|
| 39 | - stripslashes( $comment_date ) |
|
| 40 | - ) |
|
| 41 | - ); |
|
| 38 | + stripslashes( $comment_author ), |
|
| 39 | + stripslashes( $comment_date ) |
|
| 40 | + ) |
|
| 41 | + ); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -51,52 +51,52 @@ discard block |
||
| 51 | 51 | * A WP_Error object on failure. |
| 52 | 52 | */ |
| 53 | 53 | function edit_comment() { |
| 54 | - if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) ) { |
|
| 55 | - wp_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) ); |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - if ( isset( $_POST['newcomment_author'] ) ) { |
|
| 59 | - $_POST['comment_author'] = $_POST['newcomment_author']; |
|
| 60 | - } |
|
| 61 | - if ( isset( $_POST['newcomment_author_email'] ) ) { |
|
| 62 | - $_POST['comment_author_email'] = $_POST['newcomment_author_email']; |
|
| 63 | - } |
|
| 64 | - if ( isset( $_POST['newcomment_author_url'] ) ) { |
|
| 65 | - $_POST['comment_author_url'] = $_POST['newcomment_author_url']; |
|
| 66 | - } |
|
| 67 | - if ( isset( $_POST['comment_status'] ) ) { |
|
| 68 | - $_POST['comment_approved'] = $_POST['comment_status']; |
|
| 69 | - } |
|
| 70 | - if ( isset( $_POST['content'] ) ) { |
|
| 71 | - $_POST['comment_content'] = $_POST['content']; |
|
| 72 | - } |
|
| 73 | - if ( isset( $_POST['comment_ID'] ) ) { |
|
| 74 | - $_POST['comment_ID'] = (int) $_POST['comment_ID']; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) { |
|
| 78 | - if ( ! empty( $_POST[ 'hidden_' . $timeunit ] ) && $_POST[ 'hidden_' . $timeunit ] !== $_POST[ $timeunit ] ) { |
|
| 79 | - $_POST['edit_date'] = '1'; |
|
| 80 | - break; |
|
| 81 | - } |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - if ( ! empty( $_POST['edit_date'] ) ) { |
|
| 85 | - $aa = $_POST['aa']; |
|
| 86 | - $mm = $_POST['mm']; |
|
| 87 | - $jj = $_POST['jj']; |
|
| 88 | - $hh = $_POST['hh']; |
|
| 89 | - $mn = $_POST['mn']; |
|
| 90 | - $ss = $_POST['ss']; |
|
| 91 | - $jj = ( $jj > 31 ) ? 31 : $jj; |
|
| 92 | - $hh = ( $hh > 23 ) ? $hh - 24 : $hh; |
|
| 93 | - $mn = ( $mn > 59 ) ? $mn - 60 : $mn; |
|
| 94 | - $ss = ( $ss > 59 ) ? $ss - 60 : $ss; |
|
| 95 | - |
|
| 96 | - $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss"; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - return wp_update_comment( $_POST, true ); |
|
| 54 | + if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) ) { |
|
| 55 | + wp_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) ); |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + if ( isset( $_POST['newcomment_author'] ) ) { |
|
| 59 | + $_POST['comment_author'] = $_POST['newcomment_author']; |
|
| 60 | + } |
|
| 61 | + if ( isset( $_POST['newcomment_author_email'] ) ) { |
|
| 62 | + $_POST['comment_author_email'] = $_POST['newcomment_author_email']; |
|
| 63 | + } |
|
| 64 | + if ( isset( $_POST['newcomment_author_url'] ) ) { |
|
| 65 | + $_POST['comment_author_url'] = $_POST['newcomment_author_url']; |
|
| 66 | + } |
|
| 67 | + if ( isset( $_POST['comment_status'] ) ) { |
|
| 68 | + $_POST['comment_approved'] = $_POST['comment_status']; |
|
| 69 | + } |
|
| 70 | + if ( isset( $_POST['content'] ) ) { |
|
| 71 | + $_POST['comment_content'] = $_POST['content']; |
|
| 72 | + } |
|
| 73 | + if ( isset( $_POST['comment_ID'] ) ) { |
|
| 74 | + $_POST['comment_ID'] = (int) $_POST['comment_ID']; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) { |
|
| 78 | + if ( ! empty( $_POST[ 'hidden_' . $timeunit ] ) && $_POST[ 'hidden_' . $timeunit ] !== $_POST[ $timeunit ] ) { |
|
| 79 | + $_POST['edit_date'] = '1'; |
|
| 80 | + break; |
|
| 81 | + } |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + if ( ! empty( $_POST['edit_date'] ) ) { |
|
| 85 | + $aa = $_POST['aa']; |
|
| 86 | + $mm = $_POST['mm']; |
|
| 87 | + $jj = $_POST['jj']; |
|
| 88 | + $hh = $_POST['hh']; |
|
| 89 | + $mn = $_POST['mn']; |
|
| 90 | + $ss = $_POST['ss']; |
|
| 91 | + $jj = ( $jj > 31 ) ? 31 : $jj; |
|
| 92 | + $hh = ( $hh > 23 ) ? $hh - 24 : $hh; |
|
| 93 | + $mn = ( $mn > 59 ) ? $mn - 60 : $mn; |
|
| 94 | + $ss = ( $ss > 59 ) ? $ss - 60 : $ss; |
|
| 95 | + |
|
| 96 | + $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss"; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + return wp_update_comment( $_POST, true ); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -108,30 +108,30 @@ discard block |
||
| 108 | 108 | * @return WP_Comment|false Comment if found. False on failure. |
| 109 | 109 | */ |
| 110 | 110 | function get_comment_to_edit( $id ) { |
| 111 | - $comment = get_comment( $id ); |
|
| 112 | - if ( ! $comment ) { |
|
| 113 | - return false; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - $comment->comment_ID = (int) $comment->comment_ID; |
|
| 117 | - $comment->comment_post_ID = (int) $comment->comment_post_ID; |
|
| 118 | - |
|
| 119 | - $comment->comment_content = format_to_edit( $comment->comment_content ); |
|
| 120 | - /** |
|
| 121 | - * Filters the comment content before editing. |
|
| 122 | - * |
|
| 123 | - * @since 2.0.0 |
|
| 124 | - * |
|
| 125 | - * @param string $comment_content Comment content. |
|
| 126 | - */ |
|
| 127 | - $comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content ); |
|
| 128 | - |
|
| 129 | - $comment->comment_author = format_to_edit( $comment->comment_author ); |
|
| 130 | - $comment->comment_author_email = format_to_edit( $comment->comment_author_email ); |
|
| 131 | - $comment->comment_author_url = format_to_edit( $comment->comment_author_url ); |
|
| 132 | - $comment->comment_author_url = esc_url( $comment->comment_author_url ); |
|
| 133 | - |
|
| 134 | - return $comment; |
|
| 111 | + $comment = get_comment( $id ); |
|
| 112 | + if ( ! $comment ) { |
|
| 113 | + return false; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + $comment->comment_ID = (int) $comment->comment_ID; |
|
| 117 | + $comment->comment_post_ID = (int) $comment->comment_post_ID; |
|
| 118 | + |
|
| 119 | + $comment->comment_content = format_to_edit( $comment->comment_content ); |
|
| 120 | + /** |
|
| 121 | + * Filters the comment content before editing. |
|
| 122 | + * |
|
| 123 | + * @since 2.0.0 |
|
| 124 | + * |
|
| 125 | + * @param string $comment_content Comment content. |
|
| 126 | + */ |
|
| 127 | + $comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content ); |
|
| 128 | + |
|
| 129 | + $comment->comment_author = format_to_edit( $comment->comment_author ); |
|
| 130 | + $comment->comment_author_email = format_to_edit( $comment->comment_author_email ); |
|
| 131 | + $comment->comment_author_url = format_to_edit( $comment->comment_author_url ); |
|
| 132 | + $comment->comment_author_url = esc_url( $comment->comment_author_url ); |
|
| 133 | + |
|
| 134 | + return $comment; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -145,42 +145,42 @@ discard block |
||
| 145 | 145 | * @return int|int[] Either a single Posts pending comments as an int or an array of ints keyed on the Post IDs |
| 146 | 146 | */ |
| 147 | 147 | function get_pending_comments_num( $post_id ) { |
| 148 | - global $wpdb; |
|
| 149 | - |
|
| 150 | - $single = false; |
|
| 151 | - if ( ! is_array( $post_id ) ) { |
|
| 152 | - $post_id_array = (array) $post_id; |
|
| 153 | - $single = true; |
|
| 154 | - } else { |
|
| 155 | - $post_id_array = $post_id; |
|
| 156 | - } |
|
| 157 | - $post_id_array = array_map( 'intval', $post_id_array ); |
|
| 158 | - $post_id_in = "'" . implode( "', '", $post_id_array ) . "'"; |
|
| 159 | - |
|
| 160 | - $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_A ); |
|
| 161 | - |
|
| 162 | - if ( $single ) { |
|
| 163 | - if ( empty( $pending ) ) { |
|
| 164 | - return 0; |
|
| 165 | - } else { |
|
| 166 | - return absint( $pending[0]['num_comments'] ); |
|
| 167 | - } |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - $pending_keyed = array(); |
|
| 171 | - |
|
| 172 | - // Default to zero pending for all posts in request. |
|
| 173 | - foreach ( $post_id_array as $id ) { |
|
| 174 | - $pending_keyed[ $id ] = 0; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - if ( ! empty( $pending ) ) { |
|
| 178 | - foreach ( $pending as $pend ) { |
|
| 179 | - $pending_keyed[ $pend['comment_post_ID'] ] = absint( $pend['num_comments'] ); |
|
| 180 | - } |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - return $pending_keyed; |
|
| 148 | + global $wpdb; |
|
| 149 | + |
|
| 150 | + $single = false; |
|
| 151 | + if ( ! is_array( $post_id ) ) { |
|
| 152 | + $post_id_array = (array) $post_id; |
|
| 153 | + $single = true; |
|
| 154 | + } else { |
|
| 155 | + $post_id_array = $post_id; |
|
| 156 | + } |
|
| 157 | + $post_id_array = array_map( 'intval', $post_id_array ); |
|
| 158 | + $post_id_in = "'" . implode( "', '", $post_id_array ) . "'"; |
|
| 159 | + |
|
| 160 | + $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_A ); |
|
| 161 | + |
|
| 162 | + if ( $single ) { |
|
| 163 | + if ( empty( $pending ) ) { |
|
| 164 | + return 0; |
|
| 165 | + } else { |
|
| 166 | + return absint( $pending[0]['num_comments'] ); |
|
| 167 | + } |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + $pending_keyed = array(); |
|
| 171 | + |
|
| 172 | + // Default to zero pending for all posts in request. |
|
| 173 | + foreach ( $post_id_array as $id ) { |
|
| 174 | + $pending_keyed[ $id ] = 0; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + if ( ! empty( $pending ) ) { |
|
| 178 | + foreach ( $pending as $pend ) { |
|
| 179 | + $pending_keyed[ $pend['comment_post_ID'] ] = absint( $pend['num_comments'] ); |
|
| 180 | + } |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + return $pending_keyed; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -192,17 +192,17 @@ discard block |
||
| 192 | 192 | * @return string Avatar with the user name. |
| 193 | 193 | */ |
| 194 | 194 | function floated_admin_avatar( $name ) { |
| 195 | - $avatar = get_avatar( get_comment(), 32, 'mystery' ); |
|
| 196 | - return "$avatar $name"; |
|
| 195 | + $avatar = get_avatar( get_comment(), 32, 'mystery' ); |
|
| 196 | + return "$avatar $name"; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | 200 | * @since 2.7.0 |
| 201 | 201 | */ |
| 202 | 202 | function enqueue_comment_hotkeys_js() { |
| 203 | - if ( 'true' === get_user_option( 'comment_shortcuts' ) ) { |
|
| 204 | - wp_enqueue_script( 'jquery-table-hotkeys' ); |
|
| 205 | - } |
|
| 203 | + if ( 'true' === get_user_option( 'comment_shortcuts' ) ) { |
|
| 204 | + wp_enqueue_script( 'jquery-table-hotkeys' ); |
|
| 205 | + } |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @param string $msg Error Message. Assumed to contain HTML and be sanitized. |
| 212 | 212 | */ |
| 213 | 213 | function comment_footer_die( $msg ) { |
| 214 | - echo "<div class='wrap'><p>$msg</p></div>"; |
|
| 215 | - require_once ABSPATH . 'wp-admin/admin-footer.php'; |
|
| 216 | - die; |
|
| 214 | + echo "<div class='wrap'><p>$msg</p></div>"; |
|
| 215 | + require_once ABSPATH . 'wp-admin/admin-footer.php'; |
|
| 216 | + die; |
|
| 217 | 217 | } |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | * @param string $timezone Timezone. Accepts 'blog' or 'gmt'. Default 'blog'. |
| 24 | 24 | * @return string|null Comment post ID on success. |
| 25 | 25 | */ |
| 26 | -function comment_exists( $comment_author, $comment_date, $timezone = 'blog' ) { |
|
| 26 | +function comment_exists($comment_author, $comment_date, $timezone = 'blog') { |
|
| 27 | 27 | global $wpdb; |
| 28 | 28 | |
| 29 | 29 | $date_field = 'comment_date'; |
| 30 | - if ( 'gmt' === $timezone ) { |
|
| 30 | + if ('gmt' === $timezone) { |
|
| 31 | 31 | $date_field = 'comment_date_gmt'; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | $wpdb->prepare( |
| 36 | 36 | "SELECT comment_post_ID FROM $wpdb->comments |
| 37 | 37 | WHERE comment_author = %s AND $date_field = %s", |
| 38 | - stripslashes( $comment_author ), |
|
| 39 | - stripslashes( $comment_date ) |
|
| 38 | + stripslashes($comment_author), |
|
| 39 | + stripslashes($comment_date) |
|
| 40 | 40 | ) |
| 41 | 41 | ); |
| 42 | 42 | } |
@@ -51,52 +51,52 @@ discard block |
||
| 51 | 51 | * A WP_Error object on failure. |
| 52 | 52 | */ |
| 53 | 53 | function edit_comment() { |
| 54 | - if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) ) { |
|
| 55 | - wp_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) ); |
|
| 54 | + if (!current_user_can('edit_comment', (int) $_POST['comment_ID'])) { |
|
| 55 | + wp_die(__('Sorry, you are not allowed to edit comments on this post.')); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if ( isset( $_POST['newcomment_author'] ) ) { |
|
| 58 | + if (isset($_POST['newcomment_author'])) { |
|
| 59 | 59 | $_POST['comment_author'] = $_POST['newcomment_author']; |
| 60 | 60 | } |
| 61 | - if ( isset( $_POST['newcomment_author_email'] ) ) { |
|
| 61 | + if (isset($_POST['newcomment_author_email'])) { |
|
| 62 | 62 | $_POST['comment_author_email'] = $_POST['newcomment_author_email']; |
| 63 | 63 | } |
| 64 | - if ( isset( $_POST['newcomment_author_url'] ) ) { |
|
| 64 | + if (isset($_POST['newcomment_author_url'])) { |
|
| 65 | 65 | $_POST['comment_author_url'] = $_POST['newcomment_author_url']; |
| 66 | 66 | } |
| 67 | - if ( isset( $_POST['comment_status'] ) ) { |
|
| 67 | + if (isset($_POST['comment_status'])) { |
|
| 68 | 68 | $_POST['comment_approved'] = $_POST['comment_status']; |
| 69 | 69 | } |
| 70 | - if ( isset( $_POST['content'] ) ) { |
|
| 70 | + if (isset($_POST['content'])) { |
|
| 71 | 71 | $_POST['comment_content'] = $_POST['content']; |
| 72 | 72 | } |
| 73 | - if ( isset( $_POST['comment_ID'] ) ) { |
|
| 73 | + if (isset($_POST['comment_ID'])) { |
|
| 74 | 74 | $_POST['comment_ID'] = (int) $_POST['comment_ID']; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) { |
|
| 78 | - if ( ! empty( $_POST[ 'hidden_' . $timeunit ] ) && $_POST[ 'hidden_' . $timeunit ] !== $_POST[ $timeunit ] ) { |
|
| 77 | + foreach (array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit) { |
|
| 78 | + if (!empty($_POST['hidden_' . $timeunit]) && $_POST['hidden_' . $timeunit] !== $_POST[$timeunit]) { |
|
| 79 | 79 | $_POST['edit_date'] = '1'; |
| 80 | 80 | break; |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if ( ! empty( $_POST['edit_date'] ) ) { |
|
| 84 | + if (!empty($_POST['edit_date'])) { |
|
| 85 | 85 | $aa = $_POST['aa']; |
| 86 | 86 | $mm = $_POST['mm']; |
| 87 | 87 | $jj = $_POST['jj']; |
| 88 | 88 | $hh = $_POST['hh']; |
| 89 | 89 | $mn = $_POST['mn']; |
| 90 | 90 | $ss = $_POST['ss']; |
| 91 | - $jj = ( $jj > 31 ) ? 31 : $jj; |
|
| 92 | - $hh = ( $hh > 23 ) ? $hh - 24 : $hh; |
|
| 93 | - $mn = ( $mn > 59 ) ? $mn - 60 : $mn; |
|
| 94 | - $ss = ( $ss > 59 ) ? $ss - 60 : $ss; |
|
| 91 | + $jj = ($jj > 31) ? 31 : $jj; |
|
| 92 | + $hh = ($hh > 23) ? $hh - 24 : $hh; |
|
| 93 | + $mn = ($mn > 59) ? $mn - 60 : $mn; |
|
| 94 | + $ss = ($ss > 59) ? $ss - 60 : $ss; |
|
| 95 | 95 | |
| 96 | 96 | $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss"; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - return wp_update_comment( $_POST, true ); |
|
| 99 | + return wp_update_comment($_POST, true); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -107,16 +107,16 @@ discard block |
||
| 107 | 107 | * @param int $id ID of comment to retrieve. |
| 108 | 108 | * @return WP_Comment|false Comment if found. False on failure. |
| 109 | 109 | */ |
| 110 | -function get_comment_to_edit( $id ) { |
|
| 111 | - $comment = get_comment( $id ); |
|
| 112 | - if ( ! $comment ) { |
|
| 110 | +function get_comment_to_edit($id) { |
|
| 111 | + $comment = get_comment($id); |
|
| 112 | + if (!$comment) { |
|
| 113 | 113 | return false; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $comment->comment_ID = (int) $comment->comment_ID; |
| 117 | 117 | $comment->comment_post_ID = (int) $comment->comment_post_ID; |
| 118 | 118 | |
| 119 | - $comment->comment_content = format_to_edit( $comment->comment_content ); |
|
| 119 | + $comment->comment_content = format_to_edit($comment->comment_content); |
|
| 120 | 120 | /** |
| 121 | 121 | * Filters the comment content before editing. |
| 122 | 122 | * |
@@ -124,12 +124,12 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @param string $comment_content Comment content. |
| 126 | 126 | */ |
| 127 | - $comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content ); |
|
| 127 | + $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content); |
|
| 128 | 128 | |
| 129 | - $comment->comment_author = format_to_edit( $comment->comment_author ); |
|
| 130 | - $comment->comment_author_email = format_to_edit( $comment->comment_author_email ); |
|
| 131 | - $comment->comment_author_url = format_to_edit( $comment->comment_author_url ); |
|
| 132 | - $comment->comment_author_url = esc_url( $comment->comment_author_url ); |
|
| 129 | + $comment->comment_author = format_to_edit($comment->comment_author); |
|
| 130 | + $comment->comment_author_email = format_to_edit($comment->comment_author_email); |
|
| 131 | + $comment->comment_author_url = format_to_edit($comment->comment_author_url); |
|
| 132 | + $comment->comment_author_url = esc_url($comment->comment_author_url); |
|
| 133 | 133 | |
| 134 | 134 | return $comment; |
| 135 | 135 | } |
@@ -144,39 +144,39 @@ discard block |
||
| 144 | 144 | * @param int|int[] $post_id Either a single Post ID or an array of Post IDs |
| 145 | 145 | * @return int|int[] Either a single Posts pending comments as an int or an array of ints keyed on the Post IDs |
| 146 | 146 | */ |
| 147 | -function get_pending_comments_num( $post_id ) { |
|
| 147 | +function get_pending_comments_num($post_id) { |
|
| 148 | 148 | global $wpdb; |
| 149 | 149 | |
| 150 | 150 | $single = false; |
| 151 | - if ( ! is_array( $post_id ) ) { |
|
| 151 | + if (!is_array($post_id)) { |
|
| 152 | 152 | $post_id_array = (array) $post_id; |
| 153 | 153 | $single = true; |
| 154 | 154 | } else { |
| 155 | 155 | $post_id_array = $post_id; |
| 156 | 156 | } |
| 157 | - $post_id_array = array_map( 'intval', $post_id_array ); |
|
| 158 | - $post_id_in = "'" . implode( "', '", $post_id_array ) . "'"; |
|
| 157 | + $post_id_array = array_map('intval', $post_id_array); |
|
| 158 | + $post_id_in = "'" . implode("', '", $post_id_array) . "'"; |
|
| 159 | 159 | |
| 160 | - $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_A ); |
|
| 160 | + $pending = $wpdb->get_results("SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_A); |
|
| 161 | 161 | |
| 162 | - if ( $single ) { |
|
| 163 | - if ( empty( $pending ) ) { |
|
| 162 | + if ($single) { |
|
| 163 | + if (empty($pending)) { |
|
| 164 | 164 | return 0; |
| 165 | 165 | } else { |
| 166 | - return absint( $pending[0]['num_comments'] ); |
|
| 166 | + return absint($pending[0]['num_comments']); |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $pending_keyed = array(); |
| 171 | 171 | |
| 172 | 172 | // Default to zero pending for all posts in request. |
| 173 | - foreach ( $post_id_array as $id ) { |
|
| 174 | - $pending_keyed[ $id ] = 0; |
|
| 173 | + foreach ($post_id_array as $id) { |
|
| 174 | + $pending_keyed[$id] = 0; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if ( ! empty( $pending ) ) { |
|
| 178 | - foreach ( $pending as $pend ) { |
|
| 179 | - $pending_keyed[ $pend['comment_post_ID'] ] = absint( $pend['num_comments'] ); |
|
| 177 | + if (!empty($pending)) { |
|
| 178 | + foreach ($pending as $pend) { |
|
| 179 | + $pending_keyed[$pend['comment_post_ID']] = absint($pend['num_comments']); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | |
@@ -191,8 +191,8 @@ discard block |
||
| 191 | 191 | * @param string $name User name. |
| 192 | 192 | * @return string Avatar with the user name. |
| 193 | 193 | */ |
| 194 | -function floated_admin_avatar( $name ) { |
|
| 195 | - $avatar = get_avatar( get_comment(), 32, 'mystery' ); |
|
| 194 | +function floated_admin_avatar($name) { |
|
| 195 | + $avatar = get_avatar(get_comment(), 32, 'mystery'); |
|
| 196 | 196 | return "$avatar $name"; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | * @since 2.7.0 |
| 201 | 201 | */ |
| 202 | 202 | function enqueue_comment_hotkeys_js() { |
| 203 | - if ( 'true' === get_user_option( 'comment_shortcuts' ) ) { |
|
| 204 | - wp_enqueue_script( 'jquery-table-hotkeys' ); |
|
| 203 | + if ('true' === get_user_option('comment_shortcuts')) { |
|
| 204 | + wp_enqueue_script('jquery-table-hotkeys'); |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * |
| 211 | 211 | * @param string $msg Error Message. Assumed to contain HTML and be sanitized. |
| 212 | 212 | */ |
| 213 | -function comment_footer_die( $msg ) { |
|
| 213 | +function comment_footer_die($msg) { |
|
| 214 | 214 | echo "<div class='wrap'><p>$msg</p></div>"; |
| 215 | 215 | require_once ABSPATH . 'wp-admin/admin-footer.php'; |
| 216 | 216 | die; |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * @deprecated 3.0.0 |
| 17 | 17 | */ |
| 18 | 18 | function wpmu_menu() { |
| 19 | - _deprecated_function( __FUNCTION__, '3.0.0' ); |
|
| 20 | - // Deprecated. See #11763. |
|
| 19 | + _deprecated_function( __FUNCTION__, '3.0.0' ); |
|
| 20 | + // Deprecated. See #11763. |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | * @see is_upload_space_available() |
| 28 | 28 | */ |
| 29 | 29 | function wpmu_checkAvailableSpace() { |
| 30 | - _deprecated_function( __FUNCTION__, '3.0.0', 'is_upload_space_available()' ); |
|
| 30 | + _deprecated_function( __FUNCTION__, '3.0.0', 'is_upload_space_available()' ); |
|
| 31 | 31 | |
| 32 | - if ( ! is_upload_space_available() ) { |
|
| 33 | - wp_die( sprintf( |
|
| 34 | - /* translators: %s: Allowed space allocation. */ |
|
| 35 | - __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ), |
|
| 36 | - size_format( get_space_allowed() * MB_IN_BYTES ) |
|
| 37 | - ) ); |
|
| 38 | - } |
|
| 32 | + if ( ! is_upload_space_available() ) { |
|
| 33 | + wp_die( sprintf( |
|
| 34 | + /* translators: %s: Allowed space allocation. */ |
|
| 35 | + __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ), |
|
| 36 | + size_format( get_space_allowed() * MB_IN_BYTES ) |
|
| 37 | + ) ); |
|
| 38 | + } |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | * @deprecated 3.0.0 |
| 45 | 45 | */ |
| 46 | 46 | function mu_options( $options ) { |
| 47 | - _deprecated_function( __FUNCTION__, '3.0.0' ); |
|
| 48 | - return $options; |
|
| 47 | + _deprecated_function( __FUNCTION__, '3.0.0' ); |
|
| 48 | + return $options; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | * @see activate_plugin() |
| 56 | 56 | */ |
| 57 | 57 | function activate_sitewide_plugin() { |
| 58 | - _deprecated_function( __FUNCTION__, '3.0.0', 'activate_plugin()' ); |
|
| 59 | - return false; |
|
| 58 | + _deprecated_function( __FUNCTION__, '3.0.0', 'activate_plugin()' ); |
|
| 59 | + return false; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @see deactivate_plugin() |
| 67 | 67 | */ |
| 68 | 68 | function deactivate_sitewide_plugin( $plugin = false ) { |
| 69 | - _deprecated_function( __FUNCTION__, '3.0.0', 'deactivate_plugin()' ); |
|
| 69 | + _deprecated_function( __FUNCTION__, '3.0.0', 'deactivate_plugin()' ); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | * @see is_network_only_plugin() |
| 77 | 77 | */ |
| 78 | 78 | function is_wpmu_sitewide_plugin( $file ) { |
| 79 | - _deprecated_function( __FUNCTION__, '3.0.0', 'is_network_only_plugin()' ); |
|
| 80 | - return is_network_only_plugin( $file ); |
|
| 79 | + _deprecated_function( __FUNCTION__, '3.0.0', 'is_network_only_plugin()' ); |
|
| 80 | + return is_network_only_plugin( $file ); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | * @see WP_Theme::get_allowed_on_network() |
| 88 | 88 | */ |
| 89 | 89 | function get_site_allowed_themes() { |
| 90 | - _deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_network()' ); |
|
| 91 | - return array_map( 'intval', WP_Theme::get_allowed_on_network() ); |
|
| 90 | + _deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_network()' ); |
|
| 91 | + return array_map( 'intval', WP_Theme::get_allowed_on_network() ); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | * @see WP_Theme::get_allowed_on_site() |
| 99 | 99 | */ |
| 100 | 100 | function wpmu_get_blog_allowedthemes( $blog_id = 0 ) { |
| 101 | - _deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_site()' ); |
|
| 102 | - return array_map( 'intval', WP_Theme::get_allowed_on_site( $blog_id ) ); |
|
| 101 | + _deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_site()' ); |
|
| 102 | + return array_map( 'intval', WP_Theme::get_allowed_on_site( $blog_id ) ); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @deprecated 3.0.0 |
| 17 | 17 | */ |
| 18 | 18 | function wpmu_menu() { |
| 19 | - _deprecated_function( __FUNCTION__, '3.0.0' ); |
|
| 19 | + _deprecated_function(__FUNCTION__, '3.0.0'); |
|
| 20 | 20 | // Deprecated. See #11763. |
| 21 | 21 | } |
| 22 | 22 | |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | * @see is_upload_space_available() |
| 28 | 28 | */ |
| 29 | 29 | function wpmu_checkAvailableSpace() { |
| 30 | - _deprecated_function( __FUNCTION__, '3.0.0', 'is_upload_space_available()' ); |
|
| 30 | + _deprecated_function(__FUNCTION__, '3.0.0', 'is_upload_space_available()'); |
|
| 31 | 31 | |
| 32 | - if ( ! is_upload_space_available() ) { |
|
| 33 | - wp_die( sprintf( |
|
| 32 | + if (!is_upload_space_available()) { |
|
| 33 | + wp_die(sprintf( |
|
| 34 | 34 | /* translators: %s: Allowed space allocation. */ |
| 35 | - __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ), |
|
| 36 | - size_format( get_space_allowed() * MB_IN_BYTES ) |
|
| 37 | - ) ); |
|
| 35 | + __('Sorry, you have used your space allocation of %s. Please delete some files to upload more files.'), |
|
| 36 | + size_format(get_space_allowed() * MB_IN_BYTES) |
|
| 37 | + )); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @deprecated 3.0.0 |
| 45 | 45 | */ |
| 46 | -function mu_options( $options ) { |
|
| 47 | - _deprecated_function( __FUNCTION__, '3.0.0' ); |
|
| 46 | +function mu_options($options) { |
|
| 47 | + _deprecated_function(__FUNCTION__, '3.0.0'); |
|
| 48 | 48 | return $options; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @see activate_plugin() |
| 56 | 56 | */ |
| 57 | 57 | function activate_sitewide_plugin() { |
| 58 | - _deprecated_function( __FUNCTION__, '3.0.0', 'activate_plugin()' ); |
|
| 58 | + _deprecated_function(__FUNCTION__, '3.0.0', 'activate_plugin()'); |
|
| 59 | 59 | return false; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | * @deprecated 3.0.0 Use deactivate_plugin() |
| 66 | 66 | * @see deactivate_plugin() |
| 67 | 67 | */ |
| 68 | -function deactivate_sitewide_plugin( $plugin = false ) { |
|
| 69 | - _deprecated_function( __FUNCTION__, '3.0.0', 'deactivate_plugin()' ); |
|
| 68 | +function deactivate_sitewide_plugin($plugin = false) { |
|
| 69 | + _deprecated_function(__FUNCTION__, '3.0.0', 'deactivate_plugin()'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | * @deprecated 3.0.0 Use is_network_only_plugin() |
| 76 | 76 | * @see is_network_only_plugin() |
| 77 | 77 | */ |
| 78 | -function is_wpmu_sitewide_plugin( $file ) { |
|
| 79 | - _deprecated_function( __FUNCTION__, '3.0.0', 'is_network_only_plugin()' ); |
|
| 80 | - return is_network_only_plugin( $file ); |
|
| 78 | +function is_wpmu_sitewide_plugin($file) { |
|
| 79 | + _deprecated_function(__FUNCTION__, '3.0.0', 'is_network_only_plugin()'); |
|
| 80 | + return is_network_only_plugin($file); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | * @see WP_Theme::get_allowed_on_network() |
| 88 | 88 | */ |
| 89 | 89 | function get_site_allowed_themes() { |
| 90 | - _deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_network()' ); |
|
| 91 | - return array_map( 'intval', WP_Theme::get_allowed_on_network() ); |
|
| 90 | + _deprecated_function(__FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_network()'); |
|
| 91 | + return array_map('intval', WP_Theme::get_allowed_on_network()); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | * @deprecated 3.4.0 Use WP_Theme::get_allowed_on_site() |
| 98 | 98 | * @see WP_Theme::get_allowed_on_site() |
| 99 | 99 | */ |
| 100 | -function wpmu_get_blog_allowedthemes( $blog_id = 0 ) { |
|
| 101 | - _deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_site()' ); |
|
| 102 | - return array_map( 'intval', WP_Theme::get_allowed_on_site( $blog_id ) ); |
|
| 100 | +function wpmu_get_blog_allowedthemes($blog_id = 0) { |
|
| 101 | + _deprecated_function(__FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_site()'); |
|
| 102 | + return array_map('intval', WP_Theme::get_allowed_on_site($blog_id)); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -9,539 +9,539 @@ |
||
| 9 | 9 | * @since 2.8.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -__( 'Africa', 'continents-cities' ); |
|
| 13 | -__( 'Abidjan', 'continents-cities' ); |
|
| 14 | -__( 'Accra', 'continents-cities' ); |
|
| 15 | -__( 'Addis Ababa', 'continents-cities' ); |
|
| 16 | -__( 'Algiers', 'continents-cities' ); |
|
| 17 | -__( 'Asmara', 'continents-cities' ); |
|
| 18 | -__( 'Asmera', 'continents-cities' ); |
|
| 19 | -__( 'Bamako', 'continents-cities' ); |
|
| 20 | -__( 'Bangui', 'continents-cities' ); |
|
| 21 | -__( 'Banjul', 'continents-cities' ); |
|
| 22 | -__( 'Bissau', 'continents-cities' ); |
|
| 23 | -__( 'Blantyre', 'continents-cities' ); |
|
| 24 | -__( 'Brazzaville', 'continents-cities' ); |
|
| 25 | -__( 'Bujumbura', 'continents-cities' ); |
|
| 26 | -__( 'Cairo', 'continents-cities' ); |
|
| 27 | -__( 'Casablanca', 'continents-cities' ); |
|
| 28 | -__( 'Ceuta', 'continents-cities' ); |
|
| 29 | -__( 'Conakry', 'continents-cities' ); |
|
| 30 | -__( 'Dakar', 'continents-cities' ); |
|
| 31 | -__( 'Dar es Salaam', 'continents-cities' ); |
|
| 32 | -__( 'Djibouti', 'continents-cities' ); |
|
| 33 | -__( 'Douala', 'continents-cities' ); |
|
| 34 | -__( 'El Aaiun', 'continents-cities' ); |
|
| 35 | -__( 'Freetown', 'continents-cities' ); |
|
| 36 | -__( 'Gaborone', 'continents-cities' ); |
|
| 37 | -__( 'Harare', 'continents-cities' ); |
|
| 38 | -__( 'Johannesburg', 'continents-cities' ); |
|
| 39 | -__( 'Juba', 'continents-cities' ); |
|
| 40 | -__( 'Kampala', 'continents-cities' ); |
|
| 41 | -__( 'Khartoum', 'continents-cities' ); |
|
| 42 | -__( 'Kigali', 'continents-cities' ); |
|
| 43 | -__( 'Kinshasa', 'continents-cities' ); |
|
| 44 | -__( 'Lagos', 'continents-cities' ); |
|
| 45 | -__( 'Libreville', 'continents-cities' ); |
|
| 46 | -__( 'Lome', 'continents-cities' ); |
|
| 47 | -__( 'Luanda', 'continents-cities' ); |
|
| 48 | -__( 'Lubumbashi', 'continents-cities' ); |
|
| 49 | -__( 'Lusaka', 'continents-cities' ); |
|
| 50 | -__( 'Malabo', 'continents-cities' ); |
|
| 51 | -__( 'Maputo', 'continents-cities' ); |
|
| 52 | -__( 'Maseru', 'continents-cities' ); |
|
| 53 | -__( 'Mbabane', 'continents-cities' ); |
|
| 54 | -__( 'Mogadishu', 'continents-cities' ); |
|
| 55 | -__( 'Monrovia', 'continents-cities' ); |
|
| 56 | -__( 'Nairobi', 'continents-cities' ); |
|
| 57 | -__( 'Ndjamena', 'continents-cities' ); |
|
| 58 | -__( 'Niamey', 'continents-cities' ); |
|
| 59 | -__( 'Nouakchott', 'continents-cities' ); |
|
| 60 | -__( 'Ouagadougou', 'continents-cities' ); |
|
| 61 | -__( 'Porto-Novo', 'continents-cities' ); |
|
| 62 | -__( 'Sao Tome', 'continents-cities' ); |
|
| 63 | -__( 'Timbuktu', 'continents-cities' ); |
|
| 64 | -__( 'Tripoli', 'continents-cities' ); |
|
| 65 | -__( 'Tunis', 'continents-cities' ); |
|
| 66 | -__( 'Windhoek', 'continents-cities' ); |
|
| 12 | +__('Africa', 'continents-cities'); |
|
| 13 | +__('Abidjan', 'continents-cities'); |
|
| 14 | +__('Accra', 'continents-cities'); |
|
| 15 | +__('Addis Ababa', 'continents-cities'); |
|
| 16 | +__('Algiers', 'continents-cities'); |
|
| 17 | +__('Asmara', 'continents-cities'); |
|
| 18 | +__('Asmera', 'continents-cities'); |
|
| 19 | +__('Bamako', 'continents-cities'); |
|
| 20 | +__('Bangui', 'continents-cities'); |
|
| 21 | +__('Banjul', 'continents-cities'); |
|
| 22 | +__('Bissau', 'continents-cities'); |
|
| 23 | +__('Blantyre', 'continents-cities'); |
|
| 24 | +__('Brazzaville', 'continents-cities'); |
|
| 25 | +__('Bujumbura', 'continents-cities'); |
|
| 26 | +__('Cairo', 'continents-cities'); |
|
| 27 | +__('Casablanca', 'continents-cities'); |
|
| 28 | +__('Ceuta', 'continents-cities'); |
|
| 29 | +__('Conakry', 'continents-cities'); |
|
| 30 | +__('Dakar', 'continents-cities'); |
|
| 31 | +__('Dar es Salaam', 'continents-cities'); |
|
| 32 | +__('Djibouti', 'continents-cities'); |
|
| 33 | +__('Douala', 'continents-cities'); |
|
| 34 | +__('El Aaiun', 'continents-cities'); |
|
| 35 | +__('Freetown', 'continents-cities'); |
|
| 36 | +__('Gaborone', 'continents-cities'); |
|
| 37 | +__('Harare', 'continents-cities'); |
|
| 38 | +__('Johannesburg', 'continents-cities'); |
|
| 39 | +__('Juba', 'continents-cities'); |
|
| 40 | +__('Kampala', 'continents-cities'); |
|
| 41 | +__('Khartoum', 'continents-cities'); |
|
| 42 | +__('Kigali', 'continents-cities'); |
|
| 43 | +__('Kinshasa', 'continents-cities'); |
|
| 44 | +__('Lagos', 'continents-cities'); |
|
| 45 | +__('Libreville', 'continents-cities'); |
|
| 46 | +__('Lome', 'continents-cities'); |
|
| 47 | +__('Luanda', 'continents-cities'); |
|
| 48 | +__('Lubumbashi', 'continents-cities'); |
|
| 49 | +__('Lusaka', 'continents-cities'); |
|
| 50 | +__('Malabo', 'continents-cities'); |
|
| 51 | +__('Maputo', 'continents-cities'); |
|
| 52 | +__('Maseru', 'continents-cities'); |
|
| 53 | +__('Mbabane', 'continents-cities'); |
|
| 54 | +__('Mogadishu', 'continents-cities'); |
|
| 55 | +__('Monrovia', 'continents-cities'); |
|
| 56 | +__('Nairobi', 'continents-cities'); |
|
| 57 | +__('Ndjamena', 'continents-cities'); |
|
| 58 | +__('Niamey', 'continents-cities'); |
|
| 59 | +__('Nouakchott', 'continents-cities'); |
|
| 60 | +__('Ouagadougou', 'continents-cities'); |
|
| 61 | +__('Porto-Novo', 'continents-cities'); |
|
| 62 | +__('Sao Tome', 'continents-cities'); |
|
| 63 | +__('Timbuktu', 'continents-cities'); |
|
| 64 | +__('Tripoli', 'continents-cities'); |
|
| 65 | +__('Tunis', 'continents-cities'); |
|
| 66 | +__('Windhoek', 'continents-cities'); |
|
| 67 | 67 | |
| 68 | -__( 'America', 'continents-cities' ); |
|
| 69 | -__( 'Adak', 'continents-cities' ); |
|
| 70 | -__( 'Anchorage', 'continents-cities' ); |
|
| 71 | -__( 'Anguilla', 'continents-cities' ); |
|
| 72 | -__( 'Antigua', 'continents-cities' ); |
|
| 73 | -__( 'Araguaina', 'continents-cities' ); |
|
| 74 | -__( 'Argentina', 'continents-cities' ); |
|
| 75 | -__( 'Buenos Aires', 'continents-cities' ); |
|
| 76 | -__( 'Catamarca', 'continents-cities' ); |
|
| 77 | -__( 'ComodRivadavia', 'continents-cities' ); |
|
| 78 | -__( 'Cordoba', 'continents-cities' ); |
|
| 79 | -__( 'Jujuy', 'continents-cities' ); |
|
| 80 | -__( 'La Rioja', 'continents-cities' ); |
|
| 81 | -__( 'Mendoza', 'continents-cities' ); |
|
| 82 | -__( 'Rio Gallegos', 'continents-cities' ); |
|
| 83 | -__( 'Salta', 'continents-cities' ); |
|
| 84 | -__( 'San Juan', 'continents-cities' ); |
|
| 85 | -__( 'San Luis', 'continents-cities' ); |
|
| 86 | -__( 'Tucuman', 'continents-cities' ); |
|
| 87 | -__( 'Ushuaia', 'continents-cities' ); |
|
| 88 | -__( 'Aruba', 'continents-cities' ); |
|
| 89 | -__( 'Asuncion', 'continents-cities' ); |
|
| 90 | -__( 'Atikokan', 'continents-cities' ); |
|
| 91 | -__( 'Atka', 'continents-cities' ); |
|
| 92 | -__( 'Bahia', 'continents-cities' ); |
|
| 93 | -__( 'Bahia Banderas', 'continents-cities' ); |
|
| 94 | -__( 'Barbados', 'continents-cities' ); |
|
| 95 | -__( 'Belem', 'continents-cities' ); |
|
| 96 | -__( 'Belize', 'continents-cities' ); |
|
| 97 | -__( 'Blanc-Sablon', 'continents-cities' ); |
|
| 98 | -__( 'Boa Vista', 'continents-cities' ); |
|
| 99 | -__( 'Bogota', 'continents-cities' ); |
|
| 100 | -__( 'Boise', 'continents-cities' ); |
|
| 101 | -__( 'Cambridge Bay', 'continents-cities' ); |
|
| 102 | -__( 'Campo Grande', 'continents-cities' ); |
|
| 103 | -__( 'Cancun', 'continents-cities' ); |
|
| 104 | -__( 'Caracas', 'continents-cities' ); |
|
| 105 | -__( 'Cayenne', 'continents-cities' ); |
|
| 106 | -__( 'Cayman', 'continents-cities' ); |
|
| 107 | -__( 'Chicago', 'continents-cities' ); |
|
| 108 | -__( 'Chihuahua', 'continents-cities' ); |
|
| 109 | -__( 'Coral Harbour', 'continents-cities' ); |
|
| 110 | -__( 'Costa Rica', 'continents-cities' ); |
|
| 111 | -__( 'Creston', 'continents-cities' ); |
|
| 112 | -__( 'Cuiaba', 'continents-cities' ); |
|
| 113 | -__( 'Curacao', 'continents-cities' ); |
|
| 114 | -__( 'Danmarkshavn', 'continents-cities' ); |
|
| 115 | -__( 'Dawson', 'continents-cities' ); |
|
| 116 | -__( 'Dawson Creek', 'continents-cities' ); |
|
| 117 | -__( 'Denver', 'continents-cities' ); |
|
| 118 | -__( 'Detroit', 'continents-cities' ); |
|
| 119 | -__( 'Dominica', 'continents-cities' ); |
|
| 120 | -__( 'Edmonton', 'continents-cities' ); |
|
| 121 | -__( 'Eirunepe', 'continents-cities' ); |
|
| 122 | -__( 'El Salvador', 'continents-cities' ); |
|
| 123 | -__( 'Ensenada', 'continents-cities' ); |
|
| 124 | -__( 'Fort Nelson', 'continents-cities' ); |
|
| 125 | -__( 'Fort Wayne', 'continents-cities' ); |
|
| 126 | -__( 'Fortaleza', 'continents-cities' ); |
|
| 127 | -__( 'Glace Bay', 'continents-cities' ); |
|
| 128 | -__( 'Godthab', 'continents-cities' ); |
|
| 129 | -__( 'Goose Bay', 'continents-cities' ); |
|
| 130 | -__( 'Grand Turk', 'continents-cities' ); |
|
| 131 | -__( 'Grenada', 'continents-cities' ); |
|
| 132 | -__( 'Guadeloupe', 'continents-cities' ); |
|
| 133 | -__( 'Guatemala', 'continents-cities' ); |
|
| 134 | -__( 'Guayaquil', 'continents-cities' ); |
|
| 135 | -__( 'Guyana', 'continents-cities' ); |
|
| 136 | -__( 'Halifax', 'continents-cities' ); |
|
| 137 | -__( 'Havana', 'continents-cities' ); |
|
| 138 | -__( 'Hermosillo', 'continents-cities' ); |
|
| 139 | -__( 'Indiana', 'continents-cities' ); |
|
| 140 | -__( 'Indianapolis', 'continents-cities' ); |
|
| 141 | -__( 'Knox', 'continents-cities' ); |
|
| 142 | -__( 'Marengo', 'continents-cities' ); |
|
| 143 | -__( 'Petersburg', 'continents-cities' ); |
|
| 144 | -__( 'Tell City', 'continents-cities' ); |
|
| 145 | -__( 'Vevay', 'continents-cities' ); |
|
| 146 | -__( 'Vincennes', 'continents-cities' ); |
|
| 147 | -__( 'Winamac', 'continents-cities' ); |
|
| 148 | -__( 'Inuvik', 'continents-cities' ); |
|
| 149 | -__( 'Iqaluit', 'continents-cities' ); |
|
| 150 | -__( 'Jamaica', 'continents-cities' ); |
|
| 151 | -__( 'Juneau', 'continents-cities' ); |
|
| 152 | -__( 'Kentucky', 'continents-cities' ); |
|
| 153 | -__( 'Louisville', 'continents-cities' ); |
|
| 154 | -__( 'Monticello', 'continents-cities' ); |
|
| 155 | -__( 'Knox IN', 'continents-cities' ); |
|
| 156 | -__( 'Kralendijk', 'continents-cities' ); |
|
| 157 | -__( 'La Paz', 'continents-cities' ); |
|
| 158 | -__( 'Lima', 'continents-cities' ); |
|
| 159 | -__( 'Los Angeles', 'continents-cities' ); |
|
| 160 | -__( 'Lower Princes', 'continents-cities' ); |
|
| 161 | -__( 'Maceio', 'continents-cities' ); |
|
| 162 | -__( 'Managua', 'continents-cities' ); |
|
| 163 | -__( 'Manaus', 'continents-cities' ); |
|
| 164 | -__( 'Marigot', 'continents-cities' ); |
|
| 165 | -__( 'Martinique', 'continents-cities' ); |
|
| 166 | -__( 'Matamoros', 'continents-cities' ); |
|
| 167 | -__( 'Mazatlan', 'continents-cities' ); |
|
| 168 | -__( 'Menominee', 'continents-cities' ); |
|
| 169 | -__( 'Merida', 'continents-cities' ); |
|
| 170 | -__( 'Metlakatla', 'continents-cities' ); |
|
| 171 | -__( 'Mexico City', 'continents-cities' ); |
|
| 172 | -__( 'Miquelon', 'continents-cities' ); |
|
| 173 | -__( 'Moncton', 'continents-cities' ); |
|
| 174 | -__( 'Monterrey', 'continents-cities' ); |
|
| 175 | -__( 'Montevideo', 'continents-cities' ); |
|
| 176 | -__( 'Montreal', 'continents-cities' ); |
|
| 177 | -__( 'Montserrat', 'continents-cities' ); |
|
| 178 | -__( 'Nassau', 'continents-cities' ); |
|
| 179 | -__( 'New York', 'continents-cities' ); |
|
| 180 | -__( 'Nipigon', 'continents-cities' ); |
|
| 181 | -__( 'Nome', 'continents-cities' ); |
|
| 182 | -__( 'Noronha', 'continents-cities' ); |
|
| 183 | -__( 'North Dakota', 'continents-cities' ); |
|
| 184 | -__( 'Beulah', 'continents-cities' ); |
|
| 185 | -__( 'Center', 'continents-cities' ); |
|
| 186 | -__( 'New Salem', 'continents-cities' ); |
|
| 187 | -__( 'Nuuk', 'continents-cities' ); |
|
| 188 | -__( 'Ojinaga', 'continents-cities' ); |
|
| 189 | -__( 'Panama', 'continents-cities' ); |
|
| 190 | -__( 'Pangnirtung', 'continents-cities' ); |
|
| 191 | -__( 'Paramaribo', 'continents-cities' ); |
|
| 192 | -__( 'Phoenix', 'continents-cities' ); |
|
| 193 | -__( 'Port-au-Prince', 'continents-cities' ); |
|
| 194 | -__( 'Port of Spain', 'continents-cities' ); |
|
| 195 | -__( 'Porto Acre', 'continents-cities' ); |
|
| 196 | -__( 'Porto Velho', 'continents-cities' ); |
|
| 197 | -__( 'Puerto Rico', 'continents-cities' ); |
|
| 198 | -__( 'Punta Arenas', 'continents-cities' ); |
|
| 199 | -__( 'Rainy River', 'continents-cities' ); |
|
| 200 | -__( 'Rankin Inlet', 'continents-cities' ); |
|
| 201 | -__( 'Recife', 'continents-cities' ); |
|
| 202 | -__( 'Regina', 'continents-cities' ); |
|
| 203 | -__( 'Resolute', 'continents-cities' ); |
|
| 204 | -__( 'Rio Branco', 'continents-cities' ); |
|
| 205 | -__( 'Rosario', 'continents-cities' ); |
|
| 206 | -__( 'Santa Isabel', 'continents-cities' ); |
|
| 207 | -__( 'Santarem', 'continents-cities' ); |
|
| 208 | -__( 'Santiago', 'continents-cities' ); |
|
| 209 | -__( 'Santo Domingo', 'continents-cities' ); |
|
| 210 | -__( 'Sao Paulo', 'continents-cities' ); |
|
| 211 | -__( 'Scoresbysund', 'continents-cities' ); |
|
| 212 | -__( 'Shiprock', 'continents-cities' ); |
|
| 213 | -__( 'Sitka', 'continents-cities' ); |
|
| 214 | -__( 'St Barthelemy', 'continents-cities' ); |
|
| 215 | -__( 'St Johns', 'continents-cities' ); |
|
| 216 | -__( 'St Kitts', 'continents-cities' ); |
|
| 217 | -__( 'St Lucia', 'continents-cities' ); |
|
| 218 | -__( 'St Thomas', 'continents-cities' ); |
|
| 219 | -__( 'St Vincent', 'continents-cities' ); |
|
| 220 | -__( 'Swift Current', 'continents-cities' ); |
|
| 221 | -__( 'Tegucigalpa', 'continents-cities' ); |
|
| 222 | -__( 'Thule', 'continents-cities' ); |
|
| 223 | -__( 'Thunder Bay', 'continents-cities' ); |
|
| 224 | -__( 'Tijuana', 'continents-cities' ); |
|
| 225 | -__( 'Toronto', 'continents-cities' ); |
|
| 226 | -__( 'Tortola', 'continents-cities' ); |
|
| 227 | -__( 'Vancouver', 'continents-cities' ); |
|
| 228 | -__( 'Virgin', 'continents-cities' ); |
|
| 229 | -__( 'Whitehorse', 'continents-cities' ); |
|
| 230 | -__( 'Winnipeg', 'continents-cities' ); |
|
| 231 | -__( 'Yakutat', 'continents-cities' ); |
|
| 232 | -__( 'Yellowknife', 'continents-cities' ); |
|
| 68 | +__('America', 'continents-cities'); |
|
| 69 | +__('Adak', 'continents-cities'); |
|
| 70 | +__('Anchorage', 'continents-cities'); |
|
| 71 | +__('Anguilla', 'continents-cities'); |
|
| 72 | +__('Antigua', 'continents-cities'); |
|
| 73 | +__('Araguaina', 'continents-cities'); |
|
| 74 | +__('Argentina', 'continents-cities'); |
|
| 75 | +__('Buenos Aires', 'continents-cities'); |
|
| 76 | +__('Catamarca', 'continents-cities'); |
|
| 77 | +__('ComodRivadavia', 'continents-cities'); |
|
| 78 | +__('Cordoba', 'continents-cities'); |
|
| 79 | +__('Jujuy', 'continents-cities'); |
|
| 80 | +__('La Rioja', 'continents-cities'); |
|
| 81 | +__('Mendoza', 'continents-cities'); |
|
| 82 | +__('Rio Gallegos', 'continents-cities'); |
|
| 83 | +__('Salta', 'continents-cities'); |
|
| 84 | +__('San Juan', 'continents-cities'); |
|
| 85 | +__('San Luis', 'continents-cities'); |
|
| 86 | +__('Tucuman', 'continents-cities'); |
|
| 87 | +__('Ushuaia', 'continents-cities'); |
|
| 88 | +__('Aruba', 'continents-cities'); |
|
| 89 | +__('Asuncion', 'continents-cities'); |
|
| 90 | +__('Atikokan', 'continents-cities'); |
|
| 91 | +__('Atka', 'continents-cities'); |
|
| 92 | +__('Bahia', 'continents-cities'); |
|
| 93 | +__('Bahia Banderas', 'continents-cities'); |
|
| 94 | +__('Barbados', 'continents-cities'); |
|
| 95 | +__('Belem', 'continents-cities'); |
|
| 96 | +__('Belize', 'continents-cities'); |
|
| 97 | +__('Blanc-Sablon', 'continents-cities'); |
|
| 98 | +__('Boa Vista', 'continents-cities'); |
|
| 99 | +__('Bogota', 'continents-cities'); |
|
| 100 | +__('Boise', 'continents-cities'); |
|
| 101 | +__('Cambridge Bay', 'continents-cities'); |
|
| 102 | +__('Campo Grande', 'continents-cities'); |
|
| 103 | +__('Cancun', 'continents-cities'); |
|
| 104 | +__('Caracas', 'continents-cities'); |
|
| 105 | +__('Cayenne', 'continents-cities'); |
|
| 106 | +__('Cayman', 'continents-cities'); |
|
| 107 | +__('Chicago', 'continents-cities'); |
|
| 108 | +__('Chihuahua', 'continents-cities'); |
|
| 109 | +__('Coral Harbour', 'continents-cities'); |
|
| 110 | +__('Costa Rica', 'continents-cities'); |
|
| 111 | +__('Creston', 'continents-cities'); |
|
| 112 | +__('Cuiaba', 'continents-cities'); |
|
| 113 | +__('Curacao', 'continents-cities'); |
|
| 114 | +__('Danmarkshavn', 'continents-cities'); |
|
| 115 | +__('Dawson', 'continents-cities'); |
|
| 116 | +__('Dawson Creek', 'continents-cities'); |
|
| 117 | +__('Denver', 'continents-cities'); |
|
| 118 | +__('Detroit', 'continents-cities'); |
|
| 119 | +__('Dominica', 'continents-cities'); |
|
| 120 | +__('Edmonton', 'continents-cities'); |
|
| 121 | +__('Eirunepe', 'continents-cities'); |
|
| 122 | +__('El Salvador', 'continents-cities'); |
|
| 123 | +__('Ensenada', 'continents-cities'); |
|
| 124 | +__('Fort Nelson', 'continents-cities'); |
|
| 125 | +__('Fort Wayne', 'continents-cities'); |
|
| 126 | +__('Fortaleza', 'continents-cities'); |
|
| 127 | +__('Glace Bay', 'continents-cities'); |
|
| 128 | +__('Godthab', 'continents-cities'); |
|
| 129 | +__('Goose Bay', 'continents-cities'); |
|
| 130 | +__('Grand Turk', 'continents-cities'); |
|
| 131 | +__('Grenada', 'continents-cities'); |
|
| 132 | +__('Guadeloupe', 'continents-cities'); |
|
| 133 | +__('Guatemala', 'continents-cities'); |
|
| 134 | +__('Guayaquil', 'continents-cities'); |
|
| 135 | +__('Guyana', 'continents-cities'); |
|
| 136 | +__('Halifax', 'continents-cities'); |
|
| 137 | +__('Havana', 'continents-cities'); |
|
| 138 | +__('Hermosillo', 'continents-cities'); |
|
| 139 | +__('Indiana', 'continents-cities'); |
|
| 140 | +__('Indianapolis', 'continents-cities'); |
|
| 141 | +__('Knox', 'continents-cities'); |
|
| 142 | +__('Marengo', 'continents-cities'); |
|
| 143 | +__('Petersburg', 'continents-cities'); |
|
| 144 | +__('Tell City', 'continents-cities'); |
|
| 145 | +__('Vevay', 'continents-cities'); |
|
| 146 | +__('Vincennes', 'continents-cities'); |
|
| 147 | +__('Winamac', 'continents-cities'); |
|
| 148 | +__('Inuvik', 'continents-cities'); |
|
| 149 | +__('Iqaluit', 'continents-cities'); |
|
| 150 | +__('Jamaica', 'continents-cities'); |
|
| 151 | +__('Juneau', 'continents-cities'); |
|
| 152 | +__('Kentucky', 'continents-cities'); |
|
| 153 | +__('Louisville', 'continents-cities'); |
|
| 154 | +__('Monticello', 'continents-cities'); |
|
| 155 | +__('Knox IN', 'continents-cities'); |
|
| 156 | +__('Kralendijk', 'continents-cities'); |
|
| 157 | +__('La Paz', 'continents-cities'); |
|
| 158 | +__('Lima', 'continents-cities'); |
|
| 159 | +__('Los Angeles', 'continents-cities'); |
|
| 160 | +__('Lower Princes', 'continents-cities'); |
|
| 161 | +__('Maceio', 'continents-cities'); |
|
| 162 | +__('Managua', 'continents-cities'); |
|
| 163 | +__('Manaus', 'continents-cities'); |
|
| 164 | +__('Marigot', 'continents-cities'); |
|
| 165 | +__('Martinique', 'continents-cities'); |
|
| 166 | +__('Matamoros', 'continents-cities'); |
|
| 167 | +__('Mazatlan', 'continents-cities'); |
|
| 168 | +__('Menominee', 'continents-cities'); |
|
| 169 | +__('Merida', 'continents-cities'); |
|
| 170 | +__('Metlakatla', 'continents-cities'); |
|
| 171 | +__('Mexico City', 'continents-cities'); |
|
| 172 | +__('Miquelon', 'continents-cities'); |
|
| 173 | +__('Moncton', 'continents-cities'); |
|
| 174 | +__('Monterrey', 'continents-cities'); |
|
| 175 | +__('Montevideo', 'continents-cities'); |
|
| 176 | +__('Montreal', 'continents-cities'); |
|
| 177 | +__('Montserrat', 'continents-cities'); |
|
| 178 | +__('Nassau', 'continents-cities'); |
|
| 179 | +__('New York', 'continents-cities'); |
|
| 180 | +__('Nipigon', 'continents-cities'); |
|
| 181 | +__('Nome', 'continents-cities'); |
|
| 182 | +__('Noronha', 'continents-cities'); |
|
| 183 | +__('North Dakota', 'continents-cities'); |
|
| 184 | +__('Beulah', 'continents-cities'); |
|
| 185 | +__('Center', 'continents-cities'); |
|
| 186 | +__('New Salem', 'continents-cities'); |
|
| 187 | +__('Nuuk', 'continents-cities'); |
|
| 188 | +__('Ojinaga', 'continents-cities'); |
|
| 189 | +__('Panama', 'continents-cities'); |
|
| 190 | +__('Pangnirtung', 'continents-cities'); |
|
| 191 | +__('Paramaribo', 'continents-cities'); |
|
| 192 | +__('Phoenix', 'continents-cities'); |
|
| 193 | +__('Port-au-Prince', 'continents-cities'); |
|
| 194 | +__('Port of Spain', 'continents-cities'); |
|
| 195 | +__('Porto Acre', 'continents-cities'); |
|
| 196 | +__('Porto Velho', 'continents-cities'); |
|
| 197 | +__('Puerto Rico', 'continents-cities'); |
|
| 198 | +__('Punta Arenas', 'continents-cities'); |
|
| 199 | +__('Rainy River', 'continents-cities'); |
|
| 200 | +__('Rankin Inlet', 'continents-cities'); |
|
| 201 | +__('Recife', 'continents-cities'); |
|
| 202 | +__('Regina', 'continents-cities'); |
|
| 203 | +__('Resolute', 'continents-cities'); |
|
| 204 | +__('Rio Branco', 'continents-cities'); |
|
| 205 | +__('Rosario', 'continents-cities'); |
|
| 206 | +__('Santa Isabel', 'continents-cities'); |
|
| 207 | +__('Santarem', 'continents-cities'); |
|
| 208 | +__('Santiago', 'continents-cities'); |
|
| 209 | +__('Santo Domingo', 'continents-cities'); |
|
| 210 | +__('Sao Paulo', 'continents-cities'); |
|
| 211 | +__('Scoresbysund', 'continents-cities'); |
|
| 212 | +__('Shiprock', 'continents-cities'); |
|
| 213 | +__('Sitka', 'continents-cities'); |
|
| 214 | +__('St Barthelemy', 'continents-cities'); |
|
| 215 | +__('St Johns', 'continents-cities'); |
|
| 216 | +__('St Kitts', 'continents-cities'); |
|
| 217 | +__('St Lucia', 'continents-cities'); |
|
| 218 | +__('St Thomas', 'continents-cities'); |
|
| 219 | +__('St Vincent', 'continents-cities'); |
|
| 220 | +__('Swift Current', 'continents-cities'); |
|
| 221 | +__('Tegucigalpa', 'continents-cities'); |
|
| 222 | +__('Thule', 'continents-cities'); |
|
| 223 | +__('Thunder Bay', 'continents-cities'); |
|
| 224 | +__('Tijuana', 'continents-cities'); |
|
| 225 | +__('Toronto', 'continents-cities'); |
|
| 226 | +__('Tortola', 'continents-cities'); |
|
| 227 | +__('Vancouver', 'continents-cities'); |
|
| 228 | +__('Virgin', 'continents-cities'); |
|
| 229 | +__('Whitehorse', 'continents-cities'); |
|
| 230 | +__('Winnipeg', 'continents-cities'); |
|
| 231 | +__('Yakutat', 'continents-cities'); |
|
| 232 | +__('Yellowknife', 'continents-cities'); |
|
| 233 | 233 | |
| 234 | -__( 'Antarctica', 'continents-cities' ); |
|
| 235 | -__( 'Casey', 'continents-cities' ); |
|
| 236 | -__( 'Davis', 'continents-cities' ); |
|
| 237 | -__( 'DumontDUrville', 'continents-cities' ); |
|
| 238 | -__( 'Macquarie', 'continents-cities' ); |
|
| 239 | -__( 'Mawson', 'continents-cities' ); |
|
| 240 | -__( 'McMurdo', 'continents-cities' ); |
|
| 241 | -__( 'Palmer', 'continents-cities' ); |
|
| 242 | -__( 'Rothera', 'continents-cities' ); |
|
| 243 | -__( 'South Pole', 'continents-cities' ); |
|
| 244 | -__( 'Syowa', 'continents-cities' ); |
|
| 245 | -__( 'Troll', 'continents-cities' ); |
|
| 246 | -__( 'Vostok', 'continents-cities' ); |
|
| 234 | +__('Antarctica', 'continents-cities'); |
|
| 235 | +__('Casey', 'continents-cities'); |
|
| 236 | +__('Davis', 'continents-cities'); |
|
| 237 | +__('DumontDUrville', 'continents-cities'); |
|
| 238 | +__('Macquarie', 'continents-cities'); |
|
| 239 | +__('Mawson', 'continents-cities'); |
|
| 240 | +__('McMurdo', 'continents-cities'); |
|
| 241 | +__('Palmer', 'continents-cities'); |
|
| 242 | +__('Rothera', 'continents-cities'); |
|
| 243 | +__('South Pole', 'continents-cities'); |
|
| 244 | +__('Syowa', 'continents-cities'); |
|
| 245 | +__('Troll', 'continents-cities'); |
|
| 246 | +__('Vostok', 'continents-cities'); |
|
| 247 | 247 | |
| 248 | -__( 'Arctic', 'continents-cities' ); |
|
| 249 | -__( 'Longyearbyen', 'continents-cities' ); |
|
| 248 | +__('Arctic', 'continents-cities'); |
|
| 249 | +__('Longyearbyen', 'continents-cities'); |
|
| 250 | 250 | |
| 251 | -__( 'Asia', 'continents-cities' ); |
|
| 252 | -__( 'Aden', 'continents-cities' ); |
|
| 253 | -__( 'Almaty', 'continents-cities' ); |
|
| 254 | -__( 'Amman', 'continents-cities' ); |
|
| 255 | -__( 'Anadyr', 'continents-cities' ); |
|
| 256 | -__( 'Aqtau', 'continents-cities' ); |
|
| 257 | -__( 'Aqtobe', 'continents-cities' ); |
|
| 258 | -__( 'Ashgabat', 'continents-cities' ); |
|
| 259 | -__( 'Ashkhabad', 'continents-cities' ); |
|
| 260 | -__( 'Atyrau', 'continents-cities' ); |
|
| 261 | -__( 'Baghdad', 'continents-cities' ); |
|
| 262 | -__( 'Bahrain', 'continents-cities' ); |
|
| 263 | -__( 'Baku', 'continents-cities' ); |
|
| 264 | -__( 'Bangkok', 'continents-cities' ); |
|
| 265 | -__( 'Barnaul', 'continents-cities' ); |
|
| 266 | -__( 'Beirut', 'continents-cities' ); |
|
| 267 | -__( 'Bishkek', 'continents-cities' ); |
|
| 268 | -__( 'Brunei', 'continents-cities' ); |
|
| 269 | -__( 'Calcutta', 'continents-cities' ); |
|
| 270 | -__( 'Chita', 'continents-cities' ); |
|
| 271 | -__( 'Choibalsan', 'continents-cities' ); |
|
| 272 | -__( 'Chongqing', 'continents-cities' ); |
|
| 273 | -__( 'Chungking', 'continents-cities' ); |
|
| 274 | -__( 'Colombo', 'continents-cities' ); |
|
| 275 | -__( 'Dacca', 'continents-cities' ); |
|
| 276 | -__( 'Damascus', 'continents-cities' ); |
|
| 277 | -__( 'Dhaka', 'continents-cities' ); |
|
| 278 | -__( 'Dili', 'continents-cities' ); |
|
| 279 | -__( 'Dubai', 'continents-cities' ); |
|
| 280 | -__( 'Dushanbe', 'continents-cities' ); |
|
| 281 | -__( 'Famagusta', 'continents-cities' ); |
|
| 282 | -__( 'Gaza', 'continents-cities' ); |
|
| 283 | -__( 'Harbin', 'continents-cities' ); |
|
| 284 | -__( 'Hebron', 'continents-cities' ); |
|
| 285 | -__( 'Ho Chi Minh', 'continents-cities' ); |
|
| 286 | -__( 'Hong Kong', 'continents-cities' ); |
|
| 287 | -__( 'Hovd', 'continents-cities' ); |
|
| 288 | -__( 'Irkutsk', 'continents-cities' ); |
|
| 289 | -__( 'Jakarta', 'continents-cities' ); |
|
| 290 | -__( 'Jayapura', 'continents-cities' ); |
|
| 291 | -__( 'Jerusalem', 'continents-cities' ); |
|
| 292 | -__( 'Kabul', 'continents-cities' ); |
|
| 293 | -__( 'Kamchatka', 'continents-cities' ); |
|
| 294 | -__( 'Karachi', 'continents-cities' ); |
|
| 295 | -__( 'Kashgar', 'continents-cities' ); |
|
| 296 | -__( 'Kathmandu', 'continents-cities' ); |
|
| 297 | -__( 'Katmandu', 'continents-cities' ); |
|
| 298 | -__( 'Khandyga', 'continents-cities' ); |
|
| 299 | -__( 'Kolkata', 'continents-cities' ); |
|
| 300 | -__( 'Krasnoyarsk', 'continents-cities' ); |
|
| 301 | -__( 'Kuala Lumpur', 'continents-cities' ); |
|
| 302 | -__( 'Kuching', 'continents-cities' ); |
|
| 303 | -__( 'Kuwait', 'continents-cities' ); |
|
| 304 | -__( 'Macao', 'continents-cities' ); |
|
| 305 | -__( 'Macau', 'continents-cities' ); |
|
| 306 | -__( 'Magadan', 'continents-cities' ); |
|
| 307 | -__( 'Makassar', 'continents-cities' ); |
|
| 308 | -__( 'Manila', 'continents-cities' ); |
|
| 309 | -__( 'Muscat', 'continents-cities' ); |
|
| 310 | -__( 'Nicosia', 'continents-cities' ); |
|
| 311 | -__( 'Novokuznetsk', 'continents-cities' ); |
|
| 312 | -__( 'Novosibirsk', 'continents-cities' ); |
|
| 313 | -__( 'Omsk', 'continents-cities' ); |
|
| 314 | -__( 'Oral', 'continents-cities' ); |
|
| 315 | -__( 'Phnom Penh', 'continents-cities' ); |
|
| 316 | -__( 'Pontianak', 'continents-cities' ); |
|
| 317 | -__( 'Pyongyang', 'continents-cities' ); |
|
| 318 | -__( 'Qatar', 'continents-cities' ); |
|
| 319 | -__( 'Qostanay', 'continents-cities' ); |
|
| 320 | -__( 'Qyzylorda', 'continents-cities' ); |
|
| 321 | -__( 'Rangoon', 'continents-cities' ); |
|
| 322 | -__( 'Riyadh', 'continents-cities' ); |
|
| 323 | -__( 'Saigon', 'continents-cities' ); |
|
| 324 | -__( 'Sakhalin', 'continents-cities' ); |
|
| 325 | -__( 'Samarkand', 'continents-cities' ); |
|
| 326 | -__( 'Seoul', 'continents-cities' ); |
|
| 327 | -__( 'Shanghai', 'continents-cities' ); |
|
| 328 | -__( 'Singapore', 'continents-cities' ); |
|
| 329 | -__( 'Srednekolymsk', 'continents-cities' ); |
|
| 330 | -__( 'Taipei', 'continents-cities' ); |
|
| 331 | -__( 'Tashkent', 'continents-cities' ); |
|
| 332 | -__( 'Tbilisi', 'continents-cities' ); |
|
| 333 | -__( 'Tehran', 'continents-cities' ); |
|
| 334 | -__( 'Tel Aviv', 'continents-cities' ); |
|
| 335 | -__( 'Thimbu', 'continents-cities' ); |
|
| 336 | -__( 'Thimphu', 'continents-cities' ); |
|
| 337 | -__( 'Tokyo', 'continents-cities' ); |
|
| 338 | -__( 'Tomsk', 'continents-cities' ); |
|
| 339 | -__( 'Ujung Pandang', 'continents-cities' ); |
|
| 340 | -__( 'Ulaanbaatar', 'continents-cities' ); |
|
| 341 | -__( 'Ulan Bator', 'continents-cities' ); |
|
| 342 | -__( 'Urumqi', 'continents-cities' ); |
|
| 343 | -__( 'Ust-Nera', 'continents-cities' ); |
|
| 344 | -__( 'Vientiane', 'continents-cities' ); |
|
| 345 | -__( 'Vladivostok', 'continents-cities' ); |
|
| 346 | -__( 'Yakutsk', 'continents-cities' ); |
|
| 347 | -__( 'Yangon', 'continents-cities' ); |
|
| 348 | -__( 'Yekaterinburg', 'continents-cities' ); |
|
| 349 | -__( 'Yerevan', 'continents-cities' ); |
|
| 251 | +__('Asia', 'continents-cities'); |
|
| 252 | +__('Aden', 'continents-cities'); |
|
| 253 | +__('Almaty', 'continents-cities'); |
|
| 254 | +__('Amman', 'continents-cities'); |
|
| 255 | +__('Anadyr', 'continents-cities'); |
|
| 256 | +__('Aqtau', 'continents-cities'); |
|
| 257 | +__('Aqtobe', 'continents-cities'); |
|
| 258 | +__('Ashgabat', 'continents-cities'); |
|
| 259 | +__('Ashkhabad', 'continents-cities'); |
|
| 260 | +__('Atyrau', 'continents-cities'); |
|
| 261 | +__('Baghdad', 'continents-cities'); |
|
| 262 | +__('Bahrain', 'continents-cities'); |
|
| 263 | +__('Baku', 'continents-cities'); |
|
| 264 | +__('Bangkok', 'continents-cities'); |
|
| 265 | +__('Barnaul', 'continents-cities'); |
|
| 266 | +__('Beirut', 'continents-cities'); |
|
| 267 | +__('Bishkek', 'continents-cities'); |
|
| 268 | +__('Brunei', 'continents-cities'); |
|
| 269 | +__('Calcutta', 'continents-cities'); |
|
| 270 | +__('Chita', 'continents-cities'); |
|
| 271 | +__('Choibalsan', 'continents-cities'); |
|
| 272 | +__('Chongqing', 'continents-cities'); |
|
| 273 | +__('Chungking', 'continents-cities'); |
|
| 274 | +__('Colombo', 'continents-cities'); |
|
| 275 | +__('Dacca', 'continents-cities'); |
|
| 276 | +__('Damascus', 'continents-cities'); |
|
| 277 | +__('Dhaka', 'continents-cities'); |
|
| 278 | +__('Dili', 'continents-cities'); |
|
| 279 | +__('Dubai', 'continents-cities'); |
|
| 280 | +__('Dushanbe', 'continents-cities'); |
|
| 281 | +__('Famagusta', 'continents-cities'); |
|
| 282 | +__('Gaza', 'continents-cities'); |
|
| 283 | +__('Harbin', 'continents-cities'); |
|
| 284 | +__('Hebron', 'continents-cities'); |
|
| 285 | +__('Ho Chi Minh', 'continents-cities'); |
|
| 286 | +__('Hong Kong', 'continents-cities'); |
|
| 287 | +__('Hovd', 'continents-cities'); |
|
| 288 | +__('Irkutsk', 'continents-cities'); |
|
| 289 | +__('Jakarta', 'continents-cities'); |
|
| 290 | +__('Jayapura', 'continents-cities'); |
|
| 291 | +__('Jerusalem', 'continents-cities'); |
|
| 292 | +__('Kabul', 'continents-cities'); |
|
| 293 | +__('Kamchatka', 'continents-cities'); |
|
| 294 | +__('Karachi', 'continents-cities'); |
|
| 295 | +__('Kashgar', 'continents-cities'); |
|
| 296 | +__('Kathmandu', 'continents-cities'); |
|
| 297 | +__('Katmandu', 'continents-cities'); |
|
| 298 | +__('Khandyga', 'continents-cities'); |
|
| 299 | +__('Kolkata', 'continents-cities'); |
|
| 300 | +__('Krasnoyarsk', 'continents-cities'); |
|
| 301 | +__('Kuala Lumpur', 'continents-cities'); |
|
| 302 | +__('Kuching', 'continents-cities'); |
|
| 303 | +__('Kuwait', 'continents-cities'); |
|
| 304 | +__('Macao', 'continents-cities'); |
|
| 305 | +__('Macau', 'continents-cities'); |
|
| 306 | +__('Magadan', 'continents-cities'); |
|
| 307 | +__('Makassar', 'continents-cities'); |
|
| 308 | +__('Manila', 'continents-cities'); |
|
| 309 | +__('Muscat', 'continents-cities'); |
|
| 310 | +__('Nicosia', 'continents-cities'); |
|
| 311 | +__('Novokuznetsk', 'continents-cities'); |
|
| 312 | +__('Novosibirsk', 'continents-cities'); |
|
| 313 | +__('Omsk', 'continents-cities'); |
|
| 314 | +__('Oral', 'continents-cities'); |
|
| 315 | +__('Phnom Penh', 'continents-cities'); |
|
| 316 | +__('Pontianak', 'continents-cities'); |
|
| 317 | +__('Pyongyang', 'continents-cities'); |
|
| 318 | +__('Qatar', 'continents-cities'); |
|
| 319 | +__('Qostanay', 'continents-cities'); |
|
| 320 | +__('Qyzylorda', 'continents-cities'); |
|
| 321 | +__('Rangoon', 'continents-cities'); |
|
| 322 | +__('Riyadh', 'continents-cities'); |
|
| 323 | +__('Saigon', 'continents-cities'); |
|
| 324 | +__('Sakhalin', 'continents-cities'); |
|
| 325 | +__('Samarkand', 'continents-cities'); |
|
| 326 | +__('Seoul', 'continents-cities'); |
|
| 327 | +__('Shanghai', 'continents-cities'); |
|
| 328 | +__('Singapore', 'continents-cities'); |
|
| 329 | +__('Srednekolymsk', 'continents-cities'); |
|
| 330 | +__('Taipei', 'continents-cities'); |
|
| 331 | +__('Tashkent', 'continents-cities'); |
|
| 332 | +__('Tbilisi', 'continents-cities'); |
|
| 333 | +__('Tehran', 'continents-cities'); |
|
| 334 | +__('Tel Aviv', 'continents-cities'); |
|
| 335 | +__('Thimbu', 'continents-cities'); |
|
| 336 | +__('Thimphu', 'continents-cities'); |
|
| 337 | +__('Tokyo', 'continents-cities'); |
|
| 338 | +__('Tomsk', 'continents-cities'); |
|
| 339 | +__('Ujung Pandang', 'continents-cities'); |
|
| 340 | +__('Ulaanbaatar', 'continents-cities'); |
|
| 341 | +__('Ulan Bator', 'continents-cities'); |
|
| 342 | +__('Urumqi', 'continents-cities'); |
|
| 343 | +__('Ust-Nera', 'continents-cities'); |
|
| 344 | +__('Vientiane', 'continents-cities'); |
|
| 345 | +__('Vladivostok', 'continents-cities'); |
|
| 346 | +__('Yakutsk', 'continents-cities'); |
|
| 347 | +__('Yangon', 'continents-cities'); |
|
| 348 | +__('Yekaterinburg', 'continents-cities'); |
|
| 349 | +__('Yerevan', 'continents-cities'); |
|
| 350 | 350 | |
| 351 | -__( 'Atlantic', 'continents-cities' ); |
|
| 352 | -__( 'Azores', 'continents-cities' ); |
|
| 353 | -__( 'Bermuda', 'continents-cities' ); |
|
| 354 | -__( 'Canary', 'continents-cities' ); |
|
| 355 | -__( 'Cape Verde', 'continents-cities' ); |
|
| 356 | -__( 'Faeroe', 'continents-cities' ); |
|
| 357 | -__( 'Faroe', 'continents-cities' ); |
|
| 358 | -__( 'Jan Mayen', 'continents-cities' ); |
|
| 359 | -__( 'Madeira', 'continents-cities' ); |
|
| 360 | -__( 'Reykjavik', 'continents-cities' ); |
|
| 361 | -__( 'South Georgia', 'continents-cities' ); |
|
| 362 | -__( 'St Helena', 'continents-cities' ); |
|
| 363 | -__( 'Stanley', 'continents-cities' ); |
|
| 351 | +__('Atlantic', 'continents-cities'); |
|
| 352 | +__('Azores', 'continents-cities'); |
|
| 353 | +__('Bermuda', 'continents-cities'); |
|
| 354 | +__('Canary', 'continents-cities'); |
|
| 355 | +__('Cape Verde', 'continents-cities'); |
|
| 356 | +__('Faeroe', 'continents-cities'); |
|
| 357 | +__('Faroe', 'continents-cities'); |
|
| 358 | +__('Jan Mayen', 'continents-cities'); |
|
| 359 | +__('Madeira', 'continents-cities'); |
|
| 360 | +__('Reykjavik', 'continents-cities'); |
|
| 361 | +__('South Georgia', 'continents-cities'); |
|
| 362 | +__('St Helena', 'continents-cities'); |
|
| 363 | +__('Stanley', 'continents-cities'); |
|
| 364 | 364 | |
| 365 | -__( 'Australia', 'continents-cities' ); |
|
| 366 | -__( 'ACT', 'continents-cities' ); |
|
| 367 | -__( 'Adelaide', 'continents-cities' ); |
|
| 368 | -__( 'Brisbane', 'continents-cities' ); |
|
| 369 | -__( 'Broken Hill', 'continents-cities' ); |
|
| 370 | -__( 'Canberra', 'continents-cities' ); |
|
| 371 | -__( 'Currie', 'continents-cities' ); |
|
| 372 | -__( 'Darwin', 'continents-cities' ); |
|
| 373 | -__( 'Eucla', 'continents-cities' ); |
|
| 374 | -__( 'Hobart', 'continents-cities' ); |
|
| 375 | -__( 'LHI', 'continents-cities' ); |
|
| 376 | -__( 'Lindeman', 'continents-cities' ); |
|
| 377 | -__( 'Lord Howe', 'continents-cities' ); |
|
| 378 | -__( 'Melbourne', 'continents-cities' ); |
|
| 379 | -__( 'NSW', 'continents-cities' ); |
|
| 380 | -__( 'North', 'continents-cities' ); |
|
| 381 | -__( 'Perth', 'continents-cities' ); |
|
| 382 | -__( 'Queensland', 'continents-cities' ); |
|
| 383 | -__( 'South', 'continents-cities' ); |
|
| 384 | -__( 'Sydney', 'continents-cities' ); |
|
| 385 | -__( 'Tasmania', 'continents-cities' ); |
|
| 386 | -__( 'Victoria', 'continents-cities' ); |
|
| 387 | -__( 'West', 'continents-cities' ); |
|
| 388 | -__( 'Yancowinna', 'continents-cities' ); |
|
| 365 | +__('Australia', 'continents-cities'); |
|
| 366 | +__('ACT', 'continents-cities'); |
|
| 367 | +__('Adelaide', 'continents-cities'); |
|
| 368 | +__('Brisbane', 'continents-cities'); |
|
| 369 | +__('Broken Hill', 'continents-cities'); |
|
| 370 | +__('Canberra', 'continents-cities'); |
|
| 371 | +__('Currie', 'continents-cities'); |
|
| 372 | +__('Darwin', 'continents-cities'); |
|
| 373 | +__('Eucla', 'continents-cities'); |
|
| 374 | +__('Hobart', 'continents-cities'); |
|
| 375 | +__('LHI', 'continents-cities'); |
|
| 376 | +__('Lindeman', 'continents-cities'); |
|
| 377 | +__('Lord Howe', 'continents-cities'); |
|
| 378 | +__('Melbourne', 'continents-cities'); |
|
| 379 | +__('NSW', 'continents-cities'); |
|
| 380 | +__('North', 'continents-cities'); |
|
| 381 | +__('Perth', 'continents-cities'); |
|
| 382 | +__('Queensland', 'continents-cities'); |
|
| 383 | +__('South', 'continents-cities'); |
|
| 384 | +__('Sydney', 'continents-cities'); |
|
| 385 | +__('Tasmania', 'continents-cities'); |
|
| 386 | +__('Victoria', 'continents-cities'); |
|
| 387 | +__('West', 'continents-cities'); |
|
| 388 | +__('Yancowinna', 'continents-cities'); |
|
| 389 | 389 | |
| 390 | -__( 'Etc', 'continents-cities' ); |
|
| 391 | -__( 'GMT', 'continents-cities' ); |
|
| 392 | -__( 'GMT+0', 'continents-cities' ); |
|
| 393 | -__( 'GMT+1', 'continents-cities' ); |
|
| 394 | -__( 'GMT+10', 'continents-cities' ); |
|
| 395 | -__( 'GMT+11', 'continents-cities' ); |
|
| 396 | -__( 'GMT+12', 'continents-cities' ); |
|
| 397 | -__( 'GMT+2', 'continents-cities' ); |
|
| 398 | -__( 'GMT+3', 'continents-cities' ); |
|
| 399 | -__( 'GMT+4', 'continents-cities' ); |
|
| 400 | -__( 'GMT+5', 'continents-cities' ); |
|
| 401 | -__( 'GMT+6', 'continents-cities' ); |
|
| 402 | -__( 'GMT+7', 'continents-cities' ); |
|
| 403 | -__( 'GMT+8', 'continents-cities' ); |
|
| 404 | -__( 'GMT+9', 'continents-cities' ); |
|
| 405 | -__( 'GMT-0', 'continents-cities' ); |
|
| 406 | -__( 'GMT-1', 'continents-cities' ); |
|
| 407 | -__( 'GMT-10', 'continents-cities' ); |
|
| 408 | -__( 'GMT-11', 'continents-cities' ); |
|
| 409 | -__( 'GMT-12', 'continents-cities' ); |
|
| 410 | -__( 'GMT-13', 'continents-cities' ); |
|
| 411 | -__( 'GMT-14', 'continents-cities' ); |
|
| 412 | -__( 'GMT-2', 'continents-cities' ); |
|
| 413 | -__( 'GMT-3', 'continents-cities' ); |
|
| 414 | -__( 'GMT-4', 'continents-cities' ); |
|
| 415 | -__( 'GMT-5', 'continents-cities' ); |
|
| 416 | -__( 'GMT-6', 'continents-cities' ); |
|
| 417 | -__( 'GMT-7', 'continents-cities' ); |
|
| 418 | -__( 'GMT-8', 'continents-cities' ); |
|
| 419 | -__( 'GMT-9', 'continents-cities' ); |
|
| 420 | -__( 'GMT0', 'continents-cities' ); |
|
| 421 | -__( 'Greenwich', 'continents-cities' ); |
|
| 422 | -__( 'UCT', 'continents-cities' ); |
|
| 423 | -__( 'UTC', 'continents-cities' ); |
|
| 424 | -__( 'Universal', 'continents-cities' ); |
|
| 425 | -__( 'Zulu', 'continents-cities' ); |
|
| 390 | +__('Etc', 'continents-cities'); |
|
| 391 | +__('GMT', 'continents-cities'); |
|
| 392 | +__('GMT+0', 'continents-cities'); |
|
| 393 | +__('GMT+1', 'continents-cities'); |
|
| 394 | +__('GMT+10', 'continents-cities'); |
|
| 395 | +__('GMT+11', 'continents-cities'); |
|
| 396 | +__('GMT+12', 'continents-cities'); |
|
| 397 | +__('GMT+2', 'continents-cities'); |
|
| 398 | +__('GMT+3', 'continents-cities'); |
|
| 399 | +__('GMT+4', 'continents-cities'); |
|
| 400 | +__('GMT+5', 'continents-cities'); |
|
| 401 | +__('GMT+6', 'continents-cities'); |
|
| 402 | +__('GMT+7', 'continents-cities'); |
|
| 403 | +__('GMT+8', 'continents-cities'); |
|
| 404 | +__('GMT+9', 'continents-cities'); |
|
| 405 | +__('GMT-0', 'continents-cities'); |
|
| 406 | +__('GMT-1', 'continents-cities'); |
|
| 407 | +__('GMT-10', 'continents-cities'); |
|
| 408 | +__('GMT-11', 'continents-cities'); |
|
| 409 | +__('GMT-12', 'continents-cities'); |
|
| 410 | +__('GMT-13', 'continents-cities'); |
|
| 411 | +__('GMT-14', 'continents-cities'); |
|
| 412 | +__('GMT-2', 'continents-cities'); |
|
| 413 | +__('GMT-3', 'continents-cities'); |
|
| 414 | +__('GMT-4', 'continents-cities'); |
|
| 415 | +__('GMT-5', 'continents-cities'); |
|
| 416 | +__('GMT-6', 'continents-cities'); |
|
| 417 | +__('GMT-7', 'continents-cities'); |
|
| 418 | +__('GMT-8', 'continents-cities'); |
|
| 419 | +__('GMT-9', 'continents-cities'); |
|
| 420 | +__('GMT0', 'continents-cities'); |
|
| 421 | +__('Greenwich', 'continents-cities'); |
|
| 422 | +__('UCT', 'continents-cities'); |
|
| 423 | +__('UTC', 'continents-cities'); |
|
| 424 | +__('Universal', 'continents-cities'); |
|
| 425 | +__('Zulu', 'continents-cities'); |
|
| 426 | 426 | |
| 427 | -__( 'Europe', 'continents-cities' ); |
|
| 428 | -__( 'Amsterdam', 'continents-cities' ); |
|
| 429 | -__( 'Andorra', 'continents-cities' ); |
|
| 430 | -__( 'Astrakhan', 'continents-cities' ); |
|
| 431 | -__( 'Athens', 'continents-cities' ); |
|
| 432 | -__( 'Belfast', 'continents-cities' ); |
|
| 433 | -__( 'Belgrade', 'continents-cities' ); |
|
| 434 | -__( 'Berlin', 'continents-cities' ); |
|
| 435 | -__( 'Bratislava', 'continents-cities' ); |
|
| 436 | -__( 'Brussels', 'continents-cities' ); |
|
| 437 | -__( 'Bucharest', 'continents-cities' ); |
|
| 438 | -__( 'Budapest', 'continents-cities' ); |
|
| 439 | -__( 'Busingen', 'continents-cities' ); |
|
| 440 | -__( 'Chisinau', 'continents-cities' ); |
|
| 441 | -__( 'Copenhagen', 'continents-cities' ); |
|
| 442 | -__( 'Dublin', 'continents-cities' ); |
|
| 443 | -__( 'Gibraltar', 'continents-cities' ); |
|
| 444 | -__( 'Guernsey', 'continents-cities' ); |
|
| 445 | -__( 'Helsinki', 'continents-cities' ); |
|
| 446 | -__( 'Isle of Man', 'continents-cities' ); |
|
| 447 | -__( 'Istanbul', 'continents-cities' ); |
|
| 448 | -__( 'Jersey', 'continents-cities' ); |
|
| 449 | -__( 'Kaliningrad', 'continents-cities' ); |
|
| 450 | -__( 'Kiev', 'continents-cities' ); |
|
| 451 | -__( 'Kirov', 'continents-cities' ); |
|
| 452 | -__( 'Lisbon', 'continents-cities' ); |
|
| 453 | -__( 'Ljubljana', 'continents-cities' ); |
|
| 454 | -__( 'London', 'continents-cities' ); |
|
| 455 | -__( 'Luxembourg', 'continents-cities' ); |
|
| 456 | -__( 'Madrid', 'continents-cities' ); |
|
| 457 | -__( 'Malta', 'continents-cities' ); |
|
| 458 | -__( 'Mariehamn', 'continents-cities' ); |
|
| 459 | -__( 'Minsk', 'continents-cities' ); |
|
| 460 | -__( 'Monaco', 'continents-cities' ); |
|
| 461 | -__( 'Moscow', 'continents-cities' ); |
|
| 462 | -__( 'Oslo', 'continents-cities' ); |
|
| 463 | -__( 'Paris', 'continents-cities' ); |
|
| 464 | -__( 'Podgorica', 'continents-cities' ); |
|
| 465 | -__( 'Prague', 'continents-cities' ); |
|
| 466 | -__( 'Riga', 'continents-cities' ); |
|
| 467 | -__( 'Rome', 'continents-cities' ); |
|
| 468 | -__( 'Samara', 'continents-cities' ); |
|
| 469 | -__( 'San Marino', 'continents-cities' ); |
|
| 470 | -__( 'Sarajevo', 'continents-cities' ); |
|
| 471 | -__( 'Saratov', 'continents-cities' ); |
|
| 472 | -__( 'Simferopol', 'continents-cities' ); |
|
| 473 | -__( 'Skopje', 'continents-cities' ); |
|
| 474 | -__( 'Sofia', 'continents-cities' ); |
|
| 475 | -__( 'Stockholm', 'continents-cities' ); |
|
| 476 | -__( 'Tallinn', 'continents-cities' ); |
|
| 477 | -__( 'Tirane', 'continents-cities' ); |
|
| 478 | -__( 'Tiraspol', 'continents-cities' ); |
|
| 479 | -__( 'Ulyanovsk', 'continents-cities' ); |
|
| 480 | -__( 'Uzhgorod', 'continents-cities' ); |
|
| 481 | -__( 'Vaduz', 'continents-cities' ); |
|
| 482 | -__( 'Vatican', 'continents-cities' ); |
|
| 483 | -__( 'Vienna', 'continents-cities' ); |
|
| 484 | -__( 'Vilnius', 'continents-cities' ); |
|
| 485 | -__( 'Volgograd', 'continents-cities' ); |
|
| 486 | -__( 'Warsaw', 'continents-cities' ); |
|
| 487 | -__( 'Zagreb', 'continents-cities' ); |
|
| 488 | -__( 'Zaporozhye', 'continents-cities' ); |
|
| 489 | -__( 'Zurich', 'continents-cities' ); |
|
| 427 | +__('Europe', 'continents-cities'); |
|
| 428 | +__('Amsterdam', 'continents-cities'); |
|
| 429 | +__('Andorra', 'continents-cities'); |
|
| 430 | +__('Astrakhan', 'continents-cities'); |
|
| 431 | +__('Athens', 'continents-cities'); |
|
| 432 | +__('Belfast', 'continents-cities'); |
|
| 433 | +__('Belgrade', 'continents-cities'); |
|
| 434 | +__('Berlin', 'continents-cities'); |
|
| 435 | +__('Bratislava', 'continents-cities'); |
|
| 436 | +__('Brussels', 'continents-cities'); |
|
| 437 | +__('Bucharest', 'continents-cities'); |
|
| 438 | +__('Budapest', 'continents-cities'); |
|
| 439 | +__('Busingen', 'continents-cities'); |
|
| 440 | +__('Chisinau', 'continents-cities'); |
|
| 441 | +__('Copenhagen', 'continents-cities'); |
|
| 442 | +__('Dublin', 'continents-cities'); |
|
| 443 | +__('Gibraltar', 'continents-cities'); |
|
| 444 | +__('Guernsey', 'continents-cities'); |
|
| 445 | +__('Helsinki', 'continents-cities'); |
|
| 446 | +__('Isle of Man', 'continents-cities'); |
|
| 447 | +__('Istanbul', 'continents-cities'); |
|
| 448 | +__('Jersey', 'continents-cities'); |
|
| 449 | +__('Kaliningrad', 'continents-cities'); |
|
| 450 | +__('Kiev', 'continents-cities'); |
|
| 451 | +__('Kirov', 'continents-cities'); |
|
| 452 | +__('Lisbon', 'continents-cities'); |
|
| 453 | +__('Ljubljana', 'continents-cities'); |
|
| 454 | +__('London', 'continents-cities'); |
|
| 455 | +__('Luxembourg', 'continents-cities'); |
|
| 456 | +__('Madrid', 'continents-cities'); |
|
| 457 | +__('Malta', 'continents-cities'); |
|
| 458 | +__('Mariehamn', 'continents-cities'); |
|
| 459 | +__('Minsk', 'continents-cities'); |
|
| 460 | +__('Monaco', 'continents-cities'); |
|
| 461 | +__('Moscow', 'continents-cities'); |
|
| 462 | +__('Oslo', 'continents-cities'); |
|
| 463 | +__('Paris', 'continents-cities'); |
|
| 464 | +__('Podgorica', 'continents-cities'); |
|
| 465 | +__('Prague', 'continents-cities'); |
|
| 466 | +__('Riga', 'continents-cities'); |
|
| 467 | +__('Rome', 'continents-cities'); |
|
| 468 | +__('Samara', 'continents-cities'); |
|
| 469 | +__('San Marino', 'continents-cities'); |
|
| 470 | +__('Sarajevo', 'continents-cities'); |
|
| 471 | +__('Saratov', 'continents-cities'); |
|
| 472 | +__('Simferopol', 'continents-cities'); |
|
| 473 | +__('Skopje', 'continents-cities'); |
|
| 474 | +__('Sofia', 'continents-cities'); |
|
| 475 | +__('Stockholm', 'continents-cities'); |
|
| 476 | +__('Tallinn', 'continents-cities'); |
|
| 477 | +__('Tirane', 'continents-cities'); |
|
| 478 | +__('Tiraspol', 'continents-cities'); |
|
| 479 | +__('Ulyanovsk', 'continents-cities'); |
|
| 480 | +__('Uzhgorod', 'continents-cities'); |
|
| 481 | +__('Vaduz', 'continents-cities'); |
|
| 482 | +__('Vatican', 'continents-cities'); |
|
| 483 | +__('Vienna', 'continents-cities'); |
|
| 484 | +__('Vilnius', 'continents-cities'); |
|
| 485 | +__('Volgograd', 'continents-cities'); |
|
| 486 | +__('Warsaw', 'continents-cities'); |
|
| 487 | +__('Zagreb', 'continents-cities'); |
|
| 488 | +__('Zaporozhye', 'continents-cities'); |
|
| 489 | +__('Zurich', 'continents-cities'); |
|
| 490 | 490 | |
| 491 | -__( 'Indian', 'continents-cities' ); |
|
| 492 | -__( 'Antananarivo', 'continents-cities' ); |
|
| 493 | -__( 'Chagos', 'continents-cities' ); |
|
| 494 | -__( 'Christmas', 'continents-cities' ); |
|
| 495 | -__( 'Cocos', 'continents-cities' ); |
|
| 496 | -__( 'Comoro', 'continents-cities' ); |
|
| 497 | -__( 'Kerguelen', 'continents-cities' ); |
|
| 498 | -__( 'Mahe', 'continents-cities' ); |
|
| 499 | -__( 'Maldives', 'continents-cities' ); |
|
| 500 | -__( 'Mauritius', 'continents-cities' ); |
|
| 501 | -__( 'Mayotte', 'continents-cities' ); |
|
| 502 | -__( 'Reunion', 'continents-cities' ); |
|
| 491 | +__('Indian', 'continents-cities'); |
|
| 492 | +__('Antananarivo', 'continents-cities'); |
|
| 493 | +__('Chagos', 'continents-cities'); |
|
| 494 | +__('Christmas', 'continents-cities'); |
|
| 495 | +__('Cocos', 'continents-cities'); |
|
| 496 | +__('Comoro', 'continents-cities'); |
|
| 497 | +__('Kerguelen', 'continents-cities'); |
|
| 498 | +__('Mahe', 'continents-cities'); |
|
| 499 | +__('Maldives', 'continents-cities'); |
|
| 500 | +__('Mauritius', 'continents-cities'); |
|
| 501 | +__('Mayotte', 'continents-cities'); |
|
| 502 | +__('Reunion', 'continents-cities'); |
|
| 503 | 503 | |
| 504 | -__( 'Pacific', 'continents-cities' ); |
|
| 505 | -__( 'Apia', 'continents-cities' ); |
|
| 506 | -__( 'Auckland', 'continents-cities' ); |
|
| 507 | -__( 'Bougainville', 'continents-cities' ); |
|
| 508 | -__( 'Chatham', 'continents-cities' ); |
|
| 509 | -__( 'Chuuk', 'continents-cities' ); |
|
| 510 | -__( 'Easter', 'continents-cities' ); |
|
| 511 | -__( 'Efate', 'continents-cities' ); |
|
| 512 | -__( 'Enderbury', 'continents-cities' ); |
|
| 513 | -__( 'Fakaofo', 'continents-cities' ); |
|
| 514 | -__( 'Fiji', 'continents-cities' ); |
|
| 515 | -__( 'Funafuti', 'continents-cities' ); |
|
| 516 | -__( 'Galapagos', 'continents-cities' ); |
|
| 517 | -__( 'Gambier', 'continents-cities' ); |
|
| 518 | -__( 'Guadalcanal', 'continents-cities' ); |
|
| 519 | -__( 'Guam', 'continents-cities' ); |
|
| 520 | -__( 'Honolulu', 'continents-cities' ); |
|
| 521 | -__( 'Johnston', 'continents-cities' ); |
|
| 522 | -__( 'Kiritimati', 'continents-cities' ); |
|
| 523 | -__( 'Kosrae', 'continents-cities' ); |
|
| 524 | -__( 'Kwajalein', 'continents-cities' ); |
|
| 525 | -__( 'Majuro', 'continents-cities' ); |
|
| 526 | -__( 'Marquesas', 'continents-cities' ); |
|
| 527 | -__( 'Midway', 'continents-cities' ); |
|
| 528 | -__( 'Nauru', 'continents-cities' ); |
|
| 529 | -__( 'Niue', 'continents-cities' ); |
|
| 530 | -__( 'Norfolk', 'continents-cities' ); |
|
| 531 | -__( 'Noumea', 'continents-cities' ); |
|
| 532 | -__( 'Pago Pago', 'continents-cities' ); |
|
| 533 | -__( 'Palau', 'continents-cities' ); |
|
| 534 | -__( 'Pitcairn', 'continents-cities' ); |
|
| 535 | -__( 'Pohnpei', 'continents-cities' ); |
|
| 536 | -__( 'Ponape', 'continents-cities' ); |
|
| 537 | -__( 'Port Moresby', 'continents-cities' ); |
|
| 538 | -__( 'Rarotonga', 'continents-cities' ); |
|
| 539 | -__( 'Saipan', 'continents-cities' ); |
|
| 540 | -__( 'Samoa', 'continents-cities' ); |
|
| 541 | -__( 'Tahiti', 'continents-cities' ); |
|
| 542 | -__( 'Tarawa', 'continents-cities' ); |
|
| 543 | -__( 'Tongatapu', 'continents-cities' ); |
|
| 544 | -__( 'Truk', 'continents-cities' ); |
|
| 545 | -__( 'Wake', 'continents-cities' ); |
|
| 546 | -__( 'Wallis', 'continents-cities' ); |
|
| 547 | -__( 'Yap', 'continents-cities' ); |
|
| 504 | +__('Pacific', 'continents-cities'); |
|
| 505 | +__('Apia', 'continents-cities'); |
|
| 506 | +__('Auckland', 'continents-cities'); |
|
| 507 | +__('Bougainville', 'continents-cities'); |
|
| 508 | +__('Chatham', 'continents-cities'); |
|
| 509 | +__('Chuuk', 'continents-cities'); |
|
| 510 | +__('Easter', 'continents-cities'); |
|
| 511 | +__('Efate', 'continents-cities'); |
|
| 512 | +__('Enderbury', 'continents-cities'); |
|
| 513 | +__('Fakaofo', 'continents-cities'); |
|
| 514 | +__('Fiji', 'continents-cities'); |
|
| 515 | +__('Funafuti', 'continents-cities'); |
|
| 516 | +__('Galapagos', 'continents-cities'); |
|
| 517 | +__('Gambier', 'continents-cities'); |
|
| 518 | +__('Guadalcanal', 'continents-cities'); |
|
| 519 | +__('Guam', 'continents-cities'); |
|
| 520 | +__('Honolulu', 'continents-cities'); |
|
| 521 | +__('Johnston', 'continents-cities'); |
|
| 522 | +__('Kiritimati', 'continents-cities'); |
|
| 523 | +__('Kosrae', 'continents-cities'); |
|
| 524 | +__('Kwajalein', 'continents-cities'); |
|
| 525 | +__('Majuro', 'continents-cities'); |
|
| 526 | +__('Marquesas', 'continents-cities'); |
|
| 527 | +__('Midway', 'continents-cities'); |
|
| 528 | +__('Nauru', 'continents-cities'); |
|
| 529 | +__('Niue', 'continents-cities'); |
|
| 530 | +__('Norfolk', 'continents-cities'); |
|
| 531 | +__('Noumea', 'continents-cities'); |
|
| 532 | +__('Pago Pago', 'continents-cities'); |
|
| 533 | +__('Palau', 'continents-cities'); |
|
| 534 | +__('Pitcairn', 'continents-cities'); |
|
| 535 | +__('Pohnpei', 'continents-cities'); |
|
| 536 | +__('Ponape', 'continents-cities'); |
|
| 537 | +__('Port Moresby', 'continents-cities'); |
|
| 538 | +__('Rarotonga', 'continents-cities'); |
|
| 539 | +__('Saipan', 'continents-cities'); |
|
| 540 | +__('Samoa', 'continents-cities'); |
|
| 541 | +__('Tahiti', 'continents-cities'); |
|
| 542 | +__('Tarawa', 'continents-cities'); |
|
| 543 | +__('Tongatapu', 'continents-cities'); |
|
| 544 | +__('Truk', 'continents-cities'); |
|
| 545 | +__('Wake', 'continents-cities'); |
|
| 546 | +__('Wallis', 'continents-cities'); |
|
| 547 | +__('Yap', 'continents-cities'); |
|
@@ -13,55 +13,55 @@ |
||
| 13 | 13 | * @since 3.1.0 |
| 14 | 14 | */ |
| 15 | 15 | class _WP_List_Table_Compat extends WP_List_Table { |
| 16 | - public $_screen; |
|
| 17 | - public $_columns; |
|
| 16 | + public $_screen; |
|
| 17 | + public $_columns; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Constructor. |
|
| 21 | - * |
|
| 22 | - * @since 3.1.0 |
|
| 23 | - * |
|
| 24 | - * @param string|WP_Screen $screen The screen hook name or screen object. |
|
| 25 | - * @param string[] $columns An array of columns with column IDs as the keys |
|
| 26 | - * and translated column names as the values. |
|
| 27 | - */ |
|
| 28 | - public function __construct( $screen, $columns = array() ) { |
|
| 29 | - if ( is_string( $screen ) ) { |
|
| 30 | - $screen = convert_to_screen( $screen ); |
|
| 31 | - } |
|
| 19 | + /** |
|
| 20 | + * Constructor. |
|
| 21 | + * |
|
| 22 | + * @since 3.1.0 |
|
| 23 | + * |
|
| 24 | + * @param string|WP_Screen $screen The screen hook name or screen object. |
|
| 25 | + * @param string[] $columns An array of columns with column IDs as the keys |
|
| 26 | + * and translated column names as the values. |
|
| 27 | + */ |
|
| 28 | + public function __construct( $screen, $columns = array() ) { |
|
| 29 | + if ( is_string( $screen ) ) { |
|
| 30 | + $screen = convert_to_screen( $screen ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - $this->_screen = $screen; |
|
| 33 | + $this->_screen = $screen; |
|
| 34 | 34 | |
| 35 | - if ( ! empty( $columns ) ) { |
|
| 36 | - $this->_columns = $columns; |
|
| 37 | - add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 ); |
|
| 38 | - } |
|
| 39 | - } |
|
| 35 | + if ( ! empty( $columns ) ) { |
|
| 36 | + $this->_columns = $columns; |
|
| 37 | + add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 ); |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Gets a list of all, hidden, and sortable columns. |
|
| 43 | - * |
|
| 44 | - * @since 3.1.0 |
|
| 45 | - * |
|
| 46 | - * @return array |
|
| 47 | - */ |
|
| 48 | - protected function get_column_info() { |
|
| 49 | - $columns = get_column_headers( $this->_screen ); |
|
| 50 | - $hidden = get_hidden_columns( $this->_screen ); |
|
| 51 | - $sortable = array(); |
|
| 52 | - $primary = $this->get_default_primary_column_name(); |
|
| 41 | + /** |
|
| 42 | + * Gets a list of all, hidden, and sortable columns. |
|
| 43 | + * |
|
| 44 | + * @since 3.1.0 |
|
| 45 | + * |
|
| 46 | + * @return array |
|
| 47 | + */ |
|
| 48 | + protected function get_column_info() { |
|
| 49 | + $columns = get_column_headers( $this->_screen ); |
|
| 50 | + $hidden = get_hidden_columns( $this->_screen ); |
|
| 51 | + $sortable = array(); |
|
| 52 | + $primary = $this->get_default_primary_column_name(); |
|
| 53 | 53 | |
| 54 | - return array( $columns, $hidden, $sortable, $primary ); |
|
| 55 | - } |
|
| 54 | + return array( $columns, $hidden, $sortable, $primary ); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Gets a list of columns. |
|
| 59 | - * |
|
| 60 | - * @since 3.1.0 |
|
| 61 | - * |
|
| 62 | - * @return array |
|
| 63 | - */ |
|
| 64 | - public function get_columns() { |
|
| 65 | - return $this->_columns; |
|
| 66 | - } |
|
| 57 | + /** |
|
| 58 | + * Gets a list of columns. |
|
| 59 | + * |
|
| 60 | + * @since 3.1.0 |
|
| 61 | + * |
|
| 62 | + * @return array |
|
| 63 | + */ |
|
| 64 | + public function get_columns() { |
|
| 65 | + return $this->_columns; |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -25,16 +25,16 @@ discard block |
||
| 25 | 25 | * @param string[] $columns An array of columns with column IDs as the keys |
| 26 | 26 | * and translated column names as the values. |
| 27 | 27 | */ |
| 28 | - public function __construct( $screen, $columns = array() ) { |
|
| 29 | - if ( is_string( $screen ) ) { |
|
| 30 | - $screen = convert_to_screen( $screen ); |
|
| 28 | + public function __construct($screen, $columns = array()) { |
|
| 29 | + if (is_string($screen)) { |
|
| 30 | + $screen = convert_to_screen($screen); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $this->_screen = $screen; |
| 34 | 34 | |
| 35 | - if ( ! empty( $columns ) ) { |
|
| 35 | + if (!empty($columns)) { |
|
| 36 | 36 | $this->_columns = $columns; |
| 37 | - add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 ); |
|
| 37 | + add_filter('manage_' . $screen->id . '_columns', array($this, 'get_columns'), 0); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | * @return array |
| 47 | 47 | */ |
| 48 | 48 | protected function get_column_info() { |
| 49 | - $columns = get_column_headers( $this->_screen ); |
|
| 50 | - $hidden = get_hidden_columns( $this->_screen ); |
|
| 49 | + $columns = get_column_headers($this->_screen); |
|
| 50 | + $hidden = get_hidden_columns($this->_screen); |
|
| 51 | 51 | $sortable = array(); |
| 52 | 52 | $primary = $this->get_default_primary_column_name(); |
| 53 | 53 | |
| 54 | - return array( $columns, $hidden, $sortable, $primary ); |
|
| 54 | + return array($columns, $hidden, $sortable, $primary); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -17,203 +17,203 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | class WP_Theme_Install_List_Table extends WP_Themes_List_Table { |
| 19 | 19 | |
| 20 | - public $features = array(); |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * @return bool |
|
| 24 | - */ |
|
| 25 | - public function ajax_user_can() { |
|
| 26 | - return current_user_can( 'install_themes' ); |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @global array $tabs |
|
| 31 | - * @global string $tab |
|
| 32 | - * @global int $paged |
|
| 33 | - * @global string $type |
|
| 34 | - * @global array $theme_field_defaults |
|
| 35 | - */ |
|
| 36 | - public function prepare_items() { |
|
| 37 | - require ABSPATH . 'wp-admin/includes/theme-install.php'; |
|
| 38 | - |
|
| 39 | - global $tabs, $tab, $paged, $type, $theme_field_defaults; |
|
| 40 | - wp_reset_vars( array( 'tab' ) ); |
|
| 41 | - |
|
| 42 | - $search_terms = array(); |
|
| 43 | - $search_string = ''; |
|
| 44 | - if ( ! empty( $_REQUEST['s'] ) ) { |
|
| 45 | - $search_string = strtolower( wp_unslash( $_REQUEST['s'] ) ); |
|
| 46 | - $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) ); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - if ( ! empty( $_REQUEST['features'] ) ) { |
|
| 50 | - $this->features = $_REQUEST['features']; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - $paged = $this->get_pagenum(); |
|
| 54 | - |
|
| 55 | - $per_page = 36; |
|
| 56 | - |
|
| 57 | - // These are the tabs which are shown on the page, |
|
| 58 | - $tabs = array(); |
|
| 59 | - $tabs['dashboard'] = __( 'Search' ); |
|
| 60 | - if ( 'search' === $tab ) { |
|
| 61 | - $tabs['search'] = __( 'Search Results' ); |
|
| 62 | - } |
|
| 63 | - $tabs['upload'] = __( 'Upload' ); |
|
| 64 | - $tabs['featured'] = _x( 'Featured', 'themes' ); |
|
| 65 | - //$tabs['popular'] = _x( 'Popular', 'themes' ); |
|
| 66 | - $tabs['new'] = _x( 'Latest', 'themes' ); |
|
| 67 | - $tabs['updated'] = _x( 'Recently Updated', 'themes' ); |
|
| 68 | - |
|
| 69 | - $nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item. |
|
| 70 | - |
|
| 71 | - /** This filter is documented in wp-admin/theme-install.php */ |
|
| 72 | - $tabs = apply_filters( 'install_themes_tabs', $tabs ); |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * Filters tabs not associated with a menu item on the Install Themes screen. |
|
| 76 | - * |
|
| 77 | - * @since 2.8.0 |
|
| 78 | - * |
|
| 79 | - * @param string[] $nonmenu_tabs The tabs that don't have a menu item on |
|
| 80 | - * the Install Themes screen. |
|
| 81 | - */ |
|
| 82 | - $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs ); |
|
| 83 | - |
|
| 84 | - // If a non-valid menu tab has been selected, And it's not a non-menu action. |
|
| 85 | - if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { |
|
| 86 | - $tab = key( $tabs ); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $args = array( |
|
| 90 | - 'page' => $paged, |
|
| 91 | - 'per_page' => $per_page, |
|
| 92 | - 'fields' => $theme_field_defaults, |
|
| 93 | - ); |
|
| 94 | - |
|
| 95 | - switch ( $tab ) { |
|
| 96 | - case 'search': |
|
| 97 | - $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; |
|
| 98 | - switch ( $type ) { |
|
| 99 | - case 'tag': |
|
| 100 | - $args['tag'] = array_map( 'sanitize_key', $search_terms ); |
|
| 101 | - break; |
|
| 102 | - case 'term': |
|
| 103 | - $args['search'] = $search_string; |
|
| 104 | - break; |
|
| 105 | - case 'author': |
|
| 106 | - $args['author'] = $search_string; |
|
| 107 | - break; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - if ( ! empty( $this->features ) ) { |
|
| 111 | - $args['tag'] = $this->features; |
|
| 112 | - $_REQUEST['s'] = implode( ',', $this->features ); |
|
| 113 | - $_REQUEST['type'] = 'tag'; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - add_action( 'install_themes_table_header', 'install_theme_search_form', 10, 0 ); |
|
| 117 | - break; |
|
| 118 | - |
|
| 119 | - case 'featured': |
|
| 120 | - // case 'popular': |
|
| 121 | - case 'new': |
|
| 122 | - case 'updated': |
|
| 123 | - $args['browse'] = $tab; |
|
| 124 | - break; |
|
| 125 | - |
|
| 126 | - default: |
|
| 127 | - $args = false; |
|
| 128 | - break; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * Filters API request arguments for each Install Themes screen tab. |
|
| 133 | - * |
|
| 134 | - * The dynamic portion of the hook name, `$tab`, refers to the theme install |
|
| 135 | - * tab. |
|
| 136 | - * |
|
| 137 | - * Possible hook names include: |
|
| 138 | - * |
|
| 139 | - * - `install_themes_table_api_args_dashboard` |
|
| 140 | - * - `install_themes_table_api_args_featured` |
|
| 141 | - * - `install_themes_table_api_args_new` |
|
| 142 | - * - `install_themes_table_api_args_search` |
|
| 143 | - * - `install_themes_table_api_args_updated` |
|
| 144 | - * - `install_themes_table_api_args_upload` |
|
| 145 | - * |
|
| 146 | - * @since 3.7.0 |
|
| 147 | - * |
|
| 148 | - * @param array|false $args Theme install API arguments. |
|
| 149 | - */ |
|
| 150 | - $args = apply_filters( "install_themes_table_api_args_{$tab}", $args ); |
|
| 151 | - |
|
| 152 | - if ( ! $args ) { |
|
| 153 | - return; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - $api = themes_api( 'query_themes', $args ); |
|
| 157 | - |
|
| 158 | - if ( is_wp_error( $api ) ) { |
|
| 159 | - wp_die( '<p>' . $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try Again' ) . '</a></p>' ); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - $this->items = $api->themes; |
|
| 163 | - |
|
| 164 | - $this->set_pagination_args( |
|
| 165 | - array( |
|
| 166 | - 'total_items' => $api->info['results'], |
|
| 167 | - 'per_page' => $args['per_page'], |
|
| 168 | - 'infinite_scroll' => true, |
|
| 169 | - ) |
|
| 170 | - ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - */ |
|
| 175 | - public function no_items() { |
|
| 176 | - _e( 'No themes match your request.' ); |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - /** |
|
| 180 | - * @global array $tabs |
|
| 181 | - * @global string $tab |
|
| 182 | - * @return array |
|
| 183 | - */ |
|
| 184 | - protected function get_views() { |
|
| 185 | - global $tabs, $tab; |
|
| 186 | - |
|
| 187 | - $display_tabs = array(); |
|
| 188 | - foreach ( (array) $tabs as $action => $text ) { |
|
| 189 | - $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; |
|
| 190 | - $href = self_admin_url( 'theme-install.php?tab=' . $action ); |
|
| 191 | - $display_tabs[ 'theme-install-' . $action ] = "<a href='$href'$current_link_attributes>$text</a>"; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - return $display_tabs; |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Displays the theme install table. |
|
| 199 | - * |
|
| 200 | - * Overrides the parent display() method to provide a different container. |
|
| 201 | - * |
|
| 202 | - * @since 3.1.0 |
|
| 203 | - */ |
|
| 204 | - public function display() { |
|
| 205 | - wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); |
|
| 206 | - ?> |
|
| 20 | + public $features = array(); |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * @return bool |
|
| 24 | + */ |
|
| 25 | + public function ajax_user_can() { |
|
| 26 | + return current_user_can( 'install_themes' ); |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @global array $tabs |
|
| 31 | + * @global string $tab |
|
| 32 | + * @global int $paged |
|
| 33 | + * @global string $type |
|
| 34 | + * @global array $theme_field_defaults |
|
| 35 | + */ |
|
| 36 | + public function prepare_items() { |
|
| 37 | + require ABSPATH . 'wp-admin/includes/theme-install.php'; |
|
| 38 | + |
|
| 39 | + global $tabs, $tab, $paged, $type, $theme_field_defaults; |
|
| 40 | + wp_reset_vars( array( 'tab' ) ); |
|
| 41 | + |
|
| 42 | + $search_terms = array(); |
|
| 43 | + $search_string = ''; |
|
| 44 | + if ( ! empty( $_REQUEST['s'] ) ) { |
|
| 45 | + $search_string = strtolower( wp_unslash( $_REQUEST['s'] ) ); |
|
| 46 | + $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) ); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + if ( ! empty( $_REQUEST['features'] ) ) { |
|
| 50 | + $this->features = $_REQUEST['features']; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + $paged = $this->get_pagenum(); |
|
| 54 | + |
|
| 55 | + $per_page = 36; |
|
| 56 | + |
|
| 57 | + // These are the tabs which are shown on the page, |
|
| 58 | + $tabs = array(); |
|
| 59 | + $tabs['dashboard'] = __( 'Search' ); |
|
| 60 | + if ( 'search' === $tab ) { |
|
| 61 | + $tabs['search'] = __( 'Search Results' ); |
|
| 62 | + } |
|
| 63 | + $tabs['upload'] = __( 'Upload' ); |
|
| 64 | + $tabs['featured'] = _x( 'Featured', 'themes' ); |
|
| 65 | + //$tabs['popular'] = _x( 'Popular', 'themes' ); |
|
| 66 | + $tabs['new'] = _x( 'Latest', 'themes' ); |
|
| 67 | + $tabs['updated'] = _x( 'Recently Updated', 'themes' ); |
|
| 68 | + |
|
| 69 | + $nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item. |
|
| 70 | + |
|
| 71 | + /** This filter is documented in wp-admin/theme-install.php */ |
|
| 72 | + $tabs = apply_filters( 'install_themes_tabs', $tabs ); |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * Filters tabs not associated with a menu item on the Install Themes screen. |
|
| 76 | + * |
|
| 77 | + * @since 2.8.0 |
|
| 78 | + * |
|
| 79 | + * @param string[] $nonmenu_tabs The tabs that don't have a menu item on |
|
| 80 | + * the Install Themes screen. |
|
| 81 | + */ |
|
| 82 | + $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs ); |
|
| 83 | + |
|
| 84 | + // If a non-valid menu tab has been selected, And it's not a non-menu action. |
|
| 85 | + if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { |
|
| 86 | + $tab = key( $tabs ); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $args = array( |
|
| 90 | + 'page' => $paged, |
|
| 91 | + 'per_page' => $per_page, |
|
| 92 | + 'fields' => $theme_field_defaults, |
|
| 93 | + ); |
|
| 94 | + |
|
| 95 | + switch ( $tab ) { |
|
| 96 | + case 'search': |
|
| 97 | + $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; |
|
| 98 | + switch ( $type ) { |
|
| 99 | + case 'tag': |
|
| 100 | + $args['tag'] = array_map( 'sanitize_key', $search_terms ); |
|
| 101 | + break; |
|
| 102 | + case 'term': |
|
| 103 | + $args['search'] = $search_string; |
|
| 104 | + break; |
|
| 105 | + case 'author': |
|
| 106 | + $args['author'] = $search_string; |
|
| 107 | + break; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + if ( ! empty( $this->features ) ) { |
|
| 111 | + $args['tag'] = $this->features; |
|
| 112 | + $_REQUEST['s'] = implode( ',', $this->features ); |
|
| 113 | + $_REQUEST['type'] = 'tag'; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + add_action( 'install_themes_table_header', 'install_theme_search_form', 10, 0 ); |
|
| 117 | + break; |
|
| 118 | + |
|
| 119 | + case 'featured': |
|
| 120 | + // case 'popular': |
|
| 121 | + case 'new': |
|
| 122 | + case 'updated': |
|
| 123 | + $args['browse'] = $tab; |
|
| 124 | + break; |
|
| 125 | + |
|
| 126 | + default: |
|
| 127 | + $args = false; |
|
| 128 | + break; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * Filters API request arguments for each Install Themes screen tab. |
|
| 133 | + * |
|
| 134 | + * The dynamic portion of the hook name, `$tab`, refers to the theme install |
|
| 135 | + * tab. |
|
| 136 | + * |
|
| 137 | + * Possible hook names include: |
|
| 138 | + * |
|
| 139 | + * - `install_themes_table_api_args_dashboard` |
|
| 140 | + * - `install_themes_table_api_args_featured` |
|
| 141 | + * - `install_themes_table_api_args_new` |
|
| 142 | + * - `install_themes_table_api_args_search` |
|
| 143 | + * - `install_themes_table_api_args_updated` |
|
| 144 | + * - `install_themes_table_api_args_upload` |
|
| 145 | + * |
|
| 146 | + * @since 3.7.0 |
|
| 147 | + * |
|
| 148 | + * @param array|false $args Theme install API arguments. |
|
| 149 | + */ |
|
| 150 | + $args = apply_filters( "install_themes_table_api_args_{$tab}", $args ); |
|
| 151 | + |
|
| 152 | + if ( ! $args ) { |
|
| 153 | + return; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + $api = themes_api( 'query_themes', $args ); |
|
| 157 | + |
|
| 158 | + if ( is_wp_error( $api ) ) { |
|
| 159 | + wp_die( '<p>' . $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try Again' ) . '</a></p>' ); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + $this->items = $api->themes; |
|
| 163 | + |
|
| 164 | + $this->set_pagination_args( |
|
| 165 | + array( |
|
| 166 | + 'total_items' => $api->info['results'], |
|
| 167 | + 'per_page' => $args['per_page'], |
|
| 168 | + 'infinite_scroll' => true, |
|
| 169 | + ) |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + */ |
|
| 175 | + public function no_items() { |
|
| 176 | + _e( 'No themes match your request.' ); |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + /** |
|
| 180 | + * @global array $tabs |
|
| 181 | + * @global string $tab |
|
| 182 | + * @return array |
|
| 183 | + */ |
|
| 184 | + protected function get_views() { |
|
| 185 | + global $tabs, $tab; |
|
| 186 | + |
|
| 187 | + $display_tabs = array(); |
|
| 188 | + foreach ( (array) $tabs as $action => $text ) { |
|
| 189 | + $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; |
|
| 190 | + $href = self_admin_url( 'theme-install.php?tab=' . $action ); |
|
| 191 | + $display_tabs[ 'theme-install-' . $action ] = "<a href='$href'$current_link_attributes>$text</a>"; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + return $display_tabs; |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Displays the theme install table. |
|
| 199 | + * |
|
| 200 | + * Overrides the parent display() method to provide a different container. |
|
| 201 | + * |
|
| 202 | + * @since 3.1.0 |
|
| 203 | + */ |
|
| 204 | + public function display() { |
|
| 205 | + wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); |
|
| 206 | + ?> |
|
| 207 | 207 | <div class="tablenav top themes"> |
| 208 | 208 | <div class="alignleft actions"> |
| 209 | 209 | <?php |
| 210 | - /** |
|
| 211 | - * Fires in the Install Themes list table header. |
|
| 212 | - * |
|
| 213 | - * @since 2.8.0 |
|
| 214 | - */ |
|
| 215 | - do_action( 'install_themes_table_header' ); |
|
| 216 | - ?> |
|
| 210 | + /** |
|
| 211 | + * Fires in the Install Themes list table header. |
|
| 212 | + * |
|
| 213 | + * @since 2.8.0 |
|
| 214 | + */ |
|
| 215 | + do_action( 'install_themes_table_header' ); |
|
| 216 | + ?> |
|
| 217 | 217 | </div> |
| 218 | 218 | <?php $this->pagination( 'top' ); ?> |
| 219 | 219 | <br class="clear" /> |
@@ -224,140 +224,140 @@ discard block |
||
| 224 | 224 | </div> |
| 225 | 225 | |
| 226 | 226 | <?php |
| 227 | - $this->tablenav( 'bottom' ); |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - */ |
|
| 232 | - public function display_rows() { |
|
| 233 | - $themes = $this->items; |
|
| 234 | - foreach ( $themes as $theme ) { |
|
| 235 | - ?> |
|
| 227 | + $this->tablenav( 'bottom' ); |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + */ |
|
| 232 | + public function display_rows() { |
|
| 233 | + $themes = $this->items; |
|
| 234 | + foreach ( $themes as $theme ) { |
|
| 235 | + ?> |
|
| 236 | 236 | <div class="available-theme installable-theme"> |
| 237 | 237 | <?php |
| 238 | - $this->single_row( $theme ); |
|
| 239 | - ?> |
|
| 238 | + $this->single_row( $theme ); |
|
| 239 | + ?> |
|
| 240 | 240 | </div> |
| 241 | 241 | <?php |
| 242 | - } // End foreach $theme_names. |
|
| 243 | - |
|
| 244 | - $this->theme_installer(); |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - /** |
|
| 248 | - * Prints a theme from the WordPress.org API. |
|
| 249 | - * |
|
| 250 | - * @since 3.1.0 |
|
| 251 | - * |
|
| 252 | - * @global array $themes_allowedtags |
|
| 253 | - * |
|
| 254 | - * @param stdClass $theme { |
|
| 255 | - * An object that contains theme data returned by the WordPress.org API. |
|
| 256 | - * |
|
| 257 | - * @type string $name Theme name, e.g. 'Twenty Twenty-One'. |
|
| 258 | - * @type string $slug Theme slug, e.g. 'twentytwentyone'. |
|
| 259 | - * @type string $version Theme version, e.g. '1.1'. |
|
| 260 | - * @type string $author Theme author username, e.g. 'melchoyce'. |
|
| 261 | - * @type string $preview_url Preview URL, e.g. 'https://2021.wordpress.net/'. |
|
| 262 | - * @type string $screenshot_url Screenshot URL, e.g. 'https://wordpress.org/themes/twentytwentyone/'. |
|
| 263 | - * @type float $rating Rating score. |
|
| 264 | - * @type int $num_ratings The number of ratings. |
|
| 265 | - * @type string $homepage Theme homepage, e.g. 'https://wordpress.org/themes/twentytwentyone/'. |
|
| 266 | - * @type string $description Theme description. |
|
| 267 | - * @type string $download_link Theme ZIP download URL. |
|
| 268 | - * } |
|
| 269 | - */ |
|
| 270 | - public function single_row( $theme ) { |
|
| 271 | - global $themes_allowedtags; |
|
| 272 | - |
|
| 273 | - if ( empty( $theme ) ) { |
|
| 274 | - return; |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - $name = wp_kses( $theme->name, $themes_allowedtags ); |
|
| 278 | - $author = wp_kses( $theme->author, $themes_allowedtags ); |
|
| 279 | - |
|
| 280 | - /* translators: %s: Theme name. */ |
|
| 281 | - $preview_title = sprintf( __( 'Preview “%s”' ), $name ); |
|
| 282 | - $preview_url = add_query_arg( |
|
| 283 | - array( |
|
| 284 | - 'tab' => 'theme-information', |
|
| 285 | - 'theme' => $theme->slug, |
|
| 286 | - ), |
|
| 287 | - self_admin_url( 'theme-install.php' ) |
|
| 288 | - ); |
|
| 289 | - |
|
| 290 | - $actions = array(); |
|
| 291 | - |
|
| 292 | - $install_url = add_query_arg( |
|
| 293 | - array( |
|
| 294 | - 'action' => 'install-theme', |
|
| 295 | - 'theme' => $theme->slug, |
|
| 296 | - ), |
|
| 297 | - self_admin_url( 'update.php' ) |
|
| 298 | - ); |
|
| 299 | - |
|
| 300 | - $update_url = add_query_arg( |
|
| 301 | - array( |
|
| 302 | - 'action' => 'upgrade-theme', |
|
| 303 | - 'theme' => $theme->slug, |
|
| 304 | - ), |
|
| 305 | - self_admin_url( 'update.php' ) |
|
| 306 | - ); |
|
| 307 | - |
|
| 308 | - $status = $this->_get_theme_status( $theme ); |
|
| 309 | - |
|
| 310 | - switch ( $status ) { |
|
| 311 | - case 'update_available': |
|
| 312 | - $actions[] = sprintf( |
|
| 313 | - '<a class="install-now" href="%s" title="%s">%s</a>', |
|
| 314 | - esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), |
|
| 315 | - /* translators: %s: Theme version. */ |
|
| 316 | - esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), |
|
| 317 | - __( 'Update' ) |
|
| 318 | - ); |
|
| 319 | - break; |
|
| 320 | - case 'newer_installed': |
|
| 321 | - case 'latest_installed': |
|
| 322 | - $actions[] = sprintf( |
|
| 323 | - '<span class="install-now" title="%s">%s</span>', |
|
| 324 | - esc_attr__( 'This theme is already installed and is up to date' ), |
|
| 325 | - _x( 'Installed', 'theme' ) |
|
| 326 | - ); |
|
| 327 | - break; |
|
| 328 | - case 'install': |
|
| 329 | - default: |
|
| 330 | - $actions[] = sprintf( |
|
| 331 | - '<a class="install-now" href="%s" title="%s">%s</a>', |
|
| 332 | - esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), |
|
| 333 | - /* translators: %s: Theme name. */ |
|
| 334 | - esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ), |
|
| 335 | - __( 'Install Now' ) |
|
| 336 | - ); |
|
| 337 | - break; |
|
| 338 | - } |
|
| 339 | - |
|
| 340 | - $actions[] = sprintf( |
|
| 341 | - '<a class="install-theme-preview" href="%s" title="%s">%s</a>', |
|
| 342 | - esc_url( $preview_url ), |
|
| 343 | - /* translators: %s: Theme name. */ |
|
| 344 | - esc_attr( sprintf( __( 'Preview %s' ), $name ) ), |
|
| 345 | - __( 'Preview' ) |
|
| 346 | - ); |
|
| 347 | - |
|
| 348 | - /** |
|
| 349 | - * Filters the install action links for a theme in the Install Themes list table. |
|
| 350 | - * |
|
| 351 | - * @since 3.4.0 |
|
| 352 | - * |
|
| 353 | - * @param string[] $actions An array of theme action links. Defaults are |
|
| 354 | - * links to Install Now, Preview, and Details. |
|
| 355 | - * @param stdClass $theme An object that contains theme data returned by the |
|
| 356 | - * WordPress.org API. |
|
| 357 | - */ |
|
| 358 | - $actions = apply_filters( 'theme_install_actions', $actions, $theme ); |
|
| 359 | - |
|
| 360 | - ?> |
|
| 242 | + } // End foreach $theme_names. |
|
| 243 | + |
|
| 244 | + $this->theme_installer(); |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + /** |
|
| 248 | + * Prints a theme from the WordPress.org API. |
|
| 249 | + * |
|
| 250 | + * @since 3.1.0 |
|
| 251 | + * |
|
| 252 | + * @global array $themes_allowedtags |
|
| 253 | + * |
|
| 254 | + * @param stdClass $theme { |
|
| 255 | + * An object that contains theme data returned by the WordPress.org API. |
|
| 256 | + * |
|
| 257 | + * @type string $name Theme name, e.g. 'Twenty Twenty-One'. |
|
| 258 | + * @type string $slug Theme slug, e.g. 'twentytwentyone'. |
|
| 259 | + * @type string $version Theme version, e.g. '1.1'. |
|
| 260 | + * @type string $author Theme author username, e.g. 'melchoyce'. |
|
| 261 | + * @type string $preview_url Preview URL, e.g. 'https://2021.wordpress.net/'. |
|
| 262 | + * @type string $screenshot_url Screenshot URL, e.g. 'https://wordpress.org/themes/twentytwentyone/'. |
|
| 263 | + * @type float $rating Rating score. |
|
| 264 | + * @type int $num_ratings The number of ratings. |
|
| 265 | + * @type string $homepage Theme homepage, e.g. 'https://wordpress.org/themes/twentytwentyone/'. |
|
| 266 | + * @type string $description Theme description. |
|
| 267 | + * @type string $download_link Theme ZIP download URL. |
|
| 268 | + * } |
|
| 269 | + */ |
|
| 270 | + public function single_row( $theme ) { |
|
| 271 | + global $themes_allowedtags; |
|
| 272 | + |
|
| 273 | + if ( empty( $theme ) ) { |
|
| 274 | + return; |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + $name = wp_kses( $theme->name, $themes_allowedtags ); |
|
| 278 | + $author = wp_kses( $theme->author, $themes_allowedtags ); |
|
| 279 | + |
|
| 280 | + /* translators: %s: Theme name. */ |
|
| 281 | + $preview_title = sprintf( __( 'Preview “%s”' ), $name ); |
|
| 282 | + $preview_url = add_query_arg( |
|
| 283 | + array( |
|
| 284 | + 'tab' => 'theme-information', |
|
| 285 | + 'theme' => $theme->slug, |
|
| 286 | + ), |
|
| 287 | + self_admin_url( 'theme-install.php' ) |
|
| 288 | + ); |
|
| 289 | + |
|
| 290 | + $actions = array(); |
|
| 291 | + |
|
| 292 | + $install_url = add_query_arg( |
|
| 293 | + array( |
|
| 294 | + 'action' => 'install-theme', |
|
| 295 | + 'theme' => $theme->slug, |
|
| 296 | + ), |
|
| 297 | + self_admin_url( 'update.php' ) |
|
| 298 | + ); |
|
| 299 | + |
|
| 300 | + $update_url = add_query_arg( |
|
| 301 | + array( |
|
| 302 | + 'action' => 'upgrade-theme', |
|
| 303 | + 'theme' => $theme->slug, |
|
| 304 | + ), |
|
| 305 | + self_admin_url( 'update.php' ) |
|
| 306 | + ); |
|
| 307 | + |
|
| 308 | + $status = $this->_get_theme_status( $theme ); |
|
| 309 | + |
|
| 310 | + switch ( $status ) { |
|
| 311 | + case 'update_available': |
|
| 312 | + $actions[] = sprintf( |
|
| 313 | + '<a class="install-now" href="%s" title="%s">%s</a>', |
|
| 314 | + esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), |
|
| 315 | + /* translators: %s: Theme version. */ |
|
| 316 | + esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), |
|
| 317 | + __( 'Update' ) |
|
| 318 | + ); |
|
| 319 | + break; |
|
| 320 | + case 'newer_installed': |
|
| 321 | + case 'latest_installed': |
|
| 322 | + $actions[] = sprintf( |
|
| 323 | + '<span class="install-now" title="%s">%s</span>', |
|
| 324 | + esc_attr__( 'This theme is already installed and is up to date' ), |
|
| 325 | + _x( 'Installed', 'theme' ) |
|
| 326 | + ); |
|
| 327 | + break; |
|
| 328 | + case 'install': |
|
| 329 | + default: |
|
| 330 | + $actions[] = sprintf( |
|
| 331 | + '<a class="install-now" href="%s" title="%s">%s</a>', |
|
| 332 | + esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), |
|
| 333 | + /* translators: %s: Theme name. */ |
|
| 334 | + esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ), |
|
| 335 | + __( 'Install Now' ) |
|
| 336 | + ); |
|
| 337 | + break; |
|
| 338 | + } |
|
| 339 | + |
|
| 340 | + $actions[] = sprintf( |
|
| 341 | + '<a class="install-theme-preview" href="%s" title="%s">%s</a>', |
|
| 342 | + esc_url( $preview_url ), |
|
| 343 | + /* translators: %s: Theme name. */ |
|
| 344 | + esc_attr( sprintf( __( 'Preview %s' ), $name ) ), |
|
| 345 | + __( 'Preview' ) |
|
| 346 | + ); |
|
| 347 | + |
|
| 348 | + /** |
|
| 349 | + * Filters the install action links for a theme in the Install Themes list table. |
|
| 350 | + * |
|
| 351 | + * @since 3.4.0 |
|
| 352 | + * |
|
| 353 | + * @param string[] $actions An array of theme action links. Defaults are |
|
| 354 | + * links to Install Now, Preview, and Details. |
|
| 355 | + * @param stdClass $theme An object that contains theme data returned by the |
|
| 356 | + * WordPress.org API. |
|
| 357 | + */ |
|
| 358 | + $actions = apply_filters( 'theme_install_actions', $actions, $theme ); |
|
| 359 | + |
|
| 360 | + ?> |
|
| 361 | 361 | <a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>"> |
| 362 | 362 | <img src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" width="150" alt="" /> |
| 363 | 363 | </a> |
@@ -365,9 +365,9 @@ discard block |
||
| 365 | 365 | <h3><?php echo $name; ?></h3> |
| 366 | 366 | <div class="theme-author"> |
| 367 | 367 | <?php |
| 368 | - /* translators: %s: Theme author. */ |
|
| 369 | - printf( __( 'By %s' ), $author ); |
|
| 370 | - ?> |
|
| 368 | + /* translators: %s: Theme author. */ |
|
| 369 | + printf( __( 'By %s' ), $author ); |
|
| 370 | + ?> |
|
| 371 | 371 | </div> |
| 372 | 372 | |
| 373 | 373 | <div class="action-links"> |
@@ -380,14 +380,14 @@ discard block |
||
| 380 | 380 | </div> |
| 381 | 381 | |
| 382 | 382 | <?php |
| 383 | - $this->install_theme_info( $theme ); |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - /** |
|
| 387 | - * Prints the wrapper for the theme installer. |
|
| 388 | - */ |
|
| 389 | - public function theme_installer() { |
|
| 390 | - ?> |
|
| 383 | + $this->install_theme_info( $theme ); |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + /** |
|
| 387 | + * Prints the wrapper for the theme installer. |
|
| 388 | + */ |
|
| 389 | + public function theme_installer() { |
|
| 390 | + ?> |
|
| 391 | 391 | <div id="theme-installer" class="wp-full-overlay expanded"> |
| 392 | 392 | <div class="wp-full-overlay-sidebar"> |
| 393 | 393 | <div class="wp-full-overlay-header"> |
@@ -407,16 +407,16 @@ discard block |
||
| 407 | 407 | <div class="wp-full-overlay-main"></div> |
| 408 | 408 | </div> |
| 409 | 409 | <?php |
| 410 | - } |
|
| 411 | - |
|
| 412 | - /** |
|
| 413 | - * Prints the wrapper for the theme installer with a provided theme's data. |
|
| 414 | - * Used to make the theme installer work for no-js. |
|
| 415 | - * |
|
| 416 | - * @param stdClass $theme A WordPress.org Theme API object. |
|
| 417 | - */ |
|
| 418 | - public function theme_installer_single( $theme ) { |
|
| 419 | - ?> |
|
| 410 | + } |
|
| 411 | + |
|
| 412 | + /** |
|
| 413 | + * Prints the wrapper for the theme installer with a provided theme's data. |
|
| 414 | + * Used to make the theme installer work for no-js. |
|
| 415 | + * |
|
| 416 | + * @param stdClass $theme A WordPress.org Theme API object. |
|
| 417 | + */ |
|
| 418 | + public function theme_installer_single( $theme ) { |
|
| 419 | + ?> |
|
| 420 | 420 | <div id="theme-installer" class="wp-full-overlay single-theme"> |
| 421 | 421 | <div class="wp-full-overlay-sidebar"> |
| 422 | 422 | <?php $this->install_theme_info( $theme ); ?> |
@@ -426,94 +426,94 @@ discard block |
||
| 426 | 426 | </div> |
| 427 | 427 | </div> |
| 428 | 428 | <?php |
| 429 | - } |
|
| 430 | - |
|
| 431 | - /** |
|
| 432 | - * Prints the info for a theme (to be used in the theme installer modal). |
|
| 433 | - * |
|
| 434 | - * @global array $themes_allowedtags |
|
| 435 | - * |
|
| 436 | - * @param stdClass $theme A WordPress.org Theme API object. |
|
| 437 | - */ |
|
| 438 | - public function install_theme_info( $theme ) { |
|
| 439 | - global $themes_allowedtags; |
|
| 440 | - |
|
| 441 | - if ( empty( $theme ) ) { |
|
| 442 | - return; |
|
| 443 | - } |
|
| 444 | - |
|
| 445 | - $name = wp_kses( $theme->name, $themes_allowedtags ); |
|
| 446 | - $author = wp_kses( $theme->author, $themes_allowedtags ); |
|
| 447 | - |
|
| 448 | - $install_url = add_query_arg( |
|
| 449 | - array( |
|
| 450 | - 'action' => 'install-theme', |
|
| 451 | - 'theme' => $theme->slug, |
|
| 452 | - ), |
|
| 453 | - self_admin_url( 'update.php' ) |
|
| 454 | - ); |
|
| 455 | - |
|
| 456 | - $update_url = add_query_arg( |
|
| 457 | - array( |
|
| 458 | - 'action' => 'upgrade-theme', |
|
| 459 | - 'theme' => $theme->slug, |
|
| 460 | - ), |
|
| 461 | - self_admin_url( 'update.php' ) |
|
| 462 | - ); |
|
| 463 | - |
|
| 464 | - $status = $this->_get_theme_status( $theme ); |
|
| 465 | - |
|
| 466 | - ?> |
|
| 429 | + } |
|
| 430 | + |
|
| 431 | + /** |
|
| 432 | + * Prints the info for a theme (to be used in the theme installer modal). |
|
| 433 | + * |
|
| 434 | + * @global array $themes_allowedtags |
|
| 435 | + * |
|
| 436 | + * @param stdClass $theme A WordPress.org Theme API object. |
|
| 437 | + */ |
|
| 438 | + public function install_theme_info( $theme ) { |
|
| 439 | + global $themes_allowedtags; |
|
| 440 | + |
|
| 441 | + if ( empty( $theme ) ) { |
|
| 442 | + return; |
|
| 443 | + } |
|
| 444 | + |
|
| 445 | + $name = wp_kses( $theme->name, $themes_allowedtags ); |
|
| 446 | + $author = wp_kses( $theme->author, $themes_allowedtags ); |
|
| 447 | + |
|
| 448 | + $install_url = add_query_arg( |
|
| 449 | + array( |
|
| 450 | + 'action' => 'install-theme', |
|
| 451 | + 'theme' => $theme->slug, |
|
| 452 | + ), |
|
| 453 | + self_admin_url( 'update.php' ) |
|
| 454 | + ); |
|
| 455 | + |
|
| 456 | + $update_url = add_query_arg( |
|
| 457 | + array( |
|
| 458 | + 'action' => 'upgrade-theme', |
|
| 459 | + 'theme' => $theme->slug, |
|
| 460 | + ), |
|
| 461 | + self_admin_url( 'update.php' ) |
|
| 462 | + ); |
|
| 463 | + |
|
| 464 | + $status = $this->_get_theme_status( $theme ); |
|
| 465 | + |
|
| 466 | + ?> |
|
| 467 | 467 | <div class="install-theme-info"> |
| 468 | 468 | <?php |
| 469 | - switch ( $status ) { |
|
| 470 | - case 'update_available': |
|
| 471 | - printf( |
|
| 472 | - '<a class="theme-install button button-primary" href="%s" title="%s">%s</a>', |
|
| 473 | - esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), |
|
| 474 | - /* translators: %s: Theme version. */ |
|
| 475 | - esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), |
|
| 476 | - __( 'Update' ) |
|
| 477 | - ); |
|
| 478 | - break; |
|
| 479 | - case 'newer_installed': |
|
| 480 | - case 'latest_installed': |
|
| 481 | - printf( |
|
| 482 | - '<span class="theme-install" title="%s">%s</span>', |
|
| 483 | - esc_attr__( 'This theme is already installed and is up to date' ), |
|
| 484 | - _x( 'Installed', 'theme' ) |
|
| 485 | - ); |
|
| 486 | - break; |
|
| 487 | - case 'install': |
|
| 488 | - default: |
|
| 489 | - printf( |
|
| 490 | - '<a class="theme-install button button-primary" href="%s">%s</a>', |
|
| 491 | - esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), |
|
| 492 | - __( 'Install' ) |
|
| 493 | - ); |
|
| 494 | - break; |
|
| 495 | - } |
|
| 496 | - ?> |
|
| 469 | + switch ( $status ) { |
|
| 470 | + case 'update_available': |
|
| 471 | + printf( |
|
| 472 | + '<a class="theme-install button button-primary" href="%s" title="%s">%s</a>', |
|
| 473 | + esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), |
|
| 474 | + /* translators: %s: Theme version. */ |
|
| 475 | + esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), |
|
| 476 | + __( 'Update' ) |
|
| 477 | + ); |
|
| 478 | + break; |
|
| 479 | + case 'newer_installed': |
|
| 480 | + case 'latest_installed': |
|
| 481 | + printf( |
|
| 482 | + '<span class="theme-install" title="%s">%s</span>', |
|
| 483 | + esc_attr__( 'This theme is already installed and is up to date' ), |
|
| 484 | + _x( 'Installed', 'theme' ) |
|
| 485 | + ); |
|
| 486 | + break; |
|
| 487 | + case 'install': |
|
| 488 | + default: |
|
| 489 | + printf( |
|
| 490 | + '<a class="theme-install button button-primary" href="%s">%s</a>', |
|
| 491 | + esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), |
|
| 492 | + __( 'Install' ) |
|
| 493 | + ); |
|
| 494 | + break; |
|
| 495 | + } |
|
| 496 | + ?> |
|
| 497 | 497 | <h3 class="theme-name"><?php echo $name; ?></h3> |
| 498 | 498 | <span class="theme-by"> |
| 499 | 499 | <?php |
| 500 | - /* translators: %s: Theme author. */ |
|
| 501 | - printf( __( 'By %s' ), $author ); |
|
| 502 | - ?> |
|
| 500 | + /* translators: %s: Theme author. */ |
|
| 501 | + printf( __( 'By %s' ), $author ); |
|
| 502 | + ?> |
|
| 503 | 503 | </span> |
| 504 | 504 | <?php if ( isset( $theme->screenshot_url ) ) : ?> |
| 505 | 505 | <img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" alt="" /> |
| 506 | 506 | <?php endif; ?> |
| 507 | 507 | <div class="theme-details"> |
| 508 | 508 | <?php |
| 509 | - wp_star_rating( |
|
| 510 | - array( |
|
| 511 | - 'rating' => $theme->rating, |
|
| 512 | - 'type' => 'percent', |
|
| 513 | - 'number' => $theme->num_ratings, |
|
| 514 | - ) |
|
| 515 | - ); |
|
| 516 | - ?> |
|
| 509 | + wp_star_rating( |
|
| 510 | + array( |
|
| 511 | + 'rating' => $theme->rating, |
|
| 512 | + 'type' => 'percent', |
|
| 513 | + 'number' => $theme->num_ratings, |
|
| 514 | + ) |
|
| 515 | + ); |
|
| 516 | + ?> |
|
| 517 | 517 | <div class="theme-version"> |
| 518 | 518 | <strong><?php _e( 'Version:' ); ?> </strong> |
| 519 | 519 | <?php echo wp_kses( $theme->version, $themes_allowedtags ); ?> |
@@ -525,45 +525,45 @@ discard block |
||
| 525 | 525 | <input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" /> |
| 526 | 526 | </div> |
| 527 | 527 | <?php |
| 528 | - } |
|
| 529 | - |
|
| 530 | - /** |
|
| 531 | - * Send required variables to JavaScript land |
|
| 532 | - * |
|
| 533 | - * @since 3.4.0 |
|
| 534 | - * |
|
| 535 | - * @global string $tab Current tab within Themes->Install screen |
|
| 536 | - * @global string $type Type of search. |
|
| 537 | - * |
|
| 538 | - * @param array $extra_args Unused. |
|
| 539 | - */ |
|
| 540 | - public function _js_vars( $extra_args = array() ) { |
|
| 541 | - global $tab, $type; |
|
| 542 | - parent::_js_vars( compact( 'tab', 'type' ) ); |
|
| 543 | - } |
|
| 544 | - |
|
| 545 | - /** |
|
| 546 | - * Check to see if the theme is already installed. |
|
| 547 | - * |
|
| 548 | - * @since 3.4.0 |
|
| 549 | - * |
|
| 550 | - * @param stdClass $theme A WordPress.org Theme API object. |
|
| 551 | - * @return string Theme status. |
|
| 552 | - */ |
|
| 553 | - private function _get_theme_status( $theme ) { |
|
| 554 | - $status = 'install'; |
|
| 555 | - |
|
| 556 | - $installed_theme = wp_get_theme( $theme->slug ); |
|
| 557 | - if ( $installed_theme->exists() ) { |
|
| 558 | - if ( version_compare( $installed_theme->get( 'Version' ), $theme->version, '=' ) ) { |
|
| 559 | - $status = 'latest_installed'; |
|
| 560 | - } elseif ( version_compare( $installed_theme->get( 'Version' ), $theme->version, '>' ) ) { |
|
| 561 | - $status = 'newer_installed'; |
|
| 562 | - } else { |
|
| 563 | - $status = 'update_available'; |
|
| 564 | - } |
|
| 565 | - } |
|
| 566 | - |
|
| 567 | - return $status; |
|
| 568 | - } |
|
| 528 | + } |
|
| 529 | + |
|
| 530 | + /** |
|
| 531 | + * Send required variables to JavaScript land |
|
| 532 | + * |
|
| 533 | + * @since 3.4.0 |
|
| 534 | + * |
|
| 535 | + * @global string $tab Current tab within Themes->Install screen |
|
| 536 | + * @global string $type Type of search. |
|
| 537 | + * |
|
| 538 | + * @param array $extra_args Unused. |
|
| 539 | + */ |
|
| 540 | + public function _js_vars( $extra_args = array() ) { |
|
| 541 | + global $tab, $type; |
|
| 542 | + parent::_js_vars( compact( 'tab', 'type' ) ); |
|
| 543 | + } |
|
| 544 | + |
|
| 545 | + /** |
|
| 546 | + * Check to see if the theme is already installed. |
|
| 547 | + * |
|
| 548 | + * @since 3.4.0 |
|
| 549 | + * |
|
| 550 | + * @param stdClass $theme A WordPress.org Theme API object. |
|
| 551 | + * @return string Theme status. |
|
| 552 | + */ |
|
| 553 | + private function _get_theme_status( $theme ) { |
|
| 554 | + $status = 'install'; |
|
| 555 | + |
|
| 556 | + $installed_theme = wp_get_theme( $theme->slug ); |
|
| 557 | + if ( $installed_theme->exists() ) { |
|
| 558 | + if ( version_compare( $installed_theme->get( 'Version' ), $theme->version, '=' ) ) { |
|
| 559 | + $status = 'latest_installed'; |
|
| 560 | + } elseif ( version_compare( $installed_theme->get( 'Version' ), $theme->version, '>' ) ) { |
|
| 561 | + $status = 'newer_installed'; |
|
| 562 | + } else { |
|
| 563 | + $status = 'update_available'; |
|
| 564 | + } |
|
| 565 | + } |
|
| 566 | + |
|
| 567 | + return $status; |
|
| 568 | + } |
|
| 569 | 569 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return bool |
| 24 | 24 | */ |
| 25 | 25 | public function ajax_user_can() { |
| 26 | - return current_user_can( 'install_themes' ); |
|
| 26 | + return current_user_can('install_themes'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -37,16 +37,16 @@ discard block |
||
| 37 | 37 | require ABSPATH . 'wp-admin/includes/theme-install.php'; |
| 38 | 38 | |
| 39 | 39 | global $tabs, $tab, $paged, $type, $theme_field_defaults; |
| 40 | - wp_reset_vars( array( 'tab' ) ); |
|
| 40 | + wp_reset_vars(array('tab')); |
|
| 41 | 41 | |
| 42 | 42 | $search_terms = array(); |
| 43 | 43 | $search_string = ''; |
| 44 | - if ( ! empty( $_REQUEST['s'] ) ) { |
|
| 45 | - $search_string = strtolower( wp_unslash( $_REQUEST['s'] ) ); |
|
| 46 | - $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) ); |
|
| 44 | + if (!empty($_REQUEST['s'])) { |
|
| 45 | + $search_string = strtolower(wp_unslash($_REQUEST['s'])); |
|
| 46 | + $search_terms = array_unique(array_filter(array_map('trim', explode(',', $search_string)))); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if ( ! empty( $_REQUEST['features'] ) ) { |
|
| 49 | + if (!empty($_REQUEST['features'])) { |
|
| 50 | 50 | $this->features = $_REQUEST['features']; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -56,20 +56,20 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | // These are the tabs which are shown on the page, |
| 58 | 58 | $tabs = array(); |
| 59 | - $tabs['dashboard'] = __( 'Search' ); |
|
| 60 | - if ( 'search' === $tab ) { |
|
| 61 | - $tabs['search'] = __( 'Search Results' ); |
|
| 59 | + $tabs['dashboard'] = __('Search'); |
|
| 60 | + if ('search' === $tab) { |
|
| 61 | + $tabs['search'] = __('Search Results'); |
|
| 62 | 62 | } |
| 63 | - $tabs['upload'] = __( 'Upload' ); |
|
| 64 | - $tabs['featured'] = _x( 'Featured', 'themes' ); |
|
| 63 | + $tabs['upload'] = __('Upload'); |
|
| 64 | + $tabs['featured'] = _x('Featured', 'themes'); |
|
| 65 | 65 | //$tabs['popular'] = _x( 'Popular', 'themes' ); |
| 66 | - $tabs['new'] = _x( 'Latest', 'themes' ); |
|
| 67 | - $tabs['updated'] = _x( 'Recently Updated', 'themes' ); |
|
| 66 | + $tabs['new'] = _x('Latest', 'themes'); |
|
| 67 | + $tabs['updated'] = _x('Recently Updated', 'themes'); |
|
| 68 | 68 | |
| 69 | - $nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item. |
|
| 69 | + $nonmenu_tabs = array('theme-information'); // Valid actions to perform which do not have a Menu item. |
|
| 70 | 70 | |
| 71 | 71 | /** This filter is documented in wp-admin/theme-install.php */ |
| 72 | - $tabs = apply_filters( 'install_themes_tabs', $tabs ); |
|
| 72 | + $tabs = apply_filters('install_themes_tabs', $tabs); |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * Filters tabs not associated with a menu item on the Install Themes screen. |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | * @param string[] $nonmenu_tabs The tabs that don't have a menu item on |
| 80 | 80 | * the Install Themes screen. |
| 81 | 81 | */ |
| 82 | - $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs ); |
|
| 82 | + $nonmenu_tabs = apply_filters('install_themes_nonmenu_tabs', $nonmenu_tabs); |
|
| 83 | 83 | |
| 84 | 84 | // If a non-valid menu tab has been selected, And it's not a non-menu action. |
| 85 | - if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { |
|
| 86 | - $tab = key( $tabs ); |
|
| 85 | + if (empty($tab) || (!isset($tabs[$tab]) && !in_array($tab, (array) $nonmenu_tabs, true))) { |
|
| 86 | + $tab = key($tabs); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $args = array( |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | 'fields' => $theme_field_defaults, |
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | - switch ( $tab ) { |
|
| 95 | + switch ($tab) { |
|
| 96 | 96 | case 'search': |
| 97 | - $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; |
|
| 98 | - switch ( $type ) { |
|
| 97 | + $type = isset($_REQUEST['type']) ? wp_unslash($_REQUEST['type']) : 'term'; |
|
| 98 | + switch ($type) { |
|
| 99 | 99 | case 'tag': |
| 100 | - $args['tag'] = array_map( 'sanitize_key', $search_terms ); |
|
| 100 | + $args['tag'] = array_map('sanitize_key', $search_terms); |
|
| 101 | 101 | break; |
| 102 | 102 | case 'term': |
| 103 | 103 | $args['search'] = $search_string; |
@@ -107,13 +107,13 @@ discard block |
||
| 107 | 107 | break; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if ( ! empty( $this->features ) ) { |
|
| 110 | + if (!empty($this->features)) { |
|
| 111 | 111 | $args['tag'] = $this->features; |
| 112 | - $_REQUEST['s'] = implode( ',', $this->features ); |
|
| 112 | + $_REQUEST['s'] = implode(',', $this->features); |
|
| 113 | 113 | $_REQUEST['type'] = 'tag'; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - add_action( 'install_themes_table_header', 'install_theme_search_form', 10, 0 ); |
|
| 116 | + add_action('install_themes_table_header', 'install_theme_search_form', 10, 0); |
|
| 117 | 117 | break; |
| 118 | 118 | |
| 119 | 119 | case 'featured': |
@@ -147,16 +147,16 @@ discard block |
||
| 147 | 147 | * |
| 148 | 148 | * @param array|false $args Theme install API arguments. |
| 149 | 149 | */ |
| 150 | - $args = apply_filters( "install_themes_table_api_args_{$tab}", $args ); |
|
| 150 | + $args = apply_filters("install_themes_table_api_args_{$tab}", $args); |
|
| 151 | 151 | |
| 152 | - if ( ! $args ) { |
|
| 152 | + if (!$args) { |
|
| 153 | 153 | return; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - $api = themes_api( 'query_themes', $args ); |
|
| 156 | + $api = themes_api('query_themes', $args); |
|
| 157 | 157 | |
| 158 | - if ( is_wp_error( $api ) ) { |
|
| 159 | - wp_die( '<p>' . $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try Again' ) . '</a></p>' ); |
|
| 158 | + if (is_wp_error($api)) { |
|
| 159 | + wp_die('<p>' . $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __('Try Again') . '</a></p>'); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | $this->items = $api->themes; |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | /** |
| 174 | 174 | */ |
| 175 | 175 | public function no_items() { |
| 176 | - _e( 'No themes match your request.' ); |
|
| 176 | + _e('No themes match your request.'); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | global $tabs, $tab; |
| 186 | 186 | |
| 187 | 187 | $display_tabs = array(); |
| 188 | - foreach ( (array) $tabs as $action => $text ) { |
|
| 189 | - $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; |
|
| 190 | - $href = self_admin_url( 'theme-install.php?tab=' . $action ); |
|
| 191 | - $display_tabs[ 'theme-install-' . $action ] = "<a href='$href'$current_link_attributes>$text</a>"; |
|
| 188 | + foreach ((array) $tabs as $action => $text) { |
|
| 189 | + $current_link_attributes = ($action === $tab) ? ' class="current" aria-current="page"' : ''; |
|
| 190 | + $href = self_admin_url('theme-install.php?tab=' . $action); |
|
| 191 | + $display_tabs['theme-install-' . $action] = "<a href='$href'$current_link_attributes>$text</a>"; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | return $display_tabs; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @since 3.1.0 |
| 203 | 203 | */ |
| 204 | 204 | public function display() { |
| 205 | - wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); |
|
| 205 | + wp_nonce_field('fetch-list-' . get_class($this), '_ajax_fetch_list_nonce'); |
|
| 206 | 206 | ?> |
| 207 | 207 | <div class="tablenav top themes"> |
| 208 | 208 | <div class="alignleft actions"> |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | * |
| 213 | 213 | * @since 2.8.0 |
| 214 | 214 | */ |
| 215 | - do_action( 'install_themes_table_header' ); |
|
| 215 | + do_action('install_themes_table_header'); |
|
| 216 | 216 | ?> |
| 217 | 217 | </div> |
| 218 | - <?php $this->pagination( 'top' ); ?> |
|
| 218 | + <?php $this->pagination('top'); ?> |
|
| 219 | 219 | <br class="clear" /> |
| 220 | 220 | </div> |
| 221 | 221 | |
@@ -224,18 +224,18 @@ discard block |
||
| 224 | 224 | </div> |
| 225 | 225 | |
| 226 | 226 | <?php |
| 227 | - $this->tablenav( 'bottom' ); |
|
| 227 | + $this->tablenav('bottom'); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
| 231 | 231 | */ |
| 232 | 232 | public function display_rows() { |
| 233 | 233 | $themes = $this->items; |
| 234 | - foreach ( $themes as $theme ) { |
|
| 234 | + foreach ($themes as $theme) { |
|
| 235 | 235 | ?> |
| 236 | 236 | <div class="available-theme installable-theme"> |
| 237 | 237 | <?php |
| 238 | - $this->single_row( $theme ); |
|
| 238 | + $this->single_row($theme); |
|
| 239 | 239 | ?> |
| 240 | 240 | </div> |
| 241 | 241 | <?php |
@@ -267,24 +267,24 @@ discard block |
||
| 267 | 267 | * @type string $download_link Theme ZIP download URL. |
| 268 | 268 | * } |
| 269 | 269 | */ |
| 270 | - public function single_row( $theme ) { |
|
| 270 | + public function single_row($theme) { |
|
| 271 | 271 | global $themes_allowedtags; |
| 272 | 272 | |
| 273 | - if ( empty( $theme ) ) { |
|
| 273 | + if (empty($theme)) { |
|
| 274 | 274 | return; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - $name = wp_kses( $theme->name, $themes_allowedtags ); |
|
| 278 | - $author = wp_kses( $theme->author, $themes_allowedtags ); |
|
| 277 | + $name = wp_kses($theme->name, $themes_allowedtags); |
|
| 278 | + $author = wp_kses($theme->author, $themes_allowedtags); |
|
| 279 | 279 | |
| 280 | 280 | /* translators: %s: Theme name. */ |
| 281 | - $preview_title = sprintf( __( 'Preview “%s”' ), $name ); |
|
| 281 | + $preview_title = sprintf(__('Preview “%s”'), $name); |
|
| 282 | 282 | $preview_url = add_query_arg( |
| 283 | 283 | array( |
| 284 | 284 | 'tab' => 'theme-information', |
| 285 | 285 | 'theme' => $theme->slug, |
| 286 | 286 | ), |
| 287 | - self_admin_url( 'theme-install.php' ) |
|
| 287 | + self_admin_url('theme-install.php') |
|
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | 290 | $actions = array(); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | 'action' => 'install-theme', |
| 295 | 295 | 'theme' => $theme->slug, |
| 296 | 296 | ), |
| 297 | - self_admin_url( 'update.php' ) |
|
| 297 | + self_admin_url('update.php') |
|
| 298 | 298 | ); |
| 299 | 299 | |
| 300 | 300 | $update_url = add_query_arg( |
@@ -302,47 +302,47 @@ discard block |
||
| 302 | 302 | 'action' => 'upgrade-theme', |
| 303 | 303 | 'theme' => $theme->slug, |
| 304 | 304 | ), |
| 305 | - self_admin_url( 'update.php' ) |
|
| 305 | + self_admin_url('update.php') |
|
| 306 | 306 | ); |
| 307 | 307 | |
| 308 | - $status = $this->_get_theme_status( $theme ); |
|
| 308 | + $status = $this->_get_theme_status($theme); |
|
| 309 | 309 | |
| 310 | - switch ( $status ) { |
|
| 310 | + switch ($status) { |
|
| 311 | 311 | case 'update_available': |
| 312 | 312 | $actions[] = sprintf( |
| 313 | 313 | '<a class="install-now" href="%s" title="%s">%s</a>', |
| 314 | - esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), |
|
| 314 | + esc_url(wp_nonce_url($update_url, 'upgrade-theme_' . $theme->slug)), |
|
| 315 | 315 | /* translators: %s: Theme version. */ |
| 316 | - esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), |
|
| 317 | - __( 'Update' ) |
|
| 316 | + esc_attr(sprintf(__('Update to version %s'), $theme->version)), |
|
| 317 | + __('Update') |
|
| 318 | 318 | ); |
| 319 | 319 | break; |
| 320 | 320 | case 'newer_installed': |
| 321 | 321 | case 'latest_installed': |
| 322 | 322 | $actions[] = sprintf( |
| 323 | 323 | '<span class="install-now" title="%s">%s</span>', |
| 324 | - esc_attr__( 'This theme is already installed and is up to date' ), |
|
| 325 | - _x( 'Installed', 'theme' ) |
|
| 324 | + esc_attr__('This theme is already installed and is up to date'), |
|
| 325 | + _x('Installed', 'theme') |
|
| 326 | 326 | ); |
| 327 | 327 | break; |
| 328 | 328 | case 'install': |
| 329 | 329 | default: |
| 330 | 330 | $actions[] = sprintf( |
| 331 | 331 | '<a class="install-now" href="%s" title="%s">%s</a>', |
| 332 | - esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), |
|
| 332 | + esc_url(wp_nonce_url($install_url, 'install-theme_' . $theme->slug)), |
|
| 333 | 333 | /* translators: %s: Theme name. */ |
| 334 | - esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ), |
|
| 335 | - __( 'Install Now' ) |
|
| 334 | + esc_attr(sprintf(_x('Install %s', 'theme'), $name)), |
|
| 335 | + __('Install Now') |
|
| 336 | 336 | ); |
| 337 | 337 | break; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | $actions[] = sprintf( |
| 341 | 341 | '<a class="install-theme-preview" href="%s" title="%s">%s</a>', |
| 342 | - esc_url( $preview_url ), |
|
| 342 | + esc_url($preview_url), |
|
| 343 | 343 | /* translators: %s: Theme name. */ |
| 344 | - esc_attr( sprintf( __( 'Preview %s' ), $name ) ), |
|
| 345 | - __( 'Preview' ) |
|
| 344 | + esc_attr(sprintf(__('Preview %s'), $name)), |
|
| 345 | + __('Preview') |
|
| 346 | 346 | ); |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -355,32 +355,32 @@ discard block |
||
| 355 | 355 | * @param stdClass $theme An object that contains theme data returned by the |
| 356 | 356 | * WordPress.org API. |
| 357 | 357 | */ |
| 358 | - $actions = apply_filters( 'theme_install_actions', $actions, $theme ); |
|
| 358 | + $actions = apply_filters('theme_install_actions', $actions, $theme); |
|
| 359 | 359 | |
| 360 | 360 | ?> |
| 361 | - <a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>"> |
|
| 362 | - <img src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" width="150" alt="" /> |
|
| 361 | + <a class="screenshot install-theme-preview" href="<?php echo esc_url($preview_url); ?>" title="<?php echo esc_attr($preview_title); ?>"> |
|
| 362 | + <img src="<?php echo esc_url($theme->screenshot_url . '?ver=' . $theme->version); ?>" width="150" alt="" /> |
|
| 363 | 363 | </a> |
| 364 | 364 | |
| 365 | 365 | <h3><?php echo $name; ?></h3> |
| 366 | 366 | <div class="theme-author"> |
| 367 | 367 | <?php |
| 368 | 368 | /* translators: %s: Theme author. */ |
| 369 | - printf( __( 'By %s' ), $author ); |
|
| 369 | + printf(__('By %s'), $author); |
|
| 370 | 370 | ?> |
| 371 | 371 | </div> |
| 372 | 372 | |
| 373 | 373 | <div class="action-links"> |
| 374 | 374 | <ul> |
| 375 | - <?php foreach ( $actions as $action ) : ?> |
|
| 375 | + <?php foreach ($actions as $action) : ?> |
|
| 376 | 376 | <li><?php echo $action; ?></li> |
| 377 | 377 | <?php endforeach; ?> |
| 378 | - <li class="hide-if-no-js"><a href="#" class="theme-detail"><?php _e( 'Details' ); ?></a></li> |
|
| 378 | + <li class="hide-if-no-js"><a href="#" class="theme-detail"><?php _e('Details'); ?></a></li> |
|
| 379 | 379 | </ul> |
| 380 | 380 | </div> |
| 381 | 381 | |
| 382 | 382 | <?php |
| 383 | - $this->install_theme_info( $theme ); |
|
| 383 | + $this->install_theme_info($theme); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
@@ -391,16 +391,16 @@ discard block |
||
| 391 | 391 | <div id="theme-installer" class="wp-full-overlay expanded"> |
| 392 | 392 | <div class="wp-full-overlay-sidebar"> |
| 393 | 393 | <div class="wp-full-overlay-header"> |
| 394 | - <a href="#" class="close-full-overlay button"><?php _e( 'Close' ); ?></a> |
|
| 394 | + <a href="#" class="close-full-overlay button"><?php _e('Close'); ?></a> |
|
| 395 | 395 | <span class="theme-install"></span> |
| 396 | 396 | </div> |
| 397 | 397 | <div class="wp-full-overlay-sidebar-content"> |
| 398 | 398 | <div class="install-theme-info"></div> |
| 399 | 399 | </div> |
| 400 | 400 | <div class="wp-full-overlay-footer"> |
| 401 | - <button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>"> |
|
| 401 | + <button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php esc_attr_e('Collapse Sidebar'); ?>"> |
|
| 402 | 402 | <span class="collapse-sidebar-arrow"></span> |
| 403 | - <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> |
|
| 403 | + <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span> |
|
| 404 | 404 | </button> |
| 405 | 405 | </div> |
| 406 | 406 | </div> |
@@ -415,14 +415,14 @@ discard block |
||
| 415 | 415 | * |
| 416 | 416 | * @param stdClass $theme A WordPress.org Theme API object. |
| 417 | 417 | */ |
| 418 | - public function theme_installer_single( $theme ) { |
|
| 418 | + public function theme_installer_single($theme) { |
|
| 419 | 419 | ?> |
| 420 | 420 | <div id="theme-installer" class="wp-full-overlay single-theme"> |
| 421 | 421 | <div class="wp-full-overlay-sidebar"> |
| 422 | - <?php $this->install_theme_info( $theme ); ?> |
|
| 422 | + <?php $this->install_theme_info($theme); ?> |
|
| 423 | 423 | </div> |
| 424 | 424 | <div class="wp-full-overlay-main"> |
| 425 | - <iframe src="<?php echo esc_url( $theme->preview_url ); ?>"></iframe> |
|
| 425 | + <iframe src="<?php echo esc_url($theme->preview_url); ?>"></iframe> |
|
| 426 | 426 | </div> |
| 427 | 427 | </div> |
| 428 | 428 | <?php |
@@ -435,22 +435,22 @@ discard block |
||
| 435 | 435 | * |
| 436 | 436 | * @param stdClass $theme A WordPress.org Theme API object. |
| 437 | 437 | */ |
| 438 | - public function install_theme_info( $theme ) { |
|
| 438 | + public function install_theme_info($theme) { |
|
| 439 | 439 | global $themes_allowedtags; |
| 440 | 440 | |
| 441 | - if ( empty( $theme ) ) { |
|
| 441 | + if (empty($theme)) { |
|
| 442 | 442 | return; |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | - $name = wp_kses( $theme->name, $themes_allowedtags ); |
|
| 446 | - $author = wp_kses( $theme->author, $themes_allowedtags ); |
|
| 445 | + $name = wp_kses($theme->name, $themes_allowedtags); |
|
| 446 | + $author = wp_kses($theme->author, $themes_allowedtags); |
|
| 447 | 447 | |
| 448 | 448 | $install_url = add_query_arg( |
| 449 | 449 | array( |
| 450 | 450 | 'action' => 'install-theme', |
| 451 | 451 | 'theme' => $theme->slug, |
| 452 | 452 | ), |
| 453 | - self_admin_url( 'update.php' ) |
|
| 453 | + self_admin_url('update.php') |
|
| 454 | 454 | ); |
| 455 | 455 | |
| 456 | 456 | $update_url = add_query_arg( |
@@ -458,38 +458,38 @@ discard block |
||
| 458 | 458 | 'action' => 'upgrade-theme', |
| 459 | 459 | 'theme' => $theme->slug, |
| 460 | 460 | ), |
| 461 | - self_admin_url( 'update.php' ) |
|
| 461 | + self_admin_url('update.php') |
|
| 462 | 462 | ); |
| 463 | 463 | |
| 464 | - $status = $this->_get_theme_status( $theme ); |
|
| 464 | + $status = $this->_get_theme_status($theme); |
|
| 465 | 465 | |
| 466 | 466 | ?> |
| 467 | 467 | <div class="install-theme-info"> |
| 468 | 468 | <?php |
| 469 | - switch ( $status ) { |
|
| 469 | + switch ($status) { |
|
| 470 | 470 | case 'update_available': |
| 471 | 471 | printf( |
| 472 | 472 | '<a class="theme-install button button-primary" href="%s" title="%s">%s</a>', |
| 473 | - esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), |
|
| 473 | + esc_url(wp_nonce_url($update_url, 'upgrade-theme_' . $theme->slug)), |
|
| 474 | 474 | /* translators: %s: Theme version. */ |
| 475 | - esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), |
|
| 476 | - __( 'Update' ) |
|
| 475 | + esc_attr(sprintf(__('Update to version %s'), $theme->version)), |
|
| 476 | + __('Update') |
|
| 477 | 477 | ); |
| 478 | 478 | break; |
| 479 | 479 | case 'newer_installed': |
| 480 | 480 | case 'latest_installed': |
| 481 | 481 | printf( |
| 482 | 482 | '<span class="theme-install" title="%s">%s</span>', |
| 483 | - esc_attr__( 'This theme is already installed and is up to date' ), |
|
| 484 | - _x( 'Installed', 'theme' ) |
|
| 483 | + esc_attr__('This theme is already installed and is up to date'), |
|
| 484 | + _x('Installed', 'theme') |
|
| 485 | 485 | ); |
| 486 | 486 | break; |
| 487 | 487 | case 'install': |
| 488 | 488 | default: |
| 489 | 489 | printf( |
| 490 | 490 | '<a class="theme-install button button-primary" href="%s">%s</a>', |
| 491 | - esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), |
|
| 492 | - __( 'Install' ) |
|
| 491 | + esc_url(wp_nonce_url($install_url, 'install-theme_' . $theme->slug)), |
|
| 492 | + __('Install') |
|
| 493 | 493 | ); |
| 494 | 494 | break; |
| 495 | 495 | } |
@@ -498,11 +498,11 @@ discard block |
||
| 498 | 498 | <span class="theme-by"> |
| 499 | 499 | <?php |
| 500 | 500 | /* translators: %s: Theme author. */ |
| 501 | - printf( __( 'By %s' ), $author ); |
|
| 501 | + printf(__('By %s'), $author); |
|
| 502 | 502 | ?> |
| 503 | 503 | </span> |
| 504 | - <?php if ( isset( $theme->screenshot_url ) ) : ?> |
|
| 505 | - <img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" alt="" /> |
|
| 504 | + <?php if (isset($theme->screenshot_url)) : ?> |
|
| 505 | + <img class="theme-screenshot" src="<?php echo esc_url($theme->screenshot_url . '?ver=' . $theme->version); ?>" alt="" /> |
|
| 506 | 506 | <?php endif; ?> |
| 507 | 507 | <div class="theme-details"> |
| 508 | 508 | <?php |
@@ -515,14 +515,14 @@ discard block |
||
| 515 | 515 | ); |
| 516 | 516 | ?> |
| 517 | 517 | <div class="theme-version"> |
| 518 | - <strong><?php _e( 'Version:' ); ?> </strong> |
|
| 519 | - <?php echo wp_kses( $theme->version, $themes_allowedtags ); ?> |
|
| 518 | + <strong><?php _e('Version:'); ?> </strong> |
|
| 519 | + <?php echo wp_kses($theme->version, $themes_allowedtags); ?> |
|
| 520 | 520 | </div> |
| 521 | 521 | <div class="theme-description"> |
| 522 | - <?php echo wp_kses( $theme->description, $themes_allowedtags ); ?> |
|
| 522 | + <?php echo wp_kses($theme->description, $themes_allowedtags); ?> |
|
| 523 | 523 | </div> |
| 524 | 524 | </div> |
| 525 | - <input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" /> |
|
| 525 | + <input class="theme-preview-url" type="hidden" value="<?php echo esc_url($theme->preview_url); ?>" /> |
|
| 526 | 526 | </div> |
| 527 | 527 | <?php |
| 528 | 528 | } |
@@ -537,9 +537,9 @@ discard block |
||
| 537 | 537 | * |
| 538 | 538 | * @param array $extra_args Unused. |
| 539 | 539 | */ |
| 540 | - public function _js_vars( $extra_args = array() ) { |
|
| 540 | + public function _js_vars($extra_args = array()) { |
|
| 541 | 541 | global $tab, $type; |
| 542 | - parent::_js_vars( compact( 'tab', 'type' ) ); |
|
| 542 | + parent::_js_vars(compact('tab', 'type')); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | /** |
@@ -550,14 +550,14 @@ discard block |
||
| 550 | 550 | * @param stdClass $theme A WordPress.org Theme API object. |
| 551 | 551 | * @return string Theme status. |
| 552 | 552 | */ |
| 553 | - private function _get_theme_status( $theme ) { |
|
| 553 | + private function _get_theme_status($theme) { |
|
| 554 | 554 | $status = 'install'; |
| 555 | 555 | |
| 556 | - $installed_theme = wp_get_theme( $theme->slug ); |
|
| 557 | - if ( $installed_theme->exists() ) { |
|
| 558 | - if ( version_compare( $installed_theme->get( 'Version' ), $theme->version, '=' ) ) { |
|
| 556 | + $installed_theme = wp_get_theme($theme->slug); |
|
| 557 | + if ($installed_theme->exists()) { |
|
| 558 | + if (version_compare($installed_theme->get('Version'), $theme->version, '=')) { |
|
| 559 | 559 | $status = 'latest_installed'; |
| 560 | - } elseif ( version_compare( $installed_theme->get( 'Version' ), $theme->version, '>' ) ) { |
|
| 560 | + } elseif (version_compare($installed_theme->get('Version'), $theme->version, '>')) { |
|
| 561 | 561 | $status = 'newer_installed'; |
| 562 | 562 | } else { |
| 563 | 563 | $status = 'update_available'; |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | * @return string|null Returns the category ID as a numeric string if the pairing exists, null if not. |
| 23 | 23 | */ |
| 24 | 24 | function category_exists( $cat_name, $category_parent = null ) { |
| 25 | - $id = term_exists( $cat_name, 'category', $category_parent ); |
|
| 26 | - if ( is_array( $id ) ) { |
|
| 27 | - $id = $id['term_id']; |
|
| 28 | - } |
|
| 29 | - return $id; |
|
| 25 | + $id = term_exists( $cat_name, 'category', $category_parent ); |
|
| 26 | + if ( is_array( $id ) ) { |
|
| 27 | + $id = $id['term_id']; |
|
| 28 | + } |
|
| 29 | + return $id; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | * @return object |
| 39 | 39 | */ |
| 40 | 40 | function get_category_to_edit( $id ) { |
| 41 | - $category = get_term( $id, 'category', OBJECT, 'edit' ); |
|
| 42 | - _make_cat_compat( $category ); |
|
| 43 | - return $category; |
|
| 41 | + $category = get_term( $id, 'category', OBJECT, 'edit' ); |
|
| 42 | + _make_cat_compat( $category ); |
|
| 43 | + return $category; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | * @return int|WP_Error |
| 54 | 54 | */ |
| 55 | 55 | function wp_create_category( $cat_name, $category_parent = 0 ) { |
| 56 | - $id = category_exists( $cat_name, $category_parent ); |
|
| 57 | - if ( $id ) { |
|
| 58 | - return $id; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - return wp_insert_category( |
|
| 62 | - array( |
|
| 63 | - 'cat_name' => $cat_name, |
|
| 64 | - 'category_parent' => $category_parent, |
|
| 65 | - ) |
|
| 66 | - ); |
|
| 56 | + $id = category_exists( $cat_name, $category_parent ); |
|
| 57 | + if ( $id ) { |
|
| 58 | + return $id; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + return wp_insert_category( |
|
| 62 | + array( |
|
| 63 | + 'cat_name' => $cat_name, |
|
| 64 | + 'category_parent' => $category_parent, |
|
| 65 | + ) |
|
| 66 | + ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -76,24 +76,24 @@ discard block |
||
| 76 | 76 | * @return int[] Array of IDs of categories assigned to the given post. |
| 77 | 77 | */ |
| 78 | 78 | function wp_create_categories( $categories, $post_id = '' ) { |
| 79 | - $cat_ids = array(); |
|
| 80 | - foreach ( $categories as $category ) { |
|
| 81 | - $id = category_exists( $category ); |
|
| 82 | - if ( $id ) { |
|
| 83 | - $cat_ids[] = $id; |
|
| 84 | - } else { |
|
| 85 | - $id = wp_create_category( $category ); |
|
| 86 | - if ( $id ) { |
|
| 87 | - $cat_ids[] = $id; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - if ( $post_id ) { |
|
| 93 | - wp_set_post_categories( $post_id, $cat_ids ); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - return $cat_ids; |
|
| 79 | + $cat_ids = array(); |
|
| 80 | + foreach ( $categories as $category ) { |
|
| 81 | + $id = category_exists( $category ); |
|
| 82 | + if ( $id ) { |
|
| 83 | + $cat_ids[] = $id; |
|
| 84 | + } else { |
|
| 85 | + $id = wp_create_category( $category ); |
|
| 86 | + if ( $id ) { |
|
| 87 | + $cat_ids[] = $id; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + if ( $post_id ) { |
|
| 93 | + wp_set_post_categories( $post_id, $cat_ids ); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + return $cat_ids; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -119,59 +119,59 @@ discard block |
||
| 119 | 119 | * depending on param `$wp_error`. |
| 120 | 120 | */ |
| 121 | 121 | function wp_insert_category( $catarr, $wp_error = false ) { |
| 122 | - $cat_defaults = array( |
|
| 123 | - 'cat_ID' => 0, |
|
| 124 | - 'taxonomy' => 'category', |
|
| 125 | - 'cat_name' => '', |
|
| 126 | - 'category_description' => '', |
|
| 127 | - 'category_nicename' => '', |
|
| 128 | - 'category_parent' => '', |
|
| 129 | - ); |
|
| 130 | - $catarr = wp_parse_args( $catarr, $cat_defaults ); |
|
| 131 | - |
|
| 132 | - if ( '' === trim( $catarr['cat_name'] ) ) { |
|
| 133 | - if ( ! $wp_error ) { |
|
| 134 | - return 0; |
|
| 135 | - } else { |
|
| 136 | - return new WP_Error( 'cat_name', __( 'You did not enter a category name.' ) ); |
|
| 137 | - } |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - $catarr['cat_ID'] = (int) $catarr['cat_ID']; |
|
| 141 | - |
|
| 142 | - // Are we updating or creating? |
|
| 143 | - $update = ! empty( $catarr['cat_ID'] ); |
|
| 144 | - |
|
| 145 | - $name = $catarr['cat_name']; |
|
| 146 | - $description = $catarr['category_description']; |
|
| 147 | - $slug = $catarr['category_nicename']; |
|
| 148 | - $parent = (int) $catarr['category_parent']; |
|
| 149 | - if ( $parent < 0 ) { |
|
| 150 | - $parent = 0; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - if ( empty( $parent ) |
|
| 154 | - || ! term_exists( $parent, $catarr['taxonomy'] ) |
|
| 155 | - || ( $catarr['cat_ID'] && term_is_ancestor_of( $catarr['cat_ID'], $parent, $catarr['taxonomy'] ) ) ) { |
|
| 156 | - $parent = 0; |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - $args = compact( 'name', 'slug', 'parent', 'description' ); |
|
| 160 | - |
|
| 161 | - if ( $update ) { |
|
| 162 | - $catarr['cat_ID'] = wp_update_term( $catarr['cat_ID'], $catarr['taxonomy'], $args ); |
|
| 163 | - } else { |
|
| 164 | - $catarr['cat_ID'] = wp_insert_term( $catarr['cat_name'], $catarr['taxonomy'], $args ); |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - if ( is_wp_error( $catarr['cat_ID'] ) ) { |
|
| 168 | - if ( $wp_error ) { |
|
| 169 | - return $catarr['cat_ID']; |
|
| 170 | - } else { |
|
| 171 | - return 0; |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - return $catarr['cat_ID']['term_id']; |
|
| 122 | + $cat_defaults = array( |
|
| 123 | + 'cat_ID' => 0, |
|
| 124 | + 'taxonomy' => 'category', |
|
| 125 | + 'cat_name' => '', |
|
| 126 | + 'category_description' => '', |
|
| 127 | + 'category_nicename' => '', |
|
| 128 | + 'category_parent' => '', |
|
| 129 | + ); |
|
| 130 | + $catarr = wp_parse_args( $catarr, $cat_defaults ); |
|
| 131 | + |
|
| 132 | + if ( '' === trim( $catarr['cat_name'] ) ) { |
|
| 133 | + if ( ! $wp_error ) { |
|
| 134 | + return 0; |
|
| 135 | + } else { |
|
| 136 | + return new WP_Error( 'cat_name', __( 'You did not enter a category name.' ) ); |
|
| 137 | + } |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + $catarr['cat_ID'] = (int) $catarr['cat_ID']; |
|
| 141 | + |
|
| 142 | + // Are we updating or creating? |
|
| 143 | + $update = ! empty( $catarr['cat_ID'] ); |
|
| 144 | + |
|
| 145 | + $name = $catarr['cat_name']; |
|
| 146 | + $description = $catarr['category_description']; |
|
| 147 | + $slug = $catarr['category_nicename']; |
|
| 148 | + $parent = (int) $catarr['category_parent']; |
|
| 149 | + if ( $parent < 0 ) { |
|
| 150 | + $parent = 0; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + if ( empty( $parent ) |
|
| 154 | + || ! term_exists( $parent, $catarr['taxonomy'] ) |
|
| 155 | + || ( $catarr['cat_ID'] && term_is_ancestor_of( $catarr['cat_ID'], $parent, $catarr['taxonomy'] ) ) ) { |
|
| 156 | + $parent = 0; |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + $args = compact( 'name', 'slug', 'parent', 'description' ); |
|
| 160 | + |
|
| 161 | + if ( $update ) { |
|
| 162 | + $catarr['cat_ID'] = wp_update_term( $catarr['cat_ID'], $catarr['taxonomy'], $args ); |
|
| 163 | + } else { |
|
| 164 | + $catarr['cat_ID'] = wp_insert_term( $catarr['cat_name'], $catarr['taxonomy'], $args ); |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + if ( is_wp_error( $catarr['cat_ID'] ) ) { |
|
| 168 | + if ( $wp_error ) { |
|
| 169 | + return $catarr['cat_ID']; |
|
| 170 | + } else { |
|
| 171 | + return 0; |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + return $catarr['cat_ID']['term_id']; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -186,23 +186,23 @@ discard block |
||
| 186 | 186 | * @return int|false The ID number of the new or updated Category on success. Zero or FALSE on failure. |
| 187 | 187 | */ |
| 188 | 188 | function wp_update_category( $catarr ) { |
| 189 | - $cat_ID = (int) $catarr['cat_ID']; |
|
| 189 | + $cat_ID = (int) $catarr['cat_ID']; |
|
| 190 | 190 | |
| 191 | - if ( isset( $catarr['category_parent'] ) && ( $cat_ID == $catarr['category_parent'] ) ) { |
|
| 192 | - return false; |
|
| 193 | - } |
|
| 191 | + if ( isset( $catarr['category_parent'] ) && ( $cat_ID == $catarr['category_parent'] ) ) { |
|
| 192 | + return false; |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - // First, get all of the original fields. |
|
| 196 | - $category = get_term( $cat_ID, 'category', ARRAY_A ); |
|
| 197 | - _make_cat_compat( $category ); |
|
| 195 | + // First, get all of the original fields. |
|
| 196 | + $category = get_term( $cat_ID, 'category', ARRAY_A ); |
|
| 197 | + _make_cat_compat( $category ); |
|
| 198 | 198 | |
| 199 | - // Escape data pulled from DB. |
|
| 200 | - $category = wp_slash( $category ); |
|
| 199 | + // Escape data pulled from DB. |
|
| 200 | + $category = wp_slash( $category ); |
|
| 201 | 201 | |
| 202 | - // Merge old and new fields with new fields overwriting old ones. |
|
| 203 | - $catarr = array_merge( $category, $catarr ); |
|
| 202 | + // Merge old and new fields with new fields overwriting old ones. |
|
| 203 | + $catarr = array_merge( $category, $catarr ); |
|
| 204 | 204 | |
| 205 | - return wp_insert_category( $catarr ); |
|
| 205 | + return wp_insert_category( $catarr ); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * Returns 0 if term ID 0 is passed to the function. |
| 221 | 221 | */ |
| 222 | 222 | function tag_exists( $tag_name ) { |
| 223 | - return term_exists( $tag_name, 'post_tag' ); |
|
| 223 | + return term_exists( $tag_name, 'post_tag' ); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @return array|WP_Error |
| 233 | 233 | */ |
| 234 | 234 | function wp_create_tag( $tag_name ) { |
| 235 | - return wp_create_term( $tag_name, 'post_tag' ); |
|
| 235 | + return wp_create_term( $tag_name, 'post_tag' ); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @return string|false|WP_Error |
| 246 | 246 | */ |
| 247 | 247 | function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) { |
| 248 | - return get_terms_to_edit( $post_id, $taxonomy ); |
|
| 248 | + return get_terms_to_edit( $post_id, $taxonomy ); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -258,43 +258,43 @@ discard block |
||
| 258 | 258 | * @return string|false|WP_Error |
| 259 | 259 | */ |
| 260 | 260 | function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) { |
| 261 | - $post_id = (int) $post_id; |
|
| 262 | - if ( ! $post_id ) { |
|
| 263 | - return false; |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - $terms = get_object_term_cache( $post_id, $taxonomy ); |
|
| 267 | - if ( false === $terms ) { |
|
| 268 | - $terms = wp_get_object_terms( $post_id, $taxonomy ); |
|
| 269 | - wp_cache_add( $post_id, wp_list_pluck( $terms, 'term_id' ), $taxonomy . '_relationships' ); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - if ( ! $terms ) { |
|
| 273 | - return false; |
|
| 274 | - } |
|
| 275 | - if ( is_wp_error( $terms ) ) { |
|
| 276 | - return $terms; |
|
| 277 | - } |
|
| 278 | - $term_names = array(); |
|
| 279 | - foreach ( $terms as $term ) { |
|
| 280 | - $term_names[] = $term->name; |
|
| 281 | - } |
|
| 282 | - |
|
| 283 | - $terms_to_edit = esc_attr( implode( ',', $term_names ) ); |
|
| 284 | - |
|
| 285 | - /** |
|
| 286 | - * Filters the comma-separated list of terms available to edit. |
|
| 287 | - * |
|
| 288 | - * @since 2.8.0 |
|
| 289 | - * |
|
| 290 | - * @see get_terms_to_edit() |
|
| 291 | - * |
|
| 292 | - * @param string $terms_to_edit A comma-separated list of term names. |
|
| 293 | - * @param string $taxonomy The taxonomy name for which to retrieve terms. |
|
| 294 | - */ |
|
| 295 | - $terms_to_edit = apply_filters( 'terms_to_edit', $terms_to_edit, $taxonomy ); |
|
| 296 | - |
|
| 297 | - return $terms_to_edit; |
|
| 261 | + $post_id = (int) $post_id; |
|
| 262 | + if ( ! $post_id ) { |
|
| 263 | + return false; |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + $terms = get_object_term_cache( $post_id, $taxonomy ); |
|
| 267 | + if ( false === $terms ) { |
|
| 268 | + $terms = wp_get_object_terms( $post_id, $taxonomy ); |
|
| 269 | + wp_cache_add( $post_id, wp_list_pluck( $terms, 'term_id' ), $taxonomy . '_relationships' ); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + if ( ! $terms ) { |
|
| 273 | + return false; |
|
| 274 | + } |
|
| 275 | + if ( is_wp_error( $terms ) ) { |
|
| 276 | + return $terms; |
|
| 277 | + } |
|
| 278 | + $term_names = array(); |
|
| 279 | + foreach ( $terms as $term ) { |
|
| 280 | + $term_names[] = $term->name; |
|
| 281 | + } |
|
| 282 | + |
|
| 283 | + $terms_to_edit = esc_attr( implode( ',', $term_names ) ); |
|
| 284 | + |
|
| 285 | + /** |
|
| 286 | + * Filters the comma-separated list of terms available to edit. |
|
| 287 | + * |
|
| 288 | + * @since 2.8.0 |
|
| 289 | + * |
|
| 290 | + * @see get_terms_to_edit() |
|
| 291 | + * |
|
| 292 | + * @param string $terms_to_edit A comma-separated list of term names. |
|
| 293 | + * @param string $taxonomy The taxonomy name for which to retrieve terms. |
|
| 294 | + */ |
|
| 295 | + $terms_to_edit = apply_filters( 'terms_to_edit', $terms_to_edit, $taxonomy ); |
|
| 296 | + |
|
| 297 | + return $terms_to_edit; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | /** |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | * @return array|WP_Error |
| 308 | 308 | */ |
| 309 | 309 | function wp_create_term( $tag_name, $taxonomy = 'post_tag' ) { |
| 310 | - $id = term_exists( $tag_name, $taxonomy ); |
|
| 311 | - if ( $id ) { |
|
| 312 | - return $id; |
|
| 313 | - } |
|
| 310 | + $id = term_exists( $tag_name, $taxonomy ); |
|
| 311 | + if ( $id ) { |
|
| 312 | + return $id; |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - return wp_insert_term( $tag_name, $taxonomy ); |
|
| 315 | + return wp_insert_term( $tag_name, $taxonomy ); |
|
| 316 | 316 | } |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | * @param int $category_parent Optional. ID of parent category. |
| 22 | 22 | * @return string|null Returns the category ID as a numeric string if the pairing exists, null if not. |
| 23 | 23 | */ |
| 24 | -function category_exists( $cat_name, $category_parent = null ) { |
|
| 25 | - $id = term_exists( $cat_name, 'category', $category_parent ); |
|
| 26 | - if ( is_array( $id ) ) { |
|
| 24 | +function category_exists($cat_name, $category_parent = null) { |
|
| 25 | + $id = term_exists($cat_name, 'category', $category_parent); |
|
| 26 | + if (is_array($id)) { |
|
| 27 | 27 | $id = $id['term_id']; |
| 28 | 28 | } |
| 29 | 29 | return $id; |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | * @param int $id |
| 38 | 38 | * @return object |
| 39 | 39 | */ |
| 40 | -function get_category_to_edit( $id ) { |
|
| 41 | - $category = get_term( $id, 'category', OBJECT, 'edit' ); |
|
| 42 | - _make_cat_compat( $category ); |
|
| 40 | +function get_category_to_edit($id) { |
|
| 41 | + $category = get_term($id, 'category', OBJECT, 'edit'); |
|
| 42 | + _make_cat_compat($category); |
|
| 43 | 43 | return $category; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * @param int $category_parent Optional. ID of parent category. |
| 53 | 53 | * @return int|WP_Error |
| 54 | 54 | */ |
| 55 | -function wp_create_category( $cat_name, $category_parent = 0 ) { |
|
| 56 | - $id = category_exists( $cat_name, $category_parent ); |
|
| 57 | - if ( $id ) { |
|
| 55 | +function wp_create_category($cat_name, $category_parent = 0) { |
|
| 56 | + $id = category_exists($cat_name, $category_parent); |
|
| 57 | + if ($id) { |
|
| 58 | 58 | return $id; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -75,22 +75,22 @@ discard block |
||
| 75 | 75 | * @param int $post_id Optional. The post ID. Default empty. |
| 76 | 76 | * @return int[] Array of IDs of categories assigned to the given post. |
| 77 | 77 | */ |
| 78 | -function wp_create_categories( $categories, $post_id = '' ) { |
|
| 78 | +function wp_create_categories($categories, $post_id = '') { |
|
| 79 | 79 | $cat_ids = array(); |
| 80 | - foreach ( $categories as $category ) { |
|
| 81 | - $id = category_exists( $category ); |
|
| 82 | - if ( $id ) { |
|
| 80 | + foreach ($categories as $category) { |
|
| 81 | + $id = category_exists($category); |
|
| 82 | + if ($id) { |
|
| 83 | 83 | $cat_ids[] = $id; |
| 84 | 84 | } else { |
| 85 | - $id = wp_create_category( $category ); |
|
| 86 | - if ( $id ) { |
|
| 85 | + $id = wp_create_category($category); |
|
| 86 | + if ($id) { |
|
| 87 | 87 | $cat_ids[] = $id; |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if ( $post_id ) { |
|
| 93 | - wp_set_post_categories( $post_id, $cat_ids ); |
|
| 92 | + if ($post_id) { |
|
| 93 | + wp_set_post_categories($post_id, $cat_ids); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | return $cat_ids; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @return int|WP_Error The ID number of the new or updated Category on success. Zero or a WP_Error on failure, |
| 119 | 119 | * depending on param `$wp_error`. |
| 120 | 120 | */ |
| 121 | -function wp_insert_category( $catarr, $wp_error = false ) { |
|
| 121 | +function wp_insert_category($catarr, $wp_error = false) { |
|
| 122 | 122 | $cat_defaults = array( |
| 123 | 123 | 'cat_ID' => 0, |
| 124 | 124 | 'taxonomy' => 'category', |
@@ -127,45 +127,45 @@ discard block |
||
| 127 | 127 | 'category_nicename' => '', |
| 128 | 128 | 'category_parent' => '', |
| 129 | 129 | ); |
| 130 | - $catarr = wp_parse_args( $catarr, $cat_defaults ); |
|
| 130 | + $catarr = wp_parse_args($catarr, $cat_defaults); |
|
| 131 | 131 | |
| 132 | - if ( '' === trim( $catarr['cat_name'] ) ) { |
|
| 133 | - if ( ! $wp_error ) { |
|
| 132 | + if ('' === trim($catarr['cat_name'])) { |
|
| 133 | + if (!$wp_error) { |
|
| 134 | 134 | return 0; |
| 135 | 135 | } else { |
| 136 | - return new WP_Error( 'cat_name', __( 'You did not enter a category name.' ) ); |
|
| 136 | + return new WP_Error('cat_name', __('You did not enter a category name.')); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $catarr['cat_ID'] = (int) $catarr['cat_ID']; |
| 141 | 141 | |
| 142 | 142 | // Are we updating or creating? |
| 143 | - $update = ! empty( $catarr['cat_ID'] ); |
|
| 143 | + $update = !empty($catarr['cat_ID']); |
|
| 144 | 144 | |
| 145 | 145 | $name = $catarr['cat_name']; |
| 146 | 146 | $description = $catarr['category_description']; |
| 147 | 147 | $slug = $catarr['category_nicename']; |
| 148 | 148 | $parent = (int) $catarr['category_parent']; |
| 149 | - if ( $parent < 0 ) { |
|
| 149 | + if ($parent < 0) { |
|
| 150 | 150 | $parent = 0; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if ( empty( $parent ) |
|
| 154 | - || ! term_exists( $parent, $catarr['taxonomy'] ) |
|
| 155 | - || ( $catarr['cat_ID'] && term_is_ancestor_of( $catarr['cat_ID'], $parent, $catarr['taxonomy'] ) ) ) { |
|
| 153 | + if (empty($parent) |
|
| 154 | + || !term_exists($parent, $catarr['taxonomy']) |
|
| 155 | + || ($catarr['cat_ID'] && term_is_ancestor_of($catarr['cat_ID'], $parent, $catarr['taxonomy']))) { |
|
| 156 | 156 | $parent = 0; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - $args = compact( 'name', 'slug', 'parent', 'description' ); |
|
| 159 | + $args = compact('name', 'slug', 'parent', 'description'); |
|
| 160 | 160 | |
| 161 | - if ( $update ) { |
|
| 162 | - $catarr['cat_ID'] = wp_update_term( $catarr['cat_ID'], $catarr['taxonomy'], $args ); |
|
| 161 | + if ($update) { |
|
| 162 | + $catarr['cat_ID'] = wp_update_term($catarr['cat_ID'], $catarr['taxonomy'], $args); |
|
| 163 | 163 | } else { |
| 164 | - $catarr['cat_ID'] = wp_insert_term( $catarr['cat_name'], $catarr['taxonomy'], $args ); |
|
| 164 | + $catarr['cat_ID'] = wp_insert_term($catarr['cat_name'], $catarr['taxonomy'], $args); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if ( is_wp_error( $catarr['cat_ID'] ) ) { |
|
| 168 | - if ( $wp_error ) { |
|
| 167 | + if (is_wp_error($catarr['cat_ID'])) { |
|
| 168 | + if ($wp_error) { |
|
| 169 | 169 | return $catarr['cat_ID']; |
| 170 | 170 | } else { |
| 171 | 171 | return 0; |
@@ -185,24 +185,24 @@ discard block |
||
| 185 | 185 | * @param array $catarr The 'cat_ID' value is required. All other keys are optional. |
| 186 | 186 | * @return int|false The ID number of the new or updated Category on success. Zero or FALSE on failure. |
| 187 | 187 | */ |
| 188 | -function wp_update_category( $catarr ) { |
|
| 188 | +function wp_update_category($catarr) { |
|
| 189 | 189 | $cat_ID = (int) $catarr['cat_ID']; |
| 190 | 190 | |
| 191 | - if ( isset( $catarr['category_parent'] ) && ( $cat_ID == $catarr['category_parent'] ) ) { |
|
| 191 | + if (isset($catarr['category_parent']) && ($cat_ID == $catarr['category_parent'])) { |
|
| 192 | 192 | return false; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // First, get all of the original fields. |
| 196 | - $category = get_term( $cat_ID, 'category', ARRAY_A ); |
|
| 197 | - _make_cat_compat( $category ); |
|
| 196 | + $category = get_term($cat_ID, 'category', ARRAY_A); |
|
| 197 | + _make_cat_compat($category); |
|
| 198 | 198 | |
| 199 | 199 | // Escape data pulled from DB. |
| 200 | - $category = wp_slash( $category ); |
|
| 200 | + $category = wp_slash($category); |
|
| 201 | 201 | |
| 202 | 202 | // Merge old and new fields with new fields overwriting old ones. |
| 203 | - $catarr = array_merge( $category, $catarr ); |
|
| 203 | + $catarr = array_merge($category, $catarr); |
|
| 204 | 204 | |
| 205 | - return wp_insert_category( $catarr ); |
|
| 205 | + return wp_insert_category($catarr); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | * Returns an array of the term ID and the term taxonomy ID if the pairing exists. |
| 220 | 220 | * Returns 0 if term ID 0 is passed to the function. |
| 221 | 221 | */ |
| 222 | -function tag_exists( $tag_name ) { |
|
| 223 | - return term_exists( $tag_name, 'post_tag' ); |
|
| 222 | +function tag_exists($tag_name) { |
|
| 223 | + return term_exists($tag_name, 'post_tag'); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -231,8 +231,8 @@ discard block |
||
| 231 | 231 | * @param int|string $tag_name |
| 232 | 232 | * @return array|WP_Error |
| 233 | 233 | */ |
| 234 | -function wp_create_tag( $tag_name ) { |
|
| 235 | - return wp_create_term( $tag_name, 'post_tag' ); |
|
| 234 | +function wp_create_tag($tag_name) { |
|
| 235 | + return wp_create_term($tag_name, 'post_tag'); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'. |
| 245 | 245 | * @return string|false|WP_Error |
| 246 | 246 | */ |
| 247 | -function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) { |
|
| 248 | - return get_terms_to_edit( $post_id, $taxonomy ); |
|
| 247 | +function get_tags_to_edit($post_id, $taxonomy = 'post_tag') { |
|
| 248 | + return get_terms_to_edit($post_id, $taxonomy); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -257,30 +257,30 @@ discard block |
||
| 257 | 257 | * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'. |
| 258 | 258 | * @return string|false|WP_Error |
| 259 | 259 | */ |
| 260 | -function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) { |
|
| 260 | +function get_terms_to_edit($post_id, $taxonomy = 'post_tag') { |
|
| 261 | 261 | $post_id = (int) $post_id; |
| 262 | - if ( ! $post_id ) { |
|
| 262 | + if (!$post_id) { |
|
| 263 | 263 | return false; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - $terms = get_object_term_cache( $post_id, $taxonomy ); |
|
| 267 | - if ( false === $terms ) { |
|
| 268 | - $terms = wp_get_object_terms( $post_id, $taxonomy ); |
|
| 269 | - wp_cache_add( $post_id, wp_list_pluck( $terms, 'term_id' ), $taxonomy . '_relationships' ); |
|
| 266 | + $terms = get_object_term_cache($post_id, $taxonomy); |
|
| 267 | + if (false === $terms) { |
|
| 268 | + $terms = wp_get_object_terms($post_id, $taxonomy); |
|
| 269 | + wp_cache_add($post_id, wp_list_pluck($terms, 'term_id'), $taxonomy . '_relationships'); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if ( ! $terms ) { |
|
| 272 | + if (!$terms) { |
|
| 273 | 273 | return false; |
| 274 | 274 | } |
| 275 | - if ( is_wp_error( $terms ) ) { |
|
| 275 | + if (is_wp_error($terms)) { |
|
| 276 | 276 | return $terms; |
| 277 | 277 | } |
| 278 | 278 | $term_names = array(); |
| 279 | - foreach ( $terms as $term ) { |
|
| 279 | + foreach ($terms as $term) { |
|
| 280 | 280 | $term_names[] = $term->name; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - $terms_to_edit = esc_attr( implode( ',', $term_names ) ); |
|
| 283 | + $terms_to_edit = esc_attr(implode(',', $term_names)); |
|
| 284 | 284 | |
| 285 | 285 | /** |
| 286 | 286 | * Filters the comma-separated list of terms available to edit. |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @param string $terms_to_edit A comma-separated list of term names. |
| 293 | 293 | * @param string $taxonomy The taxonomy name for which to retrieve terms. |
| 294 | 294 | */ |
| 295 | - $terms_to_edit = apply_filters( 'terms_to_edit', $terms_to_edit, $taxonomy ); |
|
| 295 | + $terms_to_edit = apply_filters('terms_to_edit', $terms_to_edit, $taxonomy); |
|
| 296 | 296 | |
| 297 | 297 | return $terms_to_edit; |
| 298 | 298 | } |
@@ -306,11 +306,11 @@ discard block |
||
| 306 | 306 | * @param string $taxonomy Optional. The taxonomy within which to create the term. Default 'post_tag'. |
| 307 | 307 | * @return array|WP_Error |
| 308 | 308 | */ |
| 309 | -function wp_create_term( $tag_name, $taxonomy = 'post_tag' ) { |
|
| 310 | - $id = term_exists( $tag_name, $taxonomy ); |
|
| 311 | - if ( $id ) { |
|
| 309 | +function wp_create_term($tag_name, $taxonomy = 'post_tag') { |
|
| 310 | + $id = term_exists($tag_name, $taxonomy); |
|
| 311 | + if ($id) { |
|
| 312 | 312 | return $id; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - return wp_insert_term( $tag_name, $taxonomy ); |
|
| 315 | + return wp_insert_term($tag_name, $taxonomy); |
|
| 316 | 316 | } |
@@ -27,160 +27,160 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class ftp_pure extends ftp_base { |
| 29 | 29 | |
| 30 | - function __construct($verb=FALSE, $le=FALSE) { |
|
| 31 | - parent::__construct(false, $verb, $le); |
|
| 32 | - } |
|
| 30 | + function __construct($verb=FALSE, $le=FALSE) { |
|
| 31 | + parent::__construct(false, $verb, $le); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | // <!-- --------------------------------------------------------------------------------------- --> |
| 35 | 35 | // <!-- Private functions --> |
| 36 | 36 | // <!-- --------------------------------------------------------------------------------------- --> |
| 37 | 37 | |
| 38 | - function _settimeout($sock) { |
|
| 39 | - if(!@stream_set_timeout($sock, $this->_timeout)) { |
|
| 40 | - $this->PushError('_settimeout','socket set send timeout'); |
|
| 41 | - $this->_quit(); |
|
| 42 | - return FALSE; |
|
| 43 | - } |
|
| 44 | - return TRUE; |
|
| 45 | - } |
|
| 38 | + function _settimeout($sock) { |
|
| 39 | + if(!@stream_set_timeout($sock, $this->_timeout)) { |
|
| 40 | + $this->PushError('_settimeout','socket set send timeout'); |
|
| 41 | + $this->_quit(); |
|
| 42 | + return FALSE; |
|
| 43 | + } |
|
| 44 | + return TRUE; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - function _connect($host, $port) { |
|
| 48 | - $this->SendMSG("Creating socket"); |
|
| 49 | - $sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout); |
|
| 50 | - if (!$sock) { |
|
| 51 | - $this->PushError('_connect','socket connect failed', $errstr." (".$errno.")"); |
|
| 52 | - return FALSE; |
|
| 53 | - } |
|
| 54 | - $this->_connected=true; |
|
| 55 | - return $sock; |
|
| 56 | - } |
|
| 47 | + function _connect($host, $port) { |
|
| 48 | + $this->SendMSG("Creating socket"); |
|
| 49 | + $sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout); |
|
| 50 | + if (!$sock) { |
|
| 51 | + $this->PushError('_connect','socket connect failed', $errstr." (".$errno.")"); |
|
| 52 | + return FALSE; |
|
| 53 | + } |
|
| 54 | + $this->_connected=true; |
|
| 55 | + return $sock; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - function _readmsg($fnction="_readmsg"){ |
|
| 59 | - if(!$this->_connected) { |
|
| 60 | - $this->PushError($fnction, 'Connect first'); |
|
| 61 | - return FALSE; |
|
| 62 | - } |
|
| 63 | - $result=true; |
|
| 64 | - $this->_message=""; |
|
| 65 | - $this->_code=0; |
|
| 66 | - $go=true; |
|
| 67 | - do { |
|
| 68 | - $tmp=@fgets($this->_ftp_control_sock, 512); |
|
| 69 | - if($tmp===false) { |
|
| 70 | - $go=$result=false; |
|
| 71 | - $this->PushError($fnction,'Read failed'); |
|
| 72 | - } else { |
|
| 73 | - $this->_message.=$tmp; |
|
| 74 | - if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false; |
|
| 75 | - } |
|
| 76 | - } while($go); |
|
| 77 | - if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; |
|
| 78 | - $this->_code=(int)$regs[1]; |
|
| 79 | - return $result; |
|
| 80 | - } |
|
| 58 | + function _readmsg($fnction="_readmsg"){ |
|
| 59 | + if(!$this->_connected) { |
|
| 60 | + $this->PushError($fnction, 'Connect first'); |
|
| 61 | + return FALSE; |
|
| 62 | + } |
|
| 63 | + $result=true; |
|
| 64 | + $this->_message=""; |
|
| 65 | + $this->_code=0; |
|
| 66 | + $go=true; |
|
| 67 | + do { |
|
| 68 | + $tmp=@fgets($this->_ftp_control_sock, 512); |
|
| 69 | + if($tmp===false) { |
|
| 70 | + $go=$result=false; |
|
| 71 | + $this->PushError($fnction,'Read failed'); |
|
| 72 | + } else { |
|
| 73 | + $this->_message.=$tmp; |
|
| 74 | + if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false; |
|
| 75 | + } |
|
| 76 | + } while($go); |
|
| 77 | + if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; |
|
| 78 | + $this->_code=(int)$regs[1]; |
|
| 79 | + return $result; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - function _exec($cmd, $fnction="_exec") { |
|
| 83 | - if(!$this->_ready) { |
|
| 84 | - $this->PushError($fnction,'Connect first'); |
|
| 85 | - return FALSE; |
|
| 86 | - } |
|
| 87 | - if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; |
|
| 88 | - $status=@fputs($this->_ftp_control_sock, $cmd.CRLF); |
|
| 89 | - if($status===false) { |
|
| 90 | - $this->PushError($fnction,'socket write failed'); |
|
| 91 | - return FALSE; |
|
| 92 | - } |
|
| 93 | - $this->_lastaction=time(); |
|
| 94 | - if(!$this->_readmsg($fnction)) return FALSE; |
|
| 95 | - return TRUE; |
|
| 96 | - } |
|
| 82 | + function _exec($cmd, $fnction="_exec") { |
|
| 83 | + if(!$this->_ready) { |
|
| 84 | + $this->PushError($fnction,'Connect first'); |
|
| 85 | + return FALSE; |
|
| 86 | + } |
|
| 87 | + if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; |
|
| 88 | + $status=@fputs($this->_ftp_control_sock, $cmd.CRLF); |
|
| 89 | + if($status===false) { |
|
| 90 | + $this->PushError($fnction,'socket write failed'); |
|
| 91 | + return FALSE; |
|
| 92 | + } |
|
| 93 | + $this->_lastaction=time(); |
|
| 94 | + if(!$this->_readmsg($fnction)) return FALSE; |
|
| 95 | + return TRUE; |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - function _data_prepare($mode=FTP_ASCII) { |
|
| 99 | - if(!$this->_settype($mode)) return FALSE; |
|
| 100 | - if($this->_passive) { |
|
| 101 | - if(!$this->_exec("PASV", "pasv")) { |
|
| 102 | - $this->_data_close(); |
|
| 103 | - return FALSE; |
|
| 104 | - } |
|
| 105 | - if(!$this->_checkCode()) { |
|
| 106 | - $this->_data_close(); |
|
| 107 | - return FALSE; |
|
| 108 | - } |
|
| 109 | - $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message)); |
|
| 110 | - $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; |
|
| 98 | + function _data_prepare($mode=FTP_ASCII) { |
|
| 99 | + if(!$this->_settype($mode)) return FALSE; |
|
| 100 | + if($this->_passive) { |
|
| 101 | + if(!$this->_exec("PASV", "pasv")) { |
|
| 102 | + $this->_data_close(); |
|
| 103 | + return FALSE; |
|
| 104 | + } |
|
| 105 | + if(!$this->_checkCode()) { |
|
| 106 | + $this->_data_close(); |
|
| 107 | + return FALSE; |
|
| 108 | + } |
|
| 109 | + $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message)); |
|
| 110 | + $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; |
|
| 111 | 111 | $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); |
| 112 | - $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); |
|
| 113 | - $this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout); |
|
| 114 | - if(!$this->_ftp_data_sock) { |
|
| 115 | - $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")"); |
|
| 116 | - $this->_data_close(); |
|
| 117 | - return FALSE; |
|
| 118 | - } |
|
| 119 | - else $this->_ftp_data_sock; |
|
| 120 | - } else { |
|
| 121 | - $this->SendMSG("Only passive connections available!"); |
|
| 122 | - return FALSE; |
|
| 123 | - } |
|
| 124 | - return TRUE; |
|
| 125 | - } |
|
| 112 | + $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); |
|
| 113 | + $this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout); |
|
| 114 | + if(!$this->_ftp_data_sock) { |
|
| 115 | + $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")"); |
|
| 116 | + $this->_data_close(); |
|
| 117 | + return FALSE; |
|
| 118 | + } |
|
| 119 | + else $this->_ftp_data_sock; |
|
| 120 | + } else { |
|
| 121 | + $this->SendMSG("Only passive connections available!"); |
|
| 122 | + return FALSE; |
|
| 123 | + } |
|
| 124 | + return TRUE; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - function _data_read($mode=FTP_ASCII, $fp=NULL) { |
|
| 128 | - if(is_resource($fp)) $out=0; |
|
| 129 | - else $out=""; |
|
| 130 | - if(!$this->_passive) { |
|
| 131 | - $this->SendMSG("Only passive connections available!"); |
|
| 132 | - return FALSE; |
|
| 133 | - } |
|
| 134 | - while (!feof($this->_ftp_data_sock)) { |
|
| 135 | - $block=fread($this->_ftp_data_sock, $this->_ftp_buff_size); |
|
| 136 | - if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); |
|
| 137 | - if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); |
|
| 138 | - else $out.=$block; |
|
| 139 | - } |
|
| 140 | - return $out; |
|
| 141 | - } |
|
| 127 | + function _data_read($mode=FTP_ASCII, $fp=NULL) { |
|
| 128 | + if(is_resource($fp)) $out=0; |
|
| 129 | + else $out=""; |
|
| 130 | + if(!$this->_passive) { |
|
| 131 | + $this->SendMSG("Only passive connections available!"); |
|
| 132 | + return FALSE; |
|
| 133 | + } |
|
| 134 | + while (!feof($this->_ftp_data_sock)) { |
|
| 135 | + $block=fread($this->_ftp_data_sock, $this->_ftp_buff_size); |
|
| 136 | + if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); |
|
| 137 | + if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); |
|
| 138 | + else $out.=$block; |
|
| 139 | + } |
|
| 140 | + return $out; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - function _data_write($mode=FTP_ASCII, $fp=NULL) { |
|
| 144 | - if(is_resource($fp)) $out=0; |
|
| 145 | - else $out=""; |
|
| 146 | - if(!$this->_passive) { |
|
| 147 | - $this->SendMSG("Only passive connections available!"); |
|
| 148 | - return FALSE; |
|
| 149 | - } |
|
| 150 | - if(is_resource($fp)) { |
|
| 151 | - while(!feof($fp)) { |
|
| 152 | - $block=fread($fp, $this->_ftp_buff_size); |
|
| 153 | - if(!$this->_data_write_block($mode, $block)) return false; |
|
| 154 | - } |
|
| 155 | - } elseif(!$this->_data_write_block($mode, $fp)) return false; |
|
| 156 | - return TRUE; |
|
| 157 | - } |
|
| 143 | + function _data_write($mode=FTP_ASCII, $fp=NULL) { |
|
| 144 | + if(is_resource($fp)) $out=0; |
|
| 145 | + else $out=""; |
|
| 146 | + if(!$this->_passive) { |
|
| 147 | + $this->SendMSG("Only passive connections available!"); |
|
| 148 | + return FALSE; |
|
| 149 | + } |
|
| 150 | + if(is_resource($fp)) { |
|
| 151 | + while(!feof($fp)) { |
|
| 152 | + $block=fread($fp, $this->_ftp_buff_size); |
|
| 153 | + if(!$this->_data_write_block($mode, $block)) return false; |
|
| 154 | + } |
|
| 155 | + } elseif(!$this->_data_write_block($mode, $fp)) return false; |
|
| 156 | + return TRUE; |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - function _data_write_block($mode, $block) { |
|
| 160 | - if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); |
|
| 161 | - do { |
|
| 162 | - if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) { |
|
| 163 | - $this->PushError("_data_write","Can't write to socket"); |
|
| 164 | - return FALSE; |
|
| 165 | - } |
|
| 166 | - $block=substr($block, $t); |
|
| 167 | - } while(!empty($block)); |
|
| 168 | - return true; |
|
| 169 | - } |
|
| 159 | + function _data_write_block($mode, $block) { |
|
| 160 | + if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); |
|
| 161 | + do { |
|
| 162 | + if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) { |
|
| 163 | + $this->PushError("_data_write","Can't write to socket"); |
|
| 164 | + return FALSE; |
|
| 165 | + } |
|
| 166 | + $block=substr($block, $t); |
|
| 167 | + } while(!empty($block)); |
|
| 168 | + return true; |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - function _data_close() { |
|
| 172 | - @fclose($this->_ftp_data_sock); |
|
| 173 | - $this->SendMSG("Disconnected data from remote host"); |
|
| 174 | - return TRUE; |
|
| 175 | - } |
|
| 171 | + function _data_close() { |
|
| 172 | + @fclose($this->_ftp_data_sock); |
|
| 173 | + $this->SendMSG("Disconnected data from remote host"); |
|
| 174 | + return TRUE; |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - function _quit($force=FALSE) { |
|
| 178 | - if($this->_connected or $force) { |
|
| 179 | - @fclose($this->_ftp_control_sock); |
|
| 180 | - $this->_connected=false; |
|
| 181 | - $this->SendMSG("Socket closed"); |
|
| 182 | - } |
|
| 183 | - } |
|
| 177 | + function _quit($force=FALSE) { |
|
| 178 | + if($this->_connected or $force) { |
|
| 179 | + @fclose($this->_ftp_control_sock); |
|
| 180 | + $this->_connected=false; |
|
| 181 | + $this->SendMSG("Socket closed"); |
|
| 182 | + } |
|
| 183 | + } |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | ?> |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | class ftp_pure extends ftp_base { |
| 29 | 29 | |
| 30 | - function __construct($verb=FALSE, $le=FALSE) { |
|
| 30 | + function __construct($verb = FALSE, $le = FALSE) { |
|
| 31 | 31 | parent::__construct(false, $verb, $le); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | // <!-- --------------------------------------------------------------------------------------- --> |
| 37 | 37 | |
| 38 | 38 | function _settimeout($sock) { |
| 39 | - if(!@stream_set_timeout($sock, $this->_timeout)) { |
|
| 40 | - $this->PushError('_settimeout','socket set send timeout'); |
|
| 39 | + if (!@stream_set_timeout($sock, $this->_timeout)) { |
|
| 40 | + $this->PushError('_settimeout', 'socket set send timeout'); |
|
| 41 | 41 | $this->_quit(); |
| 42 | 42 | return FALSE; |
| 43 | 43 | } |
@@ -48,71 +48,71 @@ discard block |
||
| 48 | 48 | $this->SendMSG("Creating socket"); |
| 49 | 49 | $sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout); |
| 50 | 50 | if (!$sock) { |
| 51 | - $this->PushError('_connect','socket connect failed', $errstr." (".$errno.")"); |
|
| 51 | + $this->PushError('_connect', 'socket connect failed', $errstr . " (" . $errno . ")"); |
|
| 52 | 52 | return FALSE; |
| 53 | 53 | } |
| 54 | - $this->_connected=true; |
|
| 54 | + $this->_connected = true; |
|
| 55 | 55 | return $sock; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - function _readmsg($fnction="_readmsg"){ |
|
| 59 | - if(!$this->_connected) { |
|
| 58 | + function _readmsg($fnction = "_readmsg") { |
|
| 59 | + if (!$this->_connected) { |
|
| 60 | 60 | $this->PushError($fnction, 'Connect first'); |
| 61 | 61 | return FALSE; |
| 62 | 62 | } |
| 63 | - $result=true; |
|
| 64 | - $this->_message=""; |
|
| 65 | - $this->_code=0; |
|
| 66 | - $go=true; |
|
| 63 | + $result = true; |
|
| 64 | + $this->_message = ""; |
|
| 65 | + $this->_code = 0; |
|
| 66 | + $go = true; |
|
| 67 | 67 | do { |
| 68 | - $tmp=@fgets($this->_ftp_control_sock, 512); |
|
| 69 | - if($tmp===false) { |
|
| 70 | - $go=$result=false; |
|
| 71 | - $this->PushError($fnction,'Read failed'); |
|
| 68 | + $tmp = @fgets($this->_ftp_control_sock, 512); |
|
| 69 | + if ($tmp === false) { |
|
| 70 | + $go = $result = false; |
|
| 71 | + $this->PushError($fnction, 'Read failed'); |
|
| 72 | 72 | } else { |
| 73 | - $this->_message.=$tmp; |
|
| 74 | - if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false; |
|
| 73 | + $this->_message .= $tmp; |
|
| 74 | + if (preg_match("/^([0-9]{3})(-(.*[" . CRLF . "]{1,2})+\\1)? [^" . CRLF . "]+[" . CRLF . "]{1,2}$/", $this->_message, $regs)) $go = false; |
|
| 75 | 75 | } |
| 76 | - } while($go); |
|
| 77 | - if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; |
|
| 78 | - $this->_code=(int)$regs[1]; |
|
| 76 | + } while ($go); |
|
| 77 | + if ($this->LocalEcho) echo "GET < " . rtrim($this->_message, CRLF) . CRLF; |
|
| 78 | + $this->_code = (int) $regs[1]; |
|
| 79 | 79 | return $result; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - function _exec($cmd, $fnction="_exec") { |
|
| 83 | - if(!$this->_ready) { |
|
| 84 | - $this->PushError($fnction,'Connect first'); |
|
| 82 | + function _exec($cmd, $fnction = "_exec") { |
|
| 83 | + if (!$this->_ready) { |
|
| 84 | + $this->PushError($fnction, 'Connect first'); |
|
| 85 | 85 | return FALSE; |
| 86 | 86 | } |
| 87 | - if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; |
|
| 88 | - $status=@fputs($this->_ftp_control_sock, $cmd.CRLF); |
|
| 89 | - if($status===false) { |
|
| 90 | - $this->PushError($fnction,'socket write failed'); |
|
| 87 | + if ($this->LocalEcho) echo "PUT > ", $cmd, CRLF; |
|
| 88 | + $status = @fputs($this->_ftp_control_sock, $cmd . CRLF); |
|
| 89 | + if ($status === false) { |
|
| 90 | + $this->PushError($fnction, 'socket write failed'); |
|
| 91 | 91 | return FALSE; |
| 92 | 92 | } |
| 93 | - $this->_lastaction=time(); |
|
| 94 | - if(!$this->_readmsg($fnction)) return FALSE; |
|
| 93 | + $this->_lastaction = time(); |
|
| 94 | + if (!$this->_readmsg($fnction)) return FALSE; |
|
| 95 | 95 | return TRUE; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - function _data_prepare($mode=FTP_ASCII) { |
|
| 99 | - if(!$this->_settype($mode)) return FALSE; |
|
| 100 | - if($this->_passive) { |
|
| 101 | - if(!$this->_exec("PASV", "pasv")) { |
|
| 98 | + function _data_prepare($mode = FTP_ASCII) { |
|
| 99 | + if (!$this->_settype($mode)) return FALSE; |
|
| 100 | + if ($this->_passive) { |
|
| 101 | + if (!$this->_exec("PASV", "pasv")) { |
|
| 102 | 102 | $this->_data_close(); |
| 103 | 103 | return FALSE; |
| 104 | 104 | } |
| 105 | - if(!$this->_checkCode()) { |
|
| 105 | + if (!$this->_checkCode()) { |
|
| 106 | 106 | $this->_data_close(); |
| 107 | 107 | return FALSE; |
| 108 | 108 | } |
| 109 | 109 | $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message)); |
| 110 | - $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; |
|
| 111 | - $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); |
|
| 112 | - $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); |
|
| 113 | - $this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout); |
|
| 114 | - if(!$this->_ftp_data_sock) { |
|
| 115 | - $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")"); |
|
| 110 | + $this->_datahost = $ip_port[0] . "." . $ip_port[1] . "." . $ip_port[2] . "." . $ip_port[3]; |
|
| 111 | + $this->_dataport = (((int) $ip_port[4]) << 8) + ((int) $ip_port[5]); |
|
| 112 | + $this->SendMSG("Connecting to " . $this->_datahost . ":" . $this->_dataport); |
|
| 113 | + $this->_ftp_data_sock = @fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout); |
|
| 114 | + if (!$this->_ftp_data_sock) { |
|
| 115 | + $this->PushError("_data_prepare", "fsockopen fails", $errstr . " (" . $errno . ")"); |
|
| 116 | 116 | $this->_data_close(); |
| 117 | 117 | return FALSE; |
| 118 | 118 | } |
@@ -124,47 +124,47 @@ discard block |
||
| 124 | 124 | return TRUE; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - function _data_read($mode=FTP_ASCII, $fp=NULL) { |
|
| 128 | - if(is_resource($fp)) $out=0; |
|
| 129 | - else $out=""; |
|
| 130 | - if(!$this->_passive) { |
|
| 127 | + function _data_read($mode = FTP_ASCII, $fp = NULL) { |
|
| 128 | + if (is_resource($fp)) $out = 0; |
|
| 129 | + else $out = ""; |
|
| 130 | + if (!$this->_passive) { |
|
| 131 | 131 | $this->SendMSG("Only passive connections available!"); |
| 132 | 132 | return FALSE; |
| 133 | 133 | } |
| 134 | 134 | while (!feof($this->_ftp_data_sock)) { |
| 135 | - $block=fread($this->_ftp_data_sock, $this->_ftp_buff_size); |
|
| 136 | - if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); |
|
| 137 | - if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); |
|
| 138 | - else $out.=$block; |
|
| 135 | + $block = fread($this->_ftp_data_sock, $this->_ftp_buff_size); |
|
| 136 | + if ($mode != FTP_BINARY) $block = preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); |
|
| 137 | + if (is_resource($fp)) $out += fwrite($fp, $block, strlen($block)); |
|
| 138 | + else $out .= $block; |
|
| 139 | 139 | } |
| 140 | 140 | return $out; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - function _data_write($mode=FTP_ASCII, $fp=NULL) { |
|
| 144 | - if(is_resource($fp)) $out=0; |
|
| 145 | - else $out=""; |
|
| 146 | - if(!$this->_passive) { |
|
| 143 | + function _data_write($mode = FTP_ASCII, $fp = NULL) { |
|
| 144 | + if (is_resource($fp)) $out = 0; |
|
| 145 | + else $out = ""; |
|
| 146 | + if (!$this->_passive) { |
|
| 147 | 147 | $this->SendMSG("Only passive connections available!"); |
| 148 | 148 | return FALSE; |
| 149 | 149 | } |
| 150 | - if(is_resource($fp)) { |
|
| 151 | - while(!feof($fp)) { |
|
| 152 | - $block=fread($fp, $this->_ftp_buff_size); |
|
| 153 | - if(!$this->_data_write_block($mode, $block)) return false; |
|
| 150 | + if (is_resource($fp)) { |
|
| 151 | + while (!feof($fp)) { |
|
| 152 | + $block = fread($fp, $this->_ftp_buff_size); |
|
| 153 | + if (!$this->_data_write_block($mode, $block)) return false; |
|
| 154 | 154 | } |
| 155 | - } elseif(!$this->_data_write_block($mode, $fp)) return false; |
|
| 155 | + } elseif (!$this->_data_write_block($mode, $fp)) return false; |
|
| 156 | 156 | return TRUE; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | function _data_write_block($mode, $block) { |
| 160 | - if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); |
|
| 160 | + if ($mode != FTP_BINARY) $block = preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); |
|
| 161 | 161 | do { |
| 162 | - if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) { |
|
| 163 | - $this->PushError("_data_write","Can't write to socket"); |
|
| 162 | + if (($t = @fwrite($this->_ftp_data_sock, $block)) === FALSE) { |
|
| 163 | + $this->PushError("_data_write", "Can't write to socket"); |
|
| 164 | 164 | return FALSE; |
| 165 | 165 | } |
| 166 | - $block=substr($block, $t); |
|
| 167 | - } while(!empty($block)); |
|
| 166 | + $block = substr($block, $t); |
|
| 167 | + } while (!empty($block)); |
|
| 168 | 168 | return true; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | return TRUE; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - function _quit($force=FALSE) { |
|
| 178 | - if($this->_connected or $force) { |
|
| 177 | + function _quit($force = FALSE) { |
|
| 178 | + if ($this->_connected or $force) { |
|
| 179 | 179 | @fclose($this->_ftp_control_sock); |
| 180 | - $this->_connected=false; |
|
| 180 | + $this->_connected = false; |
|
| 181 | 181 | $this->SendMSG("Socket closed"); |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -71,10 +71,14 @@ discard block |
||
| 71 | 71 | $this->PushError($fnction,'Read failed'); |
| 72 | 72 | } else { |
| 73 | 73 | $this->_message.=$tmp; |
| 74 | - if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false; |
|
| 74 | + if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) { |
|
| 75 | + $go=false; |
|
| 76 | + } |
|
| 75 | 77 | } |
| 76 | 78 | } while($go); |
| 77 | - if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; |
|
| 79 | + if($this->LocalEcho) { |
|
| 80 | + echo "GET < ".rtrim($this->_message, CRLF).CRLF; |
|
| 81 | + } |
|
| 78 | 82 | $this->_code=(int)$regs[1]; |
| 79 | 83 | return $result; |
| 80 | 84 | } |
@@ -84,19 +88,25 @@ discard block |
||
| 84 | 88 | $this->PushError($fnction,'Connect first'); |
| 85 | 89 | return FALSE; |
| 86 | 90 | } |
| 87 | - if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; |
|
| 91 | + if($this->LocalEcho) { |
|
| 92 | + echo "PUT > ",$cmd,CRLF; |
|
| 93 | + } |
|
| 88 | 94 | $status=@fputs($this->_ftp_control_sock, $cmd.CRLF); |
| 89 | 95 | if($status===false) { |
| 90 | 96 | $this->PushError($fnction,'socket write failed'); |
| 91 | 97 | return FALSE; |
| 92 | 98 | } |
| 93 | 99 | $this->_lastaction=time(); |
| 94 | - if(!$this->_readmsg($fnction)) return FALSE; |
|
| 100 | + if(!$this->_readmsg($fnction)) { |
|
| 101 | + return FALSE; |
|
| 102 | + } |
|
| 95 | 103 | return TRUE; |
| 96 | 104 | } |
| 97 | 105 | |
| 98 | 106 | function _data_prepare($mode=FTP_ASCII) { |
| 99 | - if(!$this->_settype($mode)) return FALSE; |
|
| 107 | + if(!$this->_settype($mode)) { |
|
| 108 | + return FALSE; |
|
| 109 | + } |
|
| 100 | 110 | if($this->_passive) { |
| 101 | 111 | if(!$this->_exec("PASV", "pasv")) { |
| 102 | 112 | $this->_data_close(); |
@@ -115,8 +125,9 @@ discard block |
||
| 115 | 125 | $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")"); |
| 116 | 126 | $this->_data_close(); |
| 117 | 127 | return FALSE; |
| 128 | + } else { |
|
| 129 | + $this->_ftp_data_sock; |
|
| 118 | 130 | } |
| 119 | - else $this->_ftp_data_sock; |
|
| 120 | 131 | } else { |
| 121 | 132 | $this->SendMSG("Only passive connections available!"); |
| 122 | 133 | return FALSE; |
@@ -125,24 +136,35 @@ discard block |
||
| 125 | 136 | } |
| 126 | 137 | |
| 127 | 138 | function _data_read($mode=FTP_ASCII, $fp=NULL) { |
| 128 | - if(is_resource($fp)) $out=0; |
|
| 129 | - else $out=""; |
|
| 139 | + if(is_resource($fp)) { |
|
| 140 | + $out=0; |
|
| 141 | + } else { |
|
| 142 | + $out=""; |
|
| 143 | + } |
|
| 130 | 144 | if(!$this->_passive) { |
| 131 | 145 | $this->SendMSG("Only passive connections available!"); |
| 132 | 146 | return FALSE; |
| 133 | 147 | } |
| 134 | 148 | while (!feof($this->_ftp_data_sock)) { |
| 135 | 149 | $block=fread($this->_ftp_data_sock, $this->_ftp_buff_size); |
| 136 | - if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); |
|
| 137 | - if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); |
|
| 138 | - else $out.=$block; |
|
| 150 | + if($mode!=FTP_BINARY) { |
|
| 151 | + $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); |
|
| 152 | + } |
|
| 153 | + if(is_resource($fp)) { |
|
| 154 | + $out+=fwrite($fp, $block, strlen($block)); |
|
| 155 | + } else { |
|
| 156 | + $out.=$block; |
|
| 157 | + } |
|
| 139 | 158 | } |
| 140 | 159 | return $out; |
| 141 | 160 | } |
| 142 | 161 | |
| 143 | 162 | function _data_write($mode=FTP_ASCII, $fp=NULL) { |
| 144 | - if(is_resource($fp)) $out=0; |
|
| 145 | - else $out=""; |
|
| 163 | + if(is_resource($fp)) { |
|
| 164 | + $out=0; |
|
| 165 | + } else { |
|
| 166 | + $out=""; |
|
| 167 | + } |
|
| 146 | 168 | if(!$this->_passive) { |
| 147 | 169 | $this->SendMSG("Only passive connections available!"); |
| 148 | 170 | return FALSE; |
@@ -150,14 +172,20 @@ discard block |
||
| 150 | 172 | if(is_resource($fp)) { |
| 151 | 173 | while(!feof($fp)) { |
| 152 | 174 | $block=fread($fp, $this->_ftp_buff_size); |
| 153 | - if(!$this->_data_write_block($mode, $block)) return false; |
|
| 175 | + if(!$this->_data_write_block($mode, $block)) { |
|
| 176 | + return false; |
|
| 177 | + } |
|
| 154 | 178 | } |
| 155 | - } elseif(!$this->_data_write_block($mode, $fp)) return false; |
|
| 179 | + } elseif(!$this->_data_write_block($mode, $fp)) { |
|
| 180 | + return false; |
|
| 181 | + } |
|
| 156 | 182 | return TRUE; |
| 157 | 183 | } |
| 158 | 184 | |
| 159 | 185 | function _data_write_block($mode, $block) { |
| 160 | - if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); |
|
| 186 | + if($mode!=FTP_BINARY) { |
|
| 187 | + $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); |
|
| 188 | + } |
|
| 161 | 189 | do { |
| 162 | 190 | if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) { |
| 163 | 191 | $this->PushError("_data_write","Can't write to socket"); |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | * @return array |
| 16 | 16 | */ |
| 17 | 17 | function get_importers() { |
| 18 | - global $wp_importers; |
|
| 19 | - if ( is_array( $wp_importers ) ) { |
|
| 20 | - uasort( $wp_importers, '_usort_by_first_member' ); |
|
| 21 | - } |
|
| 22 | - return $wp_importers; |
|
| 18 | + global $wp_importers; |
|
| 19 | + if ( is_array( $wp_importers ) ) { |
|
| 20 | + uasort( $wp_importers, '_usort_by_first_member' ); |
|
| 21 | + } |
|
| 22 | + return $wp_importers; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @return int |
| 36 | 36 | */ |
| 37 | 37 | function _usort_by_first_member( $a, $b ) { |
| 38 | - return strnatcasecmp( $a[0], $b[0] ); |
|
| 38 | + return strnatcasecmp( $a[0], $b[0] ); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | * @return void|WP_Error Void on success. WP_Error when $callback is WP_Error. |
| 53 | 53 | */ |
| 54 | 54 | function register_importer( $id, $name, $description, $callback ) { |
| 55 | - global $wp_importers; |
|
| 56 | - if ( is_wp_error( $callback ) ) { |
|
| 57 | - return $callback; |
|
| 58 | - } |
|
| 59 | - $wp_importers[ $id ] = array( $name, $description, $callback ); |
|
| 55 | + global $wp_importers; |
|
| 56 | + if ( is_wp_error( $callback ) ) { |
|
| 57 | + return $callback; |
|
| 58 | + } |
|
| 59 | + $wp_importers[ $id ] = array( $name, $description, $callback ); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param string $id Importer ID. |
| 70 | 70 | */ |
| 71 | 71 | function wp_import_cleanup( $id ) { |
| 72 | - wp_delete_attachment( $id ); |
|
| 72 | + wp_delete_attachment( $id ); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -80,52 +80,52 @@ discard block |
||
| 80 | 80 | * @return array Uploaded file's details on success, error message on failure |
| 81 | 81 | */ |
| 82 | 82 | function wp_import_handle_upload() { |
| 83 | - if ( ! isset( $_FILES['import'] ) ) { |
|
| 84 | - return array( |
|
| 85 | - 'error' => sprintf( |
|
| 86 | - /* translators: 1: php.ini, 2: post_max_size, 3: upload_max_filesize */ |
|
| 87 | - __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your %1$s file or by %2$s being defined as smaller than %3$s in %1$s.' ), |
|
| 88 | - 'php.ini', |
|
| 89 | - 'post_max_size', |
|
| 90 | - 'upload_max_filesize' |
|
| 91 | - ), |
|
| 92 | - ); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - $overrides = array( |
|
| 96 | - 'test_form' => false, |
|
| 97 | - 'test_type' => false, |
|
| 98 | - ); |
|
| 99 | - $_FILES['import']['name'] .= '.txt'; |
|
| 100 | - $upload = wp_handle_upload( $_FILES['import'], $overrides ); |
|
| 101 | - |
|
| 102 | - if ( isset( $upload['error'] ) ) { |
|
| 103 | - return $upload; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - // Construct the attachment array. |
|
| 107 | - $attachment = array( |
|
| 108 | - 'post_title' => wp_basename( $upload['file'] ), |
|
| 109 | - 'post_content' => $upload['url'], |
|
| 110 | - 'post_mime_type' => $upload['type'], |
|
| 111 | - 'guid' => $upload['url'], |
|
| 112 | - 'context' => 'import', |
|
| 113 | - 'post_status' => 'private', |
|
| 114 | - ); |
|
| 115 | - |
|
| 116 | - // Save the data. |
|
| 117 | - $id = wp_insert_attachment( $attachment, $upload['file'] ); |
|
| 118 | - |
|
| 119 | - /* |
|
| 83 | + if ( ! isset( $_FILES['import'] ) ) { |
|
| 84 | + return array( |
|
| 85 | + 'error' => sprintf( |
|
| 86 | + /* translators: 1: php.ini, 2: post_max_size, 3: upload_max_filesize */ |
|
| 87 | + __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your %1$s file or by %2$s being defined as smaller than %3$s in %1$s.' ), |
|
| 88 | + 'php.ini', |
|
| 89 | + 'post_max_size', |
|
| 90 | + 'upload_max_filesize' |
|
| 91 | + ), |
|
| 92 | + ); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + $overrides = array( |
|
| 96 | + 'test_form' => false, |
|
| 97 | + 'test_type' => false, |
|
| 98 | + ); |
|
| 99 | + $_FILES['import']['name'] .= '.txt'; |
|
| 100 | + $upload = wp_handle_upload( $_FILES['import'], $overrides ); |
|
| 101 | + |
|
| 102 | + if ( isset( $upload['error'] ) ) { |
|
| 103 | + return $upload; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + // Construct the attachment array. |
|
| 107 | + $attachment = array( |
|
| 108 | + 'post_title' => wp_basename( $upload['file'] ), |
|
| 109 | + 'post_content' => $upload['url'], |
|
| 110 | + 'post_mime_type' => $upload['type'], |
|
| 111 | + 'guid' => $upload['url'], |
|
| 112 | + 'context' => 'import', |
|
| 113 | + 'post_status' => 'private', |
|
| 114 | + ); |
|
| 115 | + |
|
| 116 | + // Save the data. |
|
| 117 | + $id = wp_insert_attachment( $attachment, $upload['file'] ); |
|
| 118 | + |
|
| 119 | + /* |
|
| 120 | 120 | * Schedule a cleanup for one day from now in case of failed |
| 121 | 121 | * import or missing wp_import_cleanup() call. |
| 122 | 122 | */ |
| 123 | - wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) ); |
|
| 123 | + wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) ); |
|
| 124 | 124 | |
| 125 | - return array( |
|
| 126 | - 'file' => $upload['file'], |
|
| 127 | - 'id' => $id, |
|
| 128 | - ); |
|
| 125 | + return array( |
|
| 126 | + 'file' => $upload['file'], |
|
| 127 | + 'id' => $id, |
|
| 128 | + ); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -136,97 +136,97 @@ discard block |
||
| 136 | 136 | * @return array Importers with metadata for each. |
| 137 | 137 | */ |
| 138 | 138 | function wp_get_popular_importers() { |
| 139 | - // Include an unmodified $wp_version. |
|
| 140 | - require ABSPATH . WPINC . '/version.php'; |
|
| 141 | - |
|
| 142 | - $locale = get_user_locale(); |
|
| 143 | - $cache_key = 'popular_importers_' . md5( $locale . $wp_version ); |
|
| 144 | - $popular_importers = get_site_transient( $cache_key ); |
|
| 145 | - |
|
| 146 | - if ( ! $popular_importers ) { |
|
| 147 | - $url = add_query_arg( |
|
| 148 | - array( |
|
| 149 | - 'locale' => $locale, |
|
| 150 | - 'version' => $wp_version, |
|
| 151 | - ), |
|
| 152 | - 'http://api.wordpress.org/core/importers/1.1/' |
|
| 153 | - ); |
|
| 154 | - $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) ); |
|
| 155 | - |
|
| 156 | - if ( wp_http_supports( array( 'ssl' ) ) ) { |
|
| 157 | - $url = set_url_scheme( $url, 'https' ); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - $response = wp_remote_get( $url, $options ); |
|
| 161 | - $popular_importers = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
| 162 | - |
|
| 163 | - if ( is_array( $popular_importers ) ) { |
|
| 164 | - set_site_transient( $cache_key, $popular_importers, 2 * DAY_IN_SECONDS ); |
|
| 165 | - } else { |
|
| 166 | - $popular_importers = false; |
|
| 167 | - } |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - if ( is_array( $popular_importers ) ) { |
|
| 171 | - // If the data was received as translated, return it as-is. |
|
| 172 | - if ( $popular_importers['translated'] ) { |
|
| 173 | - return $popular_importers['importers']; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - foreach ( $popular_importers['importers'] as &$importer ) { |
|
| 177 | - // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText |
|
| 178 | - $importer['description'] = translate( $importer['description'] ); |
|
| 179 | - if ( 'WordPress' !== $importer['name'] ) { |
|
| 180 | - // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText |
|
| 181 | - $importer['name'] = translate( $importer['name'] ); |
|
| 182 | - } |
|
| 183 | - } |
|
| 184 | - return $popular_importers['importers']; |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - return array( |
|
| 188 | - // slug => name, description, plugin slug, and register_importer() slug. |
|
| 189 | - 'blogger' => array( |
|
| 190 | - 'name' => __( 'Blogger' ), |
|
| 191 | - 'description' => __( 'Import posts, comments, and users from a Blogger blog.' ), |
|
| 192 | - 'plugin-slug' => 'blogger-importer', |
|
| 193 | - 'importer-id' => 'blogger', |
|
| 194 | - ), |
|
| 195 | - 'wpcat2tag' => array( |
|
| 196 | - 'name' => __( 'Categories and Tags Converter' ), |
|
| 197 | - 'description' => __( 'Convert existing categories to tags or tags to categories, selectively.' ), |
|
| 198 | - 'plugin-slug' => 'wpcat2tag-importer', |
|
| 199 | - 'importer-id' => 'wp-cat2tag', |
|
| 200 | - ), |
|
| 201 | - 'livejournal' => array( |
|
| 202 | - 'name' => __( 'LiveJournal' ), |
|
| 203 | - 'description' => __( 'Import posts from LiveJournal using their API.' ), |
|
| 204 | - 'plugin-slug' => 'livejournal-importer', |
|
| 205 | - 'importer-id' => 'livejournal', |
|
| 206 | - ), |
|
| 207 | - 'movabletype' => array( |
|
| 208 | - 'name' => __( 'Movable Type and TypePad' ), |
|
| 209 | - 'description' => __( 'Import posts and comments from a Movable Type or TypePad blog.' ), |
|
| 210 | - 'plugin-slug' => 'movabletype-importer', |
|
| 211 | - 'importer-id' => 'mt', |
|
| 212 | - ), |
|
| 213 | - 'rss' => array( |
|
| 214 | - 'name' => __( 'RSS' ), |
|
| 215 | - 'description' => __( 'Import posts from an RSS feed.' ), |
|
| 216 | - 'plugin-slug' => 'rss-importer', |
|
| 217 | - 'importer-id' => 'rss', |
|
| 218 | - ), |
|
| 219 | - 'tumblr' => array( |
|
| 220 | - 'name' => __( 'Tumblr' ), |
|
| 221 | - 'description' => __( 'Import posts & media from Tumblr using their API.' ), |
|
| 222 | - 'plugin-slug' => 'tumblr-importer', |
|
| 223 | - 'importer-id' => 'tumblr', |
|
| 224 | - ), |
|
| 225 | - 'wordpress' => array( |
|
| 226 | - 'name' => 'WordPress', |
|
| 227 | - 'description' => __( 'Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ), |
|
| 228 | - 'plugin-slug' => 'wordpress-importer', |
|
| 229 | - 'importer-id' => 'wordpress', |
|
| 230 | - ), |
|
| 231 | - ); |
|
| 139 | + // Include an unmodified $wp_version. |
|
| 140 | + require ABSPATH . WPINC . '/version.php'; |
|
| 141 | + |
|
| 142 | + $locale = get_user_locale(); |
|
| 143 | + $cache_key = 'popular_importers_' . md5( $locale . $wp_version ); |
|
| 144 | + $popular_importers = get_site_transient( $cache_key ); |
|
| 145 | + |
|
| 146 | + if ( ! $popular_importers ) { |
|
| 147 | + $url = add_query_arg( |
|
| 148 | + array( |
|
| 149 | + 'locale' => $locale, |
|
| 150 | + 'version' => $wp_version, |
|
| 151 | + ), |
|
| 152 | + 'http://api.wordpress.org/core/importers/1.1/' |
|
| 153 | + ); |
|
| 154 | + $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) ); |
|
| 155 | + |
|
| 156 | + if ( wp_http_supports( array( 'ssl' ) ) ) { |
|
| 157 | + $url = set_url_scheme( $url, 'https' ); |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + $response = wp_remote_get( $url, $options ); |
|
| 161 | + $popular_importers = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
| 162 | + |
|
| 163 | + if ( is_array( $popular_importers ) ) { |
|
| 164 | + set_site_transient( $cache_key, $popular_importers, 2 * DAY_IN_SECONDS ); |
|
| 165 | + } else { |
|
| 166 | + $popular_importers = false; |
|
| 167 | + } |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + if ( is_array( $popular_importers ) ) { |
|
| 171 | + // If the data was received as translated, return it as-is. |
|
| 172 | + if ( $popular_importers['translated'] ) { |
|
| 173 | + return $popular_importers['importers']; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + foreach ( $popular_importers['importers'] as &$importer ) { |
|
| 177 | + // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText |
|
| 178 | + $importer['description'] = translate( $importer['description'] ); |
|
| 179 | + if ( 'WordPress' !== $importer['name'] ) { |
|
| 180 | + // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText |
|
| 181 | + $importer['name'] = translate( $importer['name'] ); |
|
| 182 | + } |
|
| 183 | + } |
|
| 184 | + return $popular_importers['importers']; |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + return array( |
|
| 188 | + // slug => name, description, plugin slug, and register_importer() slug. |
|
| 189 | + 'blogger' => array( |
|
| 190 | + 'name' => __( 'Blogger' ), |
|
| 191 | + 'description' => __( 'Import posts, comments, and users from a Blogger blog.' ), |
|
| 192 | + 'plugin-slug' => 'blogger-importer', |
|
| 193 | + 'importer-id' => 'blogger', |
|
| 194 | + ), |
|
| 195 | + 'wpcat2tag' => array( |
|
| 196 | + 'name' => __( 'Categories and Tags Converter' ), |
|
| 197 | + 'description' => __( 'Convert existing categories to tags or tags to categories, selectively.' ), |
|
| 198 | + 'plugin-slug' => 'wpcat2tag-importer', |
|
| 199 | + 'importer-id' => 'wp-cat2tag', |
|
| 200 | + ), |
|
| 201 | + 'livejournal' => array( |
|
| 202 | + 'name' => __( 'LiveJournal' ), |
|
| 203 | + 'description' => __( 'Import posts from LiveJournal using their API.' ), |
|
| 204 | + 'plugin-slug' => 'livejournal-importer', |
|
| 205 | + 'importer-id' => 'livejournal', |
|
| 206 | + ), |
|
| 207 | + 'movabletype' => array( |
|
| 208 | + 'name' => __( 'Movable Type and TypePad' ), |
|
| 209 | + 'description' => __( 'Import posts and comments from a Movable Type or TypePad blog.' ), |
|
| 210 | + 'plugin-slug' => 'movabletype-importer', |
|
| 211 | + 'importer-id' => 'mt', |
|
| 212 | + ), |
|
| 213 | + 'rss' => array( |
|
| 214 | + 'name' => __( 'RSS' ), |
|
| 215 | + 'description' => __( 'Import posts from an RSS feed.' ), |
|
| 216 | + 'plugin-slug' => 'rss-importer', |
|
| 217 | + 'importer-id' => 'rss', |
|
| 218 | + ), |
|
| 219 | + 'tumblr' => array( |
|
| 220 | + 'name' => __( 'Tumblr' ), |
|
| 221 | + 'description' => __( 'Import posts & media from Tumblr using their API.' ), |
|
| 222 | + 'plugin-slug' => 'tumblr-importer', |
|
| 223 | + 'importer-id' => 'tumblr', |
|
| 224 | + ), |
|
| 225 | + 'wordpress' => array( |
|
| 226 | + 'name' => 'WordPress', |
|
| 227 | + 'description' => __( 'Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ), |
|
| 228 | + 'plugin-slug' => 'wordpress-importer', |
|
| 229 | + 'importer-id' => 'wordpress', |
|
| 230 | + ), |
|
| 231 | + ); |
|
| 232 | 232 | } |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | function get_importers() { |
| 18 | 18 | global $wp_importers; |
| 19 | - if ( is_array( $wp_importers ) ) { |
|
| 20 | - uasort( $wp_importers, '_usort_by_first_member' ); |
|
| 19 | + if (is_array($wp_importers)) { |
|
| 20 | + uasort($wp_importers, '_usort_by_first_member'); |
|
| 21 | 21 | } |
| 22 | 22 | return $wp_importers; |
| 23 | 23 | } |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | * @param array $b |
| 35 | 35 | * @return int |
| 36 | 36 | */ |
| 37 | -function _usort_by_first_member( $a, $b ) { |
|
| 38 | - return strnatcasecmp( $a[0], $b[0] ); |
|
| 37 | +function _usort_by_first_member($a, $b) { |
|
| 38 | + return strnatcasecmp($a[0], $b[0]); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | * @param callable $callback Callback to run. |
| 52 | 52 | * @return void|WP_Error Void on success. WP_Error when $callback is WP_Error. |
| 53 | 53 | */ |
| 54 | -function register_importer( $id, $name, $description, $callback ) { |
|
| 54 | +function register_importer($id, $name, $description, $callback) { |
|
| 55 | 55 | global $wp_importers; |
| 56 | - if ( is_wp_error( $callback ) ) { |
|
| 56 | + if (is_wp_error($callback)) { |
|
| 57 | 57 | return $callback; |
| 58 | 58 | } |
| 59 | - $wp_importers[ $id ] = array( $name, $description, $callback ); |
|
| 59 | + $wp_importers[$id] = array($name, $description, $callback); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param string $id Importer ID. |
| 70 | 70 | */ |
| 71 | -function wp_import_cleanup( $id ) { |
|
| 72 | - wp_delete_attachment( $id ); |
|
| 71 | +function wp_import_cleanup($id) { |
|
| 72 | + wp_delete_attachment($id); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | * @return array Uploaded file's details on success, error message on failure |
| 81 | 81 | */ |
| 82 | 82 | function wp_import_handle_upload() { |
| 83 | - if ( ! isset( $_FILES['import'] ) ) { |
|
| 83 | + if (!isset($_FILES['import'])) { |
|
| 84 | 84 | return array( |
| 85 | 85 | 'error' => sprintf( |
| 86 | 86 | /* translators: 1: php.ini, 2: post_max_size, 3: upload_max_filesize */ |
| 87 | - __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your %1$s file or by %2$s being defined as smaller than %3$s in %1$s.' ), |
|
| 87 | + __('File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your %1$s file or by %2$s being defined as smaller than %3$s in %1$s.'), |
|
| 88 | 88 | 'php.ini', |
| 89 | 89 | 'post_max_size', |
| 90 | 90 | 'upload_max_filesize' |
@@ -92,20 +92,20 @@ discard block |
||
| 92 | 92 | ); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $overrides = array( |
|
| 95 | + $overrides = array( |
|
| 96 | 96 | 'test_form' => false, |
| 97 | 97 | 'test_type' => false, |
| 98 | 98 | ); |
| 99 | 99 | $_FILES['import']['name'] .= '.txt'; |
| 100 | - $upload = wp_handle_upload( $_FILES['import'], $overrides ); |
|
| 100 | + $upload = wp_handle_upload($_FILES['import'], $overrides); |
|
| 101 | 101 | |
| 102 | - if ( isset( $upload['error'] ) ) { |
|
| 102 | + if (isset($upload['error'])) { |
|
| 103 | 103 | return $upload; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // Construct the attachment array. |
| 107 | 107 | $attachment = array( |
| 108 | - 'post_title' => wp_basename( $upload['file'] ), |
|
| 108 | + 'post_title' => wp_basename($upload['file']), |
|
| 109 | 109 | 'post_content' => $upload['url'], |
| 110 | 110 | 'post_mime_type' => $upload['type'], |
| 111 | 111 | 'guid' => $upload['url'], |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | 116 | // Save the data. |
| 117 | - $id = wp_insert_attachment( $attachment, $upload['file'] ); |
|
| 117 | + $id = wp_insert_attachment($attachment, $upload['file']); |
|
| 118 | 118 | |
| 119 | 119 | /* |
| 120 | 120 | * Schedule a cleanup for one day from now in case of failed |
| 121 | 121 | * import or missing wp_import_cleanup() call. |
| 122 | 122 | */ |
| 123 | - wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) ); |
|
| 123 | + wp_schedule_single_event(time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array($id)); |
|
| 124 | 124 | |
| 125 | 125 | return array( |
| 126 | 126 | 'file' => $upload['file'], |
@@ -140,45 +140,45 @@ discard block |
||
| 140 | 140 | require ABSPATH . WPINC . '/version.php'; |
| 141 | 141 | |
| 142 | 142 | $locale = get_user_locale(); |
| 143 | - $cache_key = 'popular_importers_' . md5( $locale . $wp_version ); |
|
| 144 | - $popular_importers = get_site_transient( $cache_key ); |
|
| 143 | + $cache_key = 'popular_importers_' . md5($locale . $wp_version); |
|
| 144 | + $popular_importers = get_site_transient($cache_key); |
|
| 145 | 145 | |
| 146 | - if ( ! $popular_importers ) { |
|
| 147 | - $url = add_query_arg( |
|
| 146 | + if (!$popular_importers) { |
|
| 147 | + $url = add_query_arg( |
|
| 148 | 148 | array( |
| 149 | 149 | 'locale' => $locale, |
| 150 | 150 | 'version' => $wp_version, |
| 151 | 151 | ), |
| 152 | 152 | 'http://api.wordpress.org/core/importers/1.1/' |
| 153 | 153 | ); |
| 154 | - $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) ); |
|
| 154 | + $options = array('user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/')); |
|
| 155 | 155 | |
| 156 | - if ( wp_http_supports( array( 'ssl' ) ) ) { |
|
| 157 | - $url = set_url_scheme( $url, 'https' ); |
|
| 156 | + if (wp_http_supports(array('ssl'))) { |
|
| 157 | + $url = set_url_scheme($url, 'https'); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - $response = wp_remote_get( $url, $options ); |
|
| 161 | - $popular_importers = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
| 160 | + $response = wp_remote_get($url, $options); |
|
| 161 | + $popular_importers = json_decode(wp_remote_retrieve_body($response), true); |
|
| 162 | 162 | |
| 163 | - if ( is_array( $popular_importers ) ) { |
|
| 164 | - set_site_transient( $cache_key, $popular_importers, 2 * DAY_IN_SECONDS ); |
|
| 163 | + if (is_array($popular_importers)) { |
|
| 164 | + set_site_transient($cache_key, $popular_importers, 2 * DAY_IN_SECONDS); |
|
| 165 | 165 | } else { |
| 166 | 166 | $popular_importers = false; |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if ( is_array( $popular_importers ) ) { |
|
| 170 | + if (is_array($popular_importers)) { |
|
| 171 | 171 | // If the data was received as translated, return it as-is. |
| 172 | - if ( $popular_importers['translated'] ) { |
|
| 172 | + if ($popular_importers['translated']) { |
|
| 173 | 173 | return $popular_importers['importers']; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - foreach ( $popular_importers['importers'] as &$importer ) { |
|
| 176 | + foreach ($popular_importers['importers'] as &$importer) { |
|
| 177 | 177 | // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText |
| 178 | - $importer['description'] = translate( $importer['description'] ); |
|
| 179 | - if ( 'WordPress' !== $importer['name'] ) { |
|
| 178 | + $importer['description'] = translate($importer['description']); |
|
| 179 | + if ('WordPress' !== $importer['name']) { |
|
| 180 | 180 | // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText |
| 181 | - $importer['name'] = translate( $importer['name'] ); |
|
| 181 | + $importer['name'] = translate($importer['name']); |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | return $popular_importers['importers']; |
@@ -187,44 +187,44 @@ discard block |
||
| 187 | 187 | return array( |
| 188 | 188 | // slug => name, description, plugin slug, and register_importer() slug. |
| 189 | 189 | 'blogger' => array( |
| 190 | - 'name' => __( 'Blogger' ), |
|
| 191 | - 'description' => __( 'Import posts, comments, and users from a Blogger blog.' ), |
|
| 190 | + 'name' => __('Blogger'), |
|
| 191 | + 'description' => __('Import posts, comments, and users from a Blogger blog.'), |
|
| 192 | 192 | 'plugin-slug' => 'blogger-importer', |
| 193 | 193 | 'importer-id' => 'blogger', |
| 194 | 194 | ), |
| 195 | 195 | 'wpcat2tag' => array( |
| 196 | - 'name' => __( 'Categories and Tags Converter' ), |
|
| 197 | - 'description' => __( 'Convert existing categories to tags or tags to categories, selectively.' ), |
|
| 196 | + 'name' => __('Categories and Tags Converter'), |
|
| 197 | + 'description' => __('Convert existing categories to tags or tags to categories, selectively.'), |
|
| 198 | 198 | 'plugin-slug' => 'wpcat2tag-importer', |
| 199 | 199 | 'importer-id' => 'wp-cat2tag', |
| 200 | 200 | ), |
| 201 | 201 | 'livejournal' => array( |
| 202 | - 'name' => __( 'LiveJournal' ), |
|
| 203 | - 'description' => __( 'Import posts from LiveJournal using their API.' ), |
|
| 202 | + 'name' => __('LiveJournal'), |
|
| 203 | + 'description' => __('Import posts from LiveJournal using their API.'), |
|
| 204 | 204 | 'plugin-slug' => 'livejournal-importer', |
| 205 | 205 | 'importer-id' => 'livejournal', |
| 206 | 206 | ), |
| 207 | 207 | 'movabletype' => array( |
| 208 | - 'name' => __( 'Movable Type and TypePad' ), |
|
| 209 | - 'description' => __( 'Import posts and comments from a Movable Type or TypePad blog.' ), |
|
| 208 | + 'name' => __('Movable Type and TypePad'), |
|
| 209 | + 'description' => __('Import posts and comments from a Movable Type or TypePad blog.'), |
|
| 210 | 210 | 'plugin-slug' => 'movabletype-importer', |
| 211 | 211 | 'importer-id' => 'mt', |
| 212 | 212 | ), |
| 213 | 213 | 'rss' => array( |
| 214 | - 'name' => __( 'RSS' ), |
|
| 215 | - 'description' => __( 'Import posts from an RSS feed.' ), |
|
| 214 | + 'name' => __('RSS'), |
|
| 215 | + 'description' => __('Import posts from an RSS feed.'), |
|
| 216 | 216 | 'plugin-slug' => 'rss-importer', |
| 217 | 217 | 'importer-id' => 'rss', |
| 218 | 218 | ), |
| 219 | 219 | 'tumblr' => array( |
| 220 | - 'name' => __( 'Tumblr' ), |
|
| 221 | - 'description' => __( 'Import posts & media from Tumblr using their API.' ), |
|
| 220 | + 'name' => __('Tumblr'), |
|
| 221 | + 'description' => __('Import posts & media from Tumblr using their API.'), |
|
| 222 | 222 | 'plugin-slug' => 'tumblr-importer', |
| 223 | 223 | 'importer-id' => 'tumblr', |
| 224 | 224 | ), |
| 225 | 225 | 'wordpress' => array( |
| 226 | 226 | 'name' => 'WordPress', |
| 227 | - 'description' => __( 'Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ), |
|
| 227 | + 'description' => __('Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.'), |
|
| 228 | 228 | 'plugin-slug' => 'wordpress-importer', |
| 229 | 229 | 'importer-id' => 'wordpress', |
| 230 | 230 | ), |