Changeset 6287 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
- Timestamp:
- 12/19/2017 04:22:37 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r6217 r6287 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory; 3 3 4 use WordPressdotorg\Plugin_Directory\Admin\Customizations; 4 5 use WordPressdotorg\Plugin_Directory\Admin\Tools\Author_Cards; … … 59 60 60 61 // Load the API routes. 61 add_action( 'rest_api_init', array( __NAMESPACE__ . '\API\Base', ' load_routes' ) );62 add_action( 'rest_api_init', array( __NAMESPACE__ . '\API\Base', 'init' ) ); 62 63 63 64 // Allow post_modified not to be modified when we don't specifically bump it. … … 65 66 66 67 // Work around caching issues 67 add_filter( 'pre_option_jetpack_sync_full__started' 68 add_filter( 'pre_option_jetpack_sync_full__started', array( $this, 'bypass_options_cache' ), 10, 2 ); 68 69 add_filter( 'default_option_jetpack_sync_full__started', '__return_null' ); 69 add_filter( 'pre_option_jetpack_sync_full__params' 70 add_filter( 'pre_option_jetpack_sync_full__params', array( $this, 'bypass_options_cache' ), 10, 2 ); 70 71 add_filter( 'default_option_jetpack_sync_full__params', '__return_null' ); 71 add_filter( 'pre_option_jetpack_sync_full__queue_finished' 72 add_filter( 'pre_option_jetpack_sync_full__queue_finished', array( $this, 'bypass_options_cache' ), 10, 2 ); 72 73 add_filter( 'default_option_jetpack_sync_full__queue_finished', '__return_null' ); 73 add_filter( 'pre_option_jetpack_sync_full__send_started' 74 add_filter( 'pre_option_jetpack_sync_full__send_started', array( $this, 'bypass_options_cache' ), 10, 2 ); 74 75 add_filter( 'default_option_jetpack_sync_full__send_started', '__return_null' ); 75 add_filter( 'pre_option_jetpack_sync_full__finished' 76 add_filter( 'pre_option_jetpack_sync_full__finished', array( $this, 'bypass_options_cache' ), 10, 2 ); 76 77 add_filter( 'default_option_jetpack_sync_full__finished', '__return_null' ); 77 78 … … 88 89 Stats_Report::instance(); 89 90 90 add_action( 'wp_insert_post_data', 91 add_action( 'wp_insert_post_data', array( __NAMESPACE__ . '\Admin\Status_Transitions', 'can_change_post_status' ), 10, 2 ); 91 92 add_action( 'transition_post_status', array( __NAMESPACE__ . '\Admin\Status_Transitions', 'instance' ) ); 92 93 } … … 124 125 register_post_type( 'plugin', array( 125 126 'labels' => array( 126 'name' => __( 'Repo Plugins', 127 'singular_name' => __( 'Repo Plugin', 128 'menu_name' => __( 'Repo Plugins', 129 'add_new' => __( 'Add New', 130 'add_new_item' => __( 'Add New Plugin', 131 'new_item' => __( 'New Plugin', 132 'view_item' => __( 'View Plugin', 133 'search_items' => __( 'Search Plugins', 134 'not_found' => __( 'No plugins found', 127 'name' => __( 'Repo Plugins', 'wporg-plugins' ), 128 'singular_name' => __( 'Repo Plugin', 'wporg-plugins' ), 129 'menu_name' => __( 'Repo Plugins', 'wporg-plugins' ), 130 'add_new' => __( 'Add New', 'wporg-plugins' ), 131 'add_new_item' => __( 'Add New Plugin', 'wporg-plugins' ), 132 'new_item' => __( 'New Plugin', 'wporg-plugins' ), 133 'view_item' => __( 'View Plugin', 'wporg-plugins' ), 134 'search_items' => __( 'Search Plugins', 'wporg-plugins' ), 135 'not_found' => __( 'No plugins found', 'wporg-plugins' ), 135 136 'not_found_in_trash' => __( 'No plugins found in Trash', 'wporg-plugins' ), 136 137 … … 138 139 'edit_item' => is_admin() ? __( 'Editing Plugin: %s', 'wporg-plugins' ) : __( 'Edit Plugin', 'wporg-plugins' ), 139 140 ), 140 'description' 141 'supports' 142 'public' 143 'show_ui' 144 'show_in_rest' 145 'has_archive' 146 'rewrite' 147 'menu_icon' 148 'capabilities' 141 'description' => __( 'A Repo Plugin', 'wporg-plugins' ), 142 'supports' => array( 'comments', 'author', 'custom-fields' ), 143 'public' => true, 144 'show_ui' => true, 145 'show_in_rest' => true, 146 'has_archive' => true, 147 'rewrite' => false, 148 'menu_icon' => 'dashicons-admin-plugins', 149 'capabilities' => array( 149 150 'edit_post' => 'plugin_edit', 150 151 'read_post' => 'read', … … 184 185 'labels' => array( 185 186 'name' => __( 'Plugin Categories', 'wporg-plugins' ), 186 'singular_name' => __( 'Plugin Category', 187 'edit_item' => __( 'Edit Category', 188 'update_item' => __( 'Update Category', 189 'add_new_item' => __( 'Add New Category', 187 'singular_name' => __( 'Plugin Category', 'wporg-plugins' ), 188 'edit_item' => __( 'Edit Category', 'wporg-plugins' ), 189 'update_item' => __( 'Update Category', 'wporg-plugins' ), 190 'add_new_item' => __( 'Add New Category', 'wporg-plugins' ), 190 191 'new_item_name' => __( 'New Category Name', 'wporg-plugins' ), 191 192 'search_items' => __( 'Search Categories', 'wporg-plugins' ), … … 237 238 'rewrite' => false, 238 239 'labels' => array( 239 'name' => __( 'Contributors', 'wporg-plugins' ),240 'name' => __( 'Contributors', 'wporg-plugins' ), 240 241 'singular_name' => __( 'Contributor', 'wporg-plugins' ), 241 242 ), … … 253 254 'rewrite' => false, 254 255 'labels' => array( 255 'name' => __( 'Committers', 'wporg-plugins' ),256 'name' => __( 'Committers', 'wporg-plugins' ), 256 257 'singular_name' => __( 'Committer', 'wporg-plugins' ), 257 258 ), … … 269 270 'rewrite' => false, 270 271 'labels' => array( 271 'name' => __( 'Support Reps', 'wporg-plugins' ),272 'name' => __( 'Support Reps', 'wporg-plugins' ), 272 273 'singular_name' => __( 'Support Rep', 'wporg-plugins' ), 273 274 ), … … 291 292 'labels' => array( 292 293 'name' => __( 'Plugin Tags', 'wporg-plugins' ), 293 'singular_name' => __( 'Plugin Tag', 294 'edit_item' => __( 'Edit Tag', 295 'update_item' => __( 'Update Tag', 296 'add_new_item' => __( 'Add New Tag', 294 'singular_name' => __( 'Plugin Tag', 'wporg-plugins' ), 295 'edit_item' => __( 'Edit Tag', 'wporg-plugins' ), 296 'update_item' => __( 'Update Tag', 'wporg-plugins' ), 297 'add_new_item' => __( 'Add New Tag', 'wporg-plugins' ), 297 298 'new_item_name' => __( 'New Tag Name', 'wporg-plugins' ), 298 299 'search_items' => __( 'Search Tags', 'wporg-plugins' ), … … 352 353 353 354 register_meta( 'post', 'rating', array( 354 'type' 355 'description' 356 'single' 355 'type' => 'number', 356 'description' => __( 'Overall rating of the plugin.', 'wporg-plugins' ), 357 'single' => true, 357 358 // todo 'sanitize_callback' => 'absint', 358 'show_in_rest' 359 'show_in_rest' => true, 359 360 ) ); 360 361 … … 376 377 377 378 register_meta( 'post', 'tested', array( 378 'description' 379 'single' 379 'description' => __( 'The version of WordPress the plugin was tested with.', 'wporg-plugins' ), 380 'single' => true, 380 381 // TODO 'sanitize_callback' => 'absint', 381 'show_in_rest' 382 'show_in_rest' => true, 382 383 ) ); 383 384 384 385 register_meta( 'post', 'requires', array( 385 'description' 386 'single' 386 'description' => __( 'The minimum version of WordPress the plugin needs to run.', 'wporg-plugins' ), 387 'single' => true, 387 388 // TODO 'sanitize_callback' => 'absint', 388 'show_in_rest' 389 'show_in_rest' => true, 389 390 ) ); 390 391 391 392 register_meta( 'post', 'requires_php', array( 392 'description' 393 'single' 393 'description' => __( 'The minimum version of PHP the plugin needs to run.', 'wporg-plugins' ), 394 'single' => true, 394 395 // TODO 'sanitize_callback' => 'absint', 395 'show_in_rest' 396 'show_in_rest' => true, 396 397 ) ); 397 398 398 399 register_meta( 'post', 'stable_tag', array( 399 'description' 400 'single' 400 'description' => __( 'Stable version of the plugin.', 'wporg-plugins' ), 401 'single' => true, 401 402 // TODO 'sanitize_callback' => 'absint', 402 'show_in_rest' 403 'show_in_rest' => true, 403 404 ) ); 404 405 … … 411 412 412 413 register_meta( 'post', 'version', array( 413 'description' 414 'single' 414 'description' => __( 'Current stable version.', 'wporg-plugins' ), 415 'single' => true, 415 416 // TODO 'sanitize_callback' => 'esc_url_raw', 416 'show_in_rest' 417 'show_in_rest' => true, 417 418 ) ); 418 419 419 420 register_meta( 'post', 'header_name', array( 420 'description' 421 'single' 421 'description' => __( 'Name of the plugin.', 'wporg-plugins' ), 422 'single' => true, 422 423 // TODO 'sanitize_callback' => 'esc_url_raw', 423 'show_in_rest' 424 'show_in_rest' => true, 424 425 ) ); 425 426 … … 432 433 433 434 register_meta( 'post', 'header_name', array( 434 'description' 435 'single' 435 'description' => __( 'Name of the plugin.', 'wporg-plugins' ), 436 'single' => true, 436 437 // TODO 'sanitize_callback' => 'esc_url_raw', 437 'show_in_rest' 438 'show_in_rest' => true, 438 439 ) ); 439 440 440 441 register_meta( 'post', 'header_author', array( 441 'description' 442 'single' 442 'description' => __( 'Name of the plugin author.', 'wporg-plugins' ), 443 'single' => true, 443 444 // TODO 'sanitize_callback' => 'esc_url_raw', 444 'show_in_rest' 445 'show_in_rest' => true, 445 446 ) ); 446 447 … … 453 454 454 455 register_meta( 'post', 'header_description', array( 455 'description' 456 'single' 456 'description' => __( 'Description of the plugin.', 'wporg-plugins' ), 457 'single' => true, 457 458 // TODO 'sanitize_callback' => 'esc_url_raw', 458 'show_in_rest' 459 'show_in_rest' => true, 459 460 ) ); 460 461 461 462 register_meta( 'post', 'assets_icons', array( 462 'type' 463 'description' 464 'single' 463 'type' => 'array', 464 'description' => __( 'Icon images of the plugin.', 'wporg-plugins' ), 465 'single' => true, 465 466 // TODO 'sanitize_callback' => 'esc_url_raw', 466 'show_in_rest' 467 'show_in_rest' => true, 467 468 ) ); 468 469 469 470 register_meta( 'post', 'assets_banners_color', array( 470 'description' 471 'single' 471 'description' => __( 'Fallback color for the plugin.', 'wporg-plugins' ), 472 'single' => true, 472 473 // TODO 'sanitize_callback' => 'esc_url_raw', 473 'show_in_rest' 474 'show_in_rest' => true, 474 475 ) ); 475 476 … … 510 511 511 512 // If changing capabilities around, uncomment this. 512 // Capabilities::add_roles();513 // Capabilities::add_roles(); 513 514 514 515 // Remove the /admin$ redirect to wp-admin … … 523 524 if ( class_exists( 'Jetpack' ) && \Jetpack::get_option( 'id' ) && ! class_exists( 'Jetpack_Search' ) 524 525 && ! isset( $_GET['s'] ) ) { // Don't run the ES query if we're going to redirect to the pretty search URL 525 require_once ( __DIR__ . '/libs/site-search/jetpack-search.php' );526 require_once __DIR__ . '/libs/site-search/jetpack-search.php'; 526 527 \Jetpack_Search::instance(); 527 528 } … … 532 533 */ 533 534 public function register_shortcodes() { 534 add_shortcode( 'wporg-plugins-developers', array( __NAMESPACE__ . '\Shortcodes\Developers','display' ) );535 add_shortcode( 'wporg-plugin-upload', array( __NAMESPACE__ . '\Shortcodes\Upload','display' ) );535 add_shortcode( 'wporg-plugins-developers', array( __NAMESPACE__ . '\Shortcodes\Developers', 'display' ) ); 536 add_shortcode( 'wporg-plugin-upload', array( __NAMESPACE__ . '\Shortcodes\Upload', 'display' ) ); 536 537 add_shortcode( 'wporg-plugins-screenshots', array( __NAMESPACE__ . '\Shortcodes\Screenshots', 'display' ) ); 537 add_shortcode( 'wporg-plugins-reviews', array( __NAMESPACE__ . '\Shortcodes\Reviews','display' ) );538 add_shortcode( 'readme-validator', array( __NAMESPACE__ . '\Shortcodes\Readme_Validator','display' ) );538 add_shortcode( 'wporg-plugins-reviews', array( __NAMESPACE__ . '\Shortcodes\Reviews', 'display' ) ); 539 add_shortcode( 'readme-validator', array( __NAMESPACE__ . '\Shortcodes\Readme_Validator', 'display' ) ); 539 540 } 540 541 … … 552 553 'wporg-plugins-screenshots', 553 554 'wporg-plugins-reviews', 554 'readme-validator' 555 'readme-validator', 555 556 ); 556 557 … … 568 569 */ 569 570 public function register_widgets() { 570 register_widget( __NAMESPACE__ . '\Widgets\Donate' 571 register_widget( __NAMESPACE__ . '\Widgets\Meta' 572 register_widget( __NAMESPACE__ . '\Widgets\Ratings' 573 register_widget( __NAMESPACE__ . '\Widgets\Support' 574 register_widget( __NAMESPACE__ . '\Widgets\Committers' 575 register_widget( __NAMESPACE__ . '\Widgets\Contributors' 576 register_widget( __NAMESPACE__ . '\Widgets\Support_Reps' 571 register_widget( __NAMESPACE__ . '\Widgets\Donate' ); 572 register_widget( __NAMESPACE__ . '\Widgets\Meta' ); 573 register_widget( __NAMESPACE__ . '\Widgets\Ratings' ); 574 register_widget( __NAMESPACE__ . '\Widgets\Support' ); 575 register_widget( __NAMESPACE__ . '\Widgets\Committers' ); 576 register_widget( __NAMESPACE__ . '\Widgets\Contributors' ); 577 register_widget( __NAMESPACE__ . '\Widgets\Support_Reps' ); 577 578 } 578 579 … … 669 670 /** 670 671 * Filter content to make links rel=nofollow on plugin pages only 671 * @param string $content The content. 672 * 673 * @param string $content The content. 672 674 * @return string 673 675 */ … … 675 677 if ( get_post_type() == 'plugin' ) { 676 678 // regex copied from wp_rel_nofollow(). Not calling that function because it messes with slashes. 677 $content = preg_replace_callback( '|<a (.+?)>|i', 'wp_rel_nofollow_callback', $content);679 $content = preg_replace_callback( '|<a (.+?)>|i', 'wp_rel_nofollow_callback', $content ); 678 680 } 679 681 return $content; … … 706 708 $wp_query->query_vars['order'] = 'DESC'; 707 709 break; 710 708 711 case 'favorites': 709 712 $favorites_user = wp_get_current_user(); … … 723 726 724 727 $wp_query->query_vars['orderby'] = 'post_title'; 725 $wp_query->query_vars['order'] = 'ASC';728 $wp_query->query_vars['order'] = 'ASC'; 726 729 } 727 730 … … 766 769 array( 767 770 'taxonomy' => 'plugin_contributors', 768 'field' => 'slug',769 'terms' => $user770 ) 771 'field' => 'slug', 772 'terms' => $user, 773 ), 771 774 ); 772 775 … … 776 779 $wp_query->query_vars['tax_query'][] = array( 777 780 'taxonomy' => 'plugin_committers', 778 'field' => 'slug',779 'terms' => $user781 'field' => 'slug', 782 'terms' => $user, 780 783 ); 781 784 } 782 785 783 786 $wp_query->query_vars['orderby'] = 'post_title'; 784 $wp_query->query_vars['order'] = 'ASC';787 $wp_query->query_vars['order'] = 'ASC'; 785 788 786 789 // Treat it as a taxonomy query now, not the author archive. 787 790 $wp_query->is_author = false; 788 $wp_query->is_tax = true;791 $wp_query->is_tax = true; 789 792 790 793 unset( $wp_query->query_vars['author_name'], $wp_query->query_vars['author'] ); … … 796 799 $wp_query->query_vars['post_status'] = array( 'approved', 'publish', 'closed', 'disabled' ); 797 800 798 add_filter( 'posts_results', function( $posts, $this_wp_query ) use ( $wp_query ) {801 add_filter( 'posts_results', function( $posts, $this_wp_query ) use ( $wp_query ) { 799 802 if ( $this_wp_query != $wp_query ) { 800 803 return $posts; … … 825 828 // Allow anyone to view a closed plugin directly from its page. It won't show in search results or lists. 826 829 if ( $wp_query->is_main_query() && ! empty( $wp_query->query_vars['name'] ) ) { 827 $wp_query->query_vars['post_status'] = (array) $wp_query->query_vars['post_status'];830 $wp_query->query_vars['post_status'] = (array) $wp_query->query_vars['post_status']; 828 831 $wp_query->query_vars['post_status'][] = 'closed'; 829 832 $wp_query->query_vars['post_status'][] = 'disabled'; 830 $wp_query->query_vars['post_status'] = array_unique( $wp_query->query_vars['post_status'] );833 $wp_query->query_vars['post_status'] = array_unique( $wp_query->query_vars['post_status'] ); 831 834 } 832 835 … … 856 859 public function bypass_options_cache( $value, $option ) { 857 860 global $wpdb; 858 $value = $wpdb->get_var( 859 $wpdb->prepare( 860 "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", 861 $option 862 ) 863 ); 861 $value = $wpdb->get_var( $wpdb->prepare( 862 "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", 863 $option 864 ) ); 864 865 $value = maybe_unserialize( $value ); 865 866 … … 874 875 public function fix_login_url( $login_url, $redirect, $force_reauth ) { 875 876 // modify the redirect_to for the support forums to point to the current page 876 if ( 0 === strpos( $_SERVER['REQUEST_URI'], '/plugins' ) ) {877 if ( 0 === strpos( $_SERVER['REQUEST_URI'], '/plugins' ) ) { 877 878 // Note that this is not normal because of the code in /mu-plugins/wporg-sso/class-wporg-sso.php. 878 879 // The login_url function there expects the redirect_to as the first parameter passed into it instead of the second … … 884 885 // parse_url is used here to remove any additional query args from the REQUEST_URI before redirection 885 886 // The SSO code handles the urlencoding of the redirect_to parameter 886 $url_parts = parse_url('https://wordpress.org'.$_SERVER['REQUEST_URI']);887 $constructed_url = $url_parts['scheme'] . '://' . $url_parts['host'] . ( isset($url_parts['path'])?$url_parts['path']:'');888 $login_url = $constructed_url;887 $url_parts = parse_url( 'https://wordpress.org' . $_SERVER['REQUEST_URI'] ); 888 $constructed_url = $url_parts['scheme'] . '://' . $url_parts['host'] . ( isset( $url_parts['path'] ) ? $url_parts['path'] : '' ); 889 $login_url = $constructed_url; 889 890 } 890 891 return $login_url; … … 940 941 * @global string $locale Current locale. 941 942 * 942 * @param int $post_idPost ID to update.943 * @param int $min_translatedTranslations below this % threshold will not be synced to meta, to save space.943 * @param int $post_id Post ID to update. 944 * @param int $min_translated Translations below this % threshold will not be synced to meta, to save space. 944 945 * @return array 945 946 */ 946 public function sync_all_translations_to_meta( $post_id, $min_translated = 40, $skip_pfx = array( 'en_') ) {947 public function sync_all_translations_to_meta( $post_id, $min_translated = 40, $skip_pfx = array( 'en_' ) ) { 947 948 948 949 $locales_to_sync = array(); 949 $post = get_post( $post_id );950 $post = get_post( $post_id ); 950 951 if ( $post ) { 951 952 $translations = Plugin_I18n::instance()->find_all_translations_for_plugin( $post->post_name, 'stable-readme', $min_translated ); // at least $min_translated % translated … … 953 954 // Eliminate translations that start with unwanted prefixes, so we don't waste space on near-duplicates like en_AU, en_CA etc. 954 955 foreach ( $translations as $i => $_locale ) { 955 foreach ( $skip_pfx as $pfx ) 956 if ( substr( $_locale, 0, strlen( $pfx ) ) === $pfx ) 956 foreach ( $skip_pfx as $pfx ) { 957 if ( substr( $_locale, 0, strlen( $pfx ) ) === $pfx ) { 957 958 unset( $translations[ $i ] ); 959 } 960 } 958 961 } 959 962 $locales_to_sync = array_unique( $translations ); … … 961 964 } 962 965 963 if ( count( $locales_to_sync) > 0 ) {966 if ( count( $locales_to_sync ) > 0 ) { 964 967 foreach ( $locales_to_sync as $locale ) { 965 968 $this->sync_translation_to_meta( $post_id, $locale ); … … 975 978 * @global string $locale Current locale. 976 979 * 977 * @param int $post_idPost ID to update.978 * @param string $localeLocale to translate.980 * @param int $post_id Post ID to update. 981 * @param string $locale Locale to translate. 979 982 */ 980 983 public function sync_translation_to_meta( $post_id, $_locale ) { … … 983 986 $old_locale = $locale; 984 987 // Keep track of the original untranslated strings 985 $orig_title = get_the_title( $post_id );988 $orig_title = get_the_title( $post_id ); 986 989 $orig_excerpt = get_the_excerpt( $post_id ); 987 990 $orig_content = get_post_field( 'post_content', $post_id ); 988 $locale = $_locale;991 $locale = $_locale; 989 992 990 993 // Update postmeta values for the translated title, excerpt, and content, if they are available and different from the originals. 991 994 // There is a bug here, in that no attempt is made to remove old meta values for translations that do not have new translations. 992 993 995 $the_title = Plugin_I18n::instance()->translate( 'title', $orig_title, [ 'post_id' => $post_id ] ); 994 996 if ( $the_title && $the_title != $orig_title ) { … … 1003 1005 // Split up the content to translate it in sections. 1004 1006 $the_content = array(); 1005 $sections = $this->split_post_content_into_pages( $orig_content );1007 $sections = $this->split_post_content_into_pages( $orig_content ); 1006 1008 foreach ( $sections as $section => $section_content ) { 1007 1009 $translated_section = $this->translate_post_content( $section_content, $section, $post_id ); … … 1012 1014 } 1013 1015 1014 if ( ! empty( $the_content ) ) {1016 if ( ! empty( $the_content ) ) { 1015 1017 update_post_meta( $post_id, 'content_' . $locale, implode( $the_content ) ); 1016 1018 } … … 1109 1111 1110 1112 if ( 'tags' === $path[2] ) { 1111 if ( isset( $path[3] ) && ! empty( $path[3] ) ) {1113 if ( isset( $path[3] ) && ! empty( $path[3] ) ) { 1112 1114 wp_safe_redirect( home_url( '/search/' . urlencode( $path[3] ) . '/' ) ); 1113 1115 die(); … … 1145 1147 } 1146 1148 1147 // Otherwise, let's redirect to the search page1148 if ( isset( $path[2] ) && ! empty( $path[2] ) ) {1149 // Otherwise, let's redirect to the search page 1150 if ( isset( $path[2] ) && ! empty( $path[2] ) ) { 1149 1151 wp_safe_redirect( home_url( '/search/' . urlencode( $path[2] ) . '/' ) ); 1150 1152 die(); … … 1205 1207 */ 1206 1208 public function split_post_content_into_pages( $content ) { 1207 $_pages = preg_split( "#<!--section=(.+?)-->#", $content, - 1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );1209 $_pages = preg_split( '#<!--section=(.+?)-->#', $content, - 1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); 1208 1210 $content_pages = array( 1209 1211 'screenshots' => '[wporg-plugins-screenshots]', … … 1318 1320 public static function create_plugin_post( array $args ) { 1319 1321 $title = $args['post_title'] ?: $args['post_name']; 1320 $slug = $args['post_name'] 1322 $slug = $args['post_name'] ?: sanitize_title( $title ); 1321 1323 1322 1324 $args = wp_parse_args( $args, array(
Note: See TracChangeset
for help on using the changeset viewer.