diff options
Diffstat (limited to 'Postman/Postman-Controller')
4 files changed, 0 insertions, 553 deletions
diff --git a/Postman/Postman-Controller/PostmanAdminPointer.php b/Postman/Postman-Controller/PostmanAdminPointer.php deleted file mode 100644 index a05376b..0000000 --- a/Postman/Postman-Controller/PostmanAdminPointer.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -if ( ! defined( 'ABSPATH' ) ) { - exit; // Exit if accessed directly -} - -if (! class_exists ( 'PostmanAdminPointer' )) { - - /** - * From http://code.tutsplus.com/articles/integrating-with-wordpress-ui-admin-pointers--wp-26853 - * - * @author jasonhendriks - * - */ - class PostmanAdminPointer { - private $logger; - private $rootPluginFilenameAndPath; - - /** - * - * @param mixed $rootPluginFilenameAndPath - */ - function __construct($rootPluginFilenameAndPath) { - $this->logger = new PostmanLogger ( get_class ( $this ) ); - $this->rootPluginFilenameAndPath = $rootPluginFilenameAndPath; - - // Don't run on WP < 3.3 - if (get_bloginfo ( 'version' ) < '3.3' || true) - return; - - add_action ( 'admin_enqueue_scripts', array ( - $this, - 'wptuts_pointer_load' - ), 1000 ); - add_filter ( 'postman_admin_pointers-settings_page_postman', array ( - $this, - 'wptuts_register_pointer_testing' - ) ); - } - - /** - * - * @param mixed $hook_suffix - */ - function wptuts_pointer_load($hook_suffix) { - // only do this for administrators - if (PostmanUtils::isAdmin ()) { - $this->logger->trace ( 'wptuts' ); - - $screen = get_current_screen (); - $screen_id = $screen->id; - - // Get pointers for this screen - $pointers = apply_filters ( 'postman_admin_pointers-' . $screen_id, array () ); - - if (! $pointers || ! is_array ( $pointers )) - return; - - // Get dismissed pointers - $dismissed = explode ( ',', ( string ) get_user_meta ( get_current_user_id (), 'dismissed_wp_pointers', true ) ); - $this->logger->trace ( $dismissed ); - $valid_pointers = array (); - - // Check pointers and remove dismissed ones. - foreach ( $pointers as $pointer_id => $pointer ) { - - // Sanity check - if (in_array ( $pointer_id, $dismissed ) || empty ( $pointer ) || empty ( $pointer_id ) || empty ( $pointer ['target'] ) || empty ( $pointer ['options'] )) - continue; - - $pointer ['pointer_id'] = $pointer_id; - - // Add the pointer to $valid_pointers array - $valid_pointers ['pointers'] [] = $pointer; - } - - // No valid pointers? Stop here. - if (empty ( $valid_pointers )) { - return; - } - - // Add pointers style to queue. - wp_enqueue_style ( 'wp-pointer' ); - - // Add pointers script to queue. Add custom script. - wp_enqueue_script ( 'postman_admin_pointer', plugins_url ( 'script/postman-admin-pointer.js', $this->rootPluginFilenameAndPath ), array ( - 'wp-pointer' - ) ); - - // Add pointer options to script. - wp_localize_script ( 'postman_admin_pointer', 'postman_admin_pointer', $valid_pointers ); - $this->logger->trace ( 'out wptuts' ); - } - } - function wptuts_register_pointer_testing($p) { - // only do this for administrators - if (PostmanUtils::isAdmin () && false) { - $p ['postman16_log'] = array ( - 'target' => '.configure_manually', - 'options' => array ( - 'content' => '', - 'position' => array ( - 'edge' => 'top', - 'align' => 'left' - ) - ) - ); - return $p; - } - } - } -} diff --git a/Postman/Postman-Controller/PostmanDashboardWidgetController.php b/Postman/Postman-Controller/PostmanDashboardWidgetController.php deleted file mode 100644 index 8f6bae6..0000000 --- a/Postman/Postman-Controller/PostmanDashboardWidgetController.php +++ /dev/null @@ -1,161 +0,0 @@ -<?php -if ( ! defined( 'ABSPATH' ) ) { - exit; // Exit if accessed directly -} - -if (! class_exists ( "PostmanDashboardWidgetController" )) { - - // - class PostmanDashboardWidgetController { - private $rootPluginFilenameAndPath; - private $options; - private $authorizationToken; - private $wpMailBinder; - - /** - * Start up - */ - public function __construct($rootPluginFilenameAndPath, PostmanOptions $options, PostmanOAuthToken $authorizationToken, PostmanWpMailBinder $binder) { - assert ( ! empty ( $rootPluginFilenameAndPath ) ); - assert ( ! empty ( $options ) ); - assert ( ! empty ( $authorizationToken ) ); - assert ( ! empty ( $binder ) ); - $this->rootPluginFilenameAndPath = $rootPluginFilenameAndPath; - $this->options = $options; - $this->authorizationToken = $authorizationToken; - $this->wpMailBinder = $binder; - - add_action ( 'wp_dashboard_setup', array ( - $this, - 'addDashboardWidget' - ) ); - - add_action ( 'wp_network_dashboard_setup', array ( - $this, - 'addNetworkDashboardWidget' - ) ); - - // dashboard glance mod - if ($this->options->isMailLoggingEnabled ()) { - add_filter ( 'dashboard_glance_items', array ( - $this, - 'customizeAtAGlanceDashboardWidget' - ), 10, 1 ); - } - - // Postman API: register the human-readable plugin state - add_filter ( 'print_postman_status', array ( - $this, - 'print_postman_status' - ) ); - } - - /** - * Add a widget to the dashboard. - * - * This function is hooked into the 'wp_dashboard_setup' action below. - */ - public function addDashboardWidget() { - // only display to the widget to administrator - if (PostmanUtils::isAdmin ()) { - wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', 'post-smtp' ), array ( - $this, - 'printDashboardWidget' - ) ); // Display function. - } - } - - /** - * Add a widget to the network dashboard - */ - public function addNetworkDashboardWidget() { - // only display to the widget to administrator - if (PostmanUtils::isAdmin ()) { - wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', 'post-smtp' ), array ( - $this, - 'printNetworkDashboardWidget' - ) ); // Display function. - } - } - - /** - * Create the function to output the contents of our Dashboard Widget. - */ - public function printDashboardWidget() { - $goToSettings = sprintf ( '<a href="%s">%s</a>', PostmanUtils::getSettingsPageUrl (), __ ( 'Settings', 'post-smtp' ) ); - $goToEmailLog = sprintf ( '%s', _x ( 'Email Log', 'The log of Emails that have been delivered', 'post-smtp' ) ); - if ($this->options->isMailLoggingEnabled ()) { - $goToEmailLog = sprintf ( '<a href="%s">%s</a>', PostmanUtils::getEmailLogPageUrl (), $goToEmailLog ); - } - apply_filters ( 'print_postman_status', null ); - printf ( '<p>%s | %s</p>', $goToEmailLog, $goToSettings ); - } - - /** - * Print the human-readable plugin state - */ - public function print_postman_status() { - if (! PostmanPreRequisitesCheck::isReady ()) { - printf ( '<p><span style="color:red">%s</span></p>', __ ( 'Error: Postman is missing a required PHP library.', 'post-smtp' ) ); - } else if ($this->wpMailBinder->isUnboundDueToException ()) { - printf ( '<p><span style="color:red">%s</span></p>', __ ( 'Postman: wp_mail has been declared by another plugin or theme, so you won\'t be able to use Postman until the conflict is resolved.', 'post-smtp' ) ); - } else { - if ($this->options->getRunMode () != PostmanOptions::RUN_MODE_PRODUCTION) { - printf ( '<p><span style="background-color:yellow">%s</span></p>', __ ( 'Postman is in <em>non-Production</em> mode and is dumping all emails.', 'post-smtp' ) ); - } else if (PostmanTransportRegistry::getInstance ()->getSelectedTransport ()->isConfiguredAndReady ()) { - printf ( '<p class="wp-menu-image dashicons-before dashicons-email"> %s </p>', sprintf ( _n ( '<span style="color:green">Postman is configured</span> and has delivered <span style="color:green">%d</span> email.', '<span style="color:green">Postman is configured</span> and has delivered <span style="color:green">%d</span> emails.', PostmanState::getInstance ()->getSuccessfulDeliveries (), 'post-smtp' ), PostmanState::getInstance ()->getSuccessfulDeliveries () ) ); - } else { - printf ( '<p><span style="color:red">%s</span></p>', __ ( 'Postman is <em>not</em> configured and is mimicking out-of-the-box WordPress email delivery.', 'post-smtp' ) ); - } - $currentTransport = PostmanTransportRegistry::getInstance ()->getActiveTransport (); - $deliveryDetails = $currentTransport->getDeliveryDetails ( $this->options ); - printf ( '<p>%s</p>', $deliveryDetails ); - } - } - - /** - * Create the function to output the contents of our Dashboard Widget. - */ - public function printNetworkDashboardWidget() { - printf ( '<p class="wp-menu-image dashicons-before dashicons-email"> %s</p>', __ ( 'Postman is operating in per-site mode.', 'post-smtp' ) ); - } - - /** - * From http://www.hughlashbrooke.com/2014/02/wordpress-add-items-glance-widget/ - * http://coffeecupweb.com/how-to-add-custom-post-types-to-at-a-glance-dashboard-widget-in-wordpress/ - * - * @param mixed $items - * @return string - */ - function customizeAtAGlanceDashboardWidget($items = array()) { - // only modify the At-a-Glance for administrators - if (PostmanUtils::isAdmin ()) { - $post_types = array ( - PostmanEmailLogPostType::POSTMAN_CUSTOM_POST_TYPE_SLUG - ); - - foreach ( $post_types as $type ) { - - if (! post_type_exists ( $type )) - continue; - - $num_posts = wp_count_posts ( $type ); - - if ($num_posts) { - - $published = intval ( $num_posts->publish ); - $privated = intval ( $num_posts->private ); - $post_type = get_post_type_object ( $type ); - - $text = _n ( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $privated, 'post-smtp' ); - $text = sprintf ( $text, number_format_i18n ( $privated ) ); - - $items [] = sprintf ( '<a class="%1$s-count" href="%3$s">%2$s</a>', $type, $text, PostmanUtils::getEmailLogPageUrl () ) . "\n"; - } - } - - return $items; - } - } - } -}
\ No newline at end of file diff --git a/Postman/Postman-Controller/PostmanManageConfigurationAjaxHandler.php b/Postman/Postman-Controller/PostmanManageConfigurationAjaxHandler.php deleted file mode 100644 index 82472c3..0000000 --- a/Postman/Postman-Controller/PostmanManageConfigurationAjaxHandler.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -if ( ! defined( 'ABSPATH' ) ) { - exit; // Exit if accessed directly -} - -class PostmanWizardSocket { - - // these variables are populated by the Port Test - public $hostname; - public $hostnameDomainOnly; - public $port; - public $protocol; - public $secure; - public $mitm; - public $reportedHostname; - public $reportedHostnameDomainOnly; - public $message; - public $startTls; - public $authPlain; - public $auth_login; - public $auth_crammd5; - public $auth_xoauth; - public $auth_none; - public $try_smtps; - public $success; - public $transport; - - // these variables are populated by The Transport Recommenders - public $label; - public $id; - - /** - * - * @param mixed $queryHostData - */ - function __construct($queryHostData) { - $this->hostname = $queryHostData ['hostname']; - $this->hostnameDomainOnly = $queryHostData ['hostname_domain_only']; - $this->port = $queryHostData ['port']; - $this->protocol = $queryHostData ['protocol']; - $this->secure = PostmanUtils::parseBoolean ( $queryHostData ['secure'] ); - $this->mitm = PostmanUtils::parseBoolean ( $queryHostData ['mitm'] ); - $this->reportedHostname = $queryHostData ['reported_hostname']; - $this->reportedHostnameDomainOnly = $queryHostData ['reported_hostname_domain_only']; - $this->message = $queryHostData ['message']; - $this->startTls = PostmanUtils::parseBoolean ( $queryHostData ['start_tls'] ); - $this->authPlain = PostmanUtils::parseBoolean ( $queryHostData ['auth_plain'] ); - $this->auth_login = PostmanUtils::parseBoolean ( $queryHostData ['auth_login'] ); - $this->auth_crammd5 = PostmanUtils::parseBoolean ( $queryHostData ['auth_crammd5'] ); - $this->auth_xoauth = PostmanUtils::parseBoolean ( $queryHostData ['auth_xoauth'] ); - $this->auth_none = PostmanUtils::parseBoolean ( $queryHostData ['auth_none'] ); - $this->try_smtps = PostmanUtils::parseBoolean ( $queryHostData ['try_smtps'] ); - $this->success = PostmanUtils::parseBoolean ( $queryHostData ['success'] ); - $this->transport = $queryHostData ['transport']; - assert ( ! empty ( $this->transport ) ); - $this->id = sprintf ( '%s_%s', $this->hostname, $this->port ); - } -} - diff --git a/Postman/Postman-Controller/PostmanWelcomeController.php b/Postman/Postman-Controller/PostmanWelcomeController.php deleted file mode 100644 index e37d3e8..0000000 --- a/Postman/Postman-Controller/PostmanWelcomeController.php +++ /dev/null @@ -1,222 +0,0 @@ -<?php -if ( ! defined( 'ABSPATH' ) ) { - exit; // Exit if accessed directly -} - -class PostmanWelcomeController { - - private $rootPluginFilenameAndPath, $pluginUrl, $version; - - public function __construct( $rootPluginFilenameAndPath ) { - $this->rootPluginFilenameAndPath = $rootPluginFilenameAndPath; - $this->pluginUrl = plugins_url( 'style', $rootPluginFilenameAndPath ); - $this->version = PostmanState::getInstance()->getVersion(); - - add_action( 'admin_menu', array( $this, 'add_menus' ) ); - add_action( 'admin_head', array( $this, 'admin_head' ) ); - } - - public function add_menus() { - - if ( current_user_can( 'manage_options' ) ) { - - // About - add_dashboard_page( - __( 'Welcome', 'post-smtp' ), - __( 'Welcome', 'post-smtp' ), - 'manage_options', - 'post-about', - array( $this, 'about_screen' ) - ); - - // Credits - add_dashboard_page( - __( 'Credits', 'post-smtp' ), - __( 'Credits', 'post-smtp' ), - 'manage_options', - 'post-credits', - array( $this, 'credits_screen' ) - ); - - // add_action( 'admin_print_styles-' . $page, array( $this, 'postman_about_enqueue_resources' ) ); - } - } - - public function admin_head() { - remove_submenu_page( 'index.php', 'post-about' ); - remove_submenu_page( 'index.php', 'post-credits' ); - } - - public function postman_about_enqueue_resources() { - // wp_enqueue_style( 'font-awsome', '' ); - } - - - public function about_screen() { - ?> - <style type="text/css"> - .post-badge { - position: absolute; - top: 0; - right: 0; - padding-top: 142px; - height: 50px; - width: 140px; - color: #000; - font-weight: bold; - font-size: 14px; - text-align: center; - margin: 0 -5px; - background: url( <?php echo $this->pluginUrl; ?>/images/badge.png) no-repeat; - } - - .about-wrap [class$="-col"] { - flex-wrap: nowrap !important; - } - </style> - <div class="wrap about-wrap"> - <h1><?php printf( esc_html__( 'Welcome to Post SMTP %s', 'post-smtp' ), $this->version ); ?></h1> - <div class="about-text"><?php printf( esc_html__( 'Thank you for updating! Post SMTP %s is bundled up and ready to take your SMTP needs to the next level!', 'post-smtp' ), $this->version ); ?><br> - <?php printf( '<strong>%s</strong>','Post SMTP support every SMTP service: Gmail/G-suite, SendGrid, Mandrill, Office365, and more...' ); ?> - </div> - <div class="post-badge"><?php printf( esc_html__( 'Version %s', 'post-smtp' ), $this->version ); ?></div> - - <h2 class="nav-tab-wrapper"> - <a class="nav-tab nav-tab-active" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-about' ), 'index.php' ) ) ); ?>"> - <?php esc_html_e( 'What’s New', 'post-smtp' ); ?> - </a><a class="nav-tab" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-credits' ), 'index.php' ) ) ); ?>"> - <?php esc_html_e( 'Credits', 'post-smtp' ); ?> - </a> - </h2> - - <div class="changelog"> - <h3><?php esc_html_e( 'Email Log', 'post-smtp' ); ?></h3> - - <div class="feature-section col two-col"> - <div class="last-feature"> - <h4><?php esc_html_e( 'Email log filter', 'post-smtp' ); ?></h4> - <p> - <?php esc_html_e( 'You can easily filter by dates and search in your log.', 'post-smtp' ); ?> - <img src="<?php echo $this->pluginUrl; ?>/images/filter-preview.gif"> - </p> - </div> - - <div> - <h4><?php esc_html_e( 'Multiple emails resend', 'post-smtp' ); ?></h4> - <p> - <?php esc_html_e( 'Resend any email to the original recipient or any other emails you choose.', 'post-smtp' ); ?> - <img src="<?php echo $this->pluginUrl; ?>/images/resend-preview.gif"> - </p> - </div> - </div> - </div> - - <div class="changelog"> - <h3><?php esc_html_e( 'The best delivery experience', 'post-smtp' ); ?></h3> - - <div class="feature-section col one-col"> - <div class="last-feature"> - <p><?php esc_html_e( 'Easy-to-use, powerful Setup Wizard for perfect configuration, - Commercial-grade Connectivity Tester to diagnose server issues, - Log and resend all emails; see the exact cause of failed emails, - Supports International alphabets, HTML Mail and MultiPart/Alternative, - Supports forced recipients (cc, bcc, to) and custom email headers, - SASL Support: Plain/Login/CRAM-MD5/XOAUTH2 authentication, - Security Support: SMTPS and STARTTLS (SSL/TLS), - Copy configuration to other instances of Post.', 'post-smtp' ); ?></p> - </div> - </div> - - <div class="feature-section col three-col"> - <div> - <h4><?php esc_html_e( 'Email log HTML preview', 'post-smtp' ); ?></h4> - <p><?php esc_html_e( 'You can now see sent emails as HTML.', 'post-smtp' ); ?></p> - </div> - - <div> - <h4><?php esc_html_e( 'Continues email delivery', 'post-smtp' ); ?></h4> - <p><?php esc_html_e( 'if email fail to sent you will get notified using the local mail system.', 'post-smtp' ); ?></p> - </div> - - <div class="last-feature"> - <h4><?php esc_html_e( 'The best debugging tools.', 'post-smtp' ); ?></h4> - <p><?php esc_html_e( 'Full Transcripts, Connectivity Test, Diagnostic Test.', 'post-smtp' ); ?></p> - </div> - </div> - </div> - - <div class="return-to-dashboard"> - <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'postman' ), 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Go to Post SMTP Settings', 'post-smtp' ); ?></a> - </div> - - </div> - - <?php - } - - public function credits_screen() { - ?> - <style type="text/css"> - .post-badge { - position: absolute; - top: 0; - right: 0; - padding-top: 142px; - height: 50px; - width: 140px; - color: #000; - font-weight: bold; - font-size: 14px; - text-align: center; - margin: 0 -5px; - background: url( <?php echo $this->pluginUrl; ?>/images/badge.png) no-repeat; - } - </style> - <div class="wrap about-wrap"> - <h1><?php printf( esc_html__( 'Welcome to Post SMTP %s', 'post-smtp' ), $this->version ); ?></h1> - <div class="about-text"><?php printf( esc_html__( 'Thank you for updating! bbPress %s is waxed, polished, and ready for you to take it for a lap or two around the block!', 'post-smtp' ), $this->version ); ?></div> - <div class="post-badge"><?php printf( esc_html__( 'Version %s', 'post-smtp' ), $this->version ); ?></div> - - <h2 class="nav-tab-wrapper"> - <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-about' ), 'index.php' ) ) ); ?>" class="nav-tab"> - <?php esc_html_e( 'What’s New', 'post-smtp' ); ?> - </a><a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-credits' ), 'index.php' ) ) ); ?>" class="nav-tab nav-tab-active"> - <?php esc_html_e( 'Credits', 'post-smtp' ); ?> - </a> - </h2> - - <p class="about-description"><?php esc_html_e( 'Post SMTP started by Jason Hendriks, Jason left the project and Yehuda Hassine (me) continue his work.', 'post-smtp' ); ?></p> - - <h4 class="wp-people-group"><?php esc_html_e( 'Project Leaders', 'post-smtp' ); ?></h4> - <ul class="wp-people-group " id="wp-people-group-project-leaders"> - <li class="wp-person" id="wp-person-jasonhendriks"> - <a href="https://profiles.wordpress.org/jasonhendriks"><img src="https://secure.gravatar.com/avatar/8692c7b6084517a592f6cad107f7bcb0?s=60&d=mm&r=g" class="gravatar" alt="Jason Hendriks " /></a> - <a class="web" href="http://profiles.wordpress.org/matt">Jason Hendriks</a> - <span class="title"><?php esc_html_e( 'Founding Developer (abandoned)', 'post-smtp' ); ?></span> - </li> - <li class="wp-person" id="wp-person-yehudah"> - <a href="http://profiles.wordpress.org/yehudah"><img src="https://secure.gravatar.com/avatar/c561638d04ea8fef351f974dbb9ece39?s=60&d=mm&r=g" class="gravatar" alt="Yehuda Hassine" /></a> - <a class="web" href="http://profiles.wordpress.org/yehudah">Yehuda Hassine</a> - <span class="title"><?php esc_html_e( 'Lead Developer', 'post-smtp' ); ?></span> - </li> - </ul> - - <h4 class="wp-people-group"><?php esc_html_e( 'Top Community Members', 'post-smtp' ); ?></h4> - <h5><?php esc_html_e( 'Here I will list top users that help Post SMTP grow (bugs, features, etc...)', 'post-smtp' ); ?> - <p class="wp-credits-list"> - <a href="http://profiles.wordpress.org/diegocanal">diegocanal</a>, - <a href="http://profiles.wordpress.org/jyourstone">Johan Yourstone</a>, - <a href="http://profiles.wordpress.org/bodhirayo">bodhirayo</a>, - <a href="http://profiles.wordpress.org/buzztone">Neil Murray </a>, - <a href="#">A place waiting for you? :-) </a> - </p> - - <div class="return-to-dashboard"> - <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'postman' ), 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Go to Post SMTP Settings', 'post-smtp' ); ?></a> - </div> - - </div> - - <?php - } -} |