Jetpack::show_development_mode_notice PHP Method

show_development_mode_notice() public static method

Mirrors the checks made in Jetpack::is_development_mode
public static show_development_mode_notice ( )
    public static function show_development_mode_notice()
    {
        if (Jetpack::is_development_mode()) {
            if (defined('JETPACK_DEV_DEBUG') && JETPACK_DEV_DEBUG) {
                $notice = sprintf(__('In <a href="%s" target="_blank">Development Mode</a>, via the JETPACK_DEV_DEBUG constant being defined in wp-config.php or elsewhere.', 'jetpack'), 'https://jetpack.com/support/development-mode/');
            } elseif (site_url() && false === strpos(site_url(), '.')) {
                $notice = sprintf(__('In <a href="%s" target="_blank">Development Mode</a>, via site URL lacking a dot (e.g. http://localhost).', 'jetpack'), 'https://jetpack.com/support/development-mode/');
            } else {
                $notice = sprintf(__('In <a href="%s" target="_blank">Development Mode</a>, via the jetpack_development_mode filter.', 'jetpack'), 'https://jetpack.com/support/development-mode/');
            }
            echo '<div class="updated" style="border-color: #f0821e;"><p>' . $notice . '</p></div>';
        }
        // Throw up a notice if using a development version and as for feedback.
        if (Jetpack::is_development_version()) {
            /* translators: %s is a URL */
            $notice = sprintf(__('You are currently running a development version of Jetpack. <a href="%s" target="_blank">Submit your feedback</a>', 'jetpack'), 'https://jetpack.com/contact-support/beta-group/');
            echo '<div class="updated" style="border-color: #f0821e;"><p>' . $notice . '</p></div>';
        }
        // Throw up a notice if using staging mode
        if (Jetpack::is_staging_site()) {
            /* translators: %s is a URL */
            $notice = sprintf(__('You are running Jetpack on a <a href="%s" target="_blank">staging server</a>.', 'jetpack'), 'https://jetpack.com/support/staging-sites/');
            echo '<div class="updated" style="border-color: #f0821e;"><p>' . $notice . '</p></div>';
        }
    }

Usage Example

 /**
  * Handles the displaying of all sites on the network that are
  * dis/connected to Jetpack
  *
  * @since 2.9
  * @see   Jetpack_Network::jetpack_sites_list()
  */
 function network_admin_page()
 {
     global $current_site;
     $this->network_admin_page_header();
     $jp = Jetpack::init();
     // We should be, but ensure we are on the main blog
     switch_to_blog($current_site->blog_id);
     $main_active = $jp->is_active();
     restore_current_blog();
     // If we are in dev mode, just show the notice and bail
     if (Jetpack::is_development_mode()) {
         Jetpack::show_development_mode_notice();
         return;
     }
     /*
      * Ensure the main blog is connected as all other subsite blog
      * connections will feed off this one
      */
     if (!$main_active) {
         $url = $this->get_url(array('name' => 'subsiteregister', 'site_id' => 1));
         $data = array('url' => $jp->build_connect_url());
         Jetpack::init()->load_view('admin/must-connect-main-blog.php', $data);
         return;
     }
     require_once 'class.jetpack-network-sites-list-table.php';
     $myListTable = new Jetpack_Network_Sites_List_Table();
     echo '<div class="wrap"><h2>' . __('Sites', 'jetpack') . '</h2>';
     echo '<form method="post">';
     $myListTable->prepare_items();
     $myListTable->display();
     echo '</form></div>';
     $this->network_admin_page_footer();
 }
Jetpack