Changeset 2994
- Timestamp:
- 04/21/2016 07:41:53 PM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
r2982 r2994 31 31 32 32 add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) ); 33 add_action( 'save_post_plugin', array( $this, 'save_plugin_post' ) , 10, 2);33 add_action( 'save_post_plugin', array( $this, 'save_plugin_post' ) ); 34 34 35 35 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) ); … … 158 158 /** 159 159 * Filter the query in wp-admin to list only plugins relevant to the current user. 160 * 161 * @param \WP_Query $query 160 162 */ 161 163 public function pre_get_posts( $query ) { 162 global $wpdb;163 164 if ( ! $query->is_main_query() ) { 164 165 return; … … 186 187 * 187 188 * @ignore 189 * 190 * @param string $where WHERE clause. 191 * @return string 188 192 */ 189 193 public function pre_get_posts_sql_name_or_user( $where ) { … … 224 228 * @param array $post_states An array of post display states. 225 229 * @param \WP_Post $post The current post object. 230 * @return array 226 231 */ 227 232 public function post_states( $post_states, $post ) { … … 310 315 * 311 316 * @param int $post_id The post_id being updated. 312 * @param \WP_Post $post The WP_Post object being updated. 313 */ 314 public function save_plugin_post( $post_id, $post ) { 317 */ 318 public function save_plugin_post( $post_id ) { 315 319 // Save meta information 316 320 if ( isset( $_POST['tested_with'] ) && isset( $_POST['hidden_tested_with'] ) && $_POST['tested_with'] != $_POST['hidden_tested_with'] ) { … … 471 475 ); 472 476 473 if ( $comment_auto_approved ) {477 if ( $comment_auto_approved && isset( $parent ) ) { 474 478 $response['supplemental']['parent_approved'] = $parent->comment_ID; 475 479 $response['supplemental']['parent_post_id'] = $parent->comment_post_ID; -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-committers.php
r2777 r2994 84 84 'username' => __( 'Username', 'wporg-plugins' ), 85 85 ), 86 array(),87 86 array(), 88 87 'username', … … 123 122 <?php wp_nonce_field( 'add-committer', '_ajax_nonce', false ); ?> 124 123 <span id="committer-error" class="notice notice-alt notice-error" style="display:none;"></span> 125 <input type="text" name="add_committer" class="form-required" value="" aria-required="true"> 124 <label> 125 <input type="text" name="add_committer" class="form-required" value="" aria-required="true"> 126 <span class="screen-reader-text"><?php _e( 'Add a new committer', 'wporg-plugins' ); ?></span> 127 </label> 126 128 <input type="button" id="add-committer-submit" class="button" data-wp-lists="add:the-committer-list:add-committer::post_id=<?php echo get_post()->ID; ?>" value="<?php _e( 'Add Committer', 'wporg-plugins' ); ?>"> 127 129 </p> … … 144 146 } 145 147 $user_object->filter = 'display'; 146 list( $columns, $hidden, $ sortable, $primary ) = $this->get_column_info();148 list( $columns, $hidden, $primary ) = $this->get_column_info(); 147 149 148 150 // Set up the hover actions for this committer. -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php
r2991 r2994 8 8 9 9 /** 10 * Plugin API response about the current plugin displayed. 11 * 12 * @var object 13 */ 14 protected $plugin_meta; 15 16 /** 17 * 18 * @global array $avail_post_stati 19 * @global WP_Query $wp_query 20 * @global int $per_page 21 * @global string $mode 10 * 11 * @global array $avail_post_stati 12 * @global \WP_Query $wp_query 13 * @global int $per_page 14 * @global string $mode 22 15 */ 23 16 public function prepare_items() { … … 137 130 $classes[] = 'level-0'; 138 131 } 139 140 //@TODO: Switch to using the API class directly (once rewritten), or even better, post meta.141 require_once ABSPATH . '/wp-admin/includes/plugin-install.php';142 $this->plugin_meta = \plugins_api( 'plugin_information', array(143 'slug' => $post->post_name,144 ) );145 132 ?> 146 133 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>"> … … 172 159 */ 173 160 public function column_rating( $post ) { 174 if ( ! empty( $this->plugin_meta->rating ) && function_exists( 'wporg_get_dashicons_stars' ) ) { 175 echo wporg_get_dashicons_stars( $this->plugin_meta->rating / 20 ); 161 $rating = (string) get_post_meta( $post->ID, 'avg_rating', true ); 162 if ( ! empty( $rating ) && function_exists( 'wporg_get_dashicons_stars' ) ) { 163 echo wporg_get_dashicons_stars( $rating / 20 ); 176 164 } 177 165 } … … 306 294 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 307 295 * 'Delete Permanently', 'Preview', and 'View'. 308 * @param WP_Post $post The post object.296 * @param \WP_Post $post The post object. 309 297 */ 310 298 $actions = apply_filters( 'page_row_actions', $actions, $post ); … … 319 307 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 320 308 * 'Delete Permanently', 'Preview', and 'View'. 321 * @param WP_Post $post The post object.309 * @param \WP_Post $post The post object. 322 310 */ 323 311 $actions = apply_filters( 'post_row_actions', $actions, $post ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-committers.php
r2929 r2994 100 100 $response->add( array( 101 101 'what' => 'committer', 102 'data' => new \WP_Error( 'error', sprintf( __( 'The user %s does not exist.', 'wporg-plugins' ), '<code>' . $login . '</code>' ) ),102 'data' => new \WP_Error( 'error', __( 'The specified user does not exist.', 'wporg-plugins' ) ), 103 103 ) ); 104 104 $response->send(); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php
r2980 r2994 56 56 <div id="plugin-status-select" class="plugin-control-select hide-if-js"> 57 57 <input type="hidden" name="hidden_post_status" id="hidden-post-status" value="<?php echo esc_attr( $post->post_status ); ?>"> 58 <label class="screen-reader-text" for="plugin-status"><?php _e( 'Plugin status', 'wporg-plugins' ); ?></label> 58 59 <select name="post_status" id="plugin-status"> 59 60 <?php … … 96 97 <div id="tested-with-select" class="plugin-control-select hide-if-js"> 97 98 <input type="hidden" name="hidden_tested_with" id="hidden-tested-with" value="<?php echo esc_attr( $tested_up_to ); ?>"> 99 <label class="screen-reader-text" for="tested-with"><?php _e( 'Version of WordPress it was tested with', 'wporg-plugins' ); ?></label> 98 100 <select name="tested_with" id="tested-with"> 99 101 <?php -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-plugin-tags.php
r2655 r2994 8 8 */ 9 9 class Plugin_Tags { 10 11 10 /** 12 11 * Displays the Publish metabox for plugins. 13 12 * The HTML here matches what Core uses. 13 * 14 * @param \WP_Post $post 14 15 */ 15 static function display( $post, $box ) { 16 $taxonomy = get_taxonomy( 'plugin_tag' ); 16 static function display( $post ) { 17 17 ?> 18 18 <div id="taxonomy-plugin_tag" class="categorydiv"> 19 19 <div id="plugin_tag-all" class="tabs-panel"> 20 <?php 21 echo "<input type='hidden' name='tax_input[plugin_tag][]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 22 ?> 20 <?php // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. ?> 21 <input type='hidden' name='tax_input[plugin_tag][]' value='0' /> 23 22 <ul id="plugin_tagchecklist" data-wp-lists="list:plugin_tag" class="categorychecklist form-no-clear"> 24 23 <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => 'plugin_tag' ) ); ?> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/class-base.php
r2985 r2994 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory\API; 3 use WordPressdotorg\Plugin_Directory\Plugin_Directory; 3 4 4 5 /** -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-internal-stats.php
r2985 r2994 52 52 foreach ( $stats as $stat_name => $value ) { 53 53 if ( 'active_installs' == $stat_name ) { 54 $value = $this->sanitize_active_installs( $value , $plugin);54 $value = $this->sanitize_active_installs( $value ); 55 55 } elseif ( 'usage' == $stat_name ) { 56 56 $value = $this->sanitize_usage_numbers( $value, $plugin ); … … 101 101 * unless it's the latest branch, or if there's only one branch which is less than 5%. 102 102 * 103 * @param array $usage An array of the branch usage numbers.104 * @param WP_Post $plugin The plugin's WP_Post instance.103 * @param array $usage An array of the branch usage numbers. 104 * @param \WP_Post $plugin The plugin's WP_Post instance. 105 105 * @return array An array containing the percentages for the given plugin. 106 106 */ -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r2991 r2994 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory; 3 use WordPressdotorg\Plugin_Directory\Admin\Customizations; 3 4 4 5 /** … … 26 27 add_filter( 'the_content', array( $this, 'filter_post_content_to_correct_page' ), 1 ); 27 28 add_filter( 'rest_api_allowed_post_types', array( $this, 'filter_allowed_post_types' ) ); 28 add_filter( 'pre_update_option_jetpack_options', array( $this, 'filter_jetpack_options' ) , 10, 2);29 add_filter( 'pre_update_option_jetpack_options', array( $this, 'filter_jetpack_options' ) ); 29 30 30 31 add_filter( 'map_meta_cap', array( __NAMESPACE__ . '\Capabilities', 'map_meta_cap' ), 10, 4 ); … … 39 40 // Cannot be included on `admin_init` to allow access to menu hooks 40 41 if ( defined( 'WP_ADMIN' ) && WP_ADMIN ) { 41 Admin\Customizations::instance();42 Customizations::instance(); 42 43 43 44 add_action( 'transition_post_status', array( __NAMESPACE__ . '\Admin\Status_Transitions', 'instance' ) ); … … 200 201 * Setting up the site requires setting up the theme and proper 201 202 * rewrite permastructs. 202 *203 * @global \WP_Rewrite $wp_rewrite WordPress rewrite component.204 203 */ 205 204 public function activate() { 205 206 /** 207 * @var \WP_Rewrite $wp_rewrite WordPress rewrite component. 208 */ 206 209 global $wp_rewrite; 207 210 … … 220 223 } 221 224 222 // Enable the WordPress.org Plugin Repo Theme. 225 /** 226 * Enable the WordPress.org Plugin Repo Theme. 227 * 228 * @var \WP_Theme $theme 229 */ 223 230 foreach ( wp_get_themes() as $theme ) { 224 231 if ( $theme->get( 'Name' ) === 'WordPress.org Plugins' ) { … … 398 405 * 399 406 * @param mixed $new_value 400 * @param mixed $old_value401 407 * @return mixed 402 408 */ 403 public function filter_jetpack_options( $new_value , $old_value) {404 if ( is_array( $new_value) && array_key_exists( 'public', $new_value ) )409 public function filter_jetpack_options( $new_value ) { 410 if ( is_array( $new_value ) && array_key_exists( 'public', $new_value ) ) 405 411 $new_value['public'] = 1; 406 412 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-geopattern-svg.php
r2621 r2994 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory; 3 use RedeyeVentures\GeoPattern\SVG; 3 4 4 5 /** … … 7 8 * @package WordPressdotorg\Plugin_Directory 8 9 */ 9 class Plugin_Geopattern_SVG extends \RedeyeVentures\GeoPattern\SVG {10 class Plugin_Geopattern_SVG extends SVG { 10 11 11 12 /** -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-geopattern-svgtext.php
r2621 r2994 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory; 3 use RedeyeVentures\GeoPattern\SVGElements\Base; 3 4 4 5 /** … … 7 8 * @package WordPressdotorg\Plugin_Directory 8 9 */ 9 class Plugin_Geopattern_SVGText extends \RedeyeVentures\GeoPattern\SVGElements\Base {10 class Plugin_Geopattern_SVGText extends Base { 10 11 11 12 /** -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-geopattern.php
r2621 r2994 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory; 3 use RedeyeVentures\GeoPattern\GeoPattern; 3 4 4 5 require __DIR__ . '/libs/geopattern-1.1.0/geopattern_loader.php'; … … 9 10 * @package WordPressdotorg\Plugin_Directory 10 11 */ 11 class Plugin_Geopattern extends \RedeyeVentures\GeoPattern\GeoPattern {12 class Plugin_Geopattern extends GeoPattern { 12 13 13 14 /** -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-readme-parser.php
r2992 r2994 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory; 3 use Michelf\MarkdownExtra; 4 3 5 /** 4 6 * WordPress.org Plugin Readme Parser. … … 91 93 $line = $this->get_first_nonwhitespace( $contents ); 92 94 do { 93 $ key = $value = null;95 $value = null; 94 96 if ( strpos( $line, ':' ) === false ) { 95 97 // Some plugins have line-breaks within the headers. … … 258 260 while ( ( $line = array_shift( $contents ) ) !== null ) { 259 261 $trimmed = trim( $line ); 260 if ( ! empty( $ line) ) {262 if ( ! empty( $trimmed ) ) { 261 263 break; 262 264 } … … 343 345 344 346 /** 345 * Sanitize pro ided contributors to valid WordPress users347 * Sanitize provided contributors to valid WordPress users 346 348 * 347 349 * @param array $users Array of user_login's or user_nicename's. … … 370 372 } 371 373 if ( is_null( $markdown ) ) { 372 $markdown = new \Michelf\MarkdownExtra();374 $markdown = new MarkdownExtra(); 373 375 } 374 376 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r2991 r2994 16 16 $post = get_post( $post ); 17 17 18 return get_post_meta( $post->ID, 'active_installs', true );18 return (int) get_post_meta( $post->ID, 'active_installs', true ); 19 19 } 20 20 … … 149 149 * 150 150 * @param \WP_Post|string $plugin An instance of a Plugin post, or the plugin slug. 151 * @param string $output Output type. 'html' or 'raw'. Default: 'raw'. 151 152 * @return mixed 152 153 */ … … 218 219 * 219 220 * @param \WP_Post|string $plugin An instance of a Plugin post, or the plugin slug. 221 * @param string $output Output type. Default: 'raw'. 220 222 * @return mixed 221 223 */ -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r2969 r2994 43 43 * Process an import for a Plugin into the Plugin Directory. 44 44 * 45 * @throws \Exception 46 * 45 47 * @param string $plugin_slug The slug of the plugin to import. 46 * @return void.47 48 */ 48 49 public function import( $plugin_slug ) { … … 122 123 * - Handles readme.md & readme.txt prefering the latter. 123 124 * - Searches for Screenshots in /$stable/ and in /assets/ (listed remotely). 125 * 126 * @throws \Exception 124 127 * 125 128 * @param string $plugin_slug The slug of the plugin to parse. … … 249 252 return false; 250 253 } 251 252 254 } 253 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/plugin-directory.php
r2655 r2994 26 26 27 27 // Instantiate the Plugin Directory 28 include __DIR__ . '/class-plugin-directory.php';29 28 Plugin_Directory::instance(); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php
r2986 r2994 173 173 'tags' => $readme->tags, 174 174 'meta' => array( 175 'stable_tag' => $readme->stable_tag,176 175 'tested' => $readme->tested, 177 176 'requires' => $readme->requires, 177 'stable_tag' => $readme->stable_tag, 178 'upgrade_notice' => $readme->upgrade_notice, 179 'contributors' => $readme->contributors, 180 'screenshots' => $readme->screenshots, 178 181 'donate_link' => $readme->donate_link, 182 'sections' => array_keys( $readme->sections ), 179 183 'version' => $this->plugin['Version'], 184 'header_name' => $this->plugin['Name'], 180 185 'header_plugin_uri' => $this->plugin['PluginURI'], 181 186 'header_author' => $this->plugin['Author'], … … 183 188 'header_textdomain' => $this->plugin['TextDomain'], 184 189 'header_description' => $this->plugin['Description'], 185 'support_threads' => 0, 190 'assets_screenshots' => array(), 191 'assets_icons' => array(), 192 'assets_banners' => array(), 193 'assets_banners_color' => false, 194 'support_threads' => 0, 186 195 'support_threads_resolved' => 0, 187 196 ), -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/tools/class-filesystem.php
r2640 r2994 40 40 * Extract a ZIP file to a directory. 41 41 * 42 * @param string $zip_file The ZIP file to extract.43 * @param string $ temp_directory The Directory to extract the ZIP to. Optional. Default: A Temporary directory.42 * @param string $zip_file The ZIP file to extract. 43 * @param string $directory The Directory to extract the ZIP to. Optional. Default: A Temporary directory. 44 44 * 45 45 * @return string The directory the ZIP was extracted to. … … 103 103 * @param string $dir The directory to remove. 104 104 * 105 * @return bool Whether the directory was removed. .105 * @return bool Whether the directory was removed. 106 106 */ 107 107 public static function rmdir( $dir ) { 108 if ( !trim( $dir, '/' ) ) {109 return;108 if ( trim( $dir, '/' ) ) { 109 exec( 'rm -rf ' . escapeshellarg( $dir ) ); 110 110 } 111 exec( 'rm -rf ' . escapeshellarg( $dir ) );112 111 113 112 return is_dir( $dir ); 114 113 } 115 116 114 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/tools/class-svn.php
r2930 r2994 82 82 return $files; 83 83 } 84 85 return false;86 84 } 87 85
Note: See TracChangeset
for help on using the changeset viewer.