Ticket #1244: meta-1244.patch
File meta-1244.patch, 6.2 KB (added by , 9 years ago) |
---|
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php
102 102 // Do we have a stylesheet? Life is kind of pointless without. 103 103 $style_css = $this->get_style_css( $theme_files ); 104 104 if ( empty( $style_css ) ) { 105 /* translators: %s: style.css */ 105 106 return sprintf( __( 'The zip file must include a file named %s.', 'wporg-themes' ), '<code>style.css</code>' ); 106 107 } 107 108 … … 110 111 111 112 // We need a screen shot. People love screen shots. 112 113 if ( ! $this->has_screenshot( $theme_files ) ) { 114 /* translators: 1: screenshot.png, 2: screenshot.jpg */ 113 115 return sprintf( __( 'The zip file must include a file named %1$s or %2$s.', 'wporg-themes' ), '<code>screenshot.png</code>', '<code>screenshot.jpg</code>' ); 114 116 } 115 117 … … 119 121 // Let's check some theme headers, shall we? 120 122 121 123 if ( ! $this->theme_name = $this->theme->get( 'Name' ) ) { 122 return __( "The theme has no name. Add it to style.css and upload the theme again. <a href='https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet'>Theme Style Sheets</a>", 'wporg-themes' ); 124 /* translators: 1: style.css, 2: Codex URL */ 125 return sprintf( __( 'The theme has no name. Add it to %1$s and upload the theme again. <a href="%2$s">Theme Style Sheets</a>', 'wporg-themes' ), '<code>style.css</code>', __( 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet', 'wporg-themes' ) ); 123 126 } 124 127 125 128 // determine the theme slug based on the name of the theme in the stylesheet … … 129 132 130 133 // Make sure it doesn't use a slug deemed not to be used by the public. 131 134 if ( $this->has_reserved_slug() ) { 132 return sprintf( __( 'Sorry, the theme name %s is reserved for use by WordPress Core. Please change the name of your theme in <code>style.css</code> and upload it again.', 'wporg-themes' ), '<code>' . $this->theme_slug . '</code>' ); 135 /* translators: 1: theme name, 2: style.css */ 136 return sprintf( __( 'Sorry, the theme name %1$s is reserved for use by WordPress Core. Please change the name of your theme in %2$s and upload it again.', 'wporg-themes' ), '<code>' . $this->theme_slug . '</code>', '<code>style.css</code>' ); 133 137 } 134 138 135 139 // populate the theme post and author … … 137 141 138 142 $theme_description = $this->strip_non_utf8( (string) $this->theme->get( 'Description' ) ); 139 143 if ( empty( $theme_description ) ) { 140 return sprintf( __( 'The theme has no description. Add it to <code>style.css</code> and upload the theme again. <a href="%s">Theme Style Sheets</a>', 'wporg-themes' ), 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet' ); 144 /* translators: 1: style.css, 2: Codex URL */ 145 return sprintf( __( 'The theme has no description. Add it to %1$s and upload the theme again. <a href="%2$s">Theme Style Sheets</a>', 'wporg-themes' ), '<code>style.css</code>', __( 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet', 'wporg-themes' ) ); 141 146 } 142 147 143 148 if ( ! $this->theme->get( 'Tags' ) ) { 144 return __( 'The stylesheet has no tags. Add a Tags: line to your <code>style.css</code> file and upload the zip file again.', 'wporg-themes' ); 149 /* translators: %s: style.css */ 150 return sprintf( __( 'The stylesheet has no tags. Add a Tags: line to your %s file and upload the zip file again.', 'wporg-themes' ), '<code>style.css</code>' ); 145 151 } 146 152 147 153 if ( ! $this->theme->get( 'Version' ) ) { 148 return __( 'The stylesheet has no version. Add a Version: line to your <code>style.css</code> file and upload the zip file again.', 'wporg-themes' ); 154 /* translators: %s: style.css */ 155 return sprintf( __( 'The stylesheet has no version. Add a Version: line to your %s file and upload the zip file again.', 'wporg-themes' ), '<code>style.css</code>' ); 149 156 } 150 157 151 158 if ( preg_match( '|[^\d\.]|', $this->theme->get( 'Version' ) ) ) { 152 return __( 'Version strings can only contain numeric and period characters (like 1.2). Please fix your Version: line in <code>style.css</code> and upload your theme again.', 'wporg-themes' ); 159 /* translators: %s: style.css */ 160 return sprintf( __( 'Version strings can only contain numeric and period characters (like 1.2). Please fix your Version: line in %s and upload your theme again.', 'wporg-themes' ), '<code>style.css</code>' ); 153 161 } 154 162 155 163 // Make sure we have version that is higher than any previously uploaded version of this theme. 156 164 if ( ! empty( $this->theme_post ) && ! version_compare( $this->theme->get( 'Version' ), $this->theme_post->max_version, '>' ) ) { 157 return sprintf( __( 'You need to upload a version of %1$s higher than %2$s. Increase the theme version number in <code>style.css</code>, then upload your zip file again.', 'wporg-themes' ), $this->theme->display( 'Name' ), '<code>' . $this->theme_post->max_version . '</code>' ); 165 /* translators: 1: theme name, 2: version, 3: style.css */ 166 return sprintf( __( 'You need to upload a version of %1$s higher than %2$s. Increase the theme version number in %3$s, then upload your zip file again.', 'wporg-themes' ), $this->theme->display( 'Name' ), '<code>' . $this->theme_post->max_version . '</code>', '<code>style.css</code>' ); 158 167 } 159 168 160 169 // Prevent duplicate URLs. … … 171 180 172 181 // Is there already a theme with the name name by a different author? 173 182 if ( ! empty( $this->theme_post ) && $this->theme_post->post_author != $this->author->ID ) { 174 return sprintf( __( 'There is already a theme called %s by a different author. Please change the name of your theme in <code>style.css</code> and upload it again.', 'wporg-themes' ), '<code>' . $this->theme_slug . '</code>' ); 183 /* translators: 1: theme name, 2: style.css */ 184 return sprintf( __( 'There is already a theme called %1$s by a different author. Please change the name of your theme in %2$s and upload it again.', 'wporg-themes' ), '<code>' . $this->theme_slug . '</code>', '<code>style.css</code>' ); 175 185 } 176 186 177 187 // We know it's the correct author, now we can check if it's suspended.