Esempio n. 1
0
function eme_is_events_page() {
   $events_page_id = eme_get_events_page_id();
   if ($events_page_id) {
      return is_page ( $events_page_id );
   } else {
      return false;
   }
}
Esempio n. 2
0
function eme_create_events_submenu () {
   $events_page_id = eme_get_events_page_id();
   if (!$events_page_id || !get_page($events_page_id))
      add_action('admin_notices', "eme_explain_events_page_missing");

   if(function_exists('add_submenu_page')) {
      add_object_page(__('Events', 'eme'),__('Events', 'eme'),get_option('eme_cap_list_events'),'events-manager','eme_events_page', EME_PLUGIN_URL.'images/calendar-16.png');
      // Add a submenu to the custom top-level menu: 
      // edit event also needs just "add" as capability, otherwise you will not be able to edit own created events
      $plugin_page = add_submenu_page('events-manager', __('Edit'),__('Edit'),get_option('eme_cap_list_events'),'events-manager','eme_events_page');
      //add_action( 'admin_head-'. $plugin_page, 'eme_admin_events_script' );
      //add_action( 'admin_head-'. $plugin_page, 'eme_admin_event_boxes' );
      $plugin_page = add_submenu_page('events-manager', __('Add new', 'eme'), __('Add new','eme'), get_option('eme_cap_add_event'), 'eme-new_event', "eme_new_event_page");
      //add_action( 'admin_head-'. $plugin_page, 'eme_admin_events_script' ); 
      //add_action( 'admin_head-'. $plugin_page, 'eme_admin_event_boxes' );
      $plugin_page = add_submenu_page('events-manager', __('Locations', 'eme'), __('Locations', 'eme'), get_option('eme_cap_add_locations'), 'eme-locations', "eme_locations_page");
      if (get_option('eme_categories_enabled')) {
         $plugin_page = add_submenu_page('events-manager', __('Event Categories','eme'),__('Categories','eme'), get_option('eme_cap_categories'), "eme-categories", 'eme_categories_page');
      }
      $plugin_page = add_submenu_page('events-manager', __('Templates','eme'),__('Templates','eme'), get_option('eme_cap_templates'), "eme-templates", 'eme_templates_page');
      if (get_option('eme_rsvp_enabled')) {
         $plugin_page = add_submenu_page('events-manager', __('People', 'eme'), __('People', 'eme'), get_option('eme_cap_people'), 'eme-people', "eme_people_page");
         $plugin_page = add_submenu_page('events-manager', __('Pending Approvals', 'eme'), __('Pending Approvals', 'eme'), get_option('eme_cap_approve'), 'eme-registration-approval', "eme_registration_approval_page");
         $plugin_page = add_submenu_page('events-manager', __('Change Registration', 'eme'), __('Change Registration', 'eme'), get_option('eme_cap_registrations'), 'eme-registration-seats', "eme_registration_seats_page");
         if (get_option('eme_rsvp_mail_notify_is_active')) {
            $plugin_page = add_submenu_page('events-manager', __('Send Mails', 'eme'), __('Send Mails', 'eme'), get_option('eme_cap_send_mails'), 'eme-send-mails', "eme_send_mails_page");
         }
         $plugin_page = add_submenu_page('events-manager', __('Form Fields','eme'),__('Form Fields','eme'), get_option('eme_cap_forms'), "eme-formfields", 'eme_formfields_page');
      }
      $plugin_page = add_submenu_page('events-manager', __('Cleanup', 'eme'), __('Cleanup', 'eme'), get_option('eme_cap_cleanup'), 'eme-cleanup', "eme_cleanup_page");

      # just in case: make sure the Settings page can be reached if something is not correct with the security settings
      if (get_option('eme_cap_settings') =='')
         $cap_settings=DEFAULT_CAP_SETTINGS;
      else
         $cap_settings=get_option('eme_cap_settings');
      $plugin_page = add_submenu_page('events-manager', __('Events Made Easy Settings','eme'),__('Settings','eme'), $cap_settings, "eme-options", 'eme_options_page');
      //add_action( 'admin_head-'. $plugin_page, 'eme_admin_options_script' );
      // do some option checking after the options have been updated
      // add_action( 'load-'. $plugin_page, 'eme_admin_options_save');
   }
}
Esempio n. 3
0
function eme_handle_get() {
   global $plugin_page;
   if ( !is_admin() || !preg_match('/^eme-|events-manager/', $plugin_page) )
      return;

   // Disable Hello to new user if requested
   if (current_user_can( get_option('eme_cap_settings') ) && isset($_GET['disable_hello_to_user']) && $_GET['disable_hello_to_user'] == 'true')
      update_option('eme_hello_to_user', 0 );

   // Disable donation message if requested
   if (current_user_can( get_option('eme_cap_settings') ) && isset($_GET['disable_donate_message']) && $_GET['disable_donate_message'] == 'true')
      update_option('eme_donation_done', 1 );

   // Disable legacy warning
   if (current_user_can( get_option('eme_cap_settings') ) && isset($_GET['disable_legacy_warning']) && $_GET['disable_legacy_warning'] == 'true')
      update_option('eme_legacy_warning', 0 );

   // do the UTF-8 conversion if wanted
   if (current_user_can( get_option('eme_cap_settings') ) && isset($_GET['do_character_conversion']) && $_GET['do_character_conversion'] == 'true' && $wpdb->has_cap('collation')) {
      if ( ! empty($wpdb->charset)) {
         $charset = "CHARACTER SET $wpdb->charset";
         $collate="";
         if ( ! empty($wpdb->collate) )
            $collate = "COLLATE $wpdb->collate";
                        eme_convert_charset(EVENTS_TBNAME,$charset,$collate);
                        eme_convert_charset(RECURRENCE_TBNAME,$charset,$collate);
                        eme_convert_charset(LOCATIONS_TBNAME,$charset,$collate);
                        eme_convert_charset(BOOKINGS_TBNAME,$charset,$collate);
                        eme_convert_charset(PEOPLE_TBNAME,$charset,$collate);
                        eme_convert_charset(CATEGORIES_TBNAME,$charset,$collate);
      }
      update_option('eme_conversion_needed', 0 );
      print "<div id=\"message\" class=\"updated\">".__('Conversion done, please check your events and restore from backup if you see any sign of troubles.')."</div>";
   }

   // if settings have been changed, check if the SEO rules need to be flushed
   if ($plugin_page == 'eme-options' && isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true') {
      $old_events_page_id=get_option('eme_old_events_page');
      $events_page_id=eme_get_events_page_id();
      if ($events_page_id != $old_events_page_id) {
         eme_flushRules();
         update_option('eme_old_events_page',$events_page_id);
      }
   }
}
Esempio n. 4
0
function eme_alert_events_page() {
   global $pagenow;
   $events_page_id = eme_get_events_page_id();
   if ($pagenow == 'post.php' && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) && isset ( $_GET['eme_admin_action'] ) && $_GET['eme_admin_action'] == 'edit' && isset ( $_GET['post'] ) && $_GET['post'] == "$events_page_id") {
      $message = sprintf ( __ ( "This page corresponds to <strong>Events Made Easy</strong> events page. Its content will be overriden by <strong>Events Made Easy</strong>. If you want to display your content, you can can assign another page to <strong>Events Made Easy</strong> in the the <a href='%s'>Settings</a>. ", 'eme' ), 'admin.php?page=eme-options' );
      $notice = "<div class='error'><p>$message</p></div>";
      echo $notice;
   }
}