| @@ -38,103 +38,103 @@ | ||
| 38 | 38 | * @since 4.0 | 
| 39 | 39 | */ | 
| 40 | 40 |  if (function_exists('espresso_version')) { | 
| 41 | -    if (! function_exists('espresso_duplicate_plugin_error')) { | |
| 42 | - /** | |
| 43 | - * espresso_duplicate_plugin_error | |
| 44 | - * displays if more than one version of EE is activated at the same time | |
| 45 | - */ | |
| 46 | - function espresso_duplicate_plugin_error() | |
| 47 | -        { | |
| 48 | - ?> | |
| 41 | +	if (! function_exists('espresso_duplicate_plugin_error')) { | |
| 42 | + /** | |
| 43 | + * espresso_duplicate_plugin_error | |
| 44 | + * displays if more than one version of EE is activated at the same time | |
| 45 | + */ | |
| 46 | + function espresso_duplicate_plugin_error() | |
| 47 | +		{ | |
| 48 | + ?> | |
| 49 | 49 | <div class="error"> | 
| 50 | 50 | <p> | 
| 51 | 51 | <?php | 
| 52 | - echo esc_html__( | |
| 53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', | |
| 54 | - 'event_espresso' | |
| 55 | - ); ?> | |
| 52 | + echo esc_html__( | |
| 53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', | |
| 54 | + 'event_espresso' | |
| 55 | + ); ?> | |
| 56 | 56 | </p> | 
| 57 | 57 | </div> | 
| 58 | 58 | <?php | 
| 59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); | |
| 60 | - } | |
| 61 | - } | |
| 62 | -    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); | |
| 59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); | |
| 60 | + } | |
| 61 | + } | |
| 62 | +	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); | |
| 63 | 63 |  } else { | 
| 64 | -    define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); | |
| 65 | -    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { | |
| 66 | - /** | |
| 67 | - * espresso_minimum_php_version_error | |
| 68 | - * | |
| 69 | - * @return void | |
| 70 | - */ | |
| 71 | - function espresso_minimum_php_version_error() | |
| 72 | -        { | |
| 73 | - ?> | |
| 64 | +	define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); | |
| 65 | +	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { | |
| 66 | + /** | |
| 67 | + * espresso_minimum_php_version_error | |
| 68 | + * | |
| 69 | + * @return void | |
| 70 | + */ | |
| 71 | + function espresso_minimum_php_version_error() | |
| 72 | +		{ | |
| 73 | + ?> | |
| 74 | 74 | <div class="error"> | 
| 75 | 75 | <p> | 
| 76 | 76 | <?php | 
| 77 | - printf( | |
| 78 | - esc_html__( | |
| 79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', | |
| 80 | - 'event_espresso' | |
| 81 | - ), | |
| 82 | - EE_MIN_PHP_VER_REQUIRED, | |
| 83 | - PHP_VERSION, | |
| 84 | - '<br/>', | |
| 85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' | |
| 86 | - ); | |
| 87 | - ?> | |
| 77 | + printf( | |
| 78 | + esc_html__( | |
| 79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', | |
| 80 | + 'event_espresso' | |
| 81 | + ), | |
| 82 | + EE_MIN_PHP_VER_REQUIRED, | |
| 83 | + PHP_VERSION, | |
| 84 | + '<br/>', | |
| 85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' | |
| 86 | + ); | |
| 87 | + ?> | |
| 88 | 88 | </p> | 
| 89 | 89 | </div> | 
| 90 | 90 | <?php | 
| 91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); | |
| 92 | - } | |
| 91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); | |
| 92 | + } | |
| 93 | 93 | |
| 94 | -        add_action('admin_notices', 'espresso_minimum_php_version_error', 1); | |
| 95 | -    } else { | |
| 96 | -        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); | |
| 97 | - /** | |
| 98 | - * espresso_version | |
| 99 | - * Returns the plugin version | |
| 100 | - * | |
| 101 | - * @return string | |
| 102 | - */ | |
| 103 | - function espresso_version() | |
| 104 | -        { | |
| 105 | -            return apply_filters('FHEE__espresso__espresso_version', '4.9.80.rc.025'); | |
| 106 | - } | |
| 94 | +		add_action('admin_notices', 'espresso_minimum_php_version_error', 1); | |
| 95 | +	} else { | |
| 96 | +		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); | |
| 97 | + /** | |
| 98 | + * espresso_version | |
| 99 | + * Returns the plugin version | |
| 100 | + * | |
| 101 | + * @return string | |
| 102 | + */ | |
| 103 | + function espresso_version() | |
| 104 | +		{ | |
| 105 | +			return apply_filters('FHEE__espresso__espresso_version', '4.9.80.rc.025'); | |
| 106 | + } | |
| 107 | 107 | |
| 108 | - /** | |
| 109 | - * espresso_plugin_activation | |
| 110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page | |
| 111 | - */ | |
| 112 | - function espresso_plugin_activation() | |
| 113 | -        { | |
| 114 | -            update_option('ee_espresso_activation', true); | |
| 115 | - } | |
| 108 | + /** | |
| 109 | + * espresso_plugin_activation | |
| 110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page | |
| 111 | + */ | |
| 112 | + function espresso_plugin_activation() | |
| 113 | +		{ | |
| 114 | +			update_option('ee_espresso_activation', true); | |
| 115 | + } | |
| 116 | 116 | |
| 117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); | |
| 117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); | |
| 118 | 118 | |
| 119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; | |
| 120 | - bootstrap_espresso(); | |
| 121 | - } | |
| 119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; | |
| 120 | + bootstrap_espresso(); | |
| 121 | + } | |
| 122 | 122 | } | 
| 123 | 123 |  if (! function_exists('espresso_deactivate_plugin')) { | 
| 124 | - /** | |
| 125 | - * deactivate_plugin | |
| 126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); | |
| 127 | - * | |
| 128 | - * @access public | |
| 129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file | |
| 130 | - * @return void | |
| 131 | - */ | |
| 132 | - function espresso_deactivate_plugin($plugin_basename = '') | |
| 133 | -    { | |
| 134 | -        if (! function_exists('deactivate_plugins')) { | |
| 135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 136 | - } | |
| 137 | - unset($_GET['activate'], $_REQUEST['activate']); | |
| 138 | - deactivate_plugins($plugin_basename); | |
| 139 | - } | |
| 124 | + /** | |
| 125 | + * deactivate_plugin | |
| 126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); | |
| 127 | + * | |
| 128 | + * @access public | |
| 129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file | |
| 130 | + * @return void | |
| 131 | + */ | |
| 132 | + function espresso_deactivate_plugin($plugin_basename = '') | |
| 133 | +	{ | |
| 134 | +		if (! function_exists('deactivate_plugins')) { | |
| 135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 136 | + } | |
| 137 | + unset($_GET['activate'], $_REQUEST['activate']); | |
| 138 | + deactivate_plugins($plugin_basename); | |
| 139 | + } | |
| 140 | 140 | } | 
| @@ -16,222 +16,222 @@ | ||
| 16 | 16 | class Price_Types_List_Table extends EE_Admin_List_Table | 
| 17 | 17 |  { | 
| 18 | 18 | |
| 19 | - public function __construct($admin_page) | |
| 20 | -    { | |
| 21 | - parent::__construct($admin_page); | |
| 22 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); | |
| 23 | - $this->_PRT = EEM_Price_Type::instance(); | |
| 24 | - } | |
| 25 | - | |
| 26 | - | |
| 27 | - protected function _setup_data() | |
| 28 | -    { | |
| 29 | - $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; | |
| 30 | - $this->_data = $this->_admin_page->get_price_types_overview_data($this->_per_page, false, $trashed); | |
| 31 | - $this->_all_data_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, false); | |
| 32 | - $this->_trashed_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, true); | |
| 33 | - } | |
| 34 | - | |
| 35 | - | |
| 36 | - protected function _set_properties() | |
| 37 | -    { | |
| 38 | - $this->_wp_list_args = array( | |
| 39 | -            'singular' => esc_html__('price type', 'event_espresso'), | |
| 40 | -            'plural'   => esc_html__('price types', 'event_espresso'), | |
| 41 | - 'ajax' => true, | |
| 42 | - 'screen' => $this->_admin_page->get_current_screen()->id, | |
| 43 | - ); | |
| 44 | - | |
| 45 | - $this->_columns = array( | |
| 46 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text | |
| 47 | -            'name'      => esc_html__('Name', 'event_espresso'), | |
| 48 | -            'base_type' => '<div class="jst-cntr">' . esc_html__('Base Type', 'event_espresso') . '</div>', | |
| 49 | - 'percent' => '<div class="jst-cntr">' | |
| 50 | - . sprintf( | |
| 51 | - /* translators: 1: HTML new line, 2: open span tag, 3: close span tag */ | |
| 52 | -                               esc_html__('Applied %1$s as %2$s%%%3$s or %2$s$%3$s', 'event_espresso'), | |
| 53 | - '<br/>', | |
| 54 | - '<span class="big-text">', | |
| 55 | - '</span>' | |
| 56 | - ) | |
| 57 | - . '</div>', | |
| 58 | - 'order' => '<div class="jst-cntr">' | |
| 59 | - . sprintf( | |
| 60 | - /* translators: HTML new line */ | |
| 61 | -                               esc_html__('Order of %s Application', 'event_espresso'), | |
| 62 | - '<br/>' | |
| 63 | - ) | |
| 64 | - . '</div>', | |
| 65 | - ); | |
| 66 | - | |
| 67 | - $this->_sortable_columns = array( | |
| 68 | - // TRUE means its already sorted | |
| 69 | -            'name' => array('name' => false), | |
| 70 | - ); | |
| 71 | - | |
| 72 | - $this->_hidden_columns = array(); | |
| 73 | - } | |
| 74 | - | |
| 75 | - | |
| 76 | - protected function _get_table_filters() | |
| 77 | -    { | |
| 78 | - } | |
| 79 | - | |
| 80 | - | |
| 81 | - protected function _add_view_counts() | |
| 82 | -    { | |
| 83 | - $this->_views['all']['count'] = $this->_all_data_count; | |
| 84 | - if (EE_Registry::instance()->CAP->current_user_can( | |
| 85 | - 'ee_delete_default_price_types', | |
| 86 | - 'pricing_trash_price_type' | |
| 87 | -        )) { | |
| 88 | - $this->_views['trashed']['count'] = $this->_trashed_count; | |
| 89 | - } | |
| 90 | - } | |
| 91 | - | |
| 92 | - | |
| 93 | - public function column_cb($item) | |
| 94 | -    { | |
| 95 | -        if ($item->base_type() !== 1) { | |
| 96 | - return sprintf( | |
| 97 | - '<input type="checkbox" name="checkbox[%1$s]" />', | |
| 98 | - $item->ID() | |
| 99 | - ); | |
| 100 | - } | |
| 101 | - return ''; | |
| 102 | - } | |
| 103 | - | |
| 104 | - | |
| 105 | - public function column_name($item) | |
| 106 | -    { | |
| 107 | - | |
| 108 | - // Build row actions | |
| 109 | - $actions = array(); | |
| 110 | - // edit price link | |
| 111 | - if (EE_Registry::instance()->CAP->current_user_can( | |
| 112 | - 'ee_edit_default_price_type', | |
| 113 | - 'pricing_edit_price_type', | |
| 114 | - $item->ID() | |
| 115 | -        )) { | |
| 116 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( | |
| 117 | - 'action' => 'edit_price_type', | |
| 118 | - 'id' => $item->ID(), | |
| 119 | - ), PRICING_ADMIN_URL); | |
| 120 | - $actions['edit'] = '<a href="' . $edit_lnk_url . '" aria-label="' | |
| 121 | - . sprintf( | |
| 122 | - /* translators: The name of the price type */ | |
| 123 | -                                   esc_attr__('Edit Price Type (%s)', 'event_espresso'), | |
| 124 | - $item->name() | |
| 125 | - ) | |
| 126 | - . '">' | |
| 127 | -                               . esc_html__('Edit', 'event_espresso') . '</a>'; | |
| 128 | - } | |
| 129 | - | |
| 130 | - $name_link = EE_Registry::instance()->CAP->current_user_can( | |
| 131 | - 'ee_edit_default_price_type', | |
| 132 | - 'pricing_edit_price_type', | |
| 133 | - $item->ID() | |
| 134 | - ) | |
| 135 | - ? '<a href="' . $edit_lnk_url . '" aria-label="' | |
| 136 | - . sprintf( | |
| 137 | - /* translators: The name of the price type */ | |
| 138 | -                  esc_attr__('Edit Price Type (%s)', 'event_espresso'), | |
| 139 | - $item->name() | |
| 140 | - ) | |
| 141 | - . '">' | |
| 142 | - . stripslashes($item->name()) . '</a>' | |
| 143 | - : $item->name(); | |
| 144 | - | |
| 145 | -        if ($item->base_type() !== 1) { | |
| 146 | -            if ($this->_view == 'all') { | |
| 147 | - // trash price link | |
| 148 | - if (EE_Registry::instance()->CAP->current_user_can( | |
| 149 | - 'ee_delete_default_price_type', | |
| 150 | - 'pricing_trash_price_type', | |
| 151 | - $item->ID() | |
| 152 | -                )) { | |
| 153 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( | |
| 154 | - 'action' => 'trash_price_type', | |
| 155 | - 'id' => $item->ID(), | |
| 156 | - 'noheader' => true, | |
| 157 | - ), PRICING_ADMIN_URL); | |
| 158 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="' | |
| 159 | - . sprintf( | |
| 160 | - /* translators: The name of the price type */ | |
| 161 | -                                            esc_attr__('Move Price Type %s to Trash', 'event_espresso'), | |
| 162 | - $item->name() | |
| 163 | - ) | |
| 164 | - . '">' | |
| 165 | -                                        . esc_html__('Move to Trash', 'event_espresso') . '</a>'; | |
| 166 | - } | |
| 167 | -            } else { | |
| 168 | - // restore price link | |
| 169 | - if (EE_Registry::instance()->CAP->current_user_can( | |
| 170 | - 'ee_delete_default_price_type', | |
| 171 | - 'pricing_restore_price_type', | |
| 172 | - $item->ID() | |
| 173 | -                )) { | |
| 174 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( | |
| 175 | - 'action' => 'restore_price_type', | |
| 176 | - 'id' => $item->ID(), | |
| 177 | - 'noheader' => true, | |
| 178 | - ), PRICING_ADMIN_URL); | |
| 179 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="' | |
| 180 | - . sprintf( | |
| 181 | - /* translators: The name of the price type */ | |
| 182 | -                                              esc_attr__('Restore Price Type (%s)', 'event_espresso'), | |
| 183 | - $item->name() | |
| 184 | - ) | |
| 185 | - . '">' | |
| 186 | -                                          . esc_html__('Restore', 'event_espresso') . '</a>'; | |
| 187 | - } | |
| 188 | - // delete price link | |
| 189 | - if (EE_Registry::instance()->CAP->current_user_can( | |
| 190 | - 'ee_delete_default_price_type', | |
| 191 | - 'pricing_delete_price_type', | |
| 192 | - $item->ID() | |
| 193 | -                )) { | |
| 194 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( | |
| 195 | - 'action' => 'delete_price_type', | |
| 196 | - 'id' => $item->ID(), | |
| 197 | - 'noheader' => true, | |
| 198 | - ), PRICING_ADMIN_URL); | |
| 199 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="' | |
| 200 | - . sprintf( | |
| 201 | - /* translators: The name of the price type */ | |
| 202 | -                                             esc_attr__('Delete Price Type %s Permanently', 'event_espresso'), | |
| 203 | - $item->name() | |
| 204 | - ) | |
| 205 | - . '">' | |
| 206 | -                                         . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; | |
| 207 | - } | |
| 208 | - } | |
| 209 | - } | |
| 210 | - | |
| 211 | - // Return the name contents | |
| 212 | - return sprintf( | |
| 213 | - '%1$s <span style="color:silver">(id:%2$s)</span>%3$s', | |
| 214 | - $name_link, | |
| 215 | - $item->ID(), | |
| 216 | - $this->row_actions($actions) | |
| 217 | - ); | |
| 218 | - } | |
| 219 | - | |
| 220 | - | |
| 221 | - public function column_base_type($item) | |
| 222 | -    { | |
| 223 | - return '<div class="jst-cntr">' . $item->base_type_name() . '</div>'; | |
| 224 | - } | |
| 225 | - | |
| 226 | - | |
| 227 | - public function column_percent($item) | |
| 228 | -    { | |
| 229 | - return '<div class="jst-cntr">' . ($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign) . '</div>'; | |
| 230 | - } | |
| 231 | - | |
| 232 | - | |
| 233 | - public function column_order($item) | |
| 234 | -    { | |
| 235 | - return '<div class="jst-cntr">' . $item->order() . '</div>'; | |
| 236 | - } | |
| 19 | + public function __construct($admin_page) | |
| 20 | +	{ | |
| 21 | + parent::__construct($admin_page); | |
| 22 | + require_once(EE_MODELS . 'EEM_Price_Type.model.php'); | |
| 23 | + $this->_PRT = EEM_Price_Type::instance(); | |
| 24 | + } | |
| 25 | + | |
| 26 | + | |
| 27 | + protected function _setup_data() | |
| 28 | +	{ | |
| 29 | + $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; | |
| 30 | + $this->_data = $this->_admin_page->get_price_types_overview_data($this->_per_page, false, $trashed); | |
| 31 | + $this->_all_data_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, false); | |
| 32 | + $this->_trashed_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, true); | |
| 33 | + } | |
| 34 | + | |
| 35 | + | |
| 36 | + protected function _set_properties() | |
| 37 | +	{ | |
| 38 | + $this->_wp_list_args = array( | |
| 39 | +			'singular' => esc_html__('price type', 'event_espresso'), | |
| 40 | +			'plural'   => esc_html__('price types', 'event_espresso'), | |
| 41 | + 'ajax' => true, | |
| 42 | + 'screen' => $this->_admin_page->get_current_screen()->id, | |
| 43 | + ); | |
| 44 | + | |
| 45 | + $this->_columns = array( | |
| 46 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text | |
| 47 | +			'name'      => esc_html__('Name', 'event_espresso'), | |
| 48 | +			'base_type' => '<div class="jst-cntr">' . esc_html__('Base Type', 'event_espresso') . '</div>', | |
| 49 | + 'percent' => '<div class="jst-cntr">' | |
| 50 | + . sprintf( | |
| 51 | + /* translators: 1: HTML new line, 2: open span tag, 3: close span tag */ | |
| 52 | +							   esc_html__('Applied %1$s as %2$s%%%3$s or %2$s$%3$s', 'event_espresso'), | |
| 53 | + '<br/>', | |
| 54 | + '<span class="big-text">', | |
| 55 | + '</span>' | |
| 56 | + ) | |
| 57 | + . '</div>', | |
| 58 | + 'order' => '<div class="jst-cntr">' | |
| 59 | + . sprintf( | |
| 60 | + /* translators: HTML new line */ | |
| 61 | +							   esc_html__('Order of %s Application', 'event_espresso'), | |
| 62 | + '<br/>' | |
| 63 | + ) | |
| 64 | + . '</div>', | |
| 65 | + ); | |
| 66 | + | |
| 67 | + $this->_sortable_columns = array( | |
| 68 | + // TRUE means its already sorted | |
| 69 | +			'name' => array('name' => false), | |
| 70 | + ); | |
| 71 | + | |
| 72 | + $this->_hidden_columns = array(); | |
| 73 | + } | |
| 74 | + | |
| 75 | + | |
| 76 | + protected function _get_table_filters() | |
| 77 | +	{ | |
| 78 | + } | |
| 79 | + | |
| 80 | + | |
| 81 | + protected function _add_view_counts() | |
| 82 | +	{ | |
| 83 | + $this->_views['all']['count'] = $this->_all_data_count; | |
| 84 | + if (EE_Registry::instance()->CAP->current_user_can( | |
| 85 | + 'ee_delete_default_price_types', | |
| 86 | + 'pricing_trash_price_type' | |
| 87 | +		)) { | |
| 88 | + $this->_views['trashed']['count'] = $this->_trashed_count; | |
| 89 | + } | |
| 90 | + } | |
| 91 | + | |
| 92 | + | |
| 93 | + public function column_cb($item) | |
| 94 | +	{ | |
| 95 | +		if ($item->base_type() !== 1) { | |
| 96 | + return sprintf( | |
| 97 | + '<input type="checkbox" name="checkbox[%1$s]" />', | |
| 98 | + $item->ID() | |
| 99 | + ); | |
| 100 | + } | |
| 101 | + return ''; | |
| 102 | + } | |
| 103 | + | |
| 104 | + | |
| 105 | + public function column_name($item) | |
| 106 | +	{ | |
| 107 | + | |
| 108 | + // Build row actions | |
| 109 | + $actions = array(); | |
| 110 | + // edit price link | |
| 111 | + if (EE_Registry::instance()->CAP->current_user_can( | |
| 112 | + 'ee_edit_default_price_type', | |
| 113 | + 'pricing_edit_price_type', | |
| 114 | + $item->ID() | |
| 115 | +		)) { | |
| 116 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( | |
| 117 | + 'action' => 'edit_price_type', | |
| 118 | + 'id' => $item->ID(), | |
| 119 | + ), PRICING_ADMIN_URL); | |
| 120 | + $actions['edit'] = '<a href="' . $edit_lnk_url . '" aria-label="' | |
| 121 | + . sprintf( | |
| 122 | + /* translators: The name of the price type */ | |
| 123 | +								   esc_attr__('Edit Price Type (%s)', 'event_espresso'), | |
| 124 | + $item->name() | |
| 125 | + ) | |
| 126 | + . '">' | |
| 127 | +							   . esc_html__('Edit', 'event_espresso') . '</a>'; | |
| 128 | + } | |
| 129 | + | |
| 130 | + $name_link = EE_Registry::instance()->CAP->current_user_can( | |
| 131 | + 'ee_edit_default_price_type', | |
| 132 | + 'pricing_edit_price_type', | |
| 133 | + $item->ID() | |
| 134 | + ) | |
| 135 | + ? '<a href="' . $edit_lnk_url . '" aria-label="' | |
| 136 | + . sprintf( | |
| 137 | + /* translators: The name of the price type */ | |
| 138 | +				  esc_attr__('Edit Price Type (%s)', 'event_espresso'), | |
| 139 | + $item->name() | |
| 140 | + ) | |
| 141 | + . '">' | |
| 142 | + . stripslashes($item->name()) . '</a>' | |
| 143 | + : $item->name(); | |
| 144 | + | |
| 145 | +		if ($item->base_type() !== 1) { | |
| 146 | +			if ($this->_view == 'all') { | |
| 147 | + // trash price link | |
| 148 | + if (EE_Registry::instance()->CAP->current_user_can( | |
| 149 | + 'ee_delete_default_price_type', | |
| 150 | + 'pricing_trash_price_type', | |
| 151 | + $item->ID() | |
| 152 | +				)) { | |
| 153 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( | |
| 154 | + 'action' => 'trash_price_type', | |
| 155 | + 'id' => $item->ID(), | |
| 156 | + 'noheader' => true, | |
| 157 | + ), PRICING_ADMIN_URL); | |
| 158 | + $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="' | |
| 159 | + . sprintf( | |
| 160 | + /* translators: The name of the price type */ | |
| 161 | +											esc_attr__('Move Price Type %s to Trash', 'event_espresso'), | |
| 162 | + $item->name() | |
| 163 | + ) | |
| 164 | + . '">' | |
| 165 | +										. esc_html__('Move to Trash', 'event_espresso') . '</a>'; | |
| 166 | + } | |
| 167 | +			} else { | |
| 168 | + // restore price link | |
| 169 | + if (EE_Registry::instance()->CAP->current_user_can( | |
| 170 | + 'ee_delete_default_price_type', | |
| 171 | + 'pricing_restore_price_type', | |
| 172 | + $item->ID() | |
| 173 | +				)) { | |
| 174 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( | |
| 175 | + 'action' => 'restore_price_type', | |
| 176 | + 'id' => $item->ID(), | |
| 177 | + 'noheader' => true, | |
| 178 | + ), PRICING_ADMIN_URL); | |
| 179 | + $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="' | |
| 180 | + . sprintf( | |
| 181 | + /* translators: The name of the price type */ | |
| 182 | +											  esc_attr__('Restore Price Type (%s)', 'event_espresso'), | |
| 183 | + $item->name() | |
| 184 | + ) | |
| 185 | + . '">' | |
| 186 | +										  . esc_html__('Restore', 'event_espresso') . '</a>'; | |
| 187 | + } | |
| 188 | + // delete price link | |
| 189 | + if (EE_Registry::instance()->CAP->current_user_can( | |
| 190 | + 'ee_delete_default_price_type', | |
| 191 | + 'pricing_delete_price_type', | |
| 192 | + $item->ID() | |
| 193 | +				)) { | |
| 194 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( | |
| 195 | + 'action' => 'delete_price_type', | |
| 196 | + 'id' => $item->ID(), | |
| 197 | + 'noheader' => true, | |
| 198 | + ), PRICING_ADMIN_URL); | |
| 199 | + $actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="' | |
| 200 | + . sprintf( | |
| 201 | + /* translators: The name of the price type */ | |
| 202 | +											 esc_attr__('Delete Price Type %s Permanently', 'event_espresso'), | |
| 203 | + $item->name() | |
| 204 | + ) | |
| 205 | + . '">' | |
| 206 | +										 . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; | |
| 207 | + } | |
| 208 | + } | |
| 209 | + } | |
| 210 | + | |
| 211 | + // Return the name contents | |
| 212 | + return sprintf( | |
| 213 | + '%1$s <span style="color:silver">(id:%2$s)</span>%3$s', | |
| 214 | + $name_link, | |
| 215 | + $item->ID(), | |
| 216 | + $this->row_actions($actions) | |
| 217 | + ); | |
| 218 | + } | |
| 219 | + | |
| 220 | + | |
| 221 | + public function column_base_type($item) | |
| 222 | +	{ | |
| 223 | + return '<div class="jst-cntr">' . $item->base_type_name() . '</div>'; | |
| 224 | + } | |
| 225 | + | |
| 226 | + | |
| 227 | + public function column_percent($item) | |
| 228 | +	{ | |
| 229 | + return '<div class="jst-cntr">' . ($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign) . '</div>'; | |
| 230 | + } | |
| 231 | + | |
| 232 | + | |
| 233 | + public function column_order($item) | |
| 234 | +	{ | |
| 235 | + return '<div class="jst-cntr">' . $item->order() . '</div>'; | |
| 236 | + } | |
| 237 | 237 | } | 
| @@ -19,7 +19,7 @@ discard block | ||
| 19 | 19 | public function __construct($admin_page) | 
| 20 | 20 |      { | 
| 21 | 21 | parent::__construct($admin_page); | 
| 22 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); | |
| 22 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); | |
| 23 | 23 | $this->_PRT = EEM_Price_Type::instance(); | 
| 24 | 24 | } | 
| 25 | 25 | |
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | $this->_columns = array( | 
| 46 | 46 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text | 
| 47 | 47 |              'name'      => esc_html__('Name', 'event_espresso'), | 
| 48 | -            'base_type' => '<div class="jst-cntr">' . esc_html__('Base Type', 'event_espresso') . '</div>', | |
| 48 | +            'base_type' => '<div class="jst-cntr">'.esc_html__('Base Type', 'event_espresso').'</div>', | |
| 49 | 49 | 'percent' => '<div class="jst-cntr">' | 
| 50 | 50 | . sprintf( | 
| 51 | 51 | /* translators: 1: HTML new line, 2: open span tag, 3: close span tag */ | 
| @@ -117,14 +117,14 @@ discard block | ||
| 117 | 117 | 'action' => 'edit_price_type', | 
| 118 | 118 | 'id' => $item->ID(), | 
| 119 | 119 | ), PRICING_ADMIN_URL); | 
| 120 | - $actions['edit'] = '<a href="' . $edit_lnk_url . '" aria-label="' | |
| 120 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" aria-label="' | |
| 121 | 121 | . sprintf( | 
| 122 | 122 | /* translators: The name of the price type */ | 
| 123 | 123 |                                     esc_attr__('Edit Price Type (%s)', 'event_espresso'), | 
| 124 | 124 | $item->name() | 
| 125 | 125 | ) | 
| 126 | 126 | . '">' | 
| 127 | -                               . esc_html__('Edit', 'event_espresso') . '</a>'; | |
| 127 | +                               . esc_html__('Edit', 'event_espresso').'</a>'; | |
| 128 | 128 | } | 
| 129 | 129 | |
| 130 | 130 | $name_link = EE_Registry::instance()->CAP->current_user_can( | 
| @@ -132,14 +132,14 @@ discard block | ||
| 132 | 132 | 'pricing_edit_price_type', | 
| 133 | 133 | $item->ID() | 
| 134 | 134 | ) | 
| 135 | - ? '<a href="' . $edit_lnk_url . '" aria-label="' | |
| 135 | + ? '<a href="'.$edit_lnk_url.'" aria-label="' | |
| 136 | 136 | . sprintf( | 
| 137 | 137 | /* translators: The name of the price type */ | 
| 138 | 138 |                    esc_attr__('Edit Price Type (%s)', 'event_espresso'), | 
| 139 | 139 | $item->name() | 
| 140 | 140 | ) | 
| 141 | 141 | . '">' | 
| 142 | - . stripslashes($item->name()) . '</a>' | |
| 142 | + . stripslashes($item->name()).'</a>' | |
| 143 | 143 | : $item->name(); | 
| 144 | 144 | |
| 145 | 145 |          if ($item->base_type() !== 1) { | 
| @@ -155,14 +155,14 @@ discard block | ||
| 155 | 155 | 'id' => $item->ID(), | 
| 156 | 156 | 'noheader' => true, | 
| 157 | 157 | ), PRICING_ADMIN_URL); | 
| 158 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="' | |
| 158 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" aria-label="' | |
| 159 | 159 | . sprintf( | 
| 160 | 160 | /* translators: The name of the price type */ | 
| 161 | 161 |                                              esc_attr__('Move Price Type %s to Trash', 'event_espresso'), | 
| 162 | 162 | $item->name() | 
| 163 | 163 | ) | 
| 164 | 164 | . '">' | 
| 165 | -                                        . esc_html__('Move to Trash', 'event_espresso') . '</a>'; | |
| 165 | +                                        . esc_html__('Move to Trash', 'event_espresso').'</a>'; | |
| 166 | 166 | } | 
| 167 | 167 |              } else { | 
| 168 | 168 | // restore price link | 
| @@ -176,14 +176,14 @@ discard block | ||
| 176 | 176 | 'id' => $item->ID(), | 
| 177 | 177 | 'noheader' => true, | 
| 178 | 178 | ), PRICING_ADMIN_URL); | 
| 179 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="' | |
| 179 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" aria-label="' | |
| 180 | 180 | . sprintf( | 
| 181 | 181 | /* translators: The name of the price type */ | 
| 182 | 182 |                                                esc_attr__('Restore Price Type (%s)', 'event_espresso'), | 
| 183 | 183 | $item->name() | 
| 184 | 184 | ) | 
| 185 | 185 | . '">' | 
| 186 | -                                          . esc_html__('Restore', 'event_espresso') . '</a>'; | |
| 186 | +                                          . esc_html__('Restore', 'event_espresso').'</a>'; | |
| 187 | 187 | } | 
| 188 | 188 | // delete price link | 
| 189 | 189 | if (EE_Registry::instance()->CAP->current_user_can( | 
| @@ -196,14 +196,14 @@ discard block | ||
| 196 | 196 | 'id' => $item->ID(), | 
| 197 | 197 | 'noheader' => true, | 
| 198 | 198 | ), PRICING_ADMIN_URL); | 
| 199 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="' | |
| 199 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" aria-label="' | |
| 200 | 200 | . sprintf( | 
| 201 | 201 | /* translators: The name of the price type */ | 
| 202 | 202 |                                               esc_attr__('Delete Price Type %s Permanently', 'event_espresso'), | 
| 203 | 203 | $item->name() | 
| 204 | 204 | ) | 
| 205 | 205 | . '">' | 
| 206 | -                                         . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; | |
| 206 | +                                         . esc_html__('Delete Permanently', 'event_espresso').'</a>'; | |
| 207 | 207 | } | 
| 208 | 208 | } | 
| 209 | 209 | } | 
| @@ -220,18 +220,18 @@ discard block | ||
| 220 | 220 | |
| 221 | 221 | public function column_base_type($item) | 
| 222 | 222 |      { | 
| 223 | - return '<div class="jst-cntr">' . $item->base_type_name() . '</div>'; | |
| 223 | + return '<div class="jst-cntr">'.$item->base_type_name().'</div>'; | |
| 224 | 224 | } | 
| 225 | 225 | |
| 226 | 226 | |
| 227 | 227 | public function column_percent($item) | 
| 228 | 228 |      { | 
| 229 | - return '<div class="jst-cntr">' . ($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign) . '</div>'; | |
| 229 | + return '<div class="jst-cntr">'.($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign).'</div>'; | |
| 230 | 230 | } | 
| 231 | 231 | |
| 232 | 232 | |
| 233 | 233 | public function column_order($item) | 
| 234 | 234 |      { | 
| 235 | - return '<div class="jst-cntr">' . $item->order() . '</div>'; | |
| 235 | + return '<div class="jst-cntr">'.$item->order().'</div>'; | |
| 236 | 236 | } | 
| 237 | 237 | } |