if ($authorization === 'success' && $is_authorized) { ?> <div class="updated"><p>Authorized with Unbounce and WordPress domain successfully enabled.</p></div> <?php } elseif ($authorization === 'success') { ?> <div class="updated"><p>Successfully authorized with Unbounce.</p></div> <?php } elseif ($authorization === 'failure') { ?> <div class="error"><p>Sorry, there was an error authorizing with Unbounce. Please try again.</p></div> <?php } ?> <?php // Only show error if they've never authorized, otherwise it will be shown right away if (UBConfig::has_authorized() && $diagnostics_failed) { ?> <div class="error"> <p> We have identified a configuration issue with this Unbounce Pages Plugin and your WordPress configuration, please <a href="<?php echo admin_url('admin.php?page=unbounce-pages-diagnostics'); ?> ">click here</a> for more details. </p> </div> <?php }
public static function details($domain, $domain_info) { return array('PHP Version' => phpversion(), 'WordPress Version' => UBDiagnostics::wordpress_version(), 'Unbounce Plugin Version' => "1.0.15", 'Permalink Structure' => get_option('permalink_structure', ''), 'Domain' => $domain, 'Domain Authorized' => print_r(UBConfig::is_authorized_domain($domain), true), 'Has Authorized' => print_r(UBConfig::has_authorized(), true), 'Active Plugins' => print_r(get_option('active_plugins'), true), 'Plugin Details' => print_r(get_plugins(), true), 'Curl Version' => UBDiagnostics::curl_version(), 'Configuration Options' => print_r(ini_get_all(), true), 'Extensions' => print_r(get_loaded_extensions(), true), 'Operating System' => php_uname(), 'Checks' => print_r(UBDiagnostics::checks($domain, $domain_info), true), 'Options' => print_r(UBDiagnostics::ub_options(), true)); }
<?php echo '<div class="ub-plugin-wrapper>'; $is_authorized = UBConfig::is_authorized_domain($domain); $diagnostics_failed = in_array(false, UBDiagnostics::checks($domain, $domain_info)); echo UBTemplate::render('main_header', array('img_url' => plugins_url('img/unbounce-logo-blue.png', __FILE__), 'is_authorized' => $is_authorized, 'authorization' => UBUtil::get_flash('authorization'), 'diagnostics_failed' => $diagnostics_failed)); if ($is_authorized) { $proxyable_url_set = UBUtil::array_fetch($domain_info, 'proxyable_url_set', array()); $proxyable_url_set_fetched_at = UBUtil::array_fetch($domain_info, 'proxyable_url_set_fetched_at'); $last_refreshed = UBUtil::time_ago($proxyable_url_set_fetched_at); echo UBTemplate::render('main_authorized', array('domain' => $domain, 'proxyable_url_set' => $proxyable_url_set, 'last_refreshed' => $last_refreshed)); add_action('in_admin_footer', function () { echo UBTemplate::render('main_authorized_footer'); }); } else { if (UBConfig::has_authorized()) { // They've attempted to authorize, but this domain isn't in the list echo UBTemplate::render('main_failed_authorization', array('domain' => $domain)); } else { echo UBTemplate::render('main_unauthorized', array('domain' => $domain)); } add_action('in_admin_footer', function () { echo UBTemplate::render('main_unauthorized_footer'); }); } echo '</div>';