/**
  * Display the page html
  */
 public function display_page()
 {
     $signed_to_api = $this->_api_registration->is_signed();
     $signup_available = $this->_api_registration->is_api_sign_up_available();
     $ticketing_available = $this->_api_registration->is_ticket_available();
     $ticketing_message = $this->_api_registration->get_sign_message();
     $loader = $this->_registry->get('theme.loader');
     if (!$signed_to_api) {
         if (false === ai1ec_is_blank($ticketing_message)) {
             $this->_api_registration->clear_sign_message();
         }
         $args = array('title' => Ai1ec_I18n::__('Time.ly Ticketing'), 'sign_up_text' => 'Please, <a href="edit.php?post_type=ai1ec_event&page=all-in-one-event-calendar-settings">Sign Up for a Timely Network account</a> to use Ticketing.', 'signup_form' => Ai1ec_I18n::__('You need to sign up for a Timely Network account in order to use Ticketing<br /><br />') . ($signup_available ? Ai1ec_I18n::__('<a href="edit.php?post_type=ai1ec_event&page=all-in-one-event-calendar-settings" class="ai1ec-btn ai1ec-btn-primary ai1ec-btn-lg">Sign In to Timely Network</a>') : Ai1ec_I18n::__('<b>Signing up for a Timely Network account is currently unavailable. Please, try again later.</b>')));
         $file = $loader->get_file('ticketing/signup.twig', $args, true);
     } elseif (!$ticketing_available) {
         $args = array('title' => Ai1ec_I18n::__('Time.ly Ticketing'), 'sign_up_text' => '', 'signup_form' => 'Ticketing is currently not available for this website. Please, try again later.');
         $file = $loader->get_file('ticketing/signup.twig', $args, true);
     } else {
         $response = $this->_api_registration->get_payment_preferences();
         $purchases = $this->_api_registration->get_purchases();
         $args = array('title' => Ai1ec_I18n::__('Time.ly Ticketing'), 'settings_text' => Ai1ec_I18n::__('Settings'), 'sales_text' => Ai1ec_I18n::__('Sales'), 'select_payment_text' => Ai1ec_I18n::__('Please provide your PayPal details.'), 'cheque_text' => Ai1ec_I18n::__('Cheque'), 'paypal_text' => Ai1ec_I18n::__('PayPal'), 'currency_text' => Ai1ec_I18n::__('Preferred currency for tickets:'), 'required_text' => Ai1ec_I18n::__('This field is required.'), 'save_changes_text' => Ai1ec_I18n::__('Save Changes'), 'date_text' => Ai1ec_I18n::__('Date'), 'event_text' => Ai1ec_I18n::__('Event'), 'purchaser_text' => Ai1ec_I18n::__('Purchaser'), 'tickets_text' => Ai1ec_I18n::__('Tickets'), 'email_text' => Ai1ec_I18n::__('Email'), 'status_text' => Ai1ec_I18n::__('Status'), 'total_text' => Ai1ec_I18n::__('Total'), 'sign_out_button_text' => Ai1ec_I18n::__('Sign Out'), 'payment_method' => $response->payment_method, 'paypal_email' => $response->paypal_email, 'first_name' => $response->first_name, 'last_name' => $response->last_name, 'currency' => $response->currency, 'nonce' => array('action' => self::NONCE_ACTION, 'name' => self::NONCE_NAME, 'referrer' => false), 'action' => '?controller=front&action=ai1ec_api_ticketing_signup&plugin=' . AI1EC_PLUGIN_NAME, 'purchases' => $purchases, 'paypal_currencies' => array(array('description' => Ai1ec_I18n::__('United States Dollar'), 'code' => 'USD'), array('description' => Ai1ec_I18n::__('Canadian Dollar'), 'code' => 'CAD'), array('description' => Ai1ec_I18n::__('Australian Dollar'), 'code' => 'AUD'), array('description' => Ai1ec_I18n::__('Brazilian Real'), 'code' => 'BRL', 'note' => Ai1ec_I18n::__('Note: This currency is supported as a payment currency and a currency balance for in-country PayPal accounts only.')), array('description' => Ai1ec_I18n::__('Czech Koruna'), 'code' => 'CZK'), array('description' => Ai1ec_I18n::__('Danish Krone'), 'code' => 'DKK'), array('description' => Ai1ec_I18n::__('Euro'), 'code' => 'EUR'), array('description' => Ai1ec_I18n::__('Hong Kong Dollar'), 'code' => 'HKD'), array('description' => Ai1ec_I18n::__('Hungarian Forint'), 'code' => 'HUF', 'note' => Ai1ec_I18n::__('Note: Decimal amounts are not supported for this currency. Passing a decimal amount will throw an error.')), array('description' => Ai1ec_I18n::__('Israeli New Sheqel'), 'code' => 'ILS'), array('description' => Ai1ec_I18n::__('Japanese Yen'), 'code' => 'JPY', 'note' => Ai1ec_I18n::__('Note: This currency does not support decimals. Passing a decimal amount will throw an error. 1,000,000')), array('description' => Ai1ec_I18n::__('Malaysian Ringgit'), 'code' => 'MYR', 'note' => Ai1ec_I18n::__('Note: This currency is supported as a payment currency and a currency balance for in-country PayPal accounts only.')), array('description' => Ai1ec_I18n::__('Mexican Peso'), 'code' => 'MXN'), array('description' => Ai1ec_I18n::__('Norwegian Krone'), 'code' => 'NOK'), array('description' => Ai1ec_I18n::__('New Zealand Dollar'), 'code' => 'NZD'), array('description' => Ai1ec_I18n::__('Philippine Peso'), 'code' => 'PHP'), array('description' => Ai1ec_I18n::__('Polish Zloty'), 'code' => 'PLN'), array('description' => Ai1ec_I18n::__('Pound Sterling'), 'code' => 'GBP'), array('description' => Ai1ec_I18n::__('Russian Ruble'), 'code' => 'RUB', 'note' => Ai1ec_I18n::__('For in-border payments (payments made within Russia), the Russian Ruble is the only accepted currency. If you use another currency for in-border payments, the transaction will fail')), array('description' => Ai1ec_I18n::__('Singapore Dollar'), 'code' => 'SGD'), array('description' => Ai1ec_I18n::__('Swedish Krona'), 'code' => 'SEK'), array('description' => Ai1ec_I18n::__('Swiss Franc'), 'code' => 'CHF'), array('description' => Ai1ec_I18n::__('Taiwan New Dollar'), 'code' => 'TWD', 'note' => Ai1ec_I18n::__('Note: Decimal amounts are not supported for this currency. Passing a decimal amount will throw an error.')), array('description' => Ai1ec_I18n::__('Thai Baht'), 'code' => 'THB'), array('description' => Ai1ec_I18n::__('Turkish Lira'), 'code' => 'TRY', 'note' => Ai1ec_I18n::__('Note: This currency is supported as a payment currency and a currency balance for in-country PayPal accounts only.'))));
         $file = $loader->get_file('ticketing/manage.twig', $args, true);
     }
     $this->_registry->get('css.admin')->admin_enqueue_scripts('ai1ec_event_page_all-in-one-event-calendar-settings');
     $this->_registry->get('css.admin')->process_enqueue(array(array('style', 'ticketing.css')));
     if (isset($_POST['ai1ec_save_settings'])) {
         $response = $this->_api_registration->save_payment_preferences();
         // this redirect makes sure that the error messages appear on the screen
         header("Location: " . $_SERVER['HTTP_REFERER']);
     }
     return $file->render();
 }
Example #2
0
 /**
  * Add the extension tab if not present
  *
  * @param array $tabs
  * @return array
  */
 public function add_tabs(array $tabs)
 {
     if (!isset($tabs['extensions'])) {
         $tabs['extensions'] = array('name' => Ai1ec_I18n::__('Add-ons'), 'items' => array());
     }
     return $tabs;
 }
Example #3
0
 /**
  * Observes settings changes.
  *
  * If setting ai1ec_use_frontend_rendering is changed and set to true
  * perfoms theme check.
  *
  * Checks if Date format was changed, and update dates to the new format
  *
  * @param array $old_options Old options array.
  * @param array $new_options New options array.
  *
  * @return void Method does not return.
  *
  * @throws Ai1ec_Bootstrap_Exception
  */
 public function ai1ec_settings_observer($old_options, $new_options)
 {
     // Date format change checker
     $old_date_format_value = isset($old_options['input_date_format']) ? $old_options['input_date_format']['value'] : null;
     $new_date_format_value = isset($new_options['input_date_format']) ? $new_options['input_date_format']['value'] : null;
     if (null !== $old_date_format_value && null !== $new_date_format_value && $old_date_format_value !== $new_date_format_value) {
         // Get "Default calendar start date"
         $exact_date = isset($old_options['exact_date']) ? $old_options['exact_date']['value'] : '';
         if ('' !== $exact_date) {
             $date_system = $this->_registry->get('date.system');
             // Change "Default calendar start date" format
             $new_exact_date = $date_system->convert_date_format($exact_date, $old_date_format_value, $new_date_format_value);
             // Save new value
             $settings = $this->_registry->get('model.settings');
             $settings->set('exact_date', $new_exact_date);
         }
     }
     // Frontend rendering checker
     $old_value = isset($old_options['ai1ec_use_frontend_rendering']) ? (bool) $old_options['ai1ec_use_frontend_rendering']['value'] : null;
     $new_value = isset($new_options['ai1ec_use_frontend_rendering']) ? (bool) $new_options['ai1ec_use_frontend_rendering']['value'] : null;
     if ($old_value === $new_value || !$new_value) {
         return;
     }
     if ($this->is_current_theme_outside_core()) {
         $this->_registry->get('notification.admin')->store(Ai1ec_I18n::__('You have turned on Frontend Rendering and you are using a custom calendar theme. If your theme does not support Frontend Rendering, your calendar may not work correctly.'), 'error', 0, array(Ai1ec_Notification_Admin::RCPT_ADMIN), true);
     }
 }
Example #4
0
 public function get_content(array $view_args)
 {
     $date_system = $this->_registry->get('date.system');
     $settings = $this->_registry->get('model.settings');
     $defaults = array('oneday_offset' => 0, 'cat_ids' => array(), 'tag_ids' => array(), 'auth_ids' => array(), 'post_ids' => array(), 'instance_ids' => array(), 'exact_date' => $date_system->current_time());
     $args = wp_parse_args($view_args, $defaults);
     $local_date = $this->_registry->get('date.time', $args['exact_date'], 'sys.default')->adjust_day(0 + $args['oneday_offset'])->set_time(0, 0, 0);
     $cell_array = $this->get_oneday_cell_array($local_date, apply_filters('ai1ec_get_events_relative_to_filter', array('cat_ids' => $args['cat_ids'], 'tag_ids' => $args['tag_ids'], 'post_ids' => $args['post_ids'], 'auth_ids' => $args['auth_ids'], 'instance_ids' => $args['instance_ids']), $view_args, apply_filters('ai1ec_show_unique_events', false)));
     // Create pagination links.
     $title = $local_date->format_i18n($this->_registry->get('model.option')->get('date_format', 'l, M j, Y'));
     $pagination_links = $this->_get_pagination($args, $title);
     // Calculate today marker's position.
     $midnight = $this->_registry->get('date.time', 'now', 'sys.default')->set_time(0, 0, 0);
     $now = $this->_registry->get('date.time', 'now', 'sys.default');
     $now_text = $this->_registry->get('view.event.time')->get_short_time($now);
     $now = (int) ($now->diff_sec($midnight) / 60);
     $is_ticket_button_enabled = apply_filters('ai1ec_oneday_ticket_button', false);
     $show_reveal_button = apply_filters('ai1ec_oneday_reveal_button', false);
     $time_format = $this->_registry->get('model.option')->get('time_format', Ai1ec_I18n::__('g a'));
     $hours = array();
     $today = $this->_registry->get('date.time', 'now', 'sys.default');
     for ($hour = 0; $hour < 24; $hour++) {
         $hours[] = $today->set_time($hour, 0, 0)->format_i18n($time_format);
     }
     $view_args = array('title' => $title, 'type' => 'oneday', 'cell_array' => $cell_array, 'show_location_in_title' => $settings->get('show_location_in_title'), 'now_top' => $now, 'now_text' => $now_text, 'time_format' => $time_format, 'done_allday_label' => false, 'done_grid' => false, 'data_type' => $args['data_type'], 'is_ticket_button_enabled' => $is_ticket_button_enabled, 'show_reveal_button' => $show_reveal_button, 'text_full_day' => __('Reveal full day', AI1EC_PLUGIN_NAME), 'text_all_day' => __('All-day', AI1EC_PLUGIN_NAME), 'text_now_label' => __('Now:', AI1EC_PLUGIN_NAME), 'text_venue_separator' => __('@ %s', AI1EC_PLUGIN_NAME), 'hours' => $hours, 'indent_multiplier' => 16, 'indent_offset' => 54, 'pagination_links' => $pagination_links);
     $view_args = $this->get_extra_template_arguments($view_args);
     // Add navigation if requested.
     $view_args['navigation'] = $this->_get_navigation(array('no_navigation' => $args['no_navigation'], 'pagination_links' => $pagination_links, 'views_dropdown' => $args['views_dropdown'], 'below_toolbar' => apply_filters('ai1ec_below_toolbar', '', $this->get_name(), $args)));
     return $this->_registry->get('http.request')->is_json_required($args['request_format'], 'oneday') ? $this->_apply_filters_to_args($view_args) : $this->_get_view($view_args);
 }
Example #5
0
 public function get_content(array $view_args)
 {
     $date_system = $this->_registry->get('date.system');
     $settings = $this->_registry->get('model.settings');
     $defaults = array('oneday_offset' => 0, 'cat_ids' => array(), 'tag_ids' => array(), 'auth_ids' => array(), 'post_ids' => array(), 'exact_date' => $date_system->current_time());
     $args = wp_parse_args($view_args, $defaults);
     $local_date = $this->_registry->get('date.time', $args['exact_date'], 'sys.default')->adjust_day(0 + $args['oneday_offset'])->set_time(0, 0, 0);
     $cell_array = $this->get_oneday_cell_array($local_date, array('cat_ids' => $args['cat_ids'], 'tag_ids' => $args['tag_ids'], 'post_ids' => $args['post_ids'], 'auth_ids' => $args['auth_ids']));
     // Create pagination links.
     $pagination_links = $this->_get_pagination($args);
     $title = $local_date->format_i18n($this->_registry->get('model.option')->get('date_format', 'l, M j, Y'));
     // Calculate today marker's position.
     $now = $date_system->current_time();
     $midnight = $this->_registry->get('date.time', $now)->set_time(0, 0, 0);
     $now = $this->_registry->get('date.time', $now);
     $now_text = $this->_registry->get('view.event.time')->get_short_time($now);
     $now = $now->diff_sec($midnight);
     $is_ticket_button_enabled = apply_filters('ai1ec_oneday_ticket_button', false);
     $show_reveal_button = apply_filters('ai1ec_oneday_reveal_button', false);
     $time_format = $this->_registry->get('model.option')->get('time_format', Ai1ec_I18n::__('g a'));
     $view_args = array('title' => $title, 'type' => 'oneday', 'cell_array' => $cell_array, 'show_location_in_title' => $settings->get('show_location_in_title'), 'now_top' => $now, 'now_text' => $now_text, 'pagination_links' => $pagination_links, 'time_format' => $time_format, 'done_allday_label' => false, 'done_grid' => false, 'data_type' => $args['data_type'], 'data_type_events' => '', 'is_ticket_button_enabled' => $is_ticket_button_enabled, 'show_reveal_button' => $show_reveal_button, 'text_full_day' => __('Reveal full day', AI1EC_PLUGIN_NAME), 'text_all_day' => __('All-day', AI1EC_PLUGIN_NAME), 'text_now_label' => __('Now:', AI1EC_PLUGIN_NAME), 'text_venue_separator' => __('@ %s', AI1EC_PLUGIN_NAME));
     // Add navigation if requested.
     $view_args['pagination_links'] = $pagination_links;
     // Add navigation if requested.
     $view_args['navigation'] = $this->_get_navigation($args['no_navigation'], $view_args);
     return $this->_get_view($view_args);
 }
Example #6
0
 /**
  * Display the page html
  */
 public function display_page()
 {
     $api = $this->_registry->get('model.api');
     $ticketing_enabled = $api->is_signed();
     $ticketing_message = $api->get_sign_message();
     $loader = $this->_registry->get('theme.loader');
     if (!$ticketing_enabled) {
         if (false === ai1ec_is_blank($ticketing_message)) {
             $api->clear_sign_message();
         }
         $args = array('title' => Ai1ec_I18n::__('Time.ly Ticketing<sup>beta</sup>'), 'sign_up_text' => 'Please, <a href="edit.php?post_type=ai1ec_event&page=all-in-one-event-calendar-settings">Sign Up for a Timely Network account</a> to use Ticketing.');
         $file = $loader->get_file('ticketing/signup.twig', $args, true);
     } else {
         $response = $api->get_payment_preferences();
         $purchases = $api->get_purchases();
         $args = array('title' => Ai1ec_I18n::__('Time.ly Ticketing<sup>beta</sup>'), 'settings_text' => Ai1ec_I18n::__('Settings'), 'sales_text' => Ai1ec_I18n::__('Sales'), 'select_payment_text' => Ai1ec_I18n::__('How do you want the tickets revenue to be sent to you?'), 'select_payment_description_text' => Ai1ec_I18n::__('If no payout method is selected, Time.ly will collect the revenue on behalf of you. Please contact payouts@time.ly for any outstanding payouts.'), 'cheque_text' => Ai1ec_I18n::__('Cheque'), 'paypal_text' => Ai1ec_I18n::__('Paypal'), 'required_text' => Ai1ec_I18n::__('This field is required.'), 'save_changes_text' => Ai1ec_I18n::__('Save Changes'), 'date_text' => Ai1ec_I18n::__('Date'), 'event_text' => Ai1ec_I18n::__('Event'), 'purchaser_text' => Ai1ec_I18n::__('Purchaser'), 'tickets_text' => Ai1ec_I18n::__('Tickets'), 'email_text' => Ai1ec_I18n::__('Email'), 'status_text' => Ai1ec_I18n::__('Status'), 'total_text' => Ai1ec_I18n::__('Total'), 'sign_out_button_text' => Ai1ec_I18n::__('Sign Out'), 'payment_method' => $response->payment_method, 'paypal_email' => $response->paypal_email, 'first_name' => $response->first_name, 'last_name' => $response->last_name, 'street' => $response->street, 'city' => $response->city, 'state' => $response->state, 'postcode' => $response->postcode, 'country' => $response->country, 'nonce' => array('action' => self::NONCE_ACTION, 'name' => self::NONCE_NAME, 'referrer' => false), 'action' => '?controller=front&action=ai1ec_api_ticketing_signup&plugin=' . AI1EC_PLUGIN_NAME, 'purchases' => $purchases);
         $file = $loader->get_file('ticketing/manage.twig', $args, true);
     }
     $this->_registry->get('css.admin')->admin_enqueue_scripts('ai1ec_event_page_all-in-one-event-calendar-settings');
     $this->_registry->get('css.admin')->process_enqueue(array(array('style', 'ticketing.css')));
     if (isset($_POST['ai1ec_save_settings'])) {
         $response = $api->save_payment_preferences();
         // this redirect makes sure that the error messages appear on the screen
         header("Location: " . $_SERVER['HTTP_REFERER']);
     }
     return $file->render();
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<div class=\"ai1ec-modal-header\">\n\t<button type=\"button\" class=\"ai1ec-close\" data-dismiss=\"ai1ec-modal\">×</button>\n\t<h2>";
     // line 3
     echo twig_escape_filter($this->env, Ai1ec_I18n::__("Post Your Event"), "html", null, true);
     echo "</h2>\n</div>\n\n<div class=\"ai1ec-modal-body\">\n\t";
     // line 7
     if ((isset($context["message_type"]) ? $context["message_type"] : null) != "success") {
         // line 8
         echo "\t\t<div class=\"ai1ec-alert ai1ec-alert-";
         echo twig_escape_filter($this->env, isset($context["message_type"]) ? $context["message_type"] : null, "html", null, true);
         echo "\">\n\t\t\t";
         // line 9
         echo isset($context["message"]) ? $context["message"] : null;
         echo "\n\t\t</div>\n\t";
     } else {
         // line 12
         echo "\t\t";
         echo isset($context["message"]) ? $context["message"] : null;
         echo "\n\t";
     }
     // line 14
     echo "</div>\n\n<div class=\"ai1ec-modal-footer\">\n\t<a href=\"#\" class=\"ai1ec-btn ai1ec-btn-lg ai1ec-btn-primary ai1ec-pull-left ai1ec-post-another\">\n\t\t<i class=\"ai1ec-fa ai1ec-fa-plus\"></i>\n\t\t";
     // line 19
     echo twig_escape_filter($this->env, Ai1ec_I18n::__("Post Another"), "html", null, true);
     echo "\n\t</a>\n\t<a href=\"";
     // line 21
     echo twig_escape_filter($this->env, isset($context["link_url"]) ? $context["link_url"] : null, "html_attr");
     echo "\"\n\t\tclass=\"ai1ec-btn ai1ec-btn-lg ai1ec-btn-primary\">\n\t\t";
     // line 23
     echo twig_escape_filter($this->env, isset($context["link_text"]) ? $context["link_text"] : null, "html", null, true);
     echo "\n\t\t<i class=\"ai1ec-fa ai1ec-fa-arrow-right\"></i>\n\t</a>\n</div>\n";
 }
Example #8
0
 /**
  * Runs checks for necessary config options.
  *
  * @return void Method does not return.
  */
 public function run_checks()
 {
     $role = get_role('administrator');
     $current_user = get_userdata(get_current_user_id());
     if (!is_object($role) || !is_object($current_user) || !$role->has_cap('manage_ai1ec_options') || defined('DOING_AJAX') && DOING_AJAX) {
         return;
     }
     global $plugin_page;
     $settings = $this->_registry->get('model.settings');
     $notification = $this->_registry->get('notification.admin');
     $notifications = array();
     // check if is set calendar page
     if (!$settings->get('calendar_page_id')) {
         $msg = Ai1ec_I18n::__('Select an option in the <strong>Calendar page</strong> dropdown list.');
         $notifications[] = $msg;
     }
     if ($plugin_page !== AI1EC_PLUGIN_NAME . '-settings' && !empty($notifications)) {
         if ($current_user->has_cap('manage_ai1ec_options')) {
             $msg = sprintf(Ai1ec_I18n::__('The plugin is installed, but has not been configured. <a href="%s">Click here to set it up now &raquo;</a>'), admin_url(AI1EC_SETTINGS_BASE_URL));
             $notification->store($msg, 'updated', 2, array(Ai1ec_Notification_Admin::RCPT_ADMIN));
         } else {
             $msg = Ai1ec_I18n::__('The plugin is installed, but has not been configured. Please log in as an Administrator to set it up.');
             $notification->store($msg, 'updated', 2, array(Ai1ec_Notification_Admin::RCPT_ALL));
         }
         return;
     }
     foreach ($notifications as $msg) {
         $notification->store($msg, 'updated', 2, array(Ai1ec_Notification_Admin::RCPT_ADMIN));
     }
 }
Example #9
0
 /**
  * @param Ai1ec_Event $event
  *
  * @return The html of the footer
  */
 public function get_footer(Ai1ec_Event $event)
 {
     $text_calendar_feed = Ai1ec_I18n::__('This post was replicated from another site\'s <a href="%s" title="iCalendar feed"><i class="ai1ec-fa ai1ec-fa-calendar"></i> calendar feed</a>.');
     $loader = $this->_registry->get('theme.loader');
     $text_calendar_feed = sprintf($text_calendar_feed, esc_attr(str_replace('http://', 'webcal://', $event->get('ical_feed_url'))));
     $args = array('event' => $event, 'text_calendar_feed' => $text_calendar_feed, 'text_view_post' => Ai1ec_I18n::__('View original'));
     return $loader->get_file('event-single-footer.twig', $args, false)->get_content();
 }
Example #10
0
 public function add_page()
 {
     global $submenu;
     // ===============
     // = Themes Page =
     // ===============
     $themes_page = add_submenu_page(AI1EC_ADMIN_BASE_URL, Ai1ec_I18n::__('Calendar Themes'), Ai1ec_I18n::__('Calendar Themes'), 'switch_ai1ec_themes', AI1EC_PLUGIN_NAME . '-themes', array($this, 'display_page'));
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<select class=\"ai1ec-categories-selector ai1ec-select2-multiselect-selector\"\n\tid=\"";
     // line 2
     echo twig_escape_filter($this->env, isset($context["id"]) ? $context["id"] : null, "html", null, true);
     echo "\" name=\"";
     echo twig_escape_filter($this->env, isset($context["name"]) ? $context["name"] : null, "html", null, true);
     echo "\"\n\tplaceholder=\"";
     // line 3
     echo twig_escape_filter($this->env, Ai1ec_I18n::__("Categories"), "html_attr");
     echo "\"\n\tdata-placeholder=\"";
     // line 4
     echo twig_escape_filter($this->env, Ai1ec_I18n::__("Categories"), "html_attr");
     echo "\"\n\tmultiple=\"multiple\">\n\t";
     // line 6
     $context['_parent'] = (array) $context;
     $context['_seq'] = twig_ensure_traversable(isset($context["categories"]) ? $context["categories"] : null);
     foreach ($context['_seq'] as $context["_key"] => $context["term"]) {
         // line 7
         echo "\t\t<option value=\"";
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["term"]) ? $context["term"] : null, "term_id"), "html", null, true);
         echo "\"\n\t\t\t";
         // line 8
         if (twig_in_filter($this->getAttribute(isset($context["term"]) ? $context["term"] : null, "term_id"), isset($context["selected_cat_ids"]) ? $context["selected_cat_ids"] : null)) {
             // line 9
             echo "      \tselected=\"selected\"\n      ";
         }
         // line 11
         echo "\t\t\t";
         if (!twig_test_empty($this->getAttribute(isset($context["term"]) ? $context["term"] : null, "description"))) {
             // line 12
             echo "\t\t\t\tdata-description=\"";
             echo twig_escape_filter($this->env, $this->getAttribute(isset($context["term"]) ? $context["term"] : null, "description"), "html_attr");
             echo "\"\n\t\t\t";
         }
         // line 14
         echo "\t\t\t";
         if (!twig_test_empty($this->getAttribute(isset($context["term"]) ? $context["term"] : null, "color"))) {
             // line 15
             echo "\t\t\t\tdata-color=\"";
             echo twig_escape_filter($this->env, $this->getAttribute(isset($context["term"]) ? $context["term"] : null, "color"), "html_attr");
             echo "\"\n\t\t\t";
         }
         // line 17
         echo "\t\t\t>\n\t\t\t";
         // line 18
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["term"]) ? $context["term"] : null, "name"), "html", null, true);
         echo "\n\t\t</option>\n\t";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['term'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 21
     echo "</select>\n";
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<li>";
     echo twig_escape_filter($this->env, Ai1ec_I18n::__("Posterboard view:"), "html", null, true);
     echo " <code class=\"ai1ec-autoselect\">[ai1ec view=\"posterboard\"]</code></li>\n<li>";
     // line 2
     echo twig_escape_filter($this->env, Ai1ec_I18n::__("Stream view:"), "html", null, true);
     echo " <code class=\"ai1ec-autoselect\">[ai1ec view=\"stream\"]</code></li>";
 }
 /**
  * Display the page html
  */
 public function display_page()
 {
     $settings = $this->_registry->get('model.settings');
     $args = array('title' => Ai1ec_I18n::__('Time.ly Ticketing beta'), 'nonce' => array('action' => self::NONCE_ACTION, 'name' => self::NONCE_NAME, 'referrer' => false), 'metabox' => array('screen' => $settings->get('enabling_ticket_invitation_page'), 'action' => 'left', 'object' => null), 'action' => ai1ec_admin_url('?controller=front&action=ai1ec_ticketing_invitation_save&plugin=' . AI1EC_PLUGIN_NAME));
     $loader = $this->_registry->get('theme.loader');
     $file = $loader->get_file('ticketing-invitation/page.twig', $args, true);
     $this->_registry->get('css.admin')->admin_enqueue_scripts('ai1ec_event_page_all-in-one-event-calendar-settings');
     $this->_registry->get('css.admin')->process_enqueue(array(array('style', 'ticketing.css')));
     return $file->render();
 }
Example #14
0
 /**
  * Adds a link to Settings page in plugin list page.
  *
  * @param  array $links List of available links.
  *
  * @return array Modified links list.
  */
 public function plugin_action_links($links)
 {
     $settings_link = sprintf(Ai1ec_I18n::__('<a href="%s">Settings</a>'), ai1ec_admin_url(AI1EC_SETTINGS_BASE_URL));
     array_unshift($links, $settings_link);
     if (current_user_can('activate_plugins')) {
         $updates_link = sprintf(Ai1ec_I18n::__('<a href="%s">Check for updates</a>'), ai1ec_admin_url(AI1EC_FORCE_UPDATES_URL));
         array_push($links, $updates_link);
     }
     return $links;
 }
Example #15
0
 /**
  * Observes settings changes. If setting ai1ec_use_frontend_rendering
  * is changed and set to true perfoms theme check.
  *
  * @param array $old_options Old options array.
  * @param array $new_options New options array.
  *
  * @return void Method does not return.
  *
  * @throws Ai1ec_Bootstrap_Exception
  */
 public function ai1ec_settings_observer($old_options, $new_options)
 {
     $old_value = isset($old_options['ai1ec_use_frontend_rendering']) ? (bool) $old_options['ai1ec_use_frontend_rendering']['value'] : null;
     $new_value = isset($new_options['ai1ec_use_frontend_rendering']) ? (bool) $new_options['ai1ec_use_frontend_rendering']['value'] : null;
     if ($old_value === $new_value || !$new_value) {
         return;
     }
     if ($this->is_current_theme_outside_core()) {
         $this->_registry->get('notification.admin')->store(Ai1ec_I18n::__('You have turned on Frontend Rendering and you are using a custom calendar theme. If your theme does not support Frontend Rendering, your calendar may not work correctly.'), 'error', 0, array(Ai1ec_Notification_Admin::RCPT_ADMIN), true);
     }
 }
Example #16
0
 /**
  * Add the extension tab if not present
  *
  * @param array $tabs
  * @return array
  */
 public function add_tabs(array $tabs)
 {
     if (!isset($tabs['extensions'])) {
         $tabs['extensions'] = array('name' => Ai1ec_I18n::__('Add-ons'), 'items' => array('licenses' => Ai1ec_I18n::__('Licenses')));
     } else {
         if (!isset($tabs['extensions']['items']['license'])) {
             $tabs['extensions']['items']['license'] = Ai1ec_I18n::__('Licences');
         }
     }
     return $tabs;
 }
 /**
  * Get the content if the calendar page
  *
  * @param Ai1ec_Request_Parser $request
  */
 public function get_content(Ai1ec_Request_Parser $request)
 {
     // Are we loading a shortcode?
     $shortcode = $request->get('shortcode');
     // Get args for the current view; required to generate HTML for views
     // dropdown list, categories, tags, subscribe buttons, and of course the
     // view itself.
     $view_args = $this->get_view_args_for_view($request);
     try {
         $action = $this->_registry->get('model.settings-view')->get_configured($view_args['action']);
     } catch (Ai1ec_Settings_Exception $exception) {
         // short-circuit and return error message
         return '<div id="ai1ec-container"><div class="timely"><p>' . Ai1ec_I18n::__('There was an error loading calendar. Please contact site administrator and inform him to configure calendar views.') . '</p></div></div>';
     }
     $type = $request->get('request_type');
     // Add view-specific args to the current view args.
     $exact_date = $this->get_exact_date($request);
     $view_obj = $this->_registry->get('view.calendar.view.' . $action, $request);
     $view_args = $view_obj->get_extra_arguments($view_args, $exact_date);
     // Get HTML for views dropdown list.
     $dropdown_args = $view_args;
     if (isset($dropdown_args['time_limit']) && false !== $exact_date) {
         $dropdown_args['exact_date'] = $exact_date;
     }
     $views_dropdown = $this->get_html_for_views_dropdown($dropdown_args, $view_obj);
     // Add views dropdown markup to view args.
     $view_args['views_dropdown'] = $views_dropdown;
     // Get HTML for categories and for tags
     $taxonomy = $this->_registry->get('view.calendar.taxonomy');
     $categories = $taxonomy->get_html_for_categories($view_args);
     $tags = $taxonomy->get_html_for_tags($view_args, true);
     // Get HTML for subscribe buttons.
     $subscribe_buttons = $this->get_html_for_subscribe_buttons($view_args);
     // Get HTML for view itself.
     $view = $view_obj->get_content($view_args);
     if (($view_args['no_navigation'] || $type !== 'html') && 'true' !== $shortcode) {
         $router = $this->_registry->get('routing.router');
         $are_filters_set = $router->is_at_least_one_filter_set_in_request($view_args);
         // send data both for json and jsonp as shortcodes are jsonp
         return array('html' => $view, 'categories' => $categories, 'tags' => $tags, 'views_dropdown' => $views_dropdown, 'subscribe_buttons' => $subscribe_buttons, 'are_filters_set' => $are_filters_set);
     } else {
         $loader = $this->_registry->get('theme.loader');
         $empty = $loader->get_file('empty.twig', array(), false);
         // Define new arguments for overall calendar view
         $filter_args = array('views_dropdown' => $views_dropdown, 'categories' => $categories, 'tags' => $tags, 'contribution_buttons' => apply_filters('ai1ec_contribution_buttons', ''), 'show_dropdowns' => apply_filters('ai1ec_show_dropdowns', true), 'show_select2' => apply_filters('ai1ec_show_select2', false), 'span_for_select2' => apply_filters('ai1ec_span_for_select2', ''), 'authors' => apply_filters('ai1ec_authors', ''), 'save_view_btngroup' => apply_filters('ai1ec_save_view_btngroup', $empty));
         $filter_menu = $loader->get_file('filter-menu.twig', $filter_args, false);
         $calendar_args = array('version' => AI1EC_VERSION, 'filter_menu' => $filter_menu, 'view' => $view, 'subscribe_buttons' => $subscribe_buttons, 'disable_standard_filter_menu' => apply_filters('ai1ec_disable_standard_filter_menu', false));
         $calendar = $loader->get_file('calendar.twig', $calendar_args, false);
         return $calendar->get_content();
     }
 }
 public function display_meta_box($object, $box)
 {
     $widgets = $this->_registry->get('controller.javascript-widget')->get_widgets();
     // this is just for the Super Widget which doesn't fully implement Ai1ec_Embeddable
     $widgets = apply_filters('ai1ec_widget_creators_widgets', $widgets);
     $tabs = array();
     foreach ($widgets as $widget_id => $widget_class) {
         $widget = $this->_registry->get($widget_class);
         $tabs[$widget_id] = array('name' => $widget->get_name(), 'icon' => $widget->get_icon(), 'requirements' => $widget->check_requirements(), 'elements' => $this->get_html_from_settings($widget->get_configurable_for_widget_creation()));
     }
     $loader = $this->_registry->get('theme.loader');
     $file = $loader->get_file('widget-creator/super-widget-contents.twig', array('tabs' => $tabs, 'siteurl' => trailingslashit(preg_replace('/^.*?:/', '', ai1ec_get_site_url())), 'text_common_info' => Ai1ec_I18n::__('Use this tool to generate code snippets you can add to <strong>an external website</strong> to embed new calendars and widgets.'), 'text_alert' => Ai1ec_I18n::__('<h4>Attention!</h4><p>These widgets are designed to be embedded in <strong>external sites only</strong> and may cause conflicts if used within the same WordPress site.</p>'), 'text_alternatives' => sprintf(Ai1ec_I18n::__('<p>Use <a href="%s"><strong>Appearance</strong> &gt; <strong>Widgets</strong></a> to add event widgets to your WordPress site as you would any other widget, or use <a href="%s" target="_blank">shortcodes</a> to embed the full calendar.</strong></p>'), admin_url('widgets.php'), 'http://time.ly/document/user-guide/using-calendar/display-multiple-calendars-site/'), 'display_alert' => apply_filters('ai1ec_display_widget_creator_warning', true), 'text_preview' => Ai1ec_I18n::__('Preview:'), 'text_paste' => Ai1ec_I18n::__('Paste this code onto your site:'), 'text_updated_code' => Ai1ec_I18n::__('This code will update to reflect changes made to the settings. Changing settings will not affect previously embedded widgets.')), true);
     $file->render();
 }
Example #19
0
 /**
  * Validates challenge.
  *
  * @param array Challenge response data.
  *
  * @return mixed
  */
 public function validate_challenge(array $data)
 {
     $response = array('success' => true);
     if (empty($data['recaptcha_challenge_field']) || empty($data['recaptcha_response_field'])) {
         $response['message'] = Ai1ec_I18n::_('There was an error reading the human verification data. Please try again.');
         $response['success'] = false;
     }
     require_once AI1EC_VENDOR_PATH . 'recaptcha/recaptchalib.php';
     $resp = recaptcha_check_answer($this->_settings->get('google_recaptcha_private_key'), $_SERVER['REMOTE_ADDR'], $data['recaptcha_challenge_field'], $data['recaptcha_response_field']);
     if (!$resp->is_valid) {
         $response['message'] = Ai1ec_I18n::__('Please try verifying you are human again.');
         $response['success'] = false;
     }
     return $response;
 }
 /**
  * Loads a template by name.
  *
  * @param string  $name	 The template name
  * @param integer $index The index if it is an embedded template
  *
  * @return Twig_TemplateInterface A template instance representing the given template name
  */
 public function loadTemplate($name, $index = null)
 {
     try {
         return parent::loadTemplate($name, $index);
     } catch (RuntimeException $excpt) {
         $message = Ai1ec_I18n::__('We detected that your cache directory (%s) is not writable. This will make your calendar slow. Please contact your web host or server administrator to make it writable by the web server.');
         $message = sprintf($message, $this->cache);
         $this->_registry->get('notification.admin')->store($message, 'error', 1);
         $settings = $this->_registry->get('model.settings');
         /* @var $settings Ai1ec_Settings */
         // used shutdown to store settings
         // after this line exception occurs
         $type = is_writable(parent::getCache()) ? 'AI1EC_CACHE_UNAVAILABLE' : '';
         $settings->set('twig_cache', $type)->persist();
     }
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<div class=\"message ";
     echo twig_escape_filter($this->env, isset($context["class"]) ? $context["class"] : null, "html", null, true);
     echo " ai1ec-message\">\n\t";
     // line 2
     if (!array_key_exists("label", $context)) {
         // line 3
         echo "          ";
         $context["label"] = isset($context["text_label"]) ? $context["text_label"] : null;
         // line 4
         echo "\t";
     }
     // line 5
     echo "\t<h3>";
     echo twig_escape_filter($this->env, isset($context["label"]) ? $context["label"] : null, "html", null, true);
     echo "</h3>\n\n\t<p>";
     // line 7
     echo isset($context["message"]) ? $context["message"] : null;
     echo "</p>\n\n\t";
     // line 9
     if ((isset($context["persistent"]) ? $context["persistent"] : null) == true) {
         // line 10
         echo "\t\t<div>\n\t\t\t<input type=\"button\" class=\"button ai1ec-dismissable\"\n\t\t\t\tdata-key=\"";
         // line 12
         echo twig_escape_filter($this->env, isset($context["msg_key"]) ? $context["msg_key"] : null, "html", null, true);
         echo "\"\n\t\t\t\tvalue=\"";
         // line 13
         echo twig_escape_filter($this->env, Ai1ec_I18n::__("Dismiss"), "html", null, true);
         echo "\">\n\t\t</div>\n\t\t<p></p>\n\t";
     }
     // line 17
     echo "\t";
     if (isset($context["button"]) ? $context["button"] : null) {
         // line 18
         echo "\t\t<div>\n\t\t\t<input type=\"button\" class=\"button ";
         // line 19
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["button"]) ? $context["button"] : null, "class"), "html", null, true);
         echo "\"\n\t\t\t\tvalue=\"";
         // line 20
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["button"]) ? $context["button"] : null, "value"), "html", null, true);
         echo "\">\n\t\t</div>\n\t\t<p></p>\n\t";
     }
     // line 24
     echo "</div>\n";
 }
Example #22
0
 /**
  * Display Add Ons list page.
  *
  * @return void
  */
 public function display_page()
 {
     wp_enqueue_style('ai1ec_addons.css', AI1EC_ADMIN_THEME_CSS_URL . 'addons.css', array(), AI1EC_VERSION);
     $content = get_transient('ai1ec_timely_addons');
     $is_error = false;
     if (false === $content || defined('AI1EC_DEBUG') && AI1EC_DEBUG) {
         $is_error = true;
         $feed = wp_remote_get(AI1EC_TIMELY_ADDONS_URI);
         if (!is_wp_error($feed)) {
             $content = json_decode(wp_remote_retrieve_body($feed));
             if (null !== $content) {
                 set_transient('ai1ec_timely_addons', $content, 3600);
                 $is_error = false;
             }
         }
     }
     $this->_registry->get('theme.loader')->get_file('add-ons-list/page.twig', array('labels' => array('title' => Ai1ec_I18n::__('Add-ons for All In One Event Calendar'), 'button_title' => Ai1ec_I18n::__('Browse All Add-ons'), 'paragraph_content' => Ai1ec_I18n::__('These add-ons extend the functionality of the All-in-One Event Calendar.'), 'error' => Ai1ec_I18n::__('There was an error retrieving the extensions list from the server. Please try again later.')), 'content' => $content, 'is_error' => $is_error), true)->render();
 }
Example #23
0
 /**
  * Validates challenge.
  *
  * @param array Challenge response data.
  *
  * @return mixed
  */
 public function validate_challenge(array $data)
 {
     $response['message'] = Ai1ec_I18n::__('Please try verifying you are human again.');
     $response['success'] = false;
     if (empty($data['g-recaptcha-response'])) {
         $response['message'] = Ai1ec_I18n::_('There was an error reading the human verification data. Please try again.');
         $response['success'] = false;
     }
     $url = add_query_arg(array('secret' => $this->_settings->get('google_nocaptcha_private_key'), 'response' => $data['g-recaptcha-response']), 'https://www.google.com/recaptcha/api/siteverify');
     $json_resp = wp_remote_get($url);
     if (is_wp_error($json_resp)) {
         return $response;
     }
     $resp = json_decode($json_resp['body'], true);
     if (isset($resp['success']) && $resp['success']) {
         $response = array('success' => true);
     }
     return $response;
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     if ((isset($context["show_add_your_calendar"]) ? $context["show_add_your_calendar"] : null) || (isset($context["show_post_your_event"]) ? $context["show_post_your_event"] : null)) {
         // line 2
         echo "\t<div class=\"ai1ec-btn-group ai1ec-contribution-buttons\">\n\t\t";
         // line 3
         if (isset($context["show_add_your_calendar"]) ? $context["show_add_your_calendar"] : null) {
             // line 4
             echo "\t\t\t<a href=\"#ai1ec-submit-ics-modal\" class=\"ai1ec-btn ai1ec-btn-primary ai1ec-btn-xs\"\n\t\t\t\tdata-toggle=\"ai1ec-modal\">\n\t\t\t\t<i class=\"ai1ec-fa ai1ec-fa-plus\"></i>\n\t\t\t\t";
             // line 7
             echo twig_escape_filter($this->env, Ai1ec_I18n::__("Add Your Feed"), "html", null, true);
             echo "\n\t\t\t</a>\n\t\t";
         }
         // line 10
         echo "\t\t";
         if (isset($context["show_post_your_event"]) ? $context["show_post_your_event"] : null) {
             // line 11
             echo "\t\t\t";
             if (isset($context["show_front_end_create_form"]) ? $context["show_front_end_create_form"] : null) {
                 // line 12
                 echo "\t\t\t<a href=\"#ai1ec-create-event-modal\" class=\"ai1ec-btn ai1ec-btn-primary ai1ec-btn-xs\"\n\t\t\t\tdata-toggle=\"ai1ec-modal\">\n\t\t\t";
             } else {
                 // line 15
                 echo "\t\t\t<a href=\"";
                 echo twig_escape_filter($this->env, isset($context["create_event_url"]) ? $context["create_event_url"] : null, "html_attr");
                 echo "\" class=\"ai1ec-btn ai1ec-btn-primary ai1ec-btn-xs\">\n\t\t\t";
             }
             // line 17
             echo "\t\t\t\t<i class=\"ai1ec-fa ai1ec-fa-plus\"></i>\n\t\t\t\t";
             // line 18
             echo twig_escape_filter($this->env, Ai1ec_I18n::__("Post Your Event"), "html", null, true);
             echo "\n\t\t\t</a>\n\t\t";
         }
         // line 21
         echo "\t</div>\n";
     }
     // line 23
     echo "\n";
     // line 24
     echo isset($context["modals"]) ? $context["modals"] : null;
     echo "\n";
 }
Example #25
0
 public function get_content(array $view_args)
 {
     $date_system = $this->_registry->get('date.system');
     $settings = $this->_registry->get('model.settings');
     $defaults = array('week_offset' => 0, 'cat_ids' => array(), 'tag_ids' => array(), 'auth_ids' => array(), 'post_ids' => array(), 'instance_ids' => array(), 'exact_date' => $date_system->current_time());
     $args = wp_parse_args($view_args, $defaults);
     // Localize requested date and get components.
     $local_date = $this->_registry->get('date.time', $args['exact_date'], 'sys.default');
     $start_day_offset = $this->get_week_start_day_offset($local_date->format('w'));
     // get the first day of week
     $local_date->adjust_day(0 + $start_day_offset + $args['week_offset'] * 7)->set_time(0, 0, 0);
     $cell_array = $this->get_week_cell_array($local_date, apply_filters('ai1ec_get_events_relative_to_filter', array('cat_ids' => $args['cat_ids'], 'tag_ids' => $args['tag_ids'], 'post_ids' => $args['post_ids'], 'auth_ids' => $args['auth_ids'], 'instance_ids' => $args['instance_ids']), $view_args, apply_filters('ai1ec_show_unique_events', false)));
     // Create pagination links.	(Translators: '%s' = week's start date.)
     $title = sprintf(__('Week of %s', AI1EC_PLUGIN_NAME), $local_date->format_i18n('F j'));
     $pagination_links = $this->_get_pagination($args, $title);
     $time_format = $this->_registry->get('model.option')->get('time_format', Ai1ec_I18n::__('g a'));
     // Calculate today marker's position.
     $now = $this->_registry->get('date.time', 'now', 'sys.default');
     $now_text = $now->format_i18n('M j h:i a');
     $now = $now->format('G') * 60 + $now->format('i');
     // Find out if the current week view contains "now" and thus should display
     // the "now" marker.
     $show_now = false;
     foreach ($cell_array as $day) {
         if ($day['today']) {
             $show_now = true;
             break;
         }
     }
     $is_ticket_button_enabled = apply_filters('ai1ec_week_ticket_button', false);
     $show_reveal_button = apply_filters('ai1ec_week_reveal_button', false);
     $hours = array();
     $today = $this->_registry->get('date.time', 'now', 'sys.default');
     for ($hour = 0; $hour < 24; $hour++) {
         $hours[] = $today->set_time($hour, 0, 0)->format_i18n($time_format);
     }
     $view_args = array('title' => $title, 'type' => 'week', 'cell_array' => $cell_array, 'show_location_in_title' => $settings->get('show_location_in_title'), 'now_top' => $now, 'now_text' => $now_text, 'show_now' => $show_now, 'post_ids' => join(',', $args['post_ids']), 'time_format' => $time_format, 'done_allday_label' => false, 'done_grid' => false, 'data_type' => $args['data_type'], 'is_ticket_button_enabled' => $is_ticket_button_enabled, 'show_reveal_button' => $show_reveal_button, 'text_full_day' => __('Reveal full day', AI1EC_PLUGIN_NAME), 'text_all_day' => __('All-day', AI1EC_PLUGIN_NAME), 'text_now_label' => __('Now:', AI1EC_PLUGIN_NAME), 'text_venue_separator' => __('@ %s', AI1EC_PLUGIN_NAME), 'hours' => $hours, 'indent_multiplier' => 8, 'indent_offset' => 0, 'pagination_links' => $pagination_links);
     // Add navigation if requested.
     $view_args['navigation'] = $this->_get_navigation(array('no_navigation' => $args['no_navigation'], 'pagination_links' => $pagination_links, 'views_dropdown' => $args['views_dropdown'], 'below_toolbar' => apply_filters('ai1ec_below_toolbar', '', $this->get_name(), $args)));
     $view_args = $this->get_extra_template_arguments($view_args);
     return $this->_registry->get('http.request')->is_json_required($args['request_format'], 'week') ? $this->_apply_filters_to_args($view_args) : $this->_get_view($view_args);
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     if (!twig_test_empty(isset($context["recurrence"]) ? $context["recurrence"] : null)) {
         // line 2
         echo "\t<div class=\"ai1ec-recurrence ai1ec-btn-group\">\n\t\t<button class=\"ai1ec-btn ai1ec-btn-default ai1ec-btn-xs\n\t\t\tai1ec-tooltip-trigger ai1ec-disabled ai1ec-text-muted\"\n\t\t\tdata-html=\"true\"\n\t\t\ttitle=\"";
         // line 6
         ob_start();
         // line 7
         echo "\t\t\t\t";
         echo twig_escape_filter($this->env, twig_capitalize_string_filter($this->env, isset($context["recurrence"]) ? $context["recurrence"] : null), "html_attr");
         echo "\n\t\t\t\t";
         // line 8
         if (!twig_test_empty(isset($context["exclude"]) ? $context["exclude"] : null)) {
             // line 9
             echo "\t\t\t\t\t";
             echo twig_escape_filter($this->env, "<div class=\"ai1ec-recurrence-exclude\">" . Ai1ec_I18n::__("Excludes: ") . (isset($context["exclude"]) ? $context["exclude"] : null) . "</div>", "html_attr");
             echo "\n\t\t\t\t";
         }
         // line 11
         echo "\t\t\t";
         echo trim(preg_replace('/>\\s+</', '><', ob_get_clean()));
         echo "\">\n\t\t\t<i class=\"ai1ec-fa ai1ec-fa-repeat\"></i>\n\t\t\t";
         // line 13
         echo twig_escape_filter($this->env, Ai1ec_I18n::__("Repeats"), "html", null, true);
         echo "\n\t\t</button>\n\n\t\t";
         // line 16
         if (!twig_test_empty(isset($context["edit_instance_url"]) ? $context["edit_instance_url"] : null)) {
             // line 17
             echo "\t\t\t<a class=\"ai1ec-btn ai1ec-btn-default ai1ec-btn-xs ai1ec-tooltip-trigger\n\t\t\t\tai1ec-text-muted\"\n\t\t\t\ttitle=\"";
             // line 19
             echo twig_escape_filter($this->env, isset($context["edit_instance_text"]) ? $context["edit_instance_text"] : null, "html_attr");
             echo "\"\n\t\t\t\thref=\"";
             // line 20
             echo twig_escape_filter($this->env, isset($context["edit_instance_url"]) ? $context["edit_instance_url"] : null, "html", null, true);
             echo "\">\n\t\t\t\t<i class=\"ai1ec-fa ai1ec-fa-pencil\"></i>\n\t\t\t</a>\n\t\t";
         }
         // line 24
         echo "\t</div>\n";
     }
 }
Example #27
0
 public function get_content(array $view_args)
 {
     $date_system = $this->_registry->get('date.system');
     $settings = $this->_registry->get('model.settings');
     $defaults = array('week_offset' => 0, 'cat_ids' => array(), 'tag_ids' => array(), 'auth_ids' => array(), 'post_ids' => array(), 'exact_date' => $date_system->current_time());
     $args = wp_parse_args($view_args, $defaults);
     // Localize requested date and get components.
     $local_date = $this->_registry->get('date.time', $args['exact_date'], 'sys.default');
     $start_day_offset = $this->get_week_start_day_offset($local_date->format('w'));
     // get the first day of week
     $local_date->adjust_day(0 + $start_day_offset + $args['week_offset'] * 7)->set_time(0, 0, 0);
     $cell_array = $this->get_week_cell_array($local_date, array('cat_ids' => $args['cat_ids'], 'tag_ids' => $args['tag_ids'], 'post_ids' => $args['post_ids'], 'auth_ids' => $args['auth_ids']));
     // Create pagination links.
     $pagination_links = $this->_get_pagination($args);
     // Translators: "%s" below represents the week's start date.
     $title = sprintf(__('Week of %s', AI1EC_PLUGIN_NAME), $local_date->format_i18n('F j'));
     $time_format = $this->_registry->get('model.option')->get('time_format', Ai1ec_I18n::__('g a'));
     // Calculate today marker's position.
     $now = $this->_registry->get('date.time');
     $now_text = $now->format_i18n('M j');
     $now = $now->format('G') * 60 + $now->format('i');
     // Find out if the current week view contains "now" and thus should display
     // the "now" marker.
     $show_now = false;
     foreach ($cell_array as $day) {
         if ($day['today']) {
             $show_now = true;
             break;
         }
     }
     $is_ticket_button_enabled = apply_filters('ai1ec_week_ticket_button', false);
     $show_reveal_button = apply_filters('ai1ec_week_reveal_button', false);
     $view_args = array('title' => $title, 'type' => 'week', 'cell_array' => $cell_array, 'show_location_in_title' => $settings->get('show_location_in_title'), 'now_top' => $now, 'now_text' => $now_text, 'show_now' => $show_now, 'pagination_links' => $pagination_links, 'post_ids' => join(',', $args['post_ids']), 'time_format' => $time_format, 'done_allday_label' => false, 'done_grid' => false, 'data_type' => $args['data_type'], 'data_type_events' => '', 'is_ticket_button_enabled' => $is_ticket_button_enabled, 'show_reveal_button' => $show_reveal_button, 'text_full_day' => __('Reveal full day', AI1EC_PLUGIN_NAME), 'text_all_day' => __('All-day', AI1EC_PLUGIN_NAME), 'text_now_label' => __('Now:', AI1EC_PLUGIN_NAME), 'text_venue_separator' => __('@ %s', AI1EC_PLUGIN_NAME));
     if ($settings->get('ajaxify_events_in_web_widget')) {
         $view_args['data_type_events'] = $args['data_type'];
     }
     // Add navigation if requested.
     $view_args['navigation'] = $this->_get_navigation($args['no_navigation'], $view_args);
     return $this->_get_view($view_args);
 }
 public function render($output = '')
 {
     $tags = array();
     $categories = array();
     foreach (array('tags', 'categories') as $type) {
         $options = array('taxonomy' => 'events_' . $type, 'hierarchical' => true);
         ${$type} = get_categories($options);
     }
     if (empty($tags) && empty($categories)) {
         return '';
     }
     $args = array('label' => $this->_args['renderer']['label'], 'help' => $this->_args['renderer']['help']);
     $loader = $this->_registry->get('theme.loader');
     if (!empty($tags)) {
         $args['tags'] = $this->_get_select_for_terms('tags', Ai1ec_I18n::__('Tags'), $tags);
     }
     $categories_html = '';
     if (!empty($categories)) {
         $args['categories'] = $this->_get_select_for_terms('categories', Ai1ec_I18n::__('Categories'), $categories);
     }
     return $loader->get_file('setting/tags-categories.twig', $args, true)->get_content();
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<input type=\"text\" class=\"ai1ec-tags-selector\"\n\tid=\"";
     // line 2
     echo twig_escape_filter($this->env, isset($context["id"]) ? $context["id"] : null, "html", null, true);
     echo "\" name=\"";
     echo twig_escape_filter($this->env, isset($context["name"]) ? $context["name"] : null, "html", null, true);
     echo "\"\n\tplaceholder=\"";
     // line 3
     echo twig_escape_filter($this->env, Ai1ec_I18n::__("Tags"), "html_attr");
     echo "\"\n\tdata-placeholder=\"";
     // line 4
     echo twig_escape_filter($this->env, Ai1ec_I18n::__("Tags"), "html_attr");
     echo "\"\n\tdata-ai1ec-tags='";
     // line 5
     echo isset($context["tags_json"]) ? $context["tags_json"] : null;
     echo "'\n\tvalue=\"";
     // line 6
     echo isset($context["selected_tag_ids"]) ? $context["selected_tag_ids"] : null;
     echo "\" />\n";
 }
 /**
  * Renders the html of the page and returns it.
  *
  * @param Ai1ec_Event $event
  *
  * @return string the html of the page
  */
 public function get_content(Ai1ec_Event $event)
 {
     $settings = $this->_registry->get('model.settings');
     $rrule = $this->_registry->get('recurrence.rule');
     $taxonomy = $this->_registry->get('view.event.taxonomy');
     $location = $this->_registry->get('view.event.location');
     $ticket = $this->_registry->get('view.event.ticket');
     $content = $this->_registry->get('view.event.content');
     $time = $this->_registry->get('view.event.time');
     $subscribe_url = AI1EC_EXPORT_URL . '&ai1ec_post_ids=' . $event->get('post_id');
     $event->set_runtime('tickets_url_label', $ticket->get_tickets_url_label($event, false));
     $event->set_runtime('content_img_url', $content->get_content_img_url($event));
     $extra_buttons = apply_filters('ai1ec_rendering_single_event_actions', '', $event);
     $venues_html = apply_filters('ai1ec_rendering_single_event_venues', nl2br($location->get_location($event)), $event);
     // objects are passed by reference so an action is ok
     do_action('ai1ec_single_event_page_before_render', $event);
     $args = array('event' => $event, 'recurrence' => $rrule->rrule_to_text($event->get('recurrence_rules')), 'exclude' => $time->get_exclude_html($event, $rrule), 'categories' => $taxonomy->get_categories_html($event), 'tags' => $taxonomy->get_tags_html($event), 'location' => $venues_html, 'map' => $location->get_map_view($event), 'contact' => $ticket->get_contact_html($event), 'back_to_calendar' => $content->get_back_to_calendar_button_html(), 'subscribe_url' => $subscribe_url, 'subscribe_url_no_html' => $subscribe_url . '&no_html=true', 'edit_instance_url' => null, 'edit_instance_text' => null, 'google_url' => 'http://www.google.com/calendar/render?cid=' . urlencode($subscribe_url), 'show_subscribe_buttons' => !$settings->get('turn_off_subscription_buttons'), 'hide_featured_image' => $settings->get('hide_featured_image'), 'extra_buttons' => $extra_buttons, 'text_add_calendar' => __('Add to Calendar', AI1EC_PLUGIN_NAME), 'subscribe_buttons_text' => $this->_registry->get('view.calendar.subscribe-button')->get_labels(), 'text_when' => __('When:', AI1EC_PLUGIN_NAME), 'text_where' => __('Where:', AI1EC_PLUGIN_NAME), 'text_cost' => __('Cost:', AI1EC_PLUGIN_NAME), 'text_contact' => __('Contact:', AI1EC_PLUGIN_NAME), 'text_free' => __('Free', AI1EC_PLUGIN_NAME), 'text_categories' => __('Categories', AI1EC_PLUGIN_NAME), 'text_tags' => __('Tags', AI1EC_PLUGIN_NAME));
     if (!empty($args['recurrence']) && $event->get('instance_id') && current_user_can('edit_ai1ec_events')) {
         $args['edit_instance_url'] = admin_url('post.php?post=' . $event->get('post_id') . '&action=edit&instance=' . $event->get('instance_id'));
         $args['edit_instance_text'] = sprintf(Ai1ec_I18n::__('Edit this occurrence (%s)'), $event->get('start')->format_i18n('M j'));
     }
     $loader = $this->_registry->get('theme.loader');
     return $loader->get_file('event-single.twig', $args, false)->get_content();
 }