Exemple #1
0
 /**
  * Display the Under Construction page
  */
 function render_underconstruction_page()
 {
     extract(seed_ucp_get_settings());
     if (!isset($status)) {
         $err = new WP_Error('error', __("Please enter your settings.", 'under-construction-wp'));
         echo $err->get_error_message();
         exit;
     }
     if (empty($_GET['seed_ucp_preview'])) {
         $_GET['seed_ucp_preview'] = false;
     }
     // Check if Preview
     $is_preview = false;
     if (isset($_GET['seed_ucp_preview']) && $_GET['seed_ucp_preview'] == 'true') {
         $is_preview = true;
     }
     // Exit if a custom login page
     if (empty($disable_default_excluded_urls)) {
         if (preg_match("/login|admin|dashboard|account/i", $_SERVER['REQUEST_URI']) > 0 && $is_preview == false) {
             return false;
         }
     }
     // Check if user is logged in.
     if ($is_preview === false) {
         if (is_user_logged_in()) {
             return false;
         }
     }
     // Finally check if we should show the Under Construction page.
     $this->underconstruction_rendered = true;
     // custom html
     if (!empty($custom_html)) {
         echo $custom_html;
         exit;
     }
     // set headers
     if ($status == '2') {
         header('HTTP/1.1 503 Service Temporarily Unavailable');
         header('Status: 503 Service Temporarily Unavailable');
         header('Retry-After: 86400');
         // retry in a day
         $csp4_maintenance_file = WP_CONTENT_DIR . "/maintenance.php";
         if (!empty($enable_maintenance_php) and file_exists($csp4_maintenance_file)) {
             include_once $csp4_maintenance_file;
             exit;
         }
     }
     // render template tags
     $template = $this->get_default_template();
     require_once SEED_UCP_PLUGIN_PATH . '/themes/default/functions.php';
     $template_tags = array('{Title}' => seed_ucp_title(), '{Privacy}' => seed_ucp_privacy(), '{Head}' => seed_ucp_head(), '{Description}' => seed_ucp_description(), '{Credit}' => seed_ucp_credit());
     echo strtr($template, $template_tags);
     exit;
 }
Exemple #2
0
function seed_ucp_credit()
{
    $o = seed_ucp_get_settings();
    extract($o);
    $output = '';
    if (!empty($footer_credit)) {
        $output = '<div id="seed-ucp-credit">';
        $output .= '<a target="_blank" href="http://www.seedprod.com/?utm_source=under-construction-credit-link&utm_medium=banner&utm_campaign=under-construction-plugin-credit-link"><img src="' . plugins_url('under-construction-wp', dirname('.')) . '/themes/default/images/seedprod-credit.png"></a>';
        $output .= '</div>';
    }
    return $output;
}
    load_plugin_textdomain('under-construction-wp', false, dirname(plugin_basename(__FILE__)) . '/languages/');
}
add_action('plugins_loaded', 'seed_ucp_load_textdomain');
/**
 * Upon activation of the plugin, see if we are running the required version and deploy theme in defined.
 *
 * @since 0.1.0
 */
function seed_ucp_activation()
{
    require_once 'inc/default-settings.php';
    add_option('seed_ucp_settings_content', unserialize($seed_ucp_settings_deafults['seed_ucp_settings_content']));
}
register_activation_hook(__FILE__, 'seed_ucp_activation');
/***************************************************************************
 * Load Required Files
 ***************************************************************************/
// Global
global $seed_ucp_settings;
require_once 'framework/get-settings.php';
$seed_ucp_settings = seed_ucp_get_settings();
require_once 'inc/class-seed-ucp.php';
add_action('plugins_loaded', array('SEED_UCP', 'get_instance'));
if (is_admin()) {
    // Admin Only
    require_once 'inc/config-settings.php';
    require_once 'framework/framework.php';
    add_action('plugins_loaded', array('SEED_UCP_ADMIN', 'get_instance'));
} else {
    // Public only
}