/** * Output page markup. * * @since 3.0.0 */ public function html() { // @todo pull data from simplecalendar.io to showcase add-ons $js_redirect = '<script type="text/javascript">'; $js_redirect .= 'window.location = "' . simcal_ga_campaign_url(simcal_get_url('add-ons'), 'core-plugin', 'plugin-submenu-link', true) . '"'; $js_redirect .= '</script>'; echo $js_redirect; }
/** * Newsletter signup form. * * @since 3.0.0 * * @return void */ function simcal_newsletter_signup() { if ($screen = simcal_is_admin_screen()) { global $current_user; wp_get_current_user(); $name = $current_user->user_firstname ? $current_user->user_firstname : ''; ?> <div id="simcal-drip" class="<?php echo $screen; ?> "> <div class="signup"> <p> <?php _e("Enter your name and email and we'll send you a coupon code for 20% off our Google Calendar Pro add-on.", 'google-calendar-events'); ?> </p> <p> <label for="simcal-drip-field-email"><?php _e('Your Email', 'google-calendar-events'); ?> </label><br /> <input type="email" id="simcal-drip-field-email" name="fields[email]" value="<?php echo $current_user->user_email; ?> " /> </p> <p> <label for="simcal-drip-field-first_name"><?php _e('First Name', 'google-calendar-events'); ?> </label><br /> <input type="text" id="simcal-drip-field-first_name" name="fields[first_name]" value="<?php echo $name; ?> " /> </p> <p class="textright"> <a href="#" id="simcal-drip-signup" class="button button-primary"><?php _e('Send me the coupon', 'google-calendar-events'); ?> </a> </p> <div class="textright"> <a href="<?php echo simcal_ga_campaign_url(simcal_get_url('gcal-pro'), 'core-plugin', 'sidebar-link'); ?> " target="_blank"><?php _e('Just take me to GCal Pro', 'google-calendar-events'); ?> </a> </div> </div> <div class="thank-you" style="display: none;"> <?php _e('Thank you!', 'google-calendar-events'); ?> </div> <div class="clear"> </div> </div> <?php } }
/** * Test a connection to Google Calendar API. * * @since 3.0.0 * * @param string $google_calendar_id * * @return true|string */ public function test_api_key_connection($google_calendar_id) { global $post; $post_id = isset($post->ID) ? $post->ID : 0; $feed = null; if ($feed_type = wp_get_object_terms($post_id, 'calendar_feed')) { $feed = sanitize_title(current($feed_type)->name); } $message = ''; $error = ''; $has_errors = false; $message .= '<p class="description">' . sprintf(__('Step 1: Set the Google Calendar you want to use as <strong>"public."</strong> <a href="%1s" target="_blank">Detailed instructions</a>', 'google-calendar-events') . '<br />' . __('Step 2: Copy and paste your Google Calendar ID here. <a href="%2s" target="_blank">Detailed instructions</a>', 'google-calendar-events'), simcal_ga_campaign_url(simcal_get_url('docs') . '/make-google-calendar-public/', 'core-plugin', 'settings-link'), simcal_ga_campaign_url(simcal_get_url('docs') . '/find-google-calendar-id/', 'core-plugin', 'settings-link')) . '</p>'; if ($post_id > 0 && !is_null($feed) && !empty($this->feed->type)) { $no_key_notice = new Notice(array('id' => array('calendar_' . $post_id => 'google-no-api-key'), 'type' => 'error', 'screen' => 'calendar', 'post' => $post_id, 'dismissable' => false, 'content' => '<p>' . '<i class="simcal-icon-warning"></i> ' . sprintf(__('Your Google Calendar events will not show up until you <a href="%s">create and save a Google API key</a>.', 'google-calendar-events'), admin_url('edit.php?post_type=calendar&page=simple-calendar_settings&tab=feeds')) . '</p>')); if (empty($this->google_api_key) && $feed == $this->feed->type) { $has_errors = true; $no_key_notice->add(); } else { $no_key_notice->remove(); try { $this->feed->make_request($google_calendar_id); } catch (\Exception $e) { $error = $e->getMessage(); $message = !empty($error) ? '<blockquote>' . $error . '</blockquote>' : ''; } $error_notice = new Notice(array('id' => array('calendar_' . $post_id => 'google-error-response'), 'type' => 'error', 'screen' => 'calendar', 'post' => $post_id, 'dismissable' => false, 'content' => '<p>' . '<i class="simcal-icon-warning"></i> ' . __('While trying to retrieve events, Google returned an error:', 'google-calendar-events') . '<br>' . $message . '<br>' . __('Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events') . '</p>')); if (!empty($error) && $feed == $this->feed->type) { $error_notice->add(); $has_errors = true; } else { $error_notice->remove(); $has_errors = false; } } } return $message; }
/** * Output the about screen. * * @since 3.0.0 */ public function about_screen() { $welcome_image_about_path = SIMPLE_CALENDAR_ASSETS . '/images/welcome'; $welcome_addons_link = simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'welcome-page'); ?> <div id="simcal-welcome"> <div class="wrap about-wrap whats-new-wrap"> <?php $this->intro(); ?> <h3><?php _e('Configure event colors, number of events to display, grid or list style and more.', 'google-calendar-events'); ?> </h3> <img src="<?php echo $welcome_image_about_path . '/grid-view-basic.png'; ?> " /> <h3><?php _e('Mobile responsive and widget ready.', 'google-calendar-events'); ?> </h3> <img src="<?php echo $welcome_image_about_path . '/list-view-widget.png'; ?> " /> <img src="<?php echo $welcome_image_about_path . '/grid-view-widget-dark-theme.png'; ?> " /> <h3> <?php _e('Add even more display options with add-ons like', 'google-calendar-events'); ?> <a href="<?php echo $welcome_addons_link; ?> " target="_blank"><?php _e('FullCalendar and Google Calendar Pro', 'google-calendar-events'); ?> </a>. </h3> <a href="<?php echo $welcome_addons_link; ?> " target="_blank"><img src="<?php echo $welcome_image_about_path . '/fullcalendar-google-calendar-pro-grid-view.png'; ?> " /></a> <h3><a href="<?php echo $welcome_addons_link; ?> " target="_blank"><?php _e('View Pricing and Try a Demo of our Simple Calendar Pro Add-ons.', 'google-calendar-events'); ?> </a></h3> <hr/> <?php $this->main_nav_links(); ?> </div> </div> <?php }
/** * Links in plugin meta in plugins page. * * @since 3.0.0 * * @param array $meta_links * @param string $file * * @return array */ public static function plugin_row_meta($meta_links, $file) { if (self::$plugin == $file) { $links = array(); $links['github'] = '<a href="' . simcal_get_url('github') . '" target="_blank" >GitHub</a>'; $links['documentation'] = '<a href="' . simcal_ga_campaign_url(simcal_get_url('docs'), 'core-plugin', 'plugin-listing') . '" target="_blank" >' . __('Documentation', 'google-calendar-events') . '</a>'; $links['support'] = '<a href="' . simcal_get_url('support') . '" target="_blank" >' . __('Support', 'google-calendar-events') . '</a>'; $links['add-ons'] = '<a href="' . simcal_ga_campaign_url(simcal_get_url('add-ons'), 'core-plugin', 'plugin-listing') . '" target="_blank" >' . __('Add-ons', 'google-calendar-events') . '</a>'; return apply_filters('simcal_plugin_action_links', array_merge($meta_links, $links)); } return $meta_links; }
/** * Upgrade to Premium Add-ons HTML. * * @since 3.1.6 * * @return void */ function simcal_upgrade_to_premium() { if ($screen = simcal_is_admin_screen()) { ?> <div class="main"> <p class="heading centered"> <?php _e('Some of the features included with our premium add-ons', 'google-calendar-events'); ?> </p> <ul> <li><div class="dashicons dashicons-yes"></div> <?php _e('Display color coded events', 'google-calendar-events'); ?> </li> <li><div class="dashicons dashicons-yes"></div> <?php _e('Show week & day views', 'google-calendar-events'); ?> </li> <li><div class="dashicons dashicons-yes"></div> <?php _e('Fast view switching', 'google-calendar-events'); ?> </li> <li><div class="dashicons dashicons-yes"></div> <?php _e('Event titles & start times in grid', 'google-calendar-events'); ?> </li> <li><div class="dashicons dashicons-yes"></div> <?php _e('Limit event display times', 'google-calendar-events'); ?> </li> <li><div class="dashicons dashicons-yes"></div> <?php _e('Display private calendar events', 'google-calendar-events'); ?> </li> <li><div class="dashicons dashicons-yes"></div> <?php _e('Show attendees & RSVP status', 'google-calendar-events'); ?> </li> <li><div class="dashicons dashicons-yes"></div> <?php _e('Display attachments', 'google-calendar-events'); ?> </li> <li><div class="dashicons dashicons-yes"></div> <?php _e('Priority email support', 'google-calendar-events'); ?> </li> </ul> <div class="centered"> <a href="<?php echo simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'sidebar-link'); ?> " class="button-primary button-large" target="_blank"> <?php _e('Upgrade to Premium Now', 'google-calendar-events'); ?> </a> </div> </div> <?php } }
/** * Output the about screen. * * @since 3.0.0 */ public function about_screen() { $welcome_image_about_path = SIMPLE_CALENDAR_ASSETS . '/images/welcome'; $welcome_gcal_pro_link = simcal_ga_campaign_url(simcal_get_url('gcal-pro'), 'core-plugin', 'welcome-page'); ?> <div id="simcal-welcome"> <div class="wrap about-wrap whats-new-wrap"> <?php $this->intro(); ?> <h3><?php _e('Modern calendar displays with easily updateable event text and color options.', 'google-calendar-events'); ?> </h3> <img src="<?php echo $welcome_image_about_path . '/grid-view-custom-colors.png'; ?> " /> <h3><?php _e('Mobile responsive and widget ready.', 'google-calendar-events'); ?> </h3> <img src="<?php echo $welcome_image_about_path . '/list-view-widget.png'; ?> " /> <img src="<?php echo $welcome_image_about_path . '/grid-view-widget-dark-theme.png'; ?> " /> <h3><?php _e('Simpler, more intuitive calendar settings.', 'google-calendar-events'); ?> </h3> <img src="<?php echo $welcome_image_about_path . '/calendar-settings-appearance.png'; ?> " /> <h3><?php echo sprintf(__('Extendible with add-ons like <a href="%s" target="_blank">Google Calendar Pro</a>.', 'google-calendar-events'), $welcome_gcal_pro_link); ?> </h3> <a href="<?php echo $welcome_gcal_pro_link; ?> " target="_blank"><img src="<?php echo $welcome_image_about_path . '/google-calendar-pro-list-view-annotated.png'; ?> " /></a> <hr/> <?php $this->main_nav_links(); ?> </div> </div> <?php }