Plugin Directory

Changeset 2054205


Ignore:
Timestamp:
03/20/2019 07:11:15 PM (7 years ago)
Author:
ryanshoover
Message:

Tagging 0.3.1

Location:
safe-staging
Files:
30 added
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • safe-staging/tags/0.3.1/README.md

    r2032951 r2054205  
     1[![CircleCI](https://circleci.com/gh/ryanshoover/safe-staging/tree/master.svg?style=svg)](https://circleci.com/gh/ryanshoover/safe-staging/tree/master)
     2
    13# Safe Staging
    24
     
    39413. Set the URL for your production site at `/wp-admin/options-general.php?page=safe-staging`
    4042
    41 ## Hooks and Filters
     43## Frequently Asked Questions
     44
     45### Can I complicate how the plugin determines what the production URL is?
     46
     47The filter `safe_staging_is_production` will let you change what the plugin sees as the production site.
     48For example, the filter below will let you support an alternative production URL.
    4249
    4350```php
     
    4754 *
    4855 * @param bool $is_prod Is this the production site.
     56 * @return bool         Whether we should treat this as an alternative production site.
    4957 */
    50 apply_filters( 'safe_staging_is_production', $is_prod );
     58add_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);
    5170```
     71
     72= Can I let other emails get sent on staging sites? =
     73
     74The filter `safe_staging_is_whitelist_email` will let you intervene just before an email is blocked.
     75For example, the filter below will let you support an alternative production URL.
    5276
    5377```php
     
    5579 * Determine whether a particular email should be sent.
    5680 *
     81 * In this case we test if the to recipient is our admin address.
     82 *
    5783 * @param bool   $whitelisted Should the email actually send.
    5884 * @param object $this        Instance of the Fake PHPMailer class.
     85 * @return bool               Whitelist value tested against the recipient.
    5986 */
    60 apply_filters( 'safe_staging_is_whitelist_email', $whitelisted, $this );
     87add_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);
    6199```
     100
     101= Can I change the message that shows on the checkout page? =
     102
     103The filter `safe_staging_checkout_notice` will let you override the message shown on the cart and checkout pages.
    62104
    63105```php
     
    66108 * of staging sites.
    67109 *
    68  * @param string $notice HTML of the message to be shown.
     110 * @return string New message to show on the checkout page.
    69111 */
    70 apply_filters( 'safe_staging_checkout_notice', $notice );
     112add_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)
    71118```
     119
     120== Upgrade notice ==
     121
     122None 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  
    2929     */
    3030    public function do_admin_notices() {
     31        $screen             = get_current_screen();
    3132        $prod_url           = production_url();
    3233        $is_setup_dismissed = get_user_meta( get_current_user_id(), SLUG . '_notice_setup_dismiss' );
    3334
    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;
    3641        }
    3742
    3843        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;
    4051        }
    4152    }
  • safe-staging/tags/0.3.1/readme.txt

    r2032951 r2054205  
    55Tested up to: 5.1
    66Requires PHP: 7.0
     7Stable tag: trunk
    78License: GPL3
    89License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
     
    1112
    1213== Description ==
     14
     15[![CircleCI](https://circleci.com/gh/ryanshoover/safe-staging/tree/master.svg?style=svg)](https://circleci.com/gh/ryanshoover/safe-staging/tree/master)
    1316
    1417Simply 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.
     
    31343. Set the URL for your production site at `/wp-admin/options-general.php?page=safe-staging`
    3235
    33 == Hooks and Filters ==
    3436
    35 ```php
     37== Frequently Asked Questions ==
     38
     39= Can I complicate how the plugin determines what the production URL is? ==
     40
     41The filter `safe_staging_is_production` will let you change what the plugin sees as the production site.
     42For example, the filter below will let you support an alternative production URL.
     43
     44<code>
    3645/**
    3746 * Change whether Safe Staging thinks the current site
     
    3948 *
    4049 * @param bool $is_prod Is this the production site.
     50 * @return bool         Whether we should treat this as an alternative production site.
    4151 */
    42 apply_filters( 'safe_staging_is_production', $is_prod );
    43 ```
     52add_filter(
     53    'safe_staging_is_production',
     54    function( $is_prod ) {
     55        $alternative_prod_url = 'https://myothersite.com';
    4456
    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
     68The filter `safe_staging_is_whitelist_email` will let you intervene just before an email is blocked.
     69For example, the filter below will let you support an alternative production URL.
     70
     71<code>
    4672/**
    4773 * Determine whether a particular email should be sent.
    4874 *
     75 * In this case we test if the to recipient is our admin address.
     76 *
    4977 * @param bool   $whitelisted Should the email actually send.
    5078 * @param object $this        Instance of the Fake PHPMailer class.
     79 * @return bool               Whitelist value tested against the recipient.
    5180 */
    52 apply_filters( 'safe_staging_is_whitelist_email', $whitelisted, $this );
    53 ```
     81add_filter(
     82    'safe_staging_is_whitelist_email'
     83    function( $whitelisted, $phpmailer ) {
     84        if ( 'admin@mysite.com' === $phpmailer->getToAddresses() ) {
     85            $whitelisted = true;
     86        }
    5487
    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
     97The filter `safe_staging_checkout_notice` will let you override the message shown on the cart and checkout pages.
     98
     99<code>
    56100/**
    57101 * Change the warning message that gets displayed on the checkout page
    58102 * of staging sites.
    59103 *
    60  * @param string $notice HTML of the message to be shown.
     104 * @return string New message to show on the checkout page.
    61105 */
    62 apply_filters( 'safe_staging_checkout_notice', $notice );
    63 ```
     106add_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
     117None 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[![CircleCI](https://circleci.com/gh/ryanshoover/safe-staging/tree/master.svg?style=svg)](https://circleci.com/gh/ryanshoover/safe-staging/tree/master)
     2
    13# Safe Staging
    24
     
    39413. Set the URL for your production site at `/wp-admin/options-general.php?page=safe-staging`
    4042
    41 ## Hooks and Filters
     43## Frequently Asked Questions
     44
     45### Can I complicate how the plugin determines what the production URL is?
     46
     47The filter `safe_staging_is_production` will let you change what the plugin sees as the production site.
     48For example, the filter below will let you support an alternative production URL.
    4249
    4350```php
     
    4754 *
    4855 * @param bool $is_prod Is this the production site.
     56 * @return bool         Whether we should treat this as an alternative production site.
    4957 */
    50 apply_filters( 'safe_staging_is_production', $is_prod );
     58add_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);
    5170```
     71
     72= Can I let other emails get sent on staging sites? =
     73
     74The filter `safe_staging_is_whitelist_email` will let you intervene just before an email is blocked.
     75For example, the filter below will let you support an alternative production URL.
    5276
    5377```php
     
    5579 * Determine whether a particular email should be sent.
    5680 *
     81 * In this case we test if the to recipient is our admin address.
     82 *
    5783 * @param bool   $whitelisted Should the email actually send.
    5884 * @param object $this        Instance of the Fake PHPMailer class.
     85 * @return bool               Whitelist value tested against the recipient.
    5986 */
    60 apply_filters( 'safe_staging_is_whitelist_email', $whitelisted, $this );
     87add_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);
    6199```
     100
     101= Can I change the message that shows on the checkout page? =
     102
     103The filter `safe_staging_checkout_notice` will let you override the message shown on the cart and checkout pages.
    62104
    63105```php
     
    66108 * of staging sites.
    67109 *
    68  * @param string $notice HTML of the message to be shown.
     110 * @return string New message to show on the checkout page.
    69111 */
    70 apply_filters( 'safe_staging_checkout_notice', $notice );
     112add_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)
    71118```
     119
     120== Upgrade notice ==
     121
     122None 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  
    2929     */
    3030    public function do_admin_notices() {
     31        $screen             = get_current_screen();
    3132        $prod_url           = production_url();
    3233        $is_setup_dismissed = get_user_meta( get_current_user_id(), SLUG . '_notice_setup_dismiss' );
    3334
    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;
    3641        }
    3742
    3843        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;
    4051        }
    4152    }
  • safe-staging/trunk/readme.txt

    r2032951 r2054205  
    55Tested up to: 5.1
    66Requires PHP: 7.0
     7Stable tag: trunk
    78License: GPL3
    89License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
     
    1112
    1213== Description ==
     14
     15[![CircleCI](https://circleci.com/gh/ryanshoover/safe-staging/tree/master.svg?style=svg)](https://circleci.com/gh/ryanshoover/safe-staging/tree/master)
    1316
    1417Simply 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.
     
    31343. Set the URL for your production site at `/wp-admin/options-general.php?page=safe-staging`
    3235
    33 == Hooks and Filters ==
    3436
    35 ```php
     37== Frequently Asked Questions ==
     38
     39= Can I complicate how the plugin determines what the production URL is? ==
     40
     41The filter `safe_staging_is_production` will let you change what the plugin sees as the production site.
     42For example, the filter below will let you support an alternative production URL.
     43
     44<code>
    3645/**
    3746 * Change whether Safe Staging thinks the current site
     
    3948 *
    4049 * @param bool $is_prod Is this the production site.
     50 * @return bool         Whether we should treat this as an alternative production site.
    4151 */
    42 apply_filters( 'safe_staging_is_production', $is_prod );
    43 ```
     52add_filter(
     53    'safe_staging_is_production',
     54    function( $is_prod ) {
     55        $alternative_prod_url = 'https://myothersite.com';
    4456
    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
     68The filter `safe_staging_is_whitelist_email` will let you intervene just before an email is blocked.
     69For example, the filter below will let you support an alternative production URL.
     70
     71<code>
    4672/**
    4773 * Determine whether a particular email should be sent.
    4874 *
     75 * In this case we test if the to recipient is our admin address.
     76 *
    4977 * @param bool   $whitelisted Should the email actually send.
    5078 * @param object $this        Instance of the Fake PHPMailer class.
     79 * @return bool               Whitelist value tested against the recipient.
    5180 */
    52 apply_filters( 'safe_staging_is_whitelist_email', $whitelisted, $this );
    53 ```
     81add_filter(
     82    'safe_staging_is_whitelist_email'
     83    function( $whitelisted, $phpmailer ) {
     84        if ( 'admin@mysite.com' === $phpmailer->getToAddresses() ) {
     85            $whitelisted = true;
     86        }
    5487
    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
     97The filter `safe_staging_checkout_notice` will let you override the message shown on the cart and checkout pages.
     98
     99<code>
    56100/**
    57101 * Change the warning message that gets displayed on the checkout page
    58102 * of staging sites.
    59103 *
    60  * @param string $notice HTML of the message to be shown.
     104 * @return string New message to show on the checkout page.
    61105 */
    62 apply_filters( 'safe_staging_checkout_notice', $notice );
    63 ```
     106add_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
     117None 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.