if (!empty($_GET['map_id'])) { $map_id = $_GET['map_id']; $selected_map = $mapobj->fetch(array(array('map_id', '=', $map_id))); } $all_map[] = __('Select Map', WPGMP_TEXT_DOMAIN); foreach ($map_records as $key => $map_record) { $all_map[$map_record->map_id] = $map_record->map_title; } $form = new Responsive_Markup(); $form->set_form_method('get'); $form->add_element('hidden', 'page', array('value' => $_GET['page'])); $form->set_header(__('Choose Map for Drawing', WPGMP_TEXT_DOMAIN), $response, __('Choose Map for Drawing', WPGMP_TEXT_DOMAIN), 'wpgmp_manage_location'); $form->add_element('select', 'map_id', array('lable' => __('Select map', WPGMP_TEXT_DOMAIN), 'current' => $map_id, 'value' => $data['map_id'], 'desc' => __('Enter here the location title.', WPGMP_TEXT_DOMAIN), 'required' => true, 'options' => $all_map)); $form->render(); if (!empty($_GET['map_id'])) { $form = new Responsive_Markup(); $form->set_header(__('Draw Shapes', WPGMP_TEXT_DOMAIN), $response, __('Draw Shapes', WPGMP_TEXT_DOMAIN), 'wpgmp_manage_location'); echo $form->get_header(); echo $form->get_form_header(); echo "<div class='form-group'><div class='col-md-9'>"; // do_shortcode("[put_wpgm id=".$map_id."]",false); wpgmp_generate_map($selected_map[0]); echo "</div><div class='col-md-3'>"; echo '<h4 class="alert alert-info">' . __('Shape Properties', WPGMP_TEXT_DOMAIN) . '<i class="wpgmp-shape-delete hiderow dashicons-before dashicons-trash"></i></h4>'; echo "<div class='row hiderow'><div class='col-md-6'>"; echo Responsive_Markup::field_text('shape_stroke_color', array('value' => '#ff0000', 'class' => 'color {pickerClosable:true} form-control', 'id' => 'shape_stroke_color', 'desc' => __('Stroke Color', WPGMP_TEXT_DOMAIN), 'placeholder' => __('Stroke Color', WPGMP_TEXT_DOMAIN))); echo "</div><div class='col-md-6'>"; $stroke_opacity = array('1' => '1', '0.9' => '0.9', '0.8' => '0.8', '0.7' => '0.7', '0.6' => '0.6', '0.5' => '0.5', '0.4' => '0.4', '0.3' => '0.3', '0.2' => '0.2', '0.1' => '0.1'); echo Responsive_Markup::field_text('shape_fill_color', array('value' => '#ff0000', 'class' => 'color {pickerClosable:true} form-control', 'id' => 'shape_fill_color', 'desc' => __('Fill Color', WPGMP_TEXT_DOMAIN), 'placeholder' => __('Fill Color', WPGMP_TEXT_DOMAIN))); echo "</div></div><div class='row hiderow'><div class='col-md-6'>"; $stroke_weight = array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20');
} else { $data = $_POST; } } global $wpdb; $modelFactory = new FactoryModelWPGMP(); $category = $modelFactory->create_object('group_map'); $categories = (array) $category->fetch(); if (isset($_GET['doaction']) and 'edit' == $_GET['doaction'] and isset($_GET['group_map_id'])) { $category_obj = $category->fetch(array(array('group_map_id', '=', intval(wp_unslash($_GET['group_map_id']))))); $_POST = (array) $category_obj[0]; } elseif (!isset($_GET['doaction']) and isset($response['success'])) { // Reset $_POST object for antoher entry. unset($_POST); } $form = new Responsive_Markup(); $form->set_header(__('Marker Category', WPGMP_TEXT_DOMAIN), $response, __('Manage Marker Categories', WPGMP_TEXT_DOMAIN), 'wpgmp_manage_group_map'); if (is_array($categories)) { $markers = array(' ' => 'Please Select'); foreach ($categories as $i => $single_category) { if ($single_category->group_parent == 0 or $single_category->group_parent == '') { $markers[$single_category->group_map_id] = $single_category->group_map_title; } } $form->add_element('select', 'group_parent', array('lable' => __('Parent Category', WPGMP_TEXT_DOMAIN), 'current' => (isset($_POST['group_parent']) and !empty($_POST['group_parent'])) ? intval(wp_unslash($_POST['group_parent'])) : '', 'desc' => __('Assign parent category if any.', WPGMP_TEXT_DOMAIN), 'options' => $markers)); } $form->add_element('text', 'group_map_title', array('lable' => __('Marker Category Title', WPGMP_TEXT_DOMAIN), 'value' => (isset($_POST['group_map_title']) and !empty($_POST['group_map_title'])) ? sanitize_text_field(wp_unslash($_POST['group_map_title'])) : '', 'id' => 'group_map_title', 'desc' => __('Enter here marker category title.', WPGMP_TEXT_DOMAIN), 'class' => 'create_map form-control', 'placeholder' => __('Marker Category Title', WPGMP_TEXT_DOMAIN), 'required' => true)); $form->set_col(3); $form->add_element('image_picker', 'group_marker', array('lable' => __('Choose Marker Image', WPGMP_TEXT_DOMAIN), 'src' => isset($_POST['group_marker']) ? wp_unslash($_POST['group_marker']) : WPGMP_IMAGES . '/default_marker.png', 'required' => false)); $form->add_element('submit', 'create_group_map_location', array('value' => 'Save Marker Category', 'before' => '<div class="col-md-12">', 'after' => '</div>')); $form->add_element('hidden', 'operation', array('value' => 'save'));
<?php /** * This class used to manage permissions in backend. * @author Flipper Code <*****@*****.**> * @version 1.0.0 * @package Maps */ global $wp_roles; $wpgmp_roles = $wp_roles->get_names(); unset($wpgmp_roles['administrator']); $wpgmp_permissions = array('wpgmp_admin_overview' => 'Map Overview', 'wpgmp_form_location' => 'Add Locations', 'wpgmp_manage_location' => 'Manage Locations', 'wpgmp_import_location' => 'Import Locations', 'wpgmp_form_map' => 'Create Map', 'wpgmp_manage_map' => 'Manage Map', 'wpgmp_manage_drawing' => 'Drawing', 'wpgmp_form_group_map' => 'Add Marker Category', 'wpgmp_manage_group_map' => 'Manage Marker Category', 'wpgmp_form_route' => 'Add Routes', 'wpgmp_manage_route' => 'Manage Routes', 'wpgmp_settings' => 'Settings'); $form = new Responsive_Markup(); $form->set_header(__('Manage Permission(s)', WPGMP_TEXT_DOMAIN), $response); if (!empty($wpgmp_permissions)) { $count = 0; foreach ($wpgmp_permissions as $wpgmp_mkey => $wpgmp_mvalue) { $permission_row[$count][0] = $wpgmp_mvalue; foreach ($wpgmp_roles as $wpgmp_role_key => $wpgmp_role_value) { $urole = get_role($wpgmp_role_key); $permission_row[$count][] = $form->field_checkbox('wpgmp_map_permissions[' . $wpgmp_role_key . '][' . $wpgmp_mkey . ']', array('value' => 'true', 'current' => @array_key_exists($wpgmp_mkey, $urole->capabilities) == true ? 'true' : 'false', 'before' => '<div class="col-md-1">', 'after' => '</div>', 'class' => 'chkbox_class')); } $count++; } } $form->add_element('table', 'wpgmp_save_permission_table', array('heading' => array_merge(array('Page'), $wpgmp_roles), 'data' => $permission_row, 'before' => '<div class="col-md-11">', 'after' => '</div>')); $form->add_element('submit', 'wpgmp_save_permission', array('value' => __('Save Permissions', WPGMP_TEXT_DOMAIN))); $form->add_element('hidden', 'operation', array('value' => 'save')); $form->render();
/** * Image picker element. * @param string $name No use. * @param array $atts Attributes for custom html. * @return html Image Picker. */ public static function field_image_picker($name, $atts) { $html = Responsive_Markup::field_image('selected_image', array('lable' => 'Choose marker Image', 'src' => $atts['src'], 'width' => '32', 'class' => 'noclass selected_image col-md-1', 'height' => '37', 'required' => $atts['required'])); $html .= Responsive_Markup::field_anchor('choose_image', array('value' => __('Choose Marker Image', WPGMP_TEXT_DOMAIN), 'href' => 'javascript:void(0);', 'class' => 'btn btn-info choose_image col-md-3 ', 'data' => array('target' => $name))); $html .= Responsive_Markup::field_anchor('remove_image', array('value' => __('Remove Marker Image', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-3">', 'after' => '</div>', 'href' => 'javascript:void(0);', 'class' => 'btn btn-danger remove_image col-md-3 col-md-offset-1', 'data' => array('target' => $name))); $html .= Responsive_Markup::field_hidden('group_marker', array('value' => $atts['src'], 'id' => $name, 'name' => $name)); return $html; }
die('Cheating...'); } else { $data = $_POST; } } global $wpdb; $modelFactory = new FactoryModelWPGMP(); $map_obj = $modelFactory->create_object('map'); if (isset($_GET['doaction']) and 'edit' == $_GET['doaction'] and isset($_GET['map_id'])) { $map_obj = $map_obj->fetch(array(array('map_id', '=', intval(wp_unslash($_GET['map_id']))))); $data = (array) $map_obj[0]; } elseif (!isset($_GET['doaction']) and isset($response['success'])) { // Reset $_POST object for antoher entry. unset($data); } $form = new Responsive_Markup(); $form->set_header(__('Map Information', WPGMP_TEXT_DOMAIN), $response, __('Manage Maps', WPGMP_TEXT_DOMAIN), 'wpgmp_manage_map'); include 'map-forms/general-setting-form.php'; include 'map-forms/map-center-settings.php'; include 'map-forms/locations-form.php'; include 'map-forms/control-setting-form.php'; include 'map-forms/control-position-style-form.php'; include 'map-forms/layers-form.php'; include 'map-forms/geotag-form.php'; include 'map-forms/map-style-setting-form.php'; include 'map-forms/street-view-setting-form.php'; include 'map-forms/route-direction-form.php'; include 'map-forms/marker-cluster-setting-form.php'; include 'map-forms/overlay-setting-form.php'; include 'map-forms/limit-panning-setting-form.php'; include 'map-forms/tab-setting-form.php';
<?php /** * This class used to manage settings page in backend. * @author Flipper Code <*****@*****.**> * @version 1.0.0 * @package Maps */ $form = new Responsive_Markup(); $form->set_header(__('General Setting(s)', WPGMP_TEXT_DOMAIN), $response); $form->add_element('text', 'wpgmp_api_key', array('lable' => __('Business API Key', WPGMP_TEXT_DOMAIN), 'value' => get_option('wpgmp_api_key'), 'desc' => __('Insert Api Key if you signup for google maps business api.', WPGMP_TEXT_DOMAIN))); $language = array('en' => __('ENGLISH', WPGMP_TEXT_DOMAIN), 'ar' => __('ARABIC', WPGMP_TEXT_DOMAIN), 'eu' => __('BASQUE', WPGMP_TEXT_DOMAIN), 'bg' => __('BULGARIAN', WPGMP_TEXT_DOMAIN), 'bn' => __('BENGALI', WPGMP_TEXT_DOMAIN), 'ca' => __('CATALAN', WPGMP_TEXT_DOMAIN), 'cs' => __('CZECH', WPGMP_TEXT_DOMAIN), 'da' => __('DANISH', WPGMP_TEXT_DOMAIN), 'de' => __('GERMAN', WPGMP_TEXT_DOMAIN), 'el' => __('GREEK', WPGMP_TEXT_DOMAIN), 'en-AU' => __('ENGLISH (AUSTRALIAN)', WPGMP_TEXT_DOMAIN), 'en-GB' => __('ENGLISH (GREAT BRITAIN)', WPGMP_TEXT_DOMAIN), 'es' => __('SPANISH', WPGMP_TEXT_DOMAIN), 'fa' => __('FARSI', WPGMP_TEXT_DOMAIN), 'fi' => __('FINNISH', WPGMP_TEXT_DOMAIN), 'fil' => __('FILIPINO', WPGMP_TEXT_DOMAIN), 'fr' => __('FRENCH', WPGMP_TEXT_DOMAIN), 'gl' => __('GALICIAN', WPGMP_TEXT_DOMAIN), 'gu' => __('GUJARATI', WPGMP_TEXT_DOMAIN), 'hi' => __('HINDI', WPGMP_TEXT_DOMAIN), 'hr' => __('CROATIAN', WPGMP_TEXT_DOMAIN), 'hu' => __('HUNGARIAN', WPGMP_TEXT_DOMAIN), 'id' => __('INDONESIAN', WPGMP_TEXT_DOMAIN), 'it' => __('ITALIAN', WPGMP_TEXT_DOMAIN), 'iw' => __('HEBREW', WPGMP_TEXT_DOMAIN), 'ja' => __('JAPANESE', WPGMP_TEXT_DOMAIN), 'kn' => __('KANNADA', WPGMP_TEXT_DOMAIN), 'ko' => __('KOREAN', WPGMP_TEXT_DOMAIN), 'lt' => __('LITHUANIAN', WPGMP_TEXT_DOMAIN), 'lv' => __('LATVIAN', WPGMP_TEXT_DOMAIN), 'ml' => __('MALAYALAM', WPGMP_TEXT_DOMAIN), 'it' => __('ITALIAN', WPGMP_TEXT_DOMAIN), 'mr' => __('MARATHI', WPGMP_TEXT_DOMAIN), 'nl' => __('DUTCH', WPGMP_TEXT_DOMAIN), 'no' => __('NORWEGIAN', WPGMP_TEXT_DOMAIN), 'pl' => __('POLISH', WPGMP_TEXT_DOMAIN), 'pt' => __('PORTUGUESE', WPGMP_TEXT_DOMAIN), 'pt-BR' => __('PORTUGUESE (BRAZIL)', WPGMP_TEXT_DOMAIN), 'pt-PT' => __('PORTUGUESE (PORTUGAL)', WPGMP_TEXT_DOMAIN), 'ro' => __('ROMANIAN', WPGMP_TEXT_DOMAIN), 'ru' => __('RUSSIAN', WPGMP_TEXT_DOMAIN), 'sk' => __('SLOVAK', WPGMP_TEXT_DOMAIN), 'sl' => __('SLOVENIAN', WPGMP_TEXT_DOMAIN), 'sr' => __('SERBIAN', WPGMP_TEXT_DOMAIN), 'sv' => __('SWEDISH', WPGMP_TEXT_DOMAIN), 'tl' => __('TAGALOG', WPGMP_TEXT_DOMAIN), 'ta' => __('TAMIL', WPGMP_TEXT_DOMAIN), 'te' => __('TELUGU', WPGMP_TEXT_DOMAIN), 'th' => __('THAI', WPGMP_TEXT_DOMAIN), 'tr' => __('TURKISH', WPGMP_TEXT_DOMAIN), 'uk' => __('UKRAINIAN', WPGMP_TEXT_DOMAIN), 'vi' => __('VIETNAMESE', WPGMP_TEXT_DOMAIN), 'zh-CN' => __('CHINESE (SIMPLIFIED)', WPGMP_TEXT_DOMAIN), 'zh-TW' => __('CHINESE (TRADITIONAL)', WPGMP_TEXT_DOMAIN)); $form->add_element('select', 'wpgmp_language', array('lable' => __('Select Language', WPGMP_TEXT_DOMAIN), 'current' => get_option('wpgmp_language'), 'desc' => __('Default is English.', WPGMP_TEXT_DOMAIN), 'options' => $language)); $form->add_element('submit', 'wpgmp_save_settings', array('value' => __('Save Setting', WPGMP_TEXT_DOMAIN))); $form->add_element('hidden', 'operation', array('value' => 'save')); $form->add_element('hidden', 'page_options', array('value' => 'wpgmp_api_key,wpgmp_language')); $form->render();
die('Cheating...'); } else { $data = $_POST; } } global $wpdb; $modelFactory = new FactoryModelWPGMP(); $map_obj = $modelFactory->create_object('map'); if (isset($_GET['doaction']) and 'edit' == $_GET['doaction'] and isset($_GET['map_id'])) { $map_obj = $map_obj->fetch(array(array('map_id', '=', intval(wp_unslash($_GET['map_id']))))); $data = (array) $map_obj[0]; } elseif (!isset($_GET['doaction']) and isset($response['success'])) { // Reset $_POST object for antoher entry. unset($data); } $form = new Responsive_Markup(); $form->set_header(__('Map Information', WPGMP_TEXT_DOMAIN), $response, __('Manage Maps', WPGMP_TEXT_DOMAIN), 'wpgmp_manage_map'); include 'map-forms/general-setting-form.php'; include 'map-forms/map-center-settings.php'; include 'map-forms/locations-form.php'; include 'map-forms/control-setting-form.php'; include 'map-forms/control-position-style-form.php'; include 'map-forms/street-view-setting-form.php'; include 'map-forms/layers-form.php'; $form->add_element('submit', 'save_entity_data', array('value' => __('Save Map', WPGMP_TEXT_DOMAIN))); $form->add_element('hidden', 'operation', array('value' => 'save')); $form->add_element('hidden', 'map_locations', array('value' => '')); if (isset($_GET['doaction']) and 'edit' == $_GET['doaction'] and isset($_GET['map_id'])) { $form->add_element('hidden', 'entityID', array('value' => intval(wp_unslash($_GET['map_id'])))); } $form->render();
<?php /** * Import Location(s) Tool. * @package Maps * @author Flipper Code <*****@*****.**> */ $form = new Responsive_Markup(); $form->set_header(__('Import Locations', WPGMP_TEXT_DOMAIN), $response); $form->add_element('message', 'import_message', array('value' => __("You must have latitude and longitude in the file and columns should be match exactly with <a href='" . WPGMP_URL . 'assets/import_sample_files.zip' . "'>sample file</a>."), 'class' => 'alert alert-success', 'before' => '<div class="col-md-11">', 'after' => '</div>')); $form->add_element('radio', 'wpgmp_import_mode', array('lable' => __('Choose', WPGMP_TEXT_DOMAIN), 'radio-val-label' => array('wpgmp_delete' => __('Delete Current Locations', WPGMP_TEXT_DOMAIN), 'wpgmp_append' => __('Append to Current Locations', WPGMP_TEXT_DOMAIN)), 'current' => $data['map_layer_setting']['temp'], 'desc' => __('Please select temperature unit.', WPGMP_TEXT_DOMAIN), 'class' => 'chkbox_class inline', 'show' => 'false')); $form->add_element('file', 'import_file', array('label' => __('Choose File', WPGMP_TEXT_DOMAIN), 'class' => 'file_input', 'desc' => __('Please upload CSV, XML, JSON OR EXCEL file. Download sample files for correct format of the files.', WPGMP_TEXT_DOMAIN))); $form->add_element('submit', 'import_loc', array('value' => __('Import Locations', WPGMP_TEXT_DOMAIN))); $form->add_element('hidden', 'operation', array('value' => 'import_location')); $form->add_element('hidden', 'import', array('value' => 'location_import')); $form->render();
/** * Template for Add & Edit Route * @author Flipper Code <*****@*****.**> * @package Maps */ if (isset($_REQUEST['_wpnonce'])) { $nonce = sanitize_text_field(wp_unslash($_REQUEST['_wpnonce'])); if (!wp_verify_nonce($nonce, 'wpgmp-nonce')) { die('Cheating...'); } else { $data = $_POST; } } global $wpdb; $form = new Responsive_Markup(); $modelFactory = new FactoryModelWPGMP(); $category = $modelFactory->create_object('group_map'); $location = $modelFactory->create_object('location'); $locations = $location->fetch(); $categories = $category->fetch(); if (!empty($categories)) { $categories_data = array(); foreach ($categories as $cat) { $categories_data[$cat->group_map_id] = $cat->group_map_title; } } $route = $modelFactory->create_object('route'); if (isset($_GET['doaction']) and 'edit' == $_GET['doaction'] and isset($_GET['route_id'])) { $route_obj = $route->fetch(array(array('route_id', '=', intval(wp_unslash($_GET['route_id']))))); $data = (array) $route_obj[0];
$categories = $category_obj->fetch(); if (is_array($categories) and !empty($categories)) { $all_categories = array(); foreach ($categories as $category) { $all_categories[$category->group_map_id] = $category; } } $location_obj = $modelFactory->create_object('location'); if (isset($_GET['doaction']) and 'edit' == $_GET['doaction'] and isset($_GET['location_id'])) { $location_obj = $location_obj->fetch(array(array('location_id', '=', intval(wp_unslash($_GET['location_id']))))); $data = (array) $location_obj[0]; } elseif (!isset($_GET['doaction']) and isset($response['success'])) { // Reset $_POST object for antoher entry. unset($data); } $form = new Responsive_Markup(); $form->set_header(__('Location Information', WPGMP_TEXT_DOMAIN), $response, __('Manage Locations', WPGMP_TEXT_DOMAIN), 'wpgmp_manage_location'); $form->add_element('text', 'location_title', array('lable' => __('Location Title', 'wpgmp_google_map'), 'value' => (isset($data['location_title']) and !empty($data['location_title'])) ? $data['location_title'] : '', 'desc' => __('Enter here the location title.', WPGMP_TEXT_DOMAIN), 'required' => true, 'placeholder' => __('Enter Location Title', WPGMP_TEXT_DOMAIN))); $form->add_element('text', 'location_address', array('lable' => __('Location Address', WPGMP_TEXT_DOMAIN), 'value' => (isset($data['location_address']) and !empty($data['location_address'])) ? $data['location_address'] : '', 'desc' => __('Enter here the address. Google auto suggest helps you to choose one.', WPGMP_TEXT_DOMAIN), 'required' => true, 'class' => 'form-control wpgmp_auto_suggest', 'placeholder' => __('Type Location Address', WPGMP_TEXT_DOMAIN))); $form->set_col(2); $form->add_element('text', 'location_latitude', array('lable' => __('Latitude and Longitude', WPGMP_TEXT_DOMAIN), 'value' => (isset($data['location_latitude']) and !empty($data['location_latitude'])) ? $data['location_latitude'] : '', 'id' => 'googlemap_latitude', 'desc' => __('Enter here the latitude.', WPGMP_TEXT_DOMAIN), 'required' => true, 'class' => 'google_latitude form-control', 'placeholder' => __('Enter the Latitude', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->add_element('text', 'location_longitude', array('value' => (isset($data['location_longitude']) and !empty($data['location_longitude'])) ? $data['location_longitude'] : '', 'id' => 'googlemap_longitude', 'desc' => __('Enter here the longitude.', WPGMP_TEXT_DOMAIN), 'required' => true, 'class' => 'google_longitude form-control', 'placeholder' => __('Enter the Longitude', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->add_element('text', 'location_city', array('lable' => __('City and State', WPGMP_TEXT_DOMAIN), 'value' => (isset($data['location_city']) and !empty($data['location_city'])) ? $data['location_city'] : '', 'id' => 'googlemap_city', 'desc' => __('Enter here the city.', WPGMP_TEXT_DOMAIN), 'class' => 'google_city form-control', 'placeholder' => __('City', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->add_element('text', 'location_state', array('value' => (isset($data['location_state']) and !empty($data['location_state'])) ? $data['location_state'] : '', 'id' => 'googlemap_state', 'desc' => __('Enter here the state.', WPGMP_TEXT_DOMAIN), 'class' => 'google_state form-control', 'placeholder' => __('State', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->add_element('text', 'location_country', array('lable' => __('Country and Postal Code', WPGMP_TEXT_DOMAIN), 'value' => (isset($data['location_country']) and !empty($data['location_country'])) ? $data['location_country'] : '', 'id' => 'googlemap_country', 'desc' => __('Enter here the country.', WPGMP_TEXT_DOMAIN), 'class' => 'google_country form-control', 'placeholder' => __('Country', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->add_element('text', 'location_postal_code', array('value' => (isset($data['location_postal_code']) and !empty($data['location_postal_code'])) ? $data['location_postal_code'] : '', 'id' => 'googlemap_postal_code', 'desc' => __('Enter here the postal code.', WPGMP_TEXT_DOMAIN), 'class' => 'google_postal_code form-control', 'placeholder' => __('Postal Code', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->set_col(1); $form->add_element('div', 'wpgmp_map', array('lable' => __('Current Location', WPGMP_TEXT_DOMAIN), 'id' => 'wpgmp_map', 'style' => array('width' => '100%', 'height' => '300px'))); $form->add_element('radio', 'location_settings[onclick]', array('lable' => __('On Click', WPGMP_TEXT_DOMAIN), 'radio-val-label' => array('marker' => __('Display Infowindow', WPGMP_TEXT_DOMAIN), 'custom_link' => __('Redirect', WPGMP_TEXT_DOMAIN)), 'current' => $data['location_settings']['onclick'], 'class' => 'chkbox_class switch_onoff', 'default_value' => 'marker', 'data' => array('target' => '.wpgmp_location_onclick'))); $form->add_element('textarea', 'location_messages', array('lable' => __('Infowindow Message', WPGMP_TEXT_DOMAIN), 'value' => (isset($data['location_messages']) and !empty($data['location_messages'])) ? $data['location_messages'] : '', 'desc' => __('Enter here the infoWindow message.', WPGMP_TEXT_DOMAIN), 'textarea_rows' => 10, 'textarea_name' => 'location_messages', 'class' => 'form-control wpgmp_location_onclick wpgmp_location_onclick_marker', 'id' => 'googlemap_infomessage', 'show' => 'false')); $form->add_element('text', 'location_settings[redirect_link]', array('lable' => __('Redirect Url', WPGMP_TEXT_DOMAIN), 'value' => $data['location_settings']['redirect_link'], 'desc' => __('Enter here the redirect url. e.g http://www.flippercode.com', WPGMP_TEXT_DOMAIN), 'class' => 'wpgmp_location_onclick_custom_link wpgmp_location_onclick form-control', 'before' => '<div class="col-md-8">', 'after' => '</div>', 'show' => 'false'));
} } } if ('upload_backup' == $_POST['operation']) { $respone_upload_backup = $response; } else { $respone_upload_backup = array(); } if ('take_backup' == $_POST['operation']) { $respone_take_backup = $response; } else { $respone_take_backup = array(); } $form = new Responsive_Markup(); $form->set_header(__('Take Backup', WPGMP_TEXT_DOMAIN), $respone_take_backup); $form->add_element('hidden', 'operation', array('value' => 'take_backup')); $form->add_element('message', 'backup_message', array('value' => __('Click below to create a backup of all locations, maps, categories, terms and routes.', WPGMP_TEXT_DOMAIN), 'class' => 'alert alert-info')); $form->add_element('submit', 'wpgmp_save_backup', array('value' => __('Plugin Backup', WPGMP_TEXT_DOMAIN))); $form->render(); $import_form = new Responsive_Markup(); $import_form->set_header(__('Upload Backup', WPGMP_TEXT_DOMAIN), $respone_upload_backup); $import_form->add_element('hidden', 'operation', array('value' => 'upload_backup')); $import_form->add_element('file', 'uploaded_file', array('label' => __('Choose File', WPGMP_TEXT_DOMAIN), 'desc' => __('Please upload backup.', WPGMP_TEXT_DOMAIN), 'class' => 'file_input')); $import_form->add_element('submit', 'wpgmp_backup_submit', array('value' => __('Upload Backup', WPGMP_TEXT_DOMAIN))); $import_form->render(); global $wpdb; $columns = array('backup_file_name' => 'File Name', 'backup_date' => 'Date', 'backup_time' => 'Time', 'backup_import' => 'Import'); $sortable = array('backup_file_name', 'backup_date', 'backup_time', 'backup_import'); $tableinfo = array('table' => $wpdb->prefix . 'wpgmp_backups', 'textdomain' => WPGMP_TEXT_DOMAIN, 'singular_label' => 'backup', 'plural_label' => 'backup', 'admin_listing_page_name' => 'wpgmp_manage_backup', 'admin_add_page_name' => 'wpgmp_manage_backup', 'primary_col' => 'backup_id', 'columns' => $columns, 'sortable' => $sortable, 'per_page' => 20, 'actions' => array('delete'), 'col_showing_links' => 'backup_file_name', 'show_add_button' => false); return new Wpgmp_Backup_Table($tableinfo); }
<?php /** * This class used to manage settings page in backend. * @author Flipper Code <*****@*****.**> * @version 1.0.0 * @package Maps */ $form = new Responsive_Markup(); $form->set_header(__('General Setting(s)', WPGMP_TEXT_DOMAIN), $response); $form->add_element('text', 'wpgmp_api_key', array('lable' => __('Business API Key', WPGMP_TEXT_DOMAIN), 'value' => get_option('wpgmp_api_key'), 'desc' => __('Please insert here Api Key if you signup for google maps business api.', WPGMP_TEXT_DOMAIN))); $form->add_element('radio', 'wpgmp_scripts_place', array('lable' => __('Include Scripts in ', WPGMP_TEXT_DOMAIN), 'radio-val-label' => array('header' => __('Header', WPGMP_TEXT_DOMAIN), 'footer' => __('Footer (Recommanded)', WPGMP_TEXT_DOMAIN)), 'current' => get_option('wpgmp_scripts_place'), 'class' => 'chkbox_class', 'default_value' => 'footer')); $form->add_element('group', 'location_extra_fields', array('value' => __('Extra Field(s)', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-11">', 'after' => '</div>')); $data['location_extrafields'] = unserialize(get_option('wpgmp_location_extrafields')); if (isset($data['location_extrafields'])) { foreach ($data['location_extrafields'] as $i => $label) { $form->set_col(2); $form->add_element('text', 'location_extrafields[' . $i . ']', array('value' => (isset($data['location_extrafields'][$i]) and !empty($data['location_extrafields'][$i])) ? $data['location_extrafields'][$i] : '', 'desc' => '', 'class' => 'location_newfields form-control', 'placeholder' => __('Field Label', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>', 'desc' => __('Placehoder - ', WPGMP_TEXT_DOMAIN) . '{' . sanitize_title($data['location_extrafields'][$i]) . '}')); $form->add_element('button', 'location_newfields_repeat[' . $i . ']', array('value' => __('Remove', WPGMP_TEXT_DOMAIN), 'desc' => '', 'class' => 'repeat_remove_button btn btn-info btn-sm', 'before' => '<div class="col-md-4">', 'after' => '</div>')); } } $form->set_col(2); if (isset($data['location_extrafields'])) { $next_index = count($data['location_extrafields']) + 1; } else { $next_index = 0; } $form->add_element('text', 'location_extrafields[' . $next_index . ']', array('value' => (isset($data['location_extrafields'][$next_index]) and !empty($data['location_extrafields'][$next_index])) ? $data['location_extrafields'][$next_index] : '', 'desc' => '', 'class' => 'location_newfields form-control', 'placeholder' => __('Field Label', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->add_element('button', 'location_newfields_repeat', array('value' => __('Add More...', WPGMP_TEXT_DOMAIN), 'desc' => '', 'class' => 'repeat_button btn btn-info btn-sm', 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->set_col(1); $form->add_element('submit', 'wpgmp_save_settings', array('value' => __('Save Setting', WPGMP_TEXT_DOMAIN)));