function column_CHK_timestamp(EE_Checkin $item)
 {
     $actions = array();
     $delete_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'delete_checkin_row', 'DTT_ID' => $this->_req_data['DTT_ID'], '_REGID' => $this->_req_data['_REGID'], 'CHK_ID' => $item->ID()));
     $actions['delete_checkin'] = EE_Registry::instance()->CAP->current_user_can('ee_delete_checkins', 'espresso_registrations_delete_checkin_row') ? '<a href="' . $delete_url . '" title="' . esc_attr__('Click here to delete this check-in record', 'event_espresso') . '">' . __('Delete', 'event_espresso') . '</a>' : '';
     return sprintf('%1$s %2$s', $item->get_datetime('CHK_timestamp'), $this->row_actions($actions));
 }
 /**
  * _request_filesystem_credentials
  * if attempting to enable full logging, WordPress may require filesystem credentials for FTP or SSH depending on the server
  *
  * @access   protected
  * @param bool $show_errors
  * @return bool
  */
 protected function _request_filesystem_credentials($show_errors = TRUE)
 {
     require_once ABSPATH . 'wp-admin/includes/file.php';
     $url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'request_filesystem_credentials'), $this->_admin_base_url);
     $credentials = request_filesystem_credentials($url);
     if ($credentials == FALSE) {
         if ($show_errors) {
             EE_Error::get_notices(FALSE);
             EE_Error::reset_notices();
             EE_Error::add_error(__('Connection settings are missing or incorrect. Please verify that the connection settings below are correct.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
             add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', '__return_false');
         }
         return FALSE;
     }
     // now we have some credentials, try to get the wp_filesystem running
     $WP_Filesystem = WP_Filesystem($credentials);
     if (!$WP_Filesystem) {
         if ($show_errors) {
             EE_Error::get_notices(FALSE);
             EE_Error::reset_notices();
             EE_Error::add_error(__('There was an error connecting to the server. Please verify that the connection settings below are correct.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
             add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', '__return_false');
         }
         // our credentials were no good, ask the user for them again
         request_filesystem_credentials($url);
         return FALSE;
     }
     EE_Registry::instance()->CFG->admin->use_full_logging = TRUE;
     return TRUE;
 }
 public function column_count($item)
 {
     $e_args = array('action' => 'default', 'category' => $item->get_first_related('Term')->ID());
     $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EE_VENUES_ADMIN_URL);
     $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>';
     return $content;
 }
 public function column_display_text(EE_Question $item)
 {
     $system_question = $item->is_system_question();
     $actions = array();
     if (!defined('REG_ADMIN_URL')) {
         define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
     }
     $edit_query_args = array('action' => 'edit_question', 'QST_ID' => $item->ID());
     $trash_query_args = array('action' => 'trash_question', 'QST_ID' => $item->ID());
     $restore_query_args = array('action' => 'restore_question', 'QST_ID' => $item->ID());
     $delete_query_args = array('action' => 'delete_questions', 'QST_ID' => $item->ID());
     $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
     $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL);
     $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL);
     $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL);
     if (EE_Registry::instance()->CAP->current_user_can('ee_edit_question', 'espresso_registration_form_edit_question', $item->ID())) {
         $actions = array('edit' => '<a href="' . $edit_link . '" title="' . __('Edit Question', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>');
     }
     if (!$system_question && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_trash_question', $item->ID())) {
         $actions['delete'] = '<a href="' . $trash_link . '" title="' . __('Trash Question', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
     }
     if ($this->_view == 'trash') {
         if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_restore_question', $item->ID())) {
             $actions['restore'] = '<a href="' . $restore_link . '" title="' . __('Restore Question', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
         }
         if ($item->count_related('Answer') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_delete_questions', $item->ID())) {
             $actions['delete_permanently'] = '<a href="' . $delete_link . '" title="' . __('Delete Question Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>';
         }
     }
     $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_question', 'espresso_registration_form_edit_question', $item->ID()) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' : $item->display_text();
     $content .= $this->row_actions($actions);
     return $content;
 }
 function column_ATT_fname($item)
 {
     //Build row actions
     $actions = array();
     // edit attendee link
     if (EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee')) {
         $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $item->ID()), REG_ADMIN_URL);
         $actions['edit'] = '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('Edit Contact', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>';
     }
     if ($this->_view == 'in_use') {
         // trash attendee link
         if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
             $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'trash_attendees', 'ATT_ID' => $item->ID()), REG_ADMIN_URL);
             $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . esc_attr__('Move Contact to Trash', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
         }
     } else {
         if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_restore_attendees')) {
             // restore attendee link
             $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'restore_attendees', 'ATT_ID' => $item->ID()), REG_ADMIN_URL);
             $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' . esc_attr__('Restore Contact', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
         }
     }
     $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $item->ID()), REG_ADMIN_URL);
     $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('Edit Contact', 'event_espresso') . '">' . $item->fname() . '</a>' : $item->fname();
     //Return the name contents
     return sprintf('%1$s %2$s', $name_link, $this->row_actions($actions));
 }
 protected function _column_name_action_setup(EE_Event $item)
 {
     $export_query_args = array('action' => 'export_events', 'EVT_ID' => $item->ID());
     $export_event_link = EE_Admin_Page::add_query_args_and_nonce($export_query_args, EVENTS_ADMIN_URL);
     $actions = parent::_column_name_action_setup($item);
     //		$actions['export'] = '<a href="' . $export_event_link . '" title="' . __('Export Event', 'event_espresso') . '">' . __('Export', 'event_espresso') . '</a>';
     return $actions;
 }
 public function __construct($routing = TRUE)
 {
     require_once EE_MODELS . 'EEM_Question.model.php';
     require_once EE_MODELS . 'EEM_Question_Group.model.php';
     $this->_question_model = EEM_Question::instance();
     $this->_question_group_model = EEM_Question_Group::instance();
     parent::__construct($routing);
 }
 public function extra_news_box_content($content)
 {
     echo '<h4 style="margin:0">' . __('From the Forums', 'event_espresso') . '</h4>';
     echo '<div id="ee_forum_posts_content">';
     $url = 'http://eventespresso.com/forum/event-espresso-support/feed/';
     EE_Admin_Page::cached_rss_display('ee_forum_posts_content', $url);
     echo '</div>';
 }
    /**
     * Checks that there is at least one active gateway. If not, add a notice
     */
    public function check_payment_gateway_setup()
    {
        $actives = EE_Config::instance()->gateway->active_gateways;
        if (!$actives || count($actives) < 1) {
            $url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_PAYMENTS_ADMIN_URL);
            echo '<div class="error">
				 <p>' . sprintf(__("There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", "event_espresso"), "<a href='{$url}'>", "</a>") . '</p>
			 </div>';
        }
    }
/**
 * @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165
 * it is preferred to instead use _update_attendee_registration_form_new() which
 * also better handles form validation. Exits
 * @param EE_Admin_Page $admin_page
 * @return void
 */
function ee_deprecated_update_attendee_registration_form_old($admin_page)
{
    //check if the old hooks are in use. If not, do the default
    if (!ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() || !$admin_page instanceof EE_Admin_Page) {
        return;
    }
    $req_data = $admin_page->get_request_data();
    $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : FALSE;
    $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : FALSE;
    $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
    if (!$REG_ID || !$qstns) {
        EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
    }
    $success = TRUE;
    // allow others to get in on this awesome fun   :D
    do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns);
    // loop thru questions... FINALLY!!!
    foreach ($qstns as $QST_ID => $qstn) {
        //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
        if (!is_array($qstn)) {
            $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
            continue;
        }
        foreach ($qstn as $ANS_ID => $ANS_value) {
            //get answer
            $query_params = array(0 => array('ANS_ID' => $ANS_ID, 'REG_ID' => $REG_ID, 'QST_ID' => $QST_ID));
            $answer = EEM_Answer::instance()->get_one($query_params);
            //this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
            if (!$answer instanceof EE_Answer) {
                $set_values = array('QST_ID' => $QST_ID, 'REG_ID' => $REG_ID, 'ANS_value' => $qstn);
                $success = EEM_Answer::instance()->insert($set_values);
                continue 2;
            }
            $answer->set('ANS_value', $ANS_value);
            $success = $answer->save();
        }
    }
    $what = __('Registration Form', 'event_espresso');
    $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
    $admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
    exit;
}
    /**
     *	@ generates HTML for a file upload input and form
     *	@ access 	public
     * 	@param 	string 		$title - heading for the form
     * 	@param 	string 		$intro - additional text explaing what to do
     * 	@param 	string 		$page - EE Admin page to direct form to - in the form "espresso_{pageslug}"
     * 	@param 	string 		$action - EE Admin page route array "action" that form will direct to
     * 	@param 	string 		$type - type of file to import
     *	@ return 	string
     */
    public function upload_form($title, $intro, $form_url, $action, $type)
    {
        $form_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => $action), $form_url);
        ob_start();
        ?>
	<div class="ee-upload-form-dv">
		<h3><?php 
        echo $title;
        ?>
</h3>
		<p><?php 
        echo $intro;
        ?>
</p>

		<form action="<?php 
        echo $form_url;
        ?>
" method="post" enctype="multipart/form-data">
			<input type="hidden" name="csv_submitted" value="TRUE" id="<?php 
        echo time();
        ?>
">
			<input name="import" type="hidden" value="<?php 
        echo $type;
        ?>
" />
			<input type="file" name="file[]" size="90" >
			<input class="button-primary" type="submit" value="<?php 
        _e('Upload File', 'event_espresso');
        ?>
">
		</form>

		<p class="ee-attention">
			<b><?php 
        _e('Attention', 'event_espresso');
        ?>
</b><br/>
			<?php 
        echo sprintf(__('Accepts .%s file types only.', 'event_espresso'), $type);
        ?>
			<?php 
        echo __('Please only import CSV files exported from Event Espresso, or compatible 3rd-party software.', 'event_espresso');
        ?>
		</p>

	</div>

<?php 
        $uploader = ob_get_clean();
        return $uploader;
    }
 public function column_display_text(EE_Question $item)
 {
     $system_question = $item->is_system_question();
     if (!defined('REG_ADMIN_URL')) {
         define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
     }
     $edit_query_args = array('action' => 'edit_question', 'QST_ID' => $item->ID());
     $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
     $actions = array('edit' => '<a href="' . $edit_link . '" title="' . __('Edit Event', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>');
     $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>';
     $content .= $this->row_actions($actions);
     return $content;
 }
 /**
  * 		column_default
  */
 function column_DTT_EVT_start(EE_Registration $item)
 {
     $datetime_strings = array();
     $remove_defaults = array('default_where_conditions' => 'none');
     $ticket = $item->ticket();
     $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array();
     $query_args = array('action' => 'event_registrations', 'event_id' => $item->event_ID());
     foreach ($datetimes as $datetime) {
         $query_args['DTT_ID'] = $datetime->ID();
         $checkin_url = EE_Admin_Page::add_query_args_and_nonce($query_args, REG_ADMIN_URL);
         $datetime_strings[] = EE_Registry::instance()->CAP->current_user_can('ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID()) ? '<a href="' . $checkin_url . '" title="' . esc_attr__('View Checkins for this Event', 'event_espresso') . '">' . $datetime->get_i18n_datetime('DTT_EVT_start') . '</a>' : $datetime->get_i18n_datetime('DTT_EVT_start');
     }
     return implode("<br />", $datetime_strings);
 }
    /**
     * Checks if we're in maintenance mode, and if so we notify the admin adn tell them how to take the site OUT of maintenance mode
     */
    public function check_maintenance_mode()
    {
        if (EE_Maintenance_Mode::instance()->level()) {
            $maintenance_page_url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_MAINTENANCE_ADMIN_URL);
            switch (EE_Maintenance_Mode::instance()->level()) {
                case EE_Maintenance_Mode::level_1_frontend_only_maintenance:
                    echo '<div class="updated">
						<p>' . sprintf(__("Event Espresso is in Frontend-Only MAINTENANCE MODE. This means the front-end (ie, non-wp-admin pages) is disabled for ALL users except site admins. Visit the %s Maintenance Page %s to disable maintenance mode.", "event_espresso"), "<a href='{$maintenance_page_url}'>", "</a>") . '</div>';
                    break;
                case EE_Maintenance_Mode::level_2_complete_maintenance:
                    echo '<div class="error">
						<p>' . sprintf(__("As part of the process for updating Event Espresso, your database also\nneeds to be updated. Event Espresso is in COMPLETE MAINTENANCE MODE (both WordPress admin pages and front-end event registration pages are disabled) until you run the database update script. %s Visit the Maintenance Page to get started,%s it only takes a moment.", "event_espresso"), "<a href='{$maintenance_page_url}'>", "</a>") . '</div>';
                    break;
            }
        }
    }
    /**
     * Checks that there is at least one active gateway. If not, add a notice
     */
    public function check_payment_gateway_setup()
    {
        //ONLY do this check if models can query
        //and avoid a bug where when we nuke EE4's data that this causes a fatal error
        //because the tables are deleted just before this request runs. see https://events.codebasehq.com/projects/event-espresso/tickets/7539
        if (!EE_Maintenance_Mode::instance()->models_can_query() || !EEH_Activation::table_exists(EEM_Payment_Method::instance()->table())) {
            return;
        }
        // ensure Payment_Method model is loaded
        EE_Registry::instance()->load_model('Payment_Method');
        $actives = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart);
        if ($actives < 1) {
            $url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_PAYMENTS_ADMIN_URL);
            echo '<div class="error">
				 <p>' . sprintf(__("There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", "event_espresso"), "<a href='{$url}'>", "</a>") . '</p>
			 </div>';
        }
    }
 function column_TKT_name($item)
 {
     //build row actions
     $actions = array();
     //trash links
     if ($item->ID() !== 1) {
         if ($this->_view == 'all') {
             $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'trash_ticket', 'TKT_ID' => $item->ID()), TICKETS_ADMIN_URL);
             $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
         } else {
             // restore price link
             $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'restore_ticket', 'TKT_ID' => $item->ID()), TICKETS_ADMIN_URL);
             $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' . esc_attr__('Restore Ticket', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
             // delete price link
             $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'delete_ticket', 'TKT_ID' => $item->ID()), TICKETS_ADMIN_URL);
             $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>';
         }
     }
     return $item->get('TKT_name') . $this->row_actions($actions);
 }
 function column_ATT_fname($item)
 {
     //Build row actions
     $actions = array();
     // edit attendee link
     $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $item->ID()), REG_ADMIN_URL);
     $actions['edit'] = '<a href="' . $edit_lnk_url . '" title="' . __('Edit Contact', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>';
     if ($this->_view == 'in_use') {
         // trash attendee link
         $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'trash_attendees', 'ATT_ID' => $item->ID()), REG_ADMIN_URL);
         $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . __('Move Contact to Trash', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
     } else {
         // restore attendee link
         $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'restore_attendees', 'ATT_ID' => $item->ID()), REG_ADMIN_URL);
         $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' . __('Restore Contact', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
     }
     $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $item->ID()), REG_ADMIN_URL);
     $name_link = '<a href="' . $edit_lnk_url . '" title="' . __('Edit Contact', 'event_espresso') . '">' . $item->fname() . '</a>';
     //Return the name contents
     return sprintf('%1$s %2$s', $name_link, $this->row_actions($actions));
 }
 protected function _output_details($view, $taxonomy = 'espresso_people_categories')
 {
     //load formatter helper
     EE_Registry::instance()->load_helper('Formatter');
     //load field generator helper
     EE_Registry::instance()->load_helper('Form_Fields');
     $slug = $taxonomy == 'espresso_people_categories' ? 'category' : 'type';
     $route = $view == 'edit' ? 'update_' . $slug : 'insert_' . $slug;
     $this->_set_add_edit_form_tags($route);
     $this->_set_term_object($taxonomy);
     $id = !empty($this->_term_object->id) ? $this->_term_object->id : '';
     $delete_action = 'delete_' . $slug;
     //custom redirect
     $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => $slug . '_list'), $this->_admin_base_url);
     $id_ident = $taxonomy == 'espresso_people_categories' ? 'PER_CAT_ID' : 'PER_TYPE_ID';
     $this->_set_publish_post_box_vars($id_ident, $id, $delete_action, $redirect);
     //take care of contents
     $this->_template_args['admin_page_content'] = $this->_term_object_details_content($taxonomy);
     $this->display_admin_page_with_sidebar();
 }
 function column_PER_lname($item)
 {
     //Build row actions
     $actions = array();
     // edit person link
     if (EE_Registry::instance()->CAP->current_user_can('ee_edit_people', 'eea-people-addon_edit_people', $item->ID())) {
         $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $item->ID()), EEA_PEOPLE_ADDON_ADMIN_URL);
         $actions['edit'] = '<a href="' . $edit_lnk_url . '" title="' . __('Edit Person', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>';
     }
     if ($this->_view == 'publish' || $this->_view == 'all' || $this->_view == 'draft') {
         // trash person link
         if (EE_Registry::instance()->CAP->current_user_can('ee_delete_people', 'eea-people-addon_trash_people', $item->ID())) {
             $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'trash_person', 'PER_ID' => $item->ID()), EEA_PEOPLE_ADDON_ADMIN_URL);
             $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . __('Move Person to Trash', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
         }
     } else {
         if (EE_Registry::instance()->CAP->current_user_can('ee_delete_people', 'eea-people-addon_restore_people', $item->ID())) {
             // restore person link
             $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'restore_person', 'PER_ID' => $item->ID()), EEA_PEOPLE_ADDON_ADMIN_URL);
             $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' . __('Restore Person', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
             $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'delete_person', 'PER_ID' => $item->ID()), EEA_PEOPLE_ADDON_ADMIN_URL);
             $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' . __('Delete Permanently This Person.', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>';
         }
     }
     $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $item->ID()), EEA_PEOPLE_ADDON_ADMIN_URL);
     $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_people', 'eea-people-addon_edit_people', $item->ID()) ? '<a href="' . $edit_lnk_url . '" title="' . __('Edit Person', 'event_espresso') . '">' . $item->full_name() . '</a>' : $item->full_name();
     $name_link .= '<br>' . '<a href="mailto:' . $item->email() . '">' . $item->email() . '</a>';
     $name_link .= $item->phone() ? '<br>' . sprintf(__('Phone: %s', 'event_espresso'), $item->phone()) : '';
     //Return the name contents
     return sprintf('%1$s %2$s', $name_link, $this->row_actions($actions));
 }
 protected function _category_details($view)
 {
     //load formatter helper
     EE_Registry::instance()->load_helper('Formatter');
     //load field generator helper
     EE_Registry::instance()->load_helper('Form_Fields');
     $route = $view == 'edit' ? 'update_category' : 'insert_category';
     $this->_set_add_edit_form_tags($route);
     $this->_set_category_object();
     $id = !empty($this->_category->id) ? $this->_category->id : '';
     $delete_action = 'delete_category';
     $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
     $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
     //take care of contents
     $this->_template_args['admin_page_content'] = $this->_category_details_content();
     $this->display_admin_page_with_sidebar();
 }
 function column_name($item)
 {
     //Build row actions
     $actions = array();
     // edit price link
     if (EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'pricing_edit_price', $item->ID())) {
         $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_price', 'id' => $item->ID()), PRICING_ADMIN_URL);
         $actions['edit'] = '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('Edit Price', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>';
     }
     $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'edit_price', $item->ID()) ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('Edit Price', 'event_espresso') . '">' . stripslashes($item->name()) . '</a>' : $item->name();
     if ($item->type_obj()->base_type() !== 1) {
         if ($this->_view == 'all') {
             // trash price link
             if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_trash_price', $item->ID())) {
                 $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'trash_price', 'id' => $item->ID(), 'noheader' => TRUE), PRICING_ADMIN_URL);
                 $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . esc_attr__('Move Price to Trash', 'event_espresso') . '">' . __('Move to Trash', 'event_espresso') . '</a>';
             }
         } else {
             if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_restore_price', $item->ID())) {
                 // restore price link
                 $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'restore_price', 'id' => $item->ID(), 'noheader' => TRUE), PRICING_ADMIN_URL);
                 $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' . esc_attr__('Restore Price', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
             }
             // delete price link
             if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_delete_price', $item->ID())) {
                 $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'delete_price', 'id' => $item->ID(), 'noheader' => TRUE), PRICING_ADMIN_URL);
                 $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' . esc_attr__('Delete Price Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>';
             }
         }
     }
     //Return the name contents
     return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s', $name_link, $item->ID(), $this->row_actions($actions));
 }
 public function _contact_list_report()
 {
     if (!defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
         wp_redirect(EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_batch', 'batch' => 'file', 'job_handler' => urlencode('EventEspressoBatchRequest\\JobHandlers\\AttendeesReport'), 'return_url' => urlencode($this->_req_data['return_url']))));
     } else {
         EE_Registry::instance()->load_helper('File');
         if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
             require_once EE_CLASSES . 'EE_Export.class.php';
             $EE_Export = EE_Export::instance($this->_req_data);
             $EE_Export->report_attendees();
         }
     }
 }
 /**
  * Callback for FHEE__EE_Admin_List_Table__column_actions__event-espresso_page_espresso_messages action that allows for adding the content for the registered "action" column.
  *
  * @since 4.3.2
  *
  * @param EE_Base_Class
  * @param string $screen_id Unique screen id for the page
  *
  * @return string html content for the page.
  */
 public function custom_mtp_create_button_column($item, $screen_id)
 {
     if ($screen_id !== 'espresso_messages_default' || !EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template')) {
         return '';
     }
     //first we consider whether this template has override set.  If it does then that means no custom templates can be created from this template as a base.  So let's just skip the button creation.
     if ($item->get('MTP_is_override')) {
         return '';
     }
     $create_args = array('GRP_ID' => $item->ID(), 'messenger' => $item->messenger(), 'message_type' => $item->message_type(), 'action' => 'add_new_message_template');
     $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL);
     echo sprintf('<a href="%s" class="button button-small">%s</a>', $create_link, __('Create Custom', 'event_espresso'));
 }
foreach ($most_recent_migration->get_errors() as $error) {
    ?>
	<li><?php 
    echo $error;
    ?>
</li>
<?php 
}
?>
</ul>
<h2><?php 
_e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso");
?>
</h2>
<form action='<?php 
echo EE_Admin_Page::add_query_args_and_nonce(array('action' => 'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL);
?>
' method='post'>
	<table class='widefat'>
		<tr><td><label for='from'><?php 
_e("From/Reply-To:", "event_espresso");
?>
</label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php 
echo get_bloginfo('admin_email', 'display');
?>
'></td></tr>
		<tr><td><label for='from_name'><?php 
_e("Your Name", "event_espresso");
?>
</label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php 
printf(__("Admin of %s", "event_espresso"), get_bloginfo('name', 'display'));
 /**
  * @param $elements
  * @return array
  */
 public function dashboard_glance_items($elements)
 {
     $events = EEM_Event::instance()->count();
     $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
     $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
     $items['events']['title'] = __('Click to view all Events', 'event_espresso');
     $registrations = EEM_Registration::instance()->count(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete))));
     $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
     $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
     $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
     $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
     foreach ($items as $type => $item_properties) {
         $elements[] = sprintf('<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
     }
     return $elements;
 }
 protected function _parser($shortcode)
 {
     EE_Registry::instance()->load_helper('Template');
     if (!$this->_data->txn instanceof EE_Transaction) {
         return '';
     }
     switch ($shortcode) {
         case '[TXN_ID]':
             return $this->_data->txn->ID();
             break;
         case '[PAYMENT_URL]':
             $payment_url = $this->_data->txn->payment_overview_url();
             return empty($payment_url) ? __('http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url;
             break;
         case '[INVOICE_LINK]':
             $invoice_url = $this->_data->txn->invoice_url();
             $invoice_url = empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
             return sprintf(__('%sClick here for Invoice%s', 'event_espresso'), '<a href="' . $invoice_url . '">', '</a>');
             break;
             /**/
         /**/
         case '[INVOICE_URL]':
             $invoice_url = $this->_data->txn->invoice_url();
             return empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
             break;
         case "[TOTAL_COST]":
             $total = $this->_data->txn->total();
             return !empty($total) ? EEH_Template::format_currency($total) : '';
             break;
         case "[PAYMENT_STATUS]":
             $status = $this->_data->txn->pretty_status();
             return !empty($status) ? $status : __('Unknown', 'event_espresso');
             break;
             /**/
         /**/
         case "[PAYMENT_GATEWAY]":
             return $this->_get_payment_gateway();
             break;
         case "[AMOUNT_PAID]":
             $amount = isset($this->_data->payment) && is_object($this->_data->payment) ? $this->_data->payment->amount() : 0;
             return EEH_Template::format_currency($amount);
             break;
         case "[TOTAL_OWING]":
             $total_owing = isset($this->_data->txn) && is_object($this->_data->txn) ? $this->_data->txn->remaining() : $this->_data->txn->total();
             return EEH_Template::format_currency($total_owing);
             break;
         case "[TKT_QTY_PURCHASED]":
             return $this->_data->total_ticket_count;
             break;
         case "[TRANSACTION_ADMIN_URL]":
             require_once EE_CORE . 'admin/EE_Admin_Page.core.php';
             $query_args = array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $this->_data->txn->ID());
             $url = EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php'));
             return $url;
             break;
     }
     return '';
 }
 public function column_actions($item)
 {
     //todo: remove when attendees is active
     if (!defined('REG_ADMIN_URL')) {
         define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
     }
     $actionlinks = array();
     $edit_query_args = array('action' => 'edit', 'post' => $item->ID());
     $attendees_query_args = array('action' => 'default', 'event_id' => $item->ID());
     $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
     $view_link = get_permalink($item->ID());
     $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
     $actionlinks[] = '<a href="' . $view_link . '" title="' . __('View Event', 'event_espresso') . '" target="_blank">';
     $actionlinks[] = '<div class="dashicons dashicons-search"></div></a>';
     $actionlinks[] = '<a href="' . $edit_link . '" title="' . __('Edit Event', 'event_espresso') . '"><div class="ee-icon ee-icon-calendar-edit"></div></a>';
     $actionlinks[] = '<a href="' . $attendees_link . '" title="' . __('View Registrants', 'event_espresso') . '"><div class="dashicons dashicons-groups"></div></a>';
     $actionlinks = apply_filters('FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item);
     $content = '<div style="width:100%;">' . "\n\t";
     $content .= implode("\n\t", $actionlinks);
     //todo: we need to put back in a email attendees link via the new messages system
     $content .= "\n" . '</div>' . "\n";
     return $content;
 }
 /**
  * 		display_country_states
  *
  * 		@access 	public
  * 		@param 	string 		$CNT_ISO
  * 		@return 		string
  */
 public function display_country_states($CNT_ISO = '')
 {
     $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
     if (!$CNT_ISO) {
         return '';
     }
     // for ajax
     remove_all_filters('FHEE__EEH_Form_Fields__label_html');
     remove_all_filters('FHEE__EEH_Form_Fields__input_html');
     add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
     add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
     $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
     //			echo '<h4>$CNT_ISO : ' . $CNT_ISO . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
     //			global $wpdb;
     //			echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
     //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
     if ($states) {
         foreach ($states as $STA_ID => $state) {
             if ($state instanceof EE_State) {
                 //STA_abbrev 	STA_name 	STA_active
                 $state_input_types = array('STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text'), 'STA_name' => array('type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text'), 'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true));
                 $this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types);
                 $query_args = array('action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev());
                 $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL);
             }
         }
     } else {
         $this->_template_args['states'] = FALSE;
     }
     //		EEH_Debug_Tools::printr( $this->_template_args['states'], 'states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
     $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL);
     $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE);
     if (defined('DOING_AJAX')) {
         $notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
         echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
         die;
     } else {
         return $state_details_settings;
     }
 }
					<?php 
    $event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events'));
    echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="' . $event_url . '"  title="' . esc_attr__('Edit Event', 'event_espresso') . '">' . $registration->event_name() . '</a>' : $registration->event_name();
    ?>
					</td>
					<td class="jst-left">
					<?php 
    $reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $registration->ID()), REG_ADMIN_URL);
    echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
							<a href="' . $reg_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">' . sprintf(__('
								View Registration ', 'event_espresso'), $registration->ID()) . '</a>' : '';
    ?>
					</td>
					<td class="jst-left">
					<?php 
    $txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $registration->transaction_ID()), TXN_ADMIN_URL);
    echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
						<a href="' . $txn_url . '" title="' . esc_attr__('View Transaction Details', 'event_espresso') . '">
							View Transaction ' . $registration->transaction_ID() . '
						</a>' : '';
    ?>
					</td>
					<td class="jst-left"><?php 
    echo $registration->reg_code();
    ?>
</td>
					<td class="jst-rght"><?php 
    echo EEH_Template::format_currency($registration->final_price());
    ?>
</td>
				</tr>
 /**
  * _activate_payment_method_button
  *
  * @access protected
  * @param \EE_Payment_Method $payment_method
  * @return \EE_Form_Section_Proper
  */
 protected function _activate_payment_method_button(EE_Payment_Method $payment_method)
 {
     $link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name());
     return new EE_Form_Section_Proper(array('name' => 'activate_' . $payment_method->slug() . '_settings_form', 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form', 'action' => '#', 'layout_strategy' => new EE_Admin_Two_Column_Layout(), 'subsections' => apply_filters('FHEE__Payments_Admin_Page___activate_payment_method_button__form_subsections', array(new EE_Form_Section_HTML(EEH_HTML::tr(EEH_HTML::th(EEH_HTML::label(__('Click to Activate ', 'event_espresso'))) . EEH_HTML::td(EEH_HTML::link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'activate_payment_method', 'payment_method_type' => $payment_method->type()), EE_PAYMENTS_ADMIN_URL), $link_text_and_title, $link_text_and_title, 'activate_' . $payment_method->slug(), 'espresso-button-green button-primary'))))), $payment_method)));
 }