Changeset 2054205
- Timestamp:
- 03/20/2019 07:11:15 PM (7 years ago)
- Location:
- safe-staging
- Files:
-
- 30 added
- 6 edited
- 1 copied
-
tags/0.3.1 (copied) (copied from safe-staging/trunk)
-
tags/0.3.1/README.md (modified) (5 diffs)
-
tags/0.3.1/composer.json (added)
-
tags/0.3.1/inc/class-notices.php (modified) (1 diff)
-
tags/0.3.1/readme.txt (modified) (4 diffs)
-
tags/0.3.1/templates/notice-production.php (added)
-
tags/0.3.1/templates/notice-setup.php (added)
-
tags/0.3.1/templates/notice-staging.php (added)
-
tags/0.3.1/vendor (added)
-
tags/0.3.1/vendor/autoload.php (added)
-
tags/0.3.1/vendor/composer (added)
-
tags/0.3.1/vendor/composer/ClassLoader.php (added)
-
tags/0.3.1/vendor/composer/LICENSE (added)
-
tags/0.3.1/vendor/composer/autoload_classmap.php (added)
-
tags/0.3.1/vendor/composer/autoload_namespaces.php (added)
-
tags/0.3.1/vendor/composer/autoload_psr4.php (added)
-
tags/0.3.1/vendor/composer/autoload_real.php (added)
-
tags/0.3.1/vendor/composer/autoload_static.php (added)
-
tags/0.3.1/vendor/composer/installed.json (added)
-
trunk/README.md (modified) (5 diffs)
-
trunk/composer.json (added)
-
trunk/inc/class-notices.php (modified) (1 diff)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/templates/notice-production.php (added)
-
trunk/templates/notice-setup.php (added)
-
trunk/templates/notice-staging.php (added)
-
trunk/vendor (added)
-
trunk/vendor/autoload.php (added)
-
trunk/vendor/composer (added)
-
trunk/vendor/composer/ClassLoader.php (added)
-
trunk/vendor/composer/LICENSE (added)
-
trunk/vendor/composer/autoload_classmap.php (added)
-
trunk/vendor/composer/autoload_namespaces.php (added)
-
trunk/vendor/composer/autoload_psr4.php (added)
-
trunk/vendor/composer/autoload_real.php (added)
-
trunk/vendor/composer/autoload_static.php (added)
-
trunk/vendor/composer/installed.json (added)
Legend:
- Unmodified
- Added
- Removed
-
safe-staging/tags/0.3.1/README.md
r2032951 r2054205 1 [](https://circleci.com/gh/ryanshoover/safe-staging/tree/master) 2 1 3 # Safe Staging 2 4 … … 39 41 3. Set the URL for your production site at `/wp-admin/options-general.php?page=safe-staging` 40 42 41 ## Hooks and Filters 43 ## Frequently Asked Questions 44 45 ### Can I complicate how the plugin determines what the production URL is? 46 47 The filter `safe_staging_is_production` will let you change what the plugin sees as the production site. 48 For example, the filter below will let you support an alternative production URL. 42 49 43 50 ```php … … 47 54 * 48 55 * @param bool $is_prod Is this the production site. 56 * @return bool Whether we should treat this as an alternative production site. 49 57 */ 50 apply_filters( 'safe_staging_is_production', $is_prod ); 58 add_filter( 59 'safe_staging_is_production', 60 function( $is_prod ) { 61 $alternative_prod_url = 'https://myothersite.com'; 62 63 if ( site_url() === $alternative_prod_url ) { 64 $is_prod = true; 65 } 66 67 return $is_prod; 68 } 69 ); 51 70 ``` 71 72 = Can I let other emails get sent on staging sites? = 73 74 The filter `safe_staging_is_whitelist_email` will let you intervene just before an email is blocked. 75 For example, the filter below will let you support an alternative production URL. 52 76 53 77 ```php … … 55 79 * Determine whether a particular email should be sent. 56 80 * 81 * In this case we test if the to recipient is our admin address. 82 * 57 83 * @param bool $whitelisted Should the email actually send. 58 84 * @param object $this Instance of the Fake PHPMailer class. 85 * @return bool Whitelist value tested against the recipient. 59 86 */ 60 apply_filters( 'safe_staging_is_whitelist_email', $whitelisted, $this ); 87 add_filter( 88 'safe_staging_is_whitelist_email' 89 function( $whitelisted, $phpmailer ) { 90 if ( 'admin@mysite.com' === $phpmailer->getToAddresses() ) { 91 $whitelisted = true; 92 } 93 94 return $whitelisted; 95 }, 96 10, 97 2 98 ); 61 99 ``` 100 101 = Can I change the message that shows on the checkout page? = 102 103 The filter `safe_staging_checkout_notice` will let you override the message shown on the cart and checkout pages. 62 104 63 105 ```php … … 66 108 * of staging sites. 67 109 * 68 * @ param string $notice HTML of the message to be shown.110 * @return string New message to show on the checkout page. 69 111 */ 70 apply_filters( 'safe_staging_checkout_notice', $notice ); 112 add_filter( 113 'safe_staging_checkout_notice', 114 function() { 115 return 'You\'ve found our staging site! You might want to go back to the production site.'; 116 } 117 ) 71 118 ``` 119 120 == Upgrade notice == 121 122 None needed. 123 124 == Changelog == 125 126 = 0.2.4 = 127 128 * Clarifies readme code examples 129 130 = 0.2.3 = 131 132 * Adds support for CI / CD code management 133 134 = 0.2.1 = 135 136 * Bumps compatibility to 5.1. 137 * Adds uninstall file. 138 139 = 0.2 = 140 141 * Adds noindex tag to the staging site. -
safe-staging/tags/0.3.1/inc/class-notices.php
r2027920 r2054205 29 29 */ 30 30 public function do_admin_notices() { 31 $screen = get_current_screen(); 31 32 $prod_url = production_url(); 32 33 $is_setup_dismissed = get_user_meta( get_current_user_id(), SLUG . '_notice_setup_dismiss' ); 33 34 34 if ( empty( $prod_url ) && empty( $is_setup_dismissed ) ) { 35 include PATH . 'templates/setup-notice.php'; 35 if ( 36 empty( $prod_url ) && 37 empty( $is_setup_dismissed ) && 38 ( ! $screen || 'settings_page_safe-staging' !== $screen->id ) ) { 39 include PATH . 'templates/notice-setup.php'; 40 return; 36 41 } 37 42 38 43 if ( ! Protection::is_production() ) { 39 include PATH . 'templates/staging-notice.php'; 44 include PATH . 'templates/notice-staging.php'; 45 return; 46 } 47 48 if ( Protection::is_production() ) { 49 include PATH . 'templates/notice-production.php'; 50 return; 40 51 } 41 52 } -
safe-staging/tags/0.3.1/readme.txt
r2032951 r2054205 5 5 Tested up to: 5.1 6 6 Requires PHP: 7.0 7 Stable tag: trunk 7 8 License: GPL3 8 9 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html … … 11 12 12 13 == Description == 14 15 [](https://circleci.com/gh/ryanshoover/safe-staging/tree/master) 13 16 14 17 Simply define your production url in settings and copy your site to your staging instance without fear. The staging site won't send any emails and won't process any payments. … … 31 34 3. Set the URL for your production site at `/wp-admin/options-general.php?page=safe-staging` 32 35 33 == Hooks and Filters ==34 36 35 ```php 37 == Frequently Asked Questions == 38 39 = Can I complicate how the plugin determines what the production URL is? == 40 41 The filter `safe_staging_is_production` will let you change what the plugin sees as the production site. 42 For example, the filter below will let you support an alternative production URL. 43 44 <code> 36 45 /** 37 46 * Change whether Safe Staging thinks the current site … … 39 48 * 40 49 * @param bool $is_prod Is this the production site. 50 * @return bool Whether we should treat this as an alternative production site. 41 51 */ 42 apply_filters( 'safe_staging_is_production', $is_prod ); 43 ``` 52 add_filter( 53 'safe_staging_is_production', 54 function( $is_prod ) { 55 $alternative_prod_url = 'https://myothersite.com'; 44 56 45 ```php 57 if ( site_url() === $alternative_prod_url ) { 58 $is_prod = true; 59 } 60 61 return $is_prod; 62 } 63 ); 64 </code> 65 66 = Can I let other emails get sent on staging sites? = 67 68 The filter `safe_staging_is_whitelist_email` will let you intervene just before an email is blocked. 69 For example, the filter below will let you support an alternative production URL. 70 71 <code> 46 72 /** 47 73 * Determine whether a particular email should be sent. 48 74 * 75 * In this case we test if the to recipient is our admin address. 76 * 49 77 * @param bool $whitelisted Should the email actually send. 50 78 * @param object $this Instance of the Fake PHPMailer class. 79 * @return bool Whitelist value tested against the recipient. 51 80 */ 52 apply_filters( 'safe_staging_is_whitelist_email', $whitelisted, $this ); 53 ``` 81 add_filter( 82 'safe_staging_is_whitelist_email' 83 function( $whitelisted, $phpmailer ) { 84 if ( 'admin@mysite.com' === $phpmailer->getToAddresses() ) { 85 $whitelisted = true; 86 } 54 87 55 ```php 88 return $whitelisted; 89 }, 90 10, 91 2 92 ); 93 </code> 94 95 = Can I change the message that shows on the checkout page? = 96 97 The filter `safe_staging_checkout_notice` will let you override the message shown on the cart and checkout pages. 98 99 <code> 56 100 /** 57 101 * Change the warning message that gets displayed on the checkout page 58 102 * of staging sites. 59 103 * 60 * @ param string $notice HTML of the message to be shown.104 * @return string New message to show on the checkout page. 61 105 */ 62 apply_filters( 'safe_staging_checkout_notice', $notice ); 63 ``` 106 add_filter( 107 'safe_staging_checkout_notice', 108 function() { 109 return 'You\'ve found our staging site! You might want to go back to the production site.'; 110 } 111 ) 112 </code> 113 114 115 == Upgrade notice == 116 117 None needed. 118 119 == Changelog == 120 121 = 0.3 = 122 123 * Improve admin notifications 124 * Clarifies readme code examples 125 * Adds wpunit tests 126 127 = 0.2.3 = 128 129 * Adds support for CI / CD code management 130 131 = 0.2.1 = 132 133 * Bumps compatibility to 5.1. 134 * Adds uninstall file. 135 136 = 0.2 = 137 138 * Adds noindex tag to the staging site. -
safe-staging/trunk/README.md
r2032951 r2054205 1 [](https://circleci.com/gh/ryanshoover/safe-staging/tree/master) 2 1 3 # Safe Staging 2 4 … … 39 41 3. Set the URL for your production site at `/wp-admin/options-general.php?page=safe-staging` 40 42 41 ## Hooks and Filters 43 ## Frequently Asked Questions 44 45 ### Can I complicate how the plugin determines what the production URL is? 46 47 The filter `safe_staging_is_production` will let you change what the plugin sees as the production site. 48 For example, the filter below will let you support an alternative production URL. 42 49 43 50 ```php … … 47 54 * 48 55 * @param bool $is_prod Is this the production site. 56 * @return bool Whether we should treat this as an alternative production site. 49 57 */ 50 apply_filters( 'safe_staging_is_production', $is_prod ); 58 add_filter( 59 'safe_staging_is_production', 60 function( $is_prod ) { 61 $alternative_prod_url = 'https://myothersite.com'; 62 63 if ( site_url() === $alternative_prod_url ) { 64 $is_prod = true; 65 } 66 67 return $is_prod; 68 } 69 ); 51 70 ``` 71 72 = Can I let other emails get sent on staging sites? = 73 74 The filter `safe_staging_is_whitelist_email` will let you intervene just before an email is blocked. 75 For example, the filter below will let you support an alternative production URL. 52 76 53 77 ```php … … 55 79 * Determine whether a particular email should be sent. 56 80 * 81 * In this case we test if the to recipient is our admin address. 82 * 57 83 * @param bool $whitelisted Should the email actually send. 58 84 * @param object $this Instance of the Fake PHPMailer class. 85 * @return bool Whitelist value tested against the recipient. 59 86 */ 60 apply_filters( 'safe_staging_is_whitelist_email', $whitelisted, $this ); 87 add_filter( 88 'safe_staging_is_whitelist_email' 89 function( $whitelisted, $phpmailer ) { 90 if ( 'admin@mysite.com' === $phpmailer->getToAddresses() ) { 91 $whitelisted = true; 92 } 93 94 return $whitelisted; 95 }, 96 10, 97 2 98 ); 61 99 ``` 100 101 = Can I change the message that shows on the checkout page? = 102 103 The filter `safe_staging_checkout_notice` will let you override the message shown on the cart and checkout pages. 62 104 63 105 ```php … … 66 108 * of staging sites. 67 109 * 68 * @ param string $notice HTML of the message to be shown.110 * @return string New message to show on the checkout page. 69 111 */ 70 apply_filters( 'safe_staging_checkout_notice', $notice ); 112 add_filter( 113 'safe_staging_checkout_notice', 114 function() { 115 return 'You\'ve found our staging site! You might want to go back to the production site.'; 116 } 117 ) 71 118 ``` 119 120 == Upgrade notice == 121 122 None needed. 123 124 == Changelog == 125 126 = 0.2.4 = 127 128 * Clarifies readme code examples 129 130 = 0.2.3 = 131 132 * Adds support for CI / CD code management 133 134 = 0.2.1 = 135 136 * Bumps compatibility to 5.1. 137 * Adds uninstall file. 138 139 = 0.2 = 140 141 * Adds noindex tag to the staging site. -
safe-staging/trunk/inc/class-notices.php
r2027920 r2054205 29 29 */ 30 30 public function do_admin_notices() { 31 $screen = get_current_screen(); 31 32 $prod_url = production_url(); 32 33 $is_setup_dismissed = get_user_meta( get_current_user_id(), SLUG . '_notice_setup_dismiss' ); 33 34 34 if ( empty( $prod_url ) && empty( $is_setup_dismissed ) ) { 35 include PATH . 'templates/setup-notice.php'; 35 if ( 36 empty( $prod_url ) && 37 empty( $is_setup_dismissed ) && 38 ( ! $screen || 'settings_page_safe-staging' !== $screen->id ) ) { 39 include PATH . 'templates/notice-setup.php'; 40 return; 36 41 } 37 42 38 43 if ( ! Protection::is_production() ) { 39 include PATH . 'templates/staging-notice.php'; 44 include PATH . 'templates/notice-staging.php'; 45 return; 46 } 47 48 if ( Protection::is_production() ) { 49 include PATH . 'templates/notice-production.php'; 50 return; 40 51 } 41 52 } -
safe-staging/trunk/readme.txt
r2032951 r2054205 5 5 Tested up to: 5.1 6 6 Requires PHP: 7.0 7 Stable tag: trunk 7 8 License: GPL3 8 9 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html … … 11 12 12 13 == Description == 14 15 [](https://circleci.com/gh/ryanshoover/safe-staging/tree/master) 13 16 14 17 Simply define your production url in settings and copy your site to your staging instance without fear. The staging site won't send any emails and won't process any payments. … … 31 34 3. Set the URL for your production site at `/wp-admin/options-general.php?page=safe-staging` 32 35 33 == Hooks and Filters ==34 36 35 ```php 37 == Frequently Asked Questions == 38 39 = Can I complicate how the plugin determines what the production URL is? == 40 41 The filter `safe_staging_is_production` will let you change what the plugin sees as the production site. 42 For example, the filter below will let you support an alternative production URL. 43 44 <code> 36 45 /** 37 46 * Change whether Safe Staging thinks the current site … … 39 48 * 40 49 * @param bool $is_prod Is this the production site. 50 * @return bool Whether we should treat this as an alternative production site. 41 51 */ 42 apply_filters( 'safe_staging_is_production', $is_prod ); 43 ``` 52 add_filter( 53 'safe_staging_is_production', 54 function( $is_prod ) { 55 $alternative_prod_url = 'https://myothersite.com'; 44 56 45 ```php 57 if ( site_url() === $alternative_prod_url ) { 58 $is_prod = true; 59 } 60 61 return $is_prod; 62 } 63 ); 64 </code> 65 66 = Can I let other emails get sent on staging sites? = 67 68 The filter `safe_staging_is_whitelist_email` will let you intervene just before an email is blocked. 69 For example, the filter below will let you support an alternative production URL. 70 71 <code> 46 72 /** 47 73 * Determine whether a particular email should be sent. 48 74 * 75 * In this case we test if the to recipient is our admin address. 76 * 49 77 * @param bool $whitelisted Should the email actually send. 50 78 * @param object $this Instance of the Fake PHPMailer class. 79 * @return bool Whitelist value tested against the recipient. 51 80 */ 52 apply_filters( 'safe_staging_is_whitelist_email', $whitelisted, $this ); 53 ``` 81 add_filter( 82 'safe_staging_is_whitelist_email' 83 function( $whitelisted, $phpmailer ) { 84 if ( 'admin@mysite.com' === $phpmailer->getToAddresses() ) { 85 $whitelisted = true; 86 } 54 87 55 ```php 88 return $whitelisted; 89 }, 90 10, 91 2 92 ); 93 </code> 94 95 = Can I change the message that shows on the checkout page? = 96 97 The filter `safe_staging_checkout_notice` will let you override the message shown on the cart and checkout pages. 98 99 <code> 56 100 /** 57 101 * Change the warning message that gets displayed on the checkout page 58 102 * of staging sites. 59 103 * 60 * @ param string $notice HTML of the message to be shown.104 * @return string New message to show on the checkout page. 61 105 */ 62 apply_filters( 'safe_staging_checkout_notice', $notice ); 63 ``` 106 add_filter( 107 'safe_staging_checkout_notice', 108 function() { 109 return 'You\'ve found our staging site! You might want to go back to the production site.'; 110 } 111 ) 112 </code> 113 114 115 == Upgrade notice == 116 117 None needed. 118 119 == Changelog == 120 121 = 0.3 = 122 123 * Improve admin notifications 124 * Clarifies readme code examples 125 * Adds wpunit tests 126 127 = 0.2.3 = 128 129 * Adds support for CI / CD code management 130 131 = 0.2.1 = 132 133 * Bumps compatibility to 5.1. 134 * Adds uninstall file. 135 136 = 0.2 = 137 138 * Adds noindex tag to the staging site.
Note: See TracChangeset
for help on using the changeset viewer.