2018-02-23 04:55:25 -05:00
< ? php
/**
* 2 AM Awesome loginbar Settings Controls
*
* @ version 1.0
*
*/
if ( ! class_exists ( 'MAGE_Events_Setting_Controls' ) ) :
class MAGE_Events_Setting_Controls {
private $settings_api ;
function __construct () {
$this -> settings_api = new MAGE_Setting_API ;
add_action ( 'admin_init' , array ( $this , 'admin_init' ) );
add_action ( 'admin_menu' , array ( $this , 'admin_menu' ) );
}
function admin_init () {
//set the settings
$this -> settings_api -> set_sections ( $this -> get_settings_sections () );
$this -> settings_api -> set_fields ( $this -> get_settings_fields () );
//initialize settings
$this -> settings_api -> admin_init ();
}
2018-12-05 05:06:09 -05:00
2018-02-23 04:55:25 -05:00
function admin_menu () {
2018-12-05 05:06:09 -05:00
//add_options_page( 'Event Settings', 'Event Settings', 'delete_posts', 'mep_event_settings_page', array($this, 'plugin_page') );
add_submenu_page ( 'edit.php?post_type=mep_events' , __ ( 'Event Settings' , 'mage-eventpress' ), __ ( 'Event Settings' , 'mage-eventpress' ), 'manage_options' , 'mep_event_settings_page' , array ( $this , 'plugin_page' ));
2018-02-23 04:55:25 -05:00
}
function get_settings_sections () {
2018-07-02 04:39:41 -04:00
2018-02-23 04:55:25 -05:00
$sections = array (
array (
'id' => 'general_setting_sec' ,
2018-12-18 02:55:56 -05:00
'title' => __ ( 'General Settings' , 'mage-eventpress' )
2018-07-02 04:39:41 -04:00
),
array (
'id' => 'email_setting_sec' ,
2018-12-18 02:55:56 -05:00
'title' => __ ( 'Email Settings' , 'mage-eventpress' )
2018-07-03 08:16:19 -04:00
),
2018-07-09 04:27:18 -04:00
array (
'id' => 'style_setting_sec' ,
2018-12-18 02:55:56 -05:00
'title' => __ ( 'Style Settings' , 'mage-eventpress' )
2018-07-09 04:27:18 -04:00
),
2018-07-03 08:16:19 -04:00
array (
'id' => 'label_setting_sec' ,
2019-04-06 06:40:08 -04:00
'title' => __ ( 'Translation Settings' , 'mage-eventpress' )
2018-07-03 08:16:19 -04:00
)
2018-02-23 04:55:25 -05:00
);
2018-07-02 04:39:41 -04:00
2018-02-23 04:55:25 -05:00
return $sections ;
}
/**
* Returns all the settings fields
*
* @ return array settings fields
*/
function get_settings_fields () {
$settings_fields = array (
'general_setting_sec' => array (
2018-07-02 04:39:41 -04:00
2019-03-09 02:17:31 -05:00
array (
'name' => 'mep_google_map_type' ,
'label' => __ ( 'Google Map Type?' , 'mage-eventpress' ),
'desc' => __ ( 'Please select the map type you want to show in fronntend, Note it: Iframe Not always show the accurate location where API enable map has drag & drop feature so you can drag the point to accurate location.' , 'mage-eventpress' ),
'type' => 'select' ,
'default' => 'yes' ,
'options' => array (
'' => 'Please Select a Map Type' ,
'api' => 'API' ,
'iframe' => 'Iframe'
)
),
2018-07-03 08:16:19 -04:00
array (
2018-02-23 04:55:25 -05:00
'name' => 'google-map-api' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Google Map API Key' , 'mage-eventpress' ),
2019-03-09 02:17:31 -05:00
'desc' => __ ( 'Enter Your Google Map API key. <a href=https://developers.google.com/maps/documentation/javascript/get-api-key target=_blank>Get KEY</a>. Note: You must enter billing address and information into google map api account to work perfectly the google map in website.' , 'mage-eventpress' ),
2018-02-23 04:55:25 -05:00
'type' => 'text' ,
'default' => ''
),
2018-07-02 04:39:41 -04:00
array (
'name' => 'mep_global_single_template' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Event Details Template' , 'mage-eventpress' ),
'desc' => __ ( 'Event Details Template' , 'mage-eventpress' ),
2018-07-02 04:39:41 -04:00
'type' => 'select' ,
'default' => 'no' ,
'options' => event_template_name ()
),
2018-12-05 05:06:09 -05:00
array (
'name' => 'mep_event_price_show' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Show Event Price in List?' , 'mage-eventpress' ),
'desc' => __ ( 'Please select if you want to show event price in the list Yes/No' , 'mage-eventpress' ),
2018-12-05 05:06:09 -05:00
'type' => 'select' ,
'default' => 'yes' ,
'options' => array (
'yes' => 'Yes' ,
'no' => 'No'
)
),
array (
'name' => 'event-price-label' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Event Price Label' , 'mage-eventpress' ),
'desc' => __ ( 'Enter The text which you want to show as price label, Its only displayed if Show Event price value is YES above. ' , 'mage-eventpress' ),
2018-12-05 05:06:09 -05:00
'type' => 'text' ,
'default' => 'Price Starts from:'
2019-01-22 06:02:55 -05:00
),
array (
'name' => 'mep_event_time_format' ,
'label' => __ ( 'Event Time Format' , 'mage-eventpress' ),
'desc' => __ ( 'Please select what format time you want to display in event fronntend.' , 'mage-eventpress' ),
'type' => 'select' ,
'default' => '12' ,
'options' => array (
'12' => '12 Hour' ,
'24' => '24 Hour'
)
2019-03-25 06:17:44 -04:00
),
array (
'name' => 'mep_event_direct_checkout' ,
'label' => __ ( 'Redirect Checkout after Booking?' , 'mage-eventpress' ),
'desc' => __ ( 'If you want to go direct checkout page after booking an event please enable/disable this.' , 'mage-eventpress' ),
'type' => 'select' ,
'default' => 'yes' ,
'options' => array (
'yes' => 'Enable' ,
'no' => 'Disable'
)
2019-07-03 06:12:40 -04:00
),
array (
'name' => 'mep_event_expire_on_datetime' ,
'label' => __ ( 'When will event expire' , 'mage-eventpress' ),
'desc' => __ ( 'Please select when event will expire, On event start time or event endtime' , 'mage-eventpress' ),
'type' => 'select' ,
'default' => 'mep_event_start_date' ,
'options' => array (
'mep_event_start_date' => 'Event Start Time' ,
'mep_event_end_date' => 'Event End Time'
)
)
2018-07-02 04:39:41 -04:00
),
'email_setting_sec' => array (
array (
'name' => 'mep_email_form_name' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Email Form Name' , 'mage-eventpress' ),
'desc' => __ ( 'Email Form Name' , 'mage-eventpress' ),
2018-07-02 04:39:41 -04:00
'type' => 'text'
),
array (
'name' => 'mep_email_form_email' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Form Email' , 'mage-eventpress' ),
'desc' => __ ( 'Form Email' , 'mage-eventpress' ),
2018-07-02 04:39:41 -04:00
'type' => 'text'
),
array (
'name' => 'mep_email_subject' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Email Subject' , 'mage-eventpress' ),
'desc' => __ ( 'Email Subject' , 'mage-eventpress' ),
2018-07-02 04:39:41 -04:00
'type' => 'text'
),
array (
'name' => 'mep_confirmation_email_text' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Confirmation Email Text' , 'mage-eventpress' ),
'desc' => __ ( 'Confirmation Email Text' , 'mage-eventpress' ),
2018-07-02 04:39:41 -04:00
'type' => 'textarea' ,
'default' => '' ,
),
2018-02-23 04:55:25 -05:00
),
2018-07-02 04:39:41 -04:00
2018-07-03 08:16:19 -04:00
'label_setting_sec' => array (
2018-07-02 04:39:41 -04:00
2018-07-03 08:16:19 -04:00
array (
'name' => 'mep_event_ticket_type_text' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Ticket Type Table Label' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as ticket type table in event details page.' , 'mage-eventpress' ),
2018-07-03 08:16:19 -04:00
'type' => 'text' ,
'default' => 'Ticket Type:'
),
array (
'name' => 'mep_event_extra_service_text' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Extra Service Table Label' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as extra service table in event details page.' , 'mage-eventpress' ),
2018-07-03 08:16:19 -04:00
'type' => 'text' ,
'default' => 'Extra Service:'
),
array (
'name' => 'mep_cart_btn_text' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Cart Button Label' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display in Cart button in event details page.' , 'mage-eventpress' ),
2018-07-03 08:16:19 -04:00
'type' => 'text' ,
'default' => 'Register This Event'
),
array (
'name' => 'mep_calender_btn_text' ,
2019-06-11 01:09:58 -04:00
'label' => __ ( 'Add Calendar Button Label' , 'mage-eventpress' ),
2018-12-18 02:55:56 -05:00
'desc' => __ ( 'Enter the text which you want to display in Add you calender in event details page.' , 'mage-eventpress' ),
2018-07-03 08:16:19 -04:00
'type' => 'text' ,
'default' => 'ADD TO YOUR CALENDAR'
),
array (
'name' => 'mep_share_text' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Social Share Label' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as share button title in event details page.' , 'mage-eventpress' ),
2018-07-03 08:16:19 -04:00
'type' => 'text' ,
'default' => 'Share This Event'
),
2019-04-06 06:40:08 -04:00
array (
'name' => 'mep_organized_by_text' ,
'label' => __ ( 'Organized By:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Organized By in event list page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_location_text' ,
'label' => __ ( 'Location:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Location in event list page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_time_text' ,
'label' => __ ( 'Time:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Time in event list page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_event_location_text' ,
'label' => __ ( 'Event Location:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Event Location in event list page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_event_date_text' ,
'label' => __ ( 'Event Date:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Event Date in event list page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_event_time_text' ,
'label' => __ ( 'Event Time:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Event Time in event list page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_by_text' ,
'label' => __ ( 'By:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as By in event list page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_total_seat_text' ,
'label' => __ ( 'Total Seat:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Total Seat in event list page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_register_now_text' ,
'label' => __ ( 'Register Now:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Register Now in event details page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_quantity_text' ,
'label' => __ ( 'Quantity:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Quantity in event details page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_total_text' ,
'label' => __ ( 'Total:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Total in event details page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_ticket_qty_text' ,
'label' => __ ( 'Ticket Qty' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Ticket Qty in event details page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_per_ticket_price_text' ,
'label' => __ ( 'Per Ticket Price:' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as per Ticket price in event details page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
2019-07-01 01:05:56 -04:00
2019-04-06 06:40:08 -04:00
array (
'name' => 'mep_no_ticket_selected_text' ,
'label' => __ ( 'No Ticket Selected!' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as No Ticket Selected in event details page.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
2019-07-01 01:05:56 -04:00
array (
'name' => 'mep_no_seat_available_text' ,
'label' => __ ( 'No Seat Available' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as No Seat Available.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
array (
'name' => 'mep_not_available_text' ,
'label' => __ ( 'Not Available' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Not Available.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
2019-04-06 06:40:08 -04:00
2019-07-01 01:05:56 -04:00
array (
'name' => 'mep_event_expired_text' ,
'label' => __ ( 'Event Expired' , 'mage-eventpress' ),
'desc' => __ ( 'Enter the text which you want to display as Event Expired.' , 'mage-eventpress' ),
'type' => 'text' ,
'default' => ''
),
2018-07-03 08:16:19 -04:00
),
2018-07-09 04:27:18 -04:00
'style_setting_sec' => array (
array (
'name' => 'mep_base_color' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Base Color' , 'mage-eventpress' ),
'desc' => __ ( 'Select a Basic Color, It will chanage the icon background color, border color' , 'mage-eventpress' ),
2018-07-09 04:27:18 -04:00
'type' => 'color' ,
),
array (
'name' => 'mep_title_bg_color' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Label Background Color' , 'mage-eventpress' ),
'desc' => __ ( 'Select a Color Label Background' , 'mage-eventpress' ),
2018-07-09 04:27:18 -04:00
'type' => 'color' ,
),
array (
'name' => 'mep_title_text_color' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Label Text Color' , 'mage-eventpress' ),
'desc' => __ ( 'Select a Color Label Text' , 'mage-eventpress' ),
2018-07-09 04:27:18 -04:00
'type' => 'color' ,
),
array (
'name' => 'mep_cart_btn_bg_color' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Cart Button Background Color' , 'mage-eventpress' ),
'desc' => __ ( 'Select a color for Cart Button Background' , 'mage-eventpress' ),
2018-07-09 04:27:18 -04:00
'type' => 'color' ,
),
array (
'name' => 'mep_cart_btn_text_color' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Cart Button Text Color' , 'mage-eventpress' ),
'desc' => __ ( 'Select a color for Cart Button Text' , 'mage-eventpress' ),
2018-07-09 04:27:18 -04:00
'type' => 'color' ,
),
array (
'name' => 'mep_calender_btn_bg_color' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Calender Button Background Color' , 'mage-eventpress' ),
'desc' => __ ( 'Select a color for Calender Button Background' , 'mage-eventpress' ),
2018-07-09 04:27:18 -04:00
'type' => 'color' ,
),
array (
'name' => 'mep_calender_btn_text_color' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'Calender Button Text Color' , 'mage-eventpress' ),
'desc' => __ ( 'Select a color for Calender Button Text' , 'mage-eventpress' ),
2018-07-09 04:27:18 -04:00
'type' => 'color' ,
),
array (
'name' => 'mep_faq_title_bg_color' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'FAQ Title Background Color' , 'mage-eventpress' ),
'desc' => __ ( 'Select a color for FAQ title Background' , 'mage-eventpress' ),
2018-07-09 04:27:18 -04:00
'type' => 'color' ,
),
array (
'name' => 'mep_faq_title_text_color' ,
2018-12-18 02:55:56 -05:00
'label' => __ ( 'FAQ Title Text Color' , 'mage-eventpress' ),
'desc' => __ ( 'Select a color for FAQ Title Text' , 'mage-eventpress' ),
2018-07-09 04:27:18 -04:00
'type' => 'color' ,
),
)
2018-07-02 04:39:41 -04:00
2018-02-23 04:55:25 -05:00
);
return $settings_fields ;
}
function plugin_page () {
echo '<div class="wrap">' ;
$this -> settings_api -> show_navigation ();
$this -> settings_api -> show_forms ();
echo '</div>' ;
}
/**
* Get all the pages
*
* @ return array page names with key value pairs
*/
function get_pages () {
$pages = get_pages ();
$pages_options = array ();
if ( $pages ) {
foreach ( $pages as $page ) {
$pages_options [ $page -> ID ] = $page -> post_title ;
}
}
return $pages_options ;
}
}
endif ;
$settings = new MAGE_Events_Setting_Controls ();
function mep_get_option ( $option , $section , $default = '' ) {
$options = get_option ( $section );
2018-07-09 04:27:18 -04:00
2018-02-23 04:55:25 -05:00
if ( isset ( $options [ $option ] ) ) {
return $options [ $option ];
}
2018-07-09 04:27:18 -04:00
2018-02-23 04:55:25 -05:00
return $default ;
}