Ticket #2131: 2131-2.diff
File 2131-2.diff, 29.9 KB (added by , 7 years ago) |
---|
-
wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php
diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php index 82994b5..fe04b4c 100644
a b https://make.wordpress.org/plugins', 'wporg-plugins' ), 263 263 */ 264 264 private function get_plugin_root( $dir ) { 265 265 $plugin_root = ''; 266 $plugin_files = Filesystem::list_files( $dir, true /* Recursive */, '!\.php$!i' , 1 /* Depth */);266 $plugin_files = Filesystem::list_files( $dir, true /* Recursive */, '!\.php$!i' ); 267 267 268 268 foreach ( $plugin_files as $plugin_file ) { 269 269 -
wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php
diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php index 8f83e71..c04cc3c 100644
a b 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory\Admin\Metabox; 3 use WordPressdotorg\Plugin_Directory\Tools;4 3 5 4 /** 6 5 * The Plugin Review metabox. … … class Review_Tools { 46 45 add_filter( 'wp_comment_reply', function( $string ) use ( $post ) { 47 46 $author = get_user_by( 'id', $post->post_author ); 48 47 49 $committers = Tools::get_plugin_committers( $post->post_name );50 $committers = array_map( function ( $user_login ) {51 return get_user_by( 'login', $user_login );52 }, $committers );53 54 $cc_emails = wp_list_pluck( $committers, 'user_email' );55 $cc_emails = implode( ', ', array_diff( $cc_emails, array( $author->user_email ) ) );56 57 48 if ( 'new' === $post->post_status || 'pending' === $post->post_status ) { 58 49 /* translators: %s: plugin title */ 59 50 $subject = sprintf( __( '[WordPress Plugin Directory] Request: %s', 'wporg-plugins' ), $post->post_title ); … … class Review_Tools { 69 60 <form id="contact-author" class="contact-author" method="POST" action="https://supportpress.wordpress.org/plugins/thread-new.php"> 70 61 <input type="hidden" name="to_email" value="<?php echo esc_attr( $author->user_email ); ?>" /> 71 62 <input type="hidden" name="to_name" value="<?php echo esc_attr( $author->display_name ); ?>" /> 72 <input type="hidden" name="cc" value="<?php echo esc_attr( $cc_emails ); ?>" />73 63 <input type="hidden" name="subject" value="<?php echo esc_attr( $subject ); ?>" /> 74 64 <button class="button button-primary" type="submit"><?php _e( 'Contact plugin author', 'wporg-plugins' ); ?></button> 75 65 </form> -
wordpress.org/public_html/wp-content/plugins/plugin-directory/bin/rebuild-zip.php
diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/bin/rebuild-zip.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/bin/rebuild-zip.php index b6dbe27..4d870ca 100644
a b 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory; 3 use WordPressdotorg\Plugin_Directory\Plugin_Directory;4 3 use WordPressdotorg\Plugin_Directory\Tools\SVN; 5 4 6 5 // This script should only be called in a CLI environment. … … echo "Rebuilding ZIPs for $plugin_slug... "; 86 85 try { 87 86 $zip_builder = new ZIP\Builder(); 88 87 89 $plugin_post = Plugin_Directory::get_plugin_post( $plugin_slug );90 if ( ! $plugin_post ) {91 throw new Exception( "Could not locate plugin post" );92 }93 $stable_tag = get_post_meta( $plugin_post->ID, 'stable_tag', true ) ?? 'trunk';94 95 88 // (re)Build & Commit 5 Zips at a time to avoid limitations. 96 89 foreach ( array_chunk( $versions, 5 ) as $versions_to_build ) { 97 90 $zip_builder->build( 98 91 $plugin_slug, 99 92 $versions_to_build, 100 "{$plugin_slug}: Rebuild triggered by " . php_uname('n' ), 101 $stable_tag 93 "{$plugin_slug}: Rebuild triggered by " . php_uname('n' ) 102 94 ); 103 95 } 104 96 -
wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php index 5cb0057..a85e407 100644
a b class Template { 132 132 } 133 133 134 134 /** 135 * Returns a string representing the number of active install ations for an item.135 * Returns a string representing the number of active installs for an item. 136 136 * 137 137 * @static 138 138 * 139 * @param bool $full Optional. Whether to include "active install ations" suffix. Default: true.139 * @param bool $full Optional. Whether to include "active installs" suffix. Default: true. 140 140 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 141 * @return string "1+ million" or "1+ million active install ations" depending on $full.141 * @return string "1+ million" or "1+ million active installs" depending on $full. 142 142 */ 143 143 public static function active_installs( $full = true, $post = null ) { 144 144 $post = get_post( $post ); … … class Template { 154 154 $text = number_format_i18n( $count ) . '+'; 155 155 } 156 156 157 return $full ? sprintf( __( '%s active install ations', 'wporg-plugins' ), $text ) : $text;157 return $full ? sprintf( __( '%s active installs', 'wporg-plugins' ), $text ) : $text; 158 158 } 159 159 160 160 /** -
wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php index baceda1..5780013 100644
a b class Import { 195 195 array_unique( $versions_to_build ), 196 196 $svn_revision_triggered ? 197 197 "{$plugin_slug}: ZIP build triggered by https://plugins.trac.wordpress.org/changeset/{$svn_revision_triggered}" : 198 "{$plugin_slug}: ZIP build triggered by " . php_uname('n'), 199 $stable_tag 198 "{$plugin_slug}: ZIP build triggered by " . php_uname('n') 200 199 ); 201 200 } catch( Exception $e ) { 202 201 return false; -
wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php
diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php index 651300c..e0a22c5 100644
a b class Upload_Handler { 60 60 $zip_file = $_FILES['zip_file']['tmp_name']; 61 61 $this->plugin_dir = Filesystem::unzip( $zip_file ); 62 62 63 $plugin_files = Filesystem::list_files( $this->plugin_dir, true /* Recursive */, '!\.php$!i' , 1 /* Depth */);63 $plugin_files = Filesystem::list_files( $this->plugin_dir, true /* Recursive */, '!\.php$!i' ); 64 64 foreach ( $plugin_files as $plugin_file ) { 65 65 $plugin_data = get_plugin_data( $plugin_file, false, false ); // No markup/translation needed. 66 66 if ( ! empty( $plugin_data['Name'] ) ) { -
wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php
diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php index 8f28042..e4c1f15 100644
a b class Upload { 30 30 if ( is_user_logged_in() ) : 31 31 include_once ABSPATH . 'wp-admin/includes/template.php'; 32 32 33 $submitted_plugins = self::get_submitted_plugins();34 $submitted_counts = (object) array_fill_keys( array( 'new', 'pending' ), 0 );35 36 $submitted_counts->total = count( $submitted_plugins );37 38 foreach ( $submitted_plugins as $key => $plugin ) {39 if ( 'new' === $plugin->post_status ) {40 $submitted_plugins[ $key ]->status = __( 'Awaiting Review', 'wporg-plugins' );41 $submitted_counts->new++;42 } elseif ( 'pending' === $plugin->post_status ) {43 $submitted_plugins[ $key ]->status = __( 'Being Reviewed', 'wporg-plugins' );44 $submitted_counts->pending++;45 }46 }47 48 33 if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wporg-plugins-upload' ) && 'upload' === $_POST['action'] ) : 49 34 if ( UPLOAD_ERR_OK === $_FILES['zip_file']['error'] ) : 50 35 $uploader = new Upload_Handler; … … class Upload { 80 65 ?></p> 81 66 </div> 82 67 83 <?php if ( $submitted_counts->total ) : ?> 68 <?php 69 $submitted_plugins = self::get_submitted_plugins(); 70 $submitted_counts = (object) array_fill_keys( array( 'new', 'pending' ), 0 ); 71 72 foreach ( $submitted_plugins as $key => $plugin ) { 73 if ( 'new' === $plugin->post_status ) { 74 $submitted_plugins[ $key ]->status = __( 'Awaiting Review', 'wporg-plugins' ); 75 $submitted_counts->new++; 76 } elseif ( 'pending' === $plugin->post_status ) { 77 $submitted_plugins[ $key ]->status = __( 'Being Reviewed', 'wporg-plugins' ); 78 $submitted_counts->pending++; 79 } 80 } 81 ?> 82 83 <?php if ( $submitted_counts->new + $submitted_counts->pending ) : ?> 84 84 85 85 <div class="plugin-queue-message notice notice-warning notice-alt"> 86 86 <p><?php 87 if ( 1 === $submitted_counts->total) {88 _e( 'You already have a plugin in the review queue. Please wait for it to be approved before submitting any more.', 'wporg-plugins' );87 if ( 1 === ( $submitted_counts->new + $submitted_counts->pending ) ) { 88 _e( 'You have 1 plugin in the review queue.', 'wporg-plugins' ); 89 89 } else { 90 90 printf( 91 91 _n( 92 'You have %1$s plugins in the review queue, %2$s is being actively reviewed. Please wait for them to be approved before submitting any more.',93 'You have %1$s plugins in the review queue, %2$s are being actively reviewed. Please wait for them to be approved before submitting any more.',92 'You have %1$s plugins in the review queue, %2$s is being actively reviewed.', 93 'You have %1$s plugins in the review queue, %2$s are being actively reviewed.', 94 94 $submitted_counts->pending, 95 95 'wporg-plugins' 96 96 ), 97 '<strong>' . $submitted_counts->total. '</strong>',97 '<strong>' . ( $submitted_counts->new + $submitted_counts->pending ) . '</strong>', 98 98 '<strong>' . $submitted_counts->pending . '</strong>' 99 99 ); 100 100 } … … class Upload { 114 114 ?></p> 115 115 </div> 116 116 117 <?php endif; // $submitted_counts->total ?> 118 119 <?php endif; // wp_verify_nonce() && 'upload' === $_POST['action'] ?> 120 121 <?php if ( ! $submitted_counts->total ) : ?> 122 123 <form id="upload_form" class="plugin-upload-form" enctype="multipart/form-data" method="POST" action=""> 124 <?php wp_nonce_field( 'wporg-plugins-upload' ); ?> 125 <input type="hidden" name="action" value="upload"/> 126 <?php /* <fieldset> 127 <legend><?php _e( 'Select categories (up to 3)', 'wporg-plugins' ); ?></legend> 128 <ul class="category-checklist"> 129 <?php wp_terms_checklist( 0, array( 'taxonomy' => 'plugin_category' ) ); ?> 130 </ul> 131 </fieldset> */ ?> 132 133 <input type="file" id="zip_file" class="plugin-file" name="zip_file" size="25" accept=".zip"/> 134 <label class="button button-secondary" for="zip_file"><?php _e( 'Select File', 'wporg-plugins' ); ?></label> 135 136 <input id="upload_button" class="button button-primary" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-plugins' ); ?>"/> 137 138 <p> 139 <small><?php printf( __( 'Maximum allowed file size: %s', 'wporg-plugins' ), esc_html( self::get_max_allowed_file_size() ) ); ?></small> 140 </p> 141 </form> 142 <script> 143 ( function ( $ ) { 144 var $label = $( 'label.button' ), 145 labelText = $label.text(); 146 147 $( '#zip_file' ) 148 .on( 'change', function( event ) { 149 var fileName = event.target.value.split( '\\' ).pop(); 150 151 fileName ? $label.text( fileName ) : $label.text( labelText ); 152 } ) 153 .on( 'focus', function() { $label.addClass( 'focus' ); } ) 154 .on( 'blur', function() { $label.removeClass( 'focus' ); } ); 155 } ( window.jQuery ) ); 156 </script> 157 158 <?php endif; // ! $submitted_counts->total ?> 117 <?php endif; ?> 118 119 <?php endif; ?> 120 121 <form id="upload_form" class="plugin-upload-form" enctype="multipart/form-data" method="POST" action=""> 122 <?php wp_nonce_field( 'wporg-plugins-upload' ); ?> 123 <input type="hidden" name="action" value="upload"/> 124 <?php /* <fieldset> 125 <legend><?php _e( 'Select categories (up to 3)', 'wporg-plugins' ); ?></legend> 126 <ul class="category-checklist"> 127 <?php wp_terms_checklist( 0, array( 'taxonomy' => 'plugin_category' ) ); ?> 128 </ul> 129 </fieldset> */ ?> 130 131 <input type="file" id="zip_file" class="plugin-file" name="zip_file" size="25" accept=".zip"/> 132 <label class="button button-secondary" for="zip_file"><?php _e( 'Select File', 'wporg-plugins' ); ?></label> 133 134 <input id="upload_button" class="button button-primary" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-plugins' ); ?>"/> 135 136 <p> 137 <small><?php printf( __( 'Maximum allowed file size: %s', 'wporg-plugins' ), esc_html( self::get_max_allowed_file_size() ) ); ?></small> 138 </p> 139 </form> 140 <script> 141 ( function ( $ ) { 142 var $label = $( 'label.button' ), 143 labelText = $label.text(); 144 145 $( '#zip_file' ) 146 .on( 'change', function( event ) { 147 var fileName = event.target.value.split( '\\' ).pop(); 148 149 fileName ? $label.text( fileName ) : $label.text( labelText ); 150 } ) 151 .on( 'focus', function() { $label.addClass( 'focus' ); } ) 152 .on( 'blur', function() { $label.removeClass( 'focus' ); } ); 153 } ( window.jQuery ) ); 154 </script> 159 155 160 156 <?php else : ?> 161 157 162 <p><?php printf( __( 'Before you can upload a new plugin, <a href="%s">please log in</a>.', 'wporg-plugins' ), esc_url( wp_login_url()) ); ?></p>158 <p><?php printf( __( 'Before you can upload a new plugin, <a href="%s">please log in</a>.', 'wporg-plugins' ), esc_url( 'https://login.wordpress.org/' ) ); ?></p> 163 159 164 <?php endif; // is_user_logged_in()160 <?php endif; 165 161 166 162 return ob_get_clean(); 167 163 } -
wordpress.org/public_html/wp-content/plugins/plugin-directory/tools/class-filesystem.php
diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/tools/class-filesystem.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/tools/class-filesystem.php index 533b116..7a2bfa5 100644
a b class Filesystem { 80 80 * @param string $directory Path to directory to search. 81 81 * @param bool $recursive Optional. Whether to recurse into subdirectories. Default: false. 82 82 * @param string $pattern Optional. A regular expression to match files against. Default: null. 83 * @param int $depth Optional. Recursion depth. Default: -1 (infinite).84 83 * @return array All files within the passed directory. 85 84 */ 86 public static function list_files( $directory, $recursive = false, $pattern = null , $depth = -1) {85 public static function list_files( $directory, $recursive = false, $pattern = null ) { 87 86 if ( $recursive ) { 88 87 $iterator = new \RecursiveIteratorIterator( 89 88 new \RecursiveDirectoryIterator( $directory ), 90 89 \RecursiveIteratorIterator::SELF_FIRST 91 90 ); 92 93 if ( $depth > -1 ) {94 $iterator->setMaxDepth( $depth );95 }96 91 } else { 97 92 $iterator = new \DirectoryIterator( $directory ); 98 93 } -
wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-meta.php
diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-meta.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-meta.php index 1777c36..c522aa8 100644
a b class Meta extends \WP_Widget { 48 48 ); 49 49 ?> 50 50 </li> 51 <li><?php printf( __( 'Active install ations: %s', 'wporg-plugins' ), '<strong>' . Template::active_installs( false ) . '</strong>' ); ?></li>51 <li><?php printf( __( 'Active installs: %s', 'wporg-plugins' ), '<strong>' . Template::active_installs( false ) . '</strong>' ); ?></li> 52 52 53 53 <?php if ( $requires = (string) get_post_meta( $post->ID, 'requires', true ) ) : ?> 54 54 <li><?php -
wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-builder.php
diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-builder.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-builder.php index d2fc925..c485d2e 100644
a b class Builder { 14 14 const SVN_URL = 'http://plugins.svn.wordpress.org'; 15 15 const ZIP_SVN_URL = PLUGIN_ZIP_SVN_URL; 16 16 17 protected $zip_file = ''; 18 protected $checksum_file = ''; 19 protected $tmp_build_dir = ''; 20 protected $tmp_dir = ''; 17 protected $zip_file = ''; 18 protected $tmp_build_dir = ''; 19 protected $tmp_dir = ''; 21 20 22 protected $slug = ''; 23 protected $version = ''; 24 protected $context = ''; 25 protected $stable_tag = ''; 21 protected $slug = ''; 22 protected $version = ''; 23 protected $context = ''; 26 24 27 25 /** 28 * Generate a ZIP for a provided Plugin tags.26 * Generate a ZIP for a provided Plugin versions. 29 27 * 30 28 * @param string $slug The plugin slug. 31 29 * @param array $versions The versions of the plugin to build ZIPs for. 32 30 * @param string $context The context of this Builder instance (commit #, etc) 33 31 */ 34 public function build( $slug, $versions, $context = '' , $stable_tag = '') {32 public function build( $slug, $versions, $context = '' ) { 35 33 // Bail when in an unconfigured environment. 36 34 if ( ! defined( 'PLUGIN_ZIP_SVN_URL' ) ) { 37 35 return false; 38 36 } 39 37 40 $this->slug = $slug; 41 $this->versions = $versions; 42 $this->context = $context; 43 $this->stable_tag = $stable_tag; 38 $this->slug = $slug; 39 $this->versions = $versions; 40 $this->context = $context; 44 41 45 42 // General TMP directory 46 43 if ( ! is_dir( self::TMP_DIR ) ) { … … class Builder { 99 96 100 97 // Pull the ZIP file down we're going to modify, which may not already exist. 101 98 SVN::up( $this->zip_file ); 102 // This is done within the checksum generation function due to us not knowing the checksum filename until export_plugin().103 // SVN::up( $this->checksum_file );104 99 105 100 try { 106 101 … … class Builder { 108 103 mkdir( $this->tmp_build_dir, 0777, true ); 109 104 110 105 $this->export_plugin(); 111 $this->fix_directory_dates(); 112 106 $this->fix_directory_dates(); 113 107 $this->generate_zip(); 114 115 $this->generate_checksums();116 117 108 $this->cleanup_plugin_tmp(); 118 109 119 110 } catch( Exception $e ) { … … class Builder { 122 113 123 114 // Perform an SVN up to revert any changes made. 124 115 SVN::up( $this->zip_file ); 125 if ( $this->checksum_file ) {126 SVN::up( $this->checksum_file );127 }128 116 continue; 129 117 } 130 118 131 119 // Add the ZIP file to SVN - This is only really needed for new files which don't exist in SVN. 132 SVN::add( $this->zip_file ); 133 if ( $this->checksum_file ) { 134 SVN::add( $this->checksum_file ); 135 } 120 SVN::add( $this->zip_file ); 136 121 } 137 122 138 123 $res = SVN::commit( … … class Builder { 160 145 } 161 146 162 147 /** 163 * Generates a JSON file containing the checksums of the files within the ZIP.164 *165 * In the event that a previous ZIP for this version exists, checksums for all versions of the file will be included.166 */167 function generate_checksums() {168 // Only enable this for the `exploit-scanner` plugin for the time being.169 if ( 'exploit-scanner' != $this->slug ) {170 return;171 }172 173 // Don't create checksums for trunk.174 if ( ! $this->stable_tag || ( 'trunk' == $this->version && 'trunk' != $this->stable_tag && '' != $this->stable_tag ) ) {175 return;176 }177 178 // Fetch the plugin headers179 $plugin_data = false;180 foreach ( glob( $this->tmp_build_dir . '/' . $this->slug . '/*.php' ) as $filename ) {181 $plugin_data = get_plugin_data( $filename, false, false );182 183 if ( $plugin_data['Name'] && '' !== $plugin_data['Version'] ) {184 break;185 }186 }187 188 if ( ! $plugin_data || '' === $plugin_data['Version'] ) {189 return;190 }191 192 $plugin_version = $plugin_data['Version'];193 // Catch malformed version strings.194 if ( basename( $plugin_version ) != $plugin_version ) {195 return;196 }197 198 $this->checksum_file = "{$this->tmp_dir}/{$this->slug}/{$this->slug}.{$plugin_version}.checksums.json";199 200 // Checkout the Checksum file for this plugin version201 SVN::up( $this->checksum_file );202 203 // Existing checksums?204 $existing_json_checksum_file = file_exists( $this->checksum_file );205 206 $this->exec( sprintf(207 'cd %s && find . -type f -print0 | sort -z | xargs -0 md5sum 2>&1',208 escapeshellarg( $this->tmp_build_dir . '/' . $this->slug )209 ), $checksum_output, $return_value );210 211 if ( $return_value ) {212 // throw new Exception( __METHOD__ . ': Checksum generation failed, return code: ' . $return_value, 503 );213 // For now, just silently bail.214 return;215 }216 217 $checksums = array();218 foreach ( $checksum_output as $line ) {219 list( $md5, $filename ) = preg_split( '!\s+!', $line );220 $filename = preg_replace( '!^./!', '', $filename );221 $checksums[ trim( $filename ) ] = trim( $md5 );222 }223 224 $json_checksum_file = (object) array(225 'plugin' => $this->slug,226 'version' => $plugin_version,227 'source_tag' => $this->version,228 'zip' => basename( $this->zip_file ),229 'checksums' => $checksums230 );231 232 // If the checksum file exists already, merge it into this one.233 if ( $existing_json_checksum_file ) {234 $existing_json_checksum_file = json_decode( file_get_contents( $this->checksum_file ) );235 236 if ( $existing_json_checksum_file && ! empty( $existing_json_checksum_file->checksums ) ) {237 foreach ( $existing_json_checksum_file->checksums as $file => $checksum_details ) {238 239 if ( ! isset( $json_checksum_file->checksums[ $file ] ) ) {240 // Deleted file, include it in checksums.241 $json_checksum_file->checksums[ $file ] = $checksum_details;242 243 } elseif ( $json_checksum_file->checksums[ $file ] != $checksum_details ) {244 // Checksum has changed, include both in the resulting json file.245 if ( is_array( $checksum_details ) ) {246 $checksum_details[] = $json_checksum_file->checksums[ $file ];247 $json_checksum_file->checksums[ $file ] = $checksum_details;248 } else {249 $json_checksum_file->checksums[ $file ] = array(250 $json_checksum_file->checksums[ $file ],251 $checksum_details252 );253 }254 }255 }256 }257 }258 259 file_put_contents( $this->checksum_file, wp_json_encode( $json_checksum_file ) );260 }261 262 /**263 148 * Generates a temporary unique directory in a given directory 264 149 * 265 150 * Performs a similar job to `tempnam()` with an added suffix and doesn't … … class Builder { 393 278 * @return bool 394 279 */ 395 280 public function invalidate_zip_caches( $versions ) { 396 // TODO: Implement PURGE 281 // TODO: Implement PURGE 397 282 return true; 398 283 if ( ! defined( 'PLUGIN_ZIP_X_ACCEL_REDIRECT_LOCATION' ) ) { 399 284 return true; -
wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-serve.php
diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-serve.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-serve.php index 8c87874..8c7f7fc 100644
a b class Serve { 36 36 protected function determine_request() { 37 37 $zip = basename( parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ) ); 38 38 39 if ( ! preg_match( "!^(?P<slug>[a-z0-9-_]+)(\.(?P<version>.+?))?\.(?P<request_type>zip|checksums\.json)$!i", $zip, $m ) ) { 39 $slug = false; 40 $version = 'trunk'; 41 42 if ( ! preg_match( "!^(?P<slug>[a-z0-9-_]+)(.(?P<version>.+))?.zip$!i", $zip, $m ) ) { 40 43 throw new Exception( __METHOD__ . ": Invalid URL." ); 41 44 } 42 45 43 46 $slug = strtolower( $m['slug'] ); 44 45 $version = 'trunk'; 46 if ( isset( $m['version'] ) && '' !== $m['version'] ) { 47 if ( isset( $m['version'] ) ) { 47 48 $version = $m['version']; 48 49 } 50 49 51 if ( 'latest-stable' == $version ) { 50 52 $version = $this->get_stable_tag( $slug ); 51 53 } 52 54 53 if ( 'zip' == strtolower( $m['request_type'] ) ) {54 $checksum_request = false;55 } else {56 $checksum_request = true;57 58 // Checksum requests for 'trunk' are not possible.59 if ( 'trunk' == $version ) {60 throw new Exception( __METHOD__ . ": Checksum requests must include a version." );61 }62 63 }64 65 55 $args = array( 66 56 'stats' => true, 67 57 ); 68 69 if ( $checksum_request ) { 70 $args['stats'] = false; 71 72 } elseif ( isset( $_GET['stats'] ) ) { 58 if ( isset( $_GET['stats'] ) ) { 73 59 $args['stats'] = (bool) $_GET['stats']; 74 75 60 } elseif ( isset( $_GET['nostats'] ) ) { 76 61 $args['stats'] = !empty( $_GET['nostats'] ); 77 62 } 78 63 79 return compact( 'zip', 'slug', 'version', 'args' , 'checksum_request');64 return compact( 'zip', 'slug', 'version', 'args' ); 80 65 } 81 66 82 67 /** … … class Serve { 132 117 } 133 118 134 119 /** 135 * Returns the file to be servedfor the request.120 * Returns the files to use for the request. 136 121 * 137 122 * @param array $request The request object for the request. 138 * @return array The file to serve.123 * @return array An array containing the files to use for the request, 'zip' and 'md5'. 139 124 */ 140 125 protected function get_file( $request ) { 141 // Checksum requests must include a version 142 if ( $request['checksum_request'] ) { 143 return "{$request['slug']}/{$request['slug']}.{$request['version']}.checksums.json"; 144 145 } elseif ( empty( $request['version'] ) || 'trunk' == $request['version'] ) { 126 if ( empty( $request['version'] ) || 'trunk' == $request['version'] ) { 146 127 return "{$request['slug']}/{$request['slug']}.zip"; 147 148 128 } else { 149 129 return "{$request['slug']}/{$request['slug']}.{$request['version']}.zip"; 150 130 } 151 152 131 } 153 132 154 133 /** … … class Serve { 157 136 * @param array $request The request array for the request. 158 137 */ 159 138 protected function serve_zip( $request ) { 160 $ file= $this->get_file( $request );139 $zip = $this->get_file( $request ); 161 140 162 141 if ( defined( 'PLUGIN_ZIP_X_ACCEL_REDIRECT_LOCATION' ) ) { 163 $ file_url = PLUGIN_ZIP_X_ACCEL_REDIRECT_LOCATION . $file;142 $zip_url = PLUGIN_ZIP_X_ACCEL_REDIRECT_LOCATION . $zip; 164 143 165 if ( $request['checksum_request'] ) { 166 header( 'Content-Type: application/json' ); 167 } else { 168 header( 'Content-Type: application/zip' ); 169 header( 'Content-Disposition: attachment; filename=' . basename( $file ) ); 170 } 171 header( "X-Accel-Redirect: $file_url" ); 144 header( 'Content-Type: application/zip' ); 145 header( 'Content-Disposition: attachment; filename=' . basename( $zip ) ); 146 header( "X-Accel-Redirect: $zip_url" ); 172 147 } else { 173 148 header( 'Content-Type: text/plain' ); 174 echo "This is a request for $ file, this server isn't currently configured to servefiles.\n";149 echo "This is a request for $zip, this server isn't currently configured to serve zip files.\n"; 175 150 } 176 151 177 152 if ( function_exists( 'fastcgi_finish_request' ) ) { -
wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/content-none.php
diff --git a/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/content-none.php b/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/content-none.php index 6a1ff29..805796f 100644
a b 41 41 42 42 <?php else : ?> 43 43 44 <p><?php printf( __( '<a href="%s">Login to WordPress.org</a> to mark plugins as favorites.', 'wporg-plugins' ), esc_url( wp_login_url( 'https://wordpress.org/plugins/browse/favorites/' )) ); ?></p>44 <p><?php printf( __( '<a href="%s">Login to WordPress.org</a> to mark plugins as favorites.', 'wporg-plugins' ), esc_url( 'https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fplugins%2Fbrowse%2Ffavorites%2F' ) ); ?></p> 45 45 46 46 <?php 47 47 endif; // is_user_logged_in() -
wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin.php
diff --git a/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin.php b/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin.php index c176c8f..97062db 100644
a b use WordPressdotorg\Plugin_Directory\Template; 33 33 <i class="dashicons dashicons-admin-users"></i> <?php echo esc_html( strip_tags( get_post_meta( get_the_ID(), 'header_author', true ) ) ?: get_the_author() ); ?> 34 34 </span> 35 35 <span class="active-installs"> 36 <i class="dashicons dashicons-chart-area"></i> <?php printf( __( '%s active install ations', 'wporg-plugins' ), Template::active_installs(false) ); ?>36 <i class="dashicons dashicons-chart-area"></i> <?php printf( __( '%s active installs', 'wporg-plugins' ), Template::active_installs(false) ); ?> 37 37 </span> 38 38 <span class="tested-with"> 39 39 <?php if ( $tested_up_to = (string) get_post_meta( $post->ID, 'tested', true ) ) { ?> -
wordpress.tv/public_html/wp-content/themes/wptv2/anon-upload-template.php
diff --git a/wordpress.tv/public_html/wp-content/themes/wptv2/anon-upload-template.php b/wordpress.tv/public_html/wp-content/themes/wptv2/anon-upload-template.php index 2eaff55..ee68def 100644
a b function anon_upload_css() { 61 61 62 62 .video-upload p { 63 63 margin: 16px 0; 64 overflow: auto;64 overflow: hidden; 65 65 } 66 66 67 67 .video-upload h3 {