Changeset 6704
- Timestamp:
- 02/21/2018 12:10:49 AM (4 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/app/common.php
r4981 r6704 6 6 use Exception; 7 7 8 defined( 'WPINC' ) ordie();8 defined( 'WPINC' ) || die(); 9 9 10 10 const POST_TYPE = 'wc_remote_css'; … … 13 13 const AJAX_ACTION = 'wcrcss_webhook'; 14 14 const SYNCHRONIZE_ACTION = 'wcrcss_synchronize'; 15 const WEBHOOK_RATE_LIMIT = 30; // seconds 15 const WEBHOOK_RATE_LIMIT = 30; // seconds. 16 16 const OPTION_REMOTE_CSS_URL = 'wcrcss_remote_css_url'; 17 17 const CSS_HANDLE = 'wordcamp_remote_css'; … … 153 153 if ( is_wp_error( $result ) ) { 154 154 throw new Exception( sprintf( 155 // translators: %s is an email address 156 __( "Could not migrate Jetpack post. Please notify us at %s.", 'wordcamporg' ),155 // translators: %s is an email address. 156 __( 'Could not migrate Jetpack post. Please notify us at %s.', 'wordcamporg' ), 157 157 EMAIL_CENTRAL_SUPPORT 158 158 ) ); … … 176 176 'post_name' => SAFE_CSS_POST_SLUG, 177 177 'post_status' => 'private', 178 'post_content' => $content 178 'post_content' => $content, 179 179 ), true ); 180 180 … … 185 185 if ( ! is_a( $post, 'WP_Post' ) ) { 186 186 throw new Exception( sprintf( 187 // translators: %s is an email address 188 __( "Could not create CSS post. Please notify us at %s.", 'wordcamporg' ),187 // translators: %s is an email address. 188 __( 'Could not create CSS post. Please notify us at %s.', 'wordcamporg' ), 189 189 EMAIL_CENTRAL_SUPPORT 190 190 ) ); … … 211 211 */ 212 212 function get_output_mode() { 213 $mode = 'add-on';213 $mode = 'add-on'; 214 214 $jetpack_settings = (array) get_theme_mod( 'jetpack_custom_css' ); 215 215 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/app/output-cached-css.php
r4578 r6704 5 5 use Exception; 6 6 7 defined( 'WPINC' ) ordie();7 defined( 'WPINC' ) || die(); 8 8 9 9 if ( is_configured() ) { 10 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_cached_css', 11 ); // after the theme's stylesheet, but before Core's Custom CSS stylesheet 10 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_cached_css', 11 ); // after the theme's stylesheet, but before Core's Custom CSS stylesheet. 11 11 add_filter( 'stylesheet_uri', __NAMESPACE__ . '\skip_theme_stylesheet' ); 12 12 add_action( 'wp_ajax_' . CSS_HANDLE, __NAMESPACE__ . '\output_cached_css' ); … … 62 62 */ 63 63 function get_latest_revision_id() { 64 $safe_css = get_safe_css_post();64 $safe_css = get_safe_css_post(); 65 65 $latest_revision = wp_get_post_revisions( $safe_css->ID, array( 'posts_per_page' => 1 ) ); 66 66 … … 101 101 'Cache-Control' => 'maxage=' . $expiration_period, 102 102 'ETag' => '"' . md5( $last_modified ) . '"', 103 'Last-Modified' => $last_modified, // Currently Core always strips this out, but we want to send it, and maybe Core will allow that in the future 103 'Last-Modified' => $last_modified, // Currently Core always strips this out, but we want to send it, and maybe Core will allow that in the future. 104 104 'Expires' => gmdate( 'D, d M Y H:i:s', time() + $expiration_period ) . ' GMT', 105 105 ); … … 112 112 */ 113 113 function output_cached_css() { 114 // Explicitly tell the browser that this is CSS, to avoid MIME sniffing vulnerabilities 114 // Explicitly tell the browser that this is CSS, to avoid MIME sniffing vulnerabilities. 115 115 header( 'Content-Type: text/css; charset=' . get_option( 'blog_charset' ) ); 116 116 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/app/synchronize-remote-css.php
r4596 r6704 6 6 use Exception; 7 7 8 defined( 'WPINC' ) ordie();8 defined( 'WPINC' ) || die(); 9 9 10 10 /** … … 29 29 * @param string $remote_css_url 30 30 * 31 * @throws \Exception if the response body could not be retrieved for any reason31 * @throws Exception If the response body could not be retrieved for any reason. 32 32 * 33 33 * @return string … … 37 37 $remote_css_url, 38 38 array( 39 'user-agent' => 'WordCamp.org Remote CSS', // GitHub's API explicitly requests this, and it could be beneficial for other platforms too 39 'user-agent' => 'WordCamp.org Remote CSS', // GitHub's API explicitly requests this, and it could be beneficial for other platforms too. 40 40 'reject_unsafe_urls' => true, 41 41 ) … … 44 44 if ( is_wp_error( $response ) ) { 45 45 Logger\log( 'request_error', compact( 'remote_css_url', 'response' ) ); 46 throw new \Exception( $response->get_error_message() );46 throw new Exception( $response->get_error_message() ); 47 47 } 48 48 … … 52 52 Logger\log( 'invalid_response_code', compact( 'remote_css_url', 'response' ) ); 53 53 54 throw new \Exception( sprintf(54 throw new Exception( sprintf( 55 55 __( 'The remote server responded with status code <code>%d</code>, which is not valid.', 'wordcamporg' ), 56 56 $response_code … … 84 84 if ( ! $parser_rules_setup || ! $subvalue_sanitization_setup ) { 85 85 throw new Exception( sprintf( 86 // translators: %s is an email address 87 __( "Could not update CSS because sanitization was not available. Please notify us at %s.", 'wordcamporg' ),86 // translators: %s is an email address. 87 __( 'Could not update CSS because sanitization was not available. Please notify us at %s.', 'wordcamporg' ), 88 88 EMAIL_CENTRAL_SUPPORT 89 89 ) ); … … 98 98 if ( did_action( 'csstidy_optimize_postparse' ) < 1 ) { 99 99 throw new Exception( sprintf( 100 // translators: %s is an email address 101 __( "Could not update CSS because sanitization did not run. Please notify us at %s.", 'wordcamporg' ),100 // translators: %s is an email address. 101 __( 'Could not update CSS because sanitization did not run. Please notify us at %s.', 'wordcamporg' ), 102 102 EMAIL_CENTRAL_SUPPORT 103 103 ) ); … … 113 113 */ 114 114 function save_safe_css( $safe_css ) { 115 $post = get_safe_css_post();115 $post = get_safe_css_post(); 116 116 $post->post_content = $safe_css; 117 117 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/app/user-interface.php
r5819 r6704 1 1 <?php 2 3 namespace WordCamp\RemoteCSS; 4 use Exception; 5 6 defined( 'WPINC' ) || die(); 2 7 3 8 /* … … 6 11 * For errors, use https://developer.wordpress.org/themes/customize-api/tools-for-improved-user-experience/#notifications 7 12 */ 8 9 namespace WordCamp\RemoteCSS;10 defined( 'WPINC' ) or die();11 13 12 14 add_action( 'admin_menu', __NAMESPACE__ . '\add_admin_pages' ); … … 39 41 $notice = process_options_page(); 40 42 $notice_class = 'notice-success'; 41 } catch ( \Exception $exception ) {43 } catch ( Exception $exception ) { 42 44 $notice = $exception->getMessage(); 43 45 $notice_class = 'notice-error'; … … 45 47 } 46 48 47 $output_mode 48 $remote_css_url = get_option( OPTION_REMOTE_CSS_URL, '' );49 $fonts_tool_url 49 $output_mode = get_output_mode(); 50 $remote_css_url = get_option( OPTION_REMOTE_CSS_URL, '' ); 51 $fonts_tool_url = admin_url( 'themes.php?page=wc-fonts-options' ); 50 52 51 53 require_once( dirname( __DIR__ ) . '/views/page-remote-css.php' ); … … 67 69 68 70 /** 69 * Process submissions of the form on the options page 70 * 71 * @throws \Exception if the user isn't authorized71 * Process submissions of the form on the options page. 72 * 73 * @throws Exception If the user isn't authorized. 72 74 * 73 75 * @return string … … 77 79 78 80 if ( ! current_user_can( 'switch_themes' ) ) { 79 throw new \Exception( __( 'Access denied.', 'wordcamporg' ) );81 throw new Exception( __( 'Access denied.', 'wordcamporg' ) ); 80 82 } 81 83 … … 105 107 * @param string $remote_css_url 106 108 * 107 * @throws \Exception if the URL cannot be validated109 * @throws Exception If the URL cannot be validated. 108 110 * 109 111 * @return string 110 112 */ 111 113 function validate_remote_css_url( $remote_css_url ) { 112 // Syntactically-valid URLs only 114 // Syntactically-valid URLs only. 113 115 $remote_css_url = filter_var( $remote_css_url, FILTER_VALIDATE_URL ); 114 116 115 117 if ( false === $remote_css_url ) { 116 throw new \Exception( __( 'The URL was invalid.', 'wordcamporg' ) );118 throw new Exception( __( 'The URL was invalid.', 'wordcamporg' ) ); 117 119 } 118 120 … … 120 122 121 123 if ( empty( $remote_css_url ) ) { 122 throw new \Exception( __( 'The URL was invalid.', 'wordcamporg' ) );123 } 124 125 $parsed_url = parse_url( $remote_css_url );124 throw new Exception( __( 'The URL was invalid.', 'wordcamporg' ) ); 125 } 126 127 $parsed_url = wp_parse_url( $remote_css_url ); 126 128 127 129 /* 128 * Only allow whitelisted hostnames, to prevent SSRF attacks 130 * Only allow whitelisted hostnames, to prevent SSRF attacks. 129 131 * 130 132 * WARNING: These must be trusted in the sense that they're not malicious, but also in the sense that they … … 138 140 139 141 if ( ! in_array( $parsed_url['host'], $trusted_hostnames, true ) ) { 140 throw new \Exception( sprintf(141 // translators: %s: WordPress Meta Trac URL 142 throw new Exception( sprintf( 143 // translators: %s: WordPress Meta Trac URL. 142 144 __( 143 145 'Due to security constraints, only certain third-party platforms can be used. We currently only support GitHub, but more platforms can be added if there\'s interest from organizers. To request an additional platform, please <a href="%s">create a ticket</a> on Meta Trac.', … … 156 158 */ 157 159 if ( '.css' !== substr( $parsed_url['path'], strlen( $parsed_url['path'] ) - 4, 4 ) ) { 158 throw new \Exception( sprintf(159 // translators: %s: '.css' 160 throw new Exception( sprintf( 161 // translators: %s: '.css'. 160 162 __( 161 163 'The URL must be a vanilla CSS file ending in %s. If you\'d like to use SASS/LESS, please compile it into vanilla CSS on your server, and then enter the URL for that file.', … … 199 201 'basic-setup' => __( 'Basic Setup', 'wordcamporg' ), 200 202 'automated-synchronization' => __( 'Automated Synchronization', 'wordcamporg' ), 201 'tips' => __( 'Tips', 'wordcamporg' ) 203 'tips' => __( 'Tips', 'wordcamporg' ), 202 204 ); 203 205 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/app/webhook-handler.php
r4578 r6704 3 3 namespace WordCamp\RemoteCSS; 4 4 5 defined( 'WPINC' ) ordie();5 defined( 'WPINC' ) || die(); 6 6 7 7 if ( is_configured() ) { 8 add_action( 'wp_ajax_' . AJAX_ACTION, __NAMESPACE__ . '\webhook_handler' ); // This is useless in production, but useful for manual testing 8 add_action( 'wp_ajax_' . AJAX_ACTION, __NAMESPACE__ . '\webhook_handler' ); // This is useless in production, but useful for manual testing. 9 9 add_action( 'wp_ajax_nopriv_' . AJAX_ACTION, __NAMESPACE__ . '\webhook_handler' ); 10 10 add_action( SYNCHRONIZE_ACTION, __NAMESPACE__ . '\synchronize_remote_css' ); … … 52 52 wp_send_json_success( __( 'The remote CSS file was successfully synchronized.', 'wordcamporg' ) ); 53 53 } catch ( \Exception $exception ) { 54 wp_send_json_error( strip_tags( $exception->getMessage() ) ); // strip_tags() instead of wp_strip_tags() because we want to preserve the inner content 54 wp_send_json_error( strip_tags( $exception->getMessage() ) ); // strip_tags() instead of wp_strip_tags() because we want to preserve the inner content. 55 55 } 56 56 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/bootstrap.php
r2124 r6704 3 3 namespace WordCamp\RemoteCSS; 4 4 5 defined( 'WPINC' ) ordie();5 defined( 'WPINC' ) || die(); 6 6 7 7 /* -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/platforms/github.php
r4597 r6704 4 4 use WP_Error; 5 5 6 defined( 'WPINC' ) ordie();6 defined( 'WPINC' ) || die(); 7 7 8 8 /* … … 38 38 */ 39 39 function convert_to_api_urls( $remote_css_url ) { 40 $owner = $repository = $file_path = null; 41 42 $parsed_url = parse_url( $remote_css_url ); 40 $owner = null; 41 $repository = null; 42 $file_path = null; 43 $parsed_url = wp_parse_url( $remote_css_url ); 43 44 $path = explode( '/', $parsed_url['path'] ); 44 45 45 if ( 'github.com' == $parsed_url['host'] ) {46 if ( 'github.com' === $parsed_url['host'] ) { 46 47 $owner = $path[1]; 47 48 $repository = $path[2]; 48 49 $file_path = implode( '/', array_slice( $path, 5 ) ); 49 } elseif ( 'raw.githubusercontent.com' == $parsed_url['host'] ) {50 } elseif ( 'raw.githubusercontent.com' === $parsed_url['host'] ) { 50 51 $owner = $path[1]; 51 52 $repository = $path[2]; … … 71 72 * This allows us to make 5k requests per hour, instead of just 60. 72 73 * 73 * @param false|array|WP_Error $preempt See `pre_http_request` 74 * @param false|array|WP_Error $preempt See `pre_http_request`. 74 75 * @param array $request_args 75 76 * @param string $request_url … … 78 79 */ 79 80 function authenticate_requests( $preempt, $request_args, $request_url ) { 80 $parsed_url = parse_url( $request_url );81 $parsed_url = wp_parse_url( $request_url ); 81 82 82 83 /* … … 97 98 98 99 $has_authentication_params = array_key_exists( 'client_id', $request_query_params ) && 99 100 array_key_exists( 'client_secret', $request_query_params ); 100 101 101 102 if ( ! $has_authentication_params ) { … … 103 104 array( 104 105 'client_id' => REMOTE_CSS_GITHUB_ID, 105 'client_secret' => REMOTE_CSS_GITHUB_SECRET 106 'client_secret' => REMOTE_CSS_GITHUB_SECRET, 106 107 ), 107 108 $request_url -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/tests/bootstrap.php
r4601 r6704 29 29 * It may need to be refactored if we add tests for output-cached-css.php. 30 30 */ 31 31 define( 'WP_ADMIN', true ); 32 32 define( 'JETPACK_DEV_DEBUG', true ); 33 33 define( 'JETPACK__PLUGIN_DIR', dirname( dirname( __DIR__ ) ) . '/jetpack' ); … … 37 37 define( 'JETPACK__VERSION', $jetpack_plugin_data['Version'] ); 38 38 39 require_once( dirname( __DIR__ ) . '/bootstrap.php');39 require_once( dirname( __DIR__ ) . '/bootstrap.php' ); 40 40 require_once( JETPACK__PLUGIN_DIR . '/modules/custom-css/custom-css-4.7.php' ); 41 41 42 // Some of the sanitization lives here because it runs for both Custom CSS and Remote CSS 42 // Some of the sanitization lives here because it runs for both Custom CSS and Remote CSS. 43 43 require_once( dirname( dirname( dirname( __DIR__ ) ) ) . '/mu-plugins/jetpack-tweaks/css-sanitization.php' ); 44 44 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/tests/test-synchronize-remote-css.php
r4578 r6704 2 2 3 3 namespace WordCamp\RemoteCSS; 4 defined( 'WPINC' ) ordie();4 defined( 'WPINC' ) || die(); 5 5 6 6 class Test_Synchronize_Remote_CSS extends \WP_UnitTestCase { -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/tests/test-user-interface.php
r2960 r6704 2 2 3 3 namespace WordCamp\RemoteCSS; 4 defined( 'WPINC' ) ordie();4 defined( 'WPINC' ) || die(); 5 5 6 6 class Test_User_Interface extends \WP_UnitTestCase { -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/views/help-automated-synchronization.php
r5819 r6704 2 2 3 3 namespace WordCamp\RemoteCSS; 4 defined( 'WPINC' ) ordie();4 defined( 'WPINC' ) || die(); 5 5 6 6 ?> 7 7 8 8 <p> 9 <?php _e(9 <?php esc_html_e( 10 10 "You don't have to manually synchronize the local file every time you make a change to the remote file; instead, you can setup a webhook to trigger synchronization automatically.", 11 11 'wordcamporg' … … 13 13 </p> 14 14 15 <h2><?php _e( 'Setup', 'wordcamporg' ); ?></h2>15 <h2><?php esc_html_e( 'Setup', 'wordcamporg' ); ?></h2> 16 16 17 17 <p> 18 <?php _e( "The details will vary depending on your server, but let's use GitHub as an example.", 'wordcamporg' ); ?>18 <?php esc_html_e( "The details will vary depending on your server, but let's use GitHub as an example.", 'wordcamporg' ); ?> 19 19 </p> 20 20 … … 22 22 <li> 23 23 <?php printf( 24 __( 'Follow <a href="%s">GitHub\'s instructions for creating a webhook</a>.', 'wordcamporg'),24 wp_kses_data( __( 'Follow <a href="%s">GitHub\'s instructions for creating a webhook</a>.', 'wordcamporg' ) ), 25 25 'https://developer.github.com/webhooks/creating/' 26 26 ); ?> … … 29 29 <li> 30 30 <?php printf( 31 __( 'For the <code>Payload URL</code>, enter <code>%s</code>.', 'wordcamporg'),31 wp_kses_post( __( 'For the <code>Payload URL</code>, enter <code>%s</code>.', 'wordcamporg' ) ), 32 32 esc_url( $webhook_payload_url ) 33 33 ); ?> 34 34 </li> 35 35 36 <li><?php _e( 'For the rest of the options, you can accept the default values.', 'wordcamporg' ); ?></li>36 <li><?php esc_html_e( 'For the rest of the options, you can accept the default values.', 'wordcamporg' ); ?></li> 37 37 </ol> 38 38 39 39 <p> 40 <?php _e(40 <?php esc_html_e( 41 41 "If you're not using GitHub, your process will be different, but at the end of the day all you need to do is setup something to open an HTTP request to the payload URL above whenever your file changes.", 42 42 'wordcamporg' … … 44 44 </p> 45 45 46 <h2><?php _e( 'Testing & Troubleshooting', 'wordcamporg' ); ?></h2>46 <h2><?php esc_html_e( 'Testing & Troubleshooting', 'wordcamporg' ); ?></h2> 47 47 48 48 <p> 49 <?php _e(49 <?php esc_html_e( 50 50 'To test if the synchronization is working, make a change to the file, commit it, push it to GitHub, and then check the site to see if that change is active.', 51 51 'wordcamporg' … … 54 54 55 55 <p> 56 <?php _e(56 <?php echo wp_kses_data( __( 57 57 "If your change isn't active on WordCamp.org, edit the webhook and scroll down to the <strong>Recent Deliveries</strong> section, then open the latest delivery and look at the <strong>Response</strong> tab for any errors.", 58 58 'wordcamporg' 59 ) ; ?>59 ) ); ?> 60 60 </p> 61 61 62 62 <p> 63 63 <?php printf( 64 // translators: %s: WordPress Slack URL */65 __(64 // translators: %s: WordPress Slack URL. 65 wp_kses_post( __( 66 66 'If that doesn\'t help solve the problem, you can ask for help in the <code>#meta-wordcamp</code> channel on <a href="%s">Slack</a>.', 67 67 'wordcamporg' 68 ) ,68 ) ), 69 69 'https://chat.wordpress.org' 70 70 ); ?> -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/views/help-basic-setup.php
r5819 r6704 2 2 3 3 namespace WordCamp\RemoteCSS; 4 defined( 'WPINC' ) ordie();4 defined( 'WPINC' ) || die(); 5 5 6 6 ?> … … 9 9 <li> 10 10 <p> 11 <?php _e( '<strong>Publish your CSS file</strong> to one of our supported platforms.', 'wordcamporg'); ?>11 <?php echo wp_kses_data( __( '<strong>Publish your CSS file</strong> to one of our supported platforms.', 'wordcamporg' ) ); ?> 12 12 </p> 13 13 14 14 <p> 15 15 <?php printf( 16 // translators: %s: WordPress Meta Trac URL 17 __(16 // translators: %s: WordPress Meta Trac URL. 17 wp_kses_data( __( 18 18 'Due to security constraints, only certain third-party platforms can be used. We currently only support GitHub, but more platforms can be added if there\'s interest from organizers. To request an additional platform, please <a href="%s">create a ticket</a> on Meta Trac.', 19 19 'wordcamporg' 20 ) ,20 ) ), 21 21 'https://meta.trac.wordpress.org/newticket' 22 22 ); ?> … … 24 24 25 25 <p> 26 <?php _e( "If you're using SASS or LESS, you'll need to compile it into vanilla CSS and publish that file.", 'wordcamporg' ); ?>26 <?php esc_html_e( "If you're using SASS or LESS, you'll need to compile it into vanilla CSS and publish that file.", 'wordcamporg' ); ?> 27 27 </p> 28 28 </li> … … 30 30 <li> 31 31 <p> 32 <?php _e( '<strong>Enter the URL</strong> for the CSS file into the input box below.', 'wordcamporg'); ?>32 <?php echo wp_kses_data( __( '<strong>Enter the URL</strong> for the CSS file into the input box below.', 'wordcamporg' ) ); ?> 33 33 </p> 34 34 35 35 <p> 36 <?php _e(36 <?php esc_html_e( 37 37 "If you're using GitHub, you can enter the URL in any of the following formats, but we'll convert them to use the GitHub API.", 38 38 'wordcamporg' … … 42 42 <ul> 43 43 <li> 44 <?php _e( 'Web-based file browser:', 'wordcamporg' ); ?>44 <?php esc_html_e( 'Web-based file browser:', 'wordcamporg' ); ?> 45 45 <code>https://github.com/WordPressSeattle/seattle.wordcamp.org-<?php echo esc_html( date( 'Y' ) ); ?>/blob/master/style.css</code> 46 46 </li> 47 47 48 48 <li> 49 <?php _e( 'Raw file:', 'wordcamporg' ); ?>49 <?php esc_html_e( 'Raw file:', 'wordcamporg' ); ?> 50 50 <code>https://raw.githubusercontent.com/WordPressSeattle/seattle.wordcamp.org-<?php echo esc_html( date( 'Y' ) ); ?>/master/style.css</code> 51 51 </li> 52 52 53 53 <li> 54 <?php _e( 'API:', 'wordcamporg' ); ?>54 <?php esc_html_e( 'API:', 'wordcamporg' ); ?> 55 55 <code>https://api.github.com/repos/WordPressSeattle/seattle.wordcamp.org-<?php echo esc_html( date( 'Y' ) ); ?>/contents/style.css</code> 56 56 </li> … … 59 59 60 60 <li> 61 <p><?php _e( 'Click the <strong>Update</strong> button.', 'wordcamporg'); ?></p>61 <p><?php echo wp_kses_data( __( 'Click the <strong>Update</strong> button.', 'wordcamporg' ) ); ?></p> 62 62 63 63 <p> 64 <?php _e(64 <?php esc_html_e( 65 65 "WordCamp.org will download the file, sanitize it, minify it, and store a local copy, then enqueue the local copy as a stylesheet alongside your theme's default stylesheet.", 66 66 'wordcamporg' … … 70 70 71 71 <li> 72 <?php _e(72 <?php echo wp_kses_data( __( 73 73 'The local copy will need to be <strong>synchronized</strong> whenever you make a change to the file. You can either update manually by pushing the <strong>Update</strong> button again, or update automatically by setting up a webhook. For instructions on setting up a webhook, open the <strong>Automated Synchronization</strong> tab.', 74 74 'wordcamporg' 75 ) ; ?>75 ) ); ?> 76 76 </li> 77 77 </ol> … … 79 79 <p> 80 80 <?php printf( 81 // translators: %s: WordPress Slack URL */82 __(81 // translators: %s: WordPress Slack URL. 82 wp_kses_data( __( 83 83 'If you run into any problems, you can ask for help in the <code>#meta-wordcamp</code> channel on <a href="%s">Slack</a>.', 84 84 'wordcamporg' 85 ) ,85 ) ), 86 86 'https://chat.wordpress.org' 87 87 ); ?> -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/views/help-overview.php
r5819 r6704 2 2 3 3 namespace WordCamp\RemoteCSS; 4 defined( 'WPINC' ) ordie();4 defined( 'WPINC' ) || die(); 5 5 6 6 /** … … 11 11 12 12 <p> 13 <?php _e(13 <?php esc_html_e( 14 14 'Remote CSS gives you a lot more flexibility in how you develop your site than the Core/Jetpack editor. For instance, you can:', 15 15 'wordcamporg' … … 18 18 19 19 <ul> 20 <li><?php _e( 'Work in a local development environment, like Varying Vagrant Vagrants.', 'wordcamporg' ); ?></li>21 <li><?php _e( 'Use your favorite IDE or text-editor, like PhpStorm or Sublime Text.', 'wordcamporg' ); ?></li>22 <li><?php _e( 'Use SASS or LESS instead of vanilla CSS.', 'wordcamporg' ); ?></li>23 <li><?php _e( 'Use tools like Grunt to automate your workflow.', 'wordcamporg' ); ?></li>24 <li><?php _e( 'Manage your CSS in a source control system like Git.', 'wordcamporg' ); ?></li>25 <li><?php _e( 'Collaborate with others on a social coding platform like GitHub.', 'wordcamporg' ); ?></li>20 <li><?php esc_html_e( 'Work in a local development environment, like Varying Vagrant Vagrants.', 'wordcamporg' ); ?></li> 21 <li><?php esc_html_e( 'Use your favorite IDE or text-editor, like PhpStorm or Sublime Text.', 'wordcamporg' ); ?></li> 22 <li><?php esc_html_e( 'Use SASS or LESS instead of vanilla CSS.', 'wordcamporg' ); ?></li> 23 <li><?php esc_html_e( 'Use tools like Grunt to automate your workflow.', 'wordcamporg' ); ?></li> 24 <li><?php esc_html_e( 'Manage your CSS in a source control system like Git.', 'wordcamporg' ); ?></li> 25 <li><?php esc_html_e( 'Collaborate with others on a social coding platform like GitHub.', 'wordcamporg' ); ?></li> 26 26 </ul> 27 27 28 28 <p> 29 <?php _e(29 <?php esc_html_e( 30 30 "You can use all of those tools, only some of them, or completely different ones. It's up to you how you choose to work.", 31 31 'wordcamporg' … … 34 34 35 35 <p> 36 <?php _e(36 <?php echo wp_kses_data( __( 37 37 "This tool works by fetching your CSS file from a remote server (like GitHub.com), sanitizing the CSS, minifying it, and then storing a local copy on WordCamp.org. The local copy is then enqueued as a stylesheet, either in addition to your theme's stylesheet, or as a replacement for it. The local copy of the CSS is synchronized with the remote file whenever you press the <strong>Update</strong> button, and you can also setup webhook notifications for automatic synchronization when the remote file changes.", 38 38 'wordcamporg' 39 ) ; ?>39 ) ); ?> 40 40 </p> 41 41 42 42 <p> 43 43 <?php printf( 44 // translators: %s: URL to Custom CSS section in the Customizer 45 __( 'If you\'re looking for something simpler, <a href="%s">the Core/Jetpack editor</a> is a great option.', 'wordcamporg'),44 // translators: %s: URL to Custom CSS section in the Customizer. 45 wp_kses_data( __( 'If you\'re looking for something simpler, <a href="%s">the Core/Jetpack editor</a> is a great option.', 'wordcamporg' ) ), 46 46 esc_url( $custom_css_url ) 47 47 ); ?> -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/views/help-tips.php
r5819 r6704 2 2 3 3 namespace WordCamp\RemoteCSS; 4 defined( 'WPINC' ) ordie();4 defined( 'WPINC' ) || die(); 5 5 6 6 /** … … 14 14 <li> 15 15 <?php printf( 16 __( 'We recommend <a href="%s">setting up a local development environment that mirrors WordCamp.org</a>.', 'wordcamporg'),16 wp_kses_data( __( 'We recommend <a href="%s">setting up a local development environment that mirrors WordCamp.org</a>.', 'wordcamporg' ) ), 17 17 'https://make.wordpress.org/community/handbook/wordcamp-organizer-handbook/first-steps/web-presence/contributing-to-wordcamp-org/setting-up-a-local-wordcamp-org-sandbox/' 18 18 ); ?> … … 20 20 21 21 <li> 22 <?php _e(22 <?php echo wp_kses_data( __( 23 23 "Don't use post IDs as selectors, because they can change between your development environment and production. Instead, use the slug; e.g. <code>body.post-slug-call-for-volunteers</code>, or <code>body.wcb_speaker-slug-sergey-biryukov</code>. Just make sure that you update your CSS if you rename a post.", 24 24 'wordcamporg' 25 ) ; ?>25 ) ); ?> 26 26 </li> 27 27 28 28 <li> 29 29 <?php printf( 30 __( 'Use <a href="%s">the Fonts tool</a> to embed your web fonts.', 'wordcamporg'),30 wp_kses_data( __( 'Use <a href="%s">the Fonts tool</a> to embed your web fonts.', 'wordcamporg' ) ), 31 31 esc_url( $fonts_tool_url ) 32 32 ); ?> … … 35 35 <li> 36 36 <?php printf( 37 __(37 wp_kses_data( __( 38 38 'Upload your images to <a href="%s">the Media Library</a> rather than hosting them on 3rd party servers. That way, visitors will avoid an extra DNS request, and you won\'t have to worry about them going offline if there\'s a problem with the external server.', 39 39 'wordcamporg' 40 ) ,40 ) ), 41 41 esc_url( $media_library_url ) 42 42 ); ?> … … 44 44 45 45 <li> 46 <?php _e(46 <?php esc_html_e( 47 47 "This tool plays nicely with the Core/Jetpack editor, and it's possible to use both. If you do, the rules in the Core/Jetpack editor will take precedence.", 48 48 'wordcamporg' -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/views/page-remote-css.php
r5819 r6704 2 2 3 3 namespace WordCamp\RemoteCSS; 4 defined( 'WPINC' ) or die(); 4 use WordCamp\Jetpack_Tweaks; 5 6 defined( 'WPINC' ) || die(); 5 7 6 8 /** … … 14 16 15 17 <div class="wrap"> 16 <h1><?php _e( 'Remote CSS', 'wordcamporg' ); ?></h1>18 <h1><?php esc_html_e( 'Remote CSS', 'wordcamporg' ); ?></h1> 17 19 18 20 <?php 19 if ( is_callable( '\WordCamp\Jetpack_Tweaks\notify_import_rules_stripped' ) ) { 20 // This has to be called manually because process_options_page() is called after `admin_notices` fires 21 \WordCamp\Jetpack_Tweaks\notify_import_rules_stripped(); 22 } 21 22 if ( is_callable( '\WordCamp\Jetpack_Tweaks\notify_import_rules_stripped' ) ) { 23 // This has to be called manually because process_options_page() is called after `admin_notices` fires. 24 Jetpack_Tweaks\notify_import_rules_stripped(); 25 } 26 23 27 ?> 24 28 25 29 <?php if ( $notice ) : ?> 26 30 <div id="message" class="notice <?php echo esc_attr( $notice_class ); ?> is-dismissible"> 27 <p><?php echo wp_kses ( $notice, wp_kses_allowed_html( 'data' )); ?></p>31 <p><?php echo wp_kses_data( $notice ); ?></p> 28 32 </div> 29 33 <?php endif; ?> … … 31 35 <p> 32 36 <?php printf( 33 // translators: %s: button attributes 34 __(37 // translators: %s: button attributes. 38 wp_kses_data( __( 35 39 'Remote CSS allows you to develop your CSS in any environment that you choose, and with whatever tools that you prefer. <button %s>Open the Help tab</button> for detailed instructions.', 36 40 'wordcamporg' 37 ) ,41 ) ), 38 42 'type="button" id="wcrcss-open-help-tab" class="button-link"' 39 43 ); ?> … … 45 49 <p> 46 50 <label> 47 <?php _e( 'Remote CSS URL:', 'wordcamporg' ); ?><br />51 <?php esc_html_e( 'Remote CSS URL:', 'wordcamporg' ); ?><br /> 48 52 <input type="text" name="wcrcss-remote-css-url" class="large-text" value="<?php echo esc_url( $remote_css_url ); ?>" /> 49 53 </label> … … 51 55 52 56 <div> 53 <?php _e( 'Output Mode:', 'wordcamporg' ); ?>57 <?php esc_html_e( 'Output Mode:', 'wordcamporg' ); ?> 54 58 55 59 <ul> … … 57 61 <label> 58 62 <input type="radio" name="wcrcss-output-mode" value="add-on" <?php checked( $output_mode, 'add-on' ); ?> /> 59 <?php _e( "Add-on: The theme's stylesheet will remain, and your custom CSS will be added after it.", 'wordcamporg' ); ?>63 <?php esc_html_e( "Add-on: The theme's stylesheet will remain, and your custom CSS will be added after it.", 'wordcamporg' ); ?> 60 64 </label> 61 65 </li> … … 64 68 <label> 65 69 <input type="radio" name="wcrcss-output-mode" value="replace" <?php checked( $output_mode, 'replace' ); ?> /> 66 <?php _e( "Replace: The theme's stylesheet will be removed, so that only your custom CSS is present.", 'wordcamporg' ); ?>70 <?php esc_html_e( "Replace: The theme's stylesheet will be removed, so that only your custom CSS is present.", 'wordcamporg' ); ?> 67 71 </label> 68 72 </li> -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-remote-css/views/template-discovery-notice.php
r4578 r6704 2 2 3 3 namespace WordCamp\RemoteCSS; 4 defined( 'WPINC' ) ordie();4 defined( 'WPINC' ) || die(); 5 5 6 6 /**
Note: See TracChangeset
for help on using the changeset viewer.