'error', 'information' => 'notice-warning', ); private static $dismissible_notices = array( 'welcome' => 'arlo-welcome-admin-notice', 'developer' => 'arlo-developer-admin-notice', 'webinar' => 'arlo-webinar-admin-notice', 'newpages' => 'arlo-newpages-admin-notice', 'wp_video' => 'arlo-wp-video', ); public function __construct($message_handler, $importer, $dbl) { $this->message_handler = $message_handler; $this->importer = $importer; $this->dbl = &$dbl; $this->settings = get_option('arlo_settings'); } public function global_notices() { $messages = array_merge($this->message_handler->get_messages('import_error', true), $this->message_handler->get_messages('error', true)); foreach ($messages as $message) { echo $this->create_notice($message); } } public function arlo_notices() { $messages = $this->message_handler->get_messages(null, false); foreach ($messages as $message) { echo $this->create_notice($message); } } public function create_notice($message) { $notice_type = (!empty($message->type) && isset(self::$message_notice_types[$message->type]) ? self::$message_notice_types[$message->type] : (!empty($message->type) ? $message->type : 'error')); $global_message = ''; if ($message->global) { $global_message = '
Arlo is connected to ' . $this->settings['platform_name'] . ' Last synchronized: ' . $this->importer->get_last_import_date() . ' UTC ' . (get_option('arlo_import_disabled', '0') != '1' ? 'Synchronize now' : '') . '
'; echo $this->create_notice($message); if (strtolower($this->settings['platform_name']) === \Arlo_For_Wordpress::DEFAULT_PLATFORM) { $message->class = 'updated'; $message->title = 'Connected to demo data'; $message->message = 'Your site is currently using demo event, presenter, and venue data. Start an Arlo trial to load your own events!
Get started with free Arlo trial Connect existing Arlo platform
'; echo $this->create_notice($message); } } public function permalink_notice() { $message_obj = $this->create_message_object( __("Permalink setting change required.", 'arlo-for-wordpress' ), '' . sprintf(__('Arlo for WordPress requires Permalinks to be set to "Post name".', 'arlo-for-wordpress' ), admin_url('options-permalink.php')) . '
', 'error notice'); echo $this->create_notice($message_obj); } public function plugin_disabled() { $message = '' . sprintf(__('The Arlo for WordPress plugin has been disabled, please check the System Requirements page'), '?page=arlo-for-wordpress#systemrequirements', 'arlo-pages-systemrequirements') . '
'; $message_obj = $this->create_message_object( __('Plugin disabled', 'arlo-for-wordpress'), $message, 'error', true, false); echo $this->create_notice($message_obj); } public function import_disabled() { $message = '' . sprintf(__('The import for the Arlo for WordPress plugin has been disabled, but the current existing data is still available. Please check the System Requirements page'), '?page=arlo-for-wordpress#systemrequirements', 'arlo-pages-systemrequirements') . '
'; $message_obj = $this->create_message_object( __('Import disabled', 'arlo-for-wordpress'), $message, 'error', true, false); echo $this->create_notice($message_obj); } public function posttype_notice() { $message_obj = $this->create_message_object( __("Page setup required.", 'arlo-for-wordpress' ), '' . __('Arlo for WordPress requires you to setup the pages which will host event information.', 'arlo-for-wordpress' ) .' '. sprintf(__('Setup pages', 'arlo-for-wordpress' ), admin_url('admin.php?page=arlo-for-wordpress#pages/events')) . '
' . sprintf(__('View documentation for more information.', 'arlo-for-wordpress' ), 'http://developer.arlo.co/doc/wordpress/index#pages-and-post-types') . '
', 'error notice'); echo $this->create_notice($message_obj); } public function welcome_notice() { $message = '' . __( 'Create beautiful and interactive training and event websites using the Arlo for WordPress plugin. Access an extensive library of WordPress Shortcodes, Templates, and Widgets, all designed specifically for web developers to make integration easy.', 'arlo-for-wordpress' ) . '
' . __('Learn how to use Arlo for WordPress or visit www.arlo.co to find out more about Arlo.', 'arlo-for-wordpress' ) . '
' . (empty($this->settings['platform_name']) ? '' . __('Try with demo data', 'arlo-for-wordpress' ) . ' ' : '') .'' . __('Get started with free trial', 'arlo-for-wordpress' ) . '
'; $message_obj = $this->create_message_object( __('Welcome to Arlo for WordPress', 'arlo-for-wordpress' ), $message, 'notice', true, true ); echo $this->create_user_notice('welcome', $message_obj); $this->wp_video_notice(); $this->load_demo_notice(!empty($_SESSION['arlo-demo']) ? $_SESSION['arlo-demo'] : []); $this->webinar_notice(); $this->developer_notice(); unset($_SESSION['arlo-import']); } public function developer_notice() { $message = '
' . __('Are you a web developer building a site for a client?', 'arlo-for-wordpress' ) . '
' . sprintf(__('Contact us to become an Arlo partner', 'arlo-for-wordpress' ), 'https://www.arlo.co/contact') . '
' . sprintf(__('Watch overview video', 'arlo-for-wordpress' ), 'https://www.arlo.co/videos#-uUhu90cvoc') . '
' . __('to see Arlo for WordPress in action.', 'arlo-for-wordpress' ) . '
' . __('Watch overview video', 'arlo-for-wordpress' ) .'
' . __('Jon Arlo for WordPress Getting started webinar on ', 'arlo-for-wordpress' ) . '
' . __('Register now! or view more times', 'arlo-for-wordpress' ) . '
' . sprintf(__('Couldn\'t set the following post types: %s', 'arlo-for-wordpress' ), implode(', ', $error)) . '
', 'error notice', false, true) ); } else { if ($meta !== '0') { if (!empty($this->settings['platform_name']) && $events !== false && $upcoming !== false && $presenters !== false && $venues !== false) { //Get the first event template wich has event $sql = " SELECT ID FROM {$this->dbl->prefix}arlo_events AS e LEFT JOIN {$this->dbl->prefix}arlo_eventtemplates AS et ON e.et_arlo_id = et.et_arlo_id AND e.import_id = " . $import_id ." LEFT JOIN {$this->dbl->prefix}posts ON et_post_id = ID AND post_status = 'publish' WHERE et.import_id = " . $import_id ." LIMIT 1 "; $event = $this->dbl->get_results($sql, ARRAY_A); $event_link = ''; if (count($event)) { $event_link = sprintf('%s,', get_post_permalink($event[0]['ID']), __('Event', 'arlo-for-wordpress' )); } //Get the first presenter $sql = " SELECT ID FROM {$this->dbl->prefix}arlo_presenters AS p LEFT JOIN {$this->dbl->prefix}posts ON p_post_id = ID AND post_status = 'publish' WHERE p.import_id = " . $import_id ." LIMIT 1 "; $presenter = $this->dbl->get_results($sql, ARRAY_A); $presenter_link = ''; if (count($event)) { $presenter_link = sprintf('%s,', get_post_permalink($presenter[0]['ID']), __('Presenter profile', 'arlo-for-wordpress' )); } //Get the first venue $sql = " SELECT ID FROM {$this->dbl->prefix}arlo_venues AS v LEFT JOIN {$this->dbl->prefix}posts ON v_post_id = ID AND post_status = 'publish' WHERE v.import_id = " . $import_id ." LIMIT 1 "; $venue = $this->dbl->get_results($sql, ARRAY_A); $venue_link = ''; if (count($event)) { $venue_link = sprintf('%s,', get_post_permalink($venue[0]['ID']), __('Venue information', 'arlo-for-wordpress' )); } echo $this->create_user_notice('newpages', $this->create_message_object( __('Start editing your new pages', 'arlo-for-wordpress' ), ''.sprintf(__('View %s %s, %s, %s %s %s or %s pages', 'arlo-for-wordpress' ), $event_link, $events->guid, __('Catalogue', 'arlo-for-wordpress' ), $upcoming->guid, $upcoming->post_title, $presenter_link, $presenters->guid, __('Presenters list', 'arlo-for-wordpress' ), $venue_link, $venues->guid, __('Venues list', 'arlo-for-wordpress' ) ) . '
' . __('Edit the page templates for each of these websites pages below.') . '
', 'notice', false, true) ); unset($_SESSION['arlo-demo']); } } } } }