Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "Revert "Fix: bug JS frontmap""
This reverts commit 503fd36.
  • Loading branch information
gonzalesc committed Jan 2, 2019
1 parent 503fd36 commit 6947f48
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 44 deletions.
2 changes: 1 addition & 1 deletion admin/class-areamaps-admin.php
Expand Up @@ -106,7 +106,7 @@ public function input_map() {
include_once AREAGM_PLUGIN_DIR . '/admin/layouts/view-admin-maps.php';
}
else
echo sprintf(__('Please enter your google api key in <a href="%s" title="setting page">Setting page</a>','letsgo'), admin_url('edit.php?post_type=areamaps&page=area_settings') );
echo sprintf(__('Please enter your ApiKey Google Maps in the <a href="%s" title="setting section">setting section</a>','letsgo'), admin_url('edit.php?post_type=areamaps&page=area_settings') );
}

public function input_shortcode() {
Expand Down
12 changes: 6 additions & 6 deletions admin/class-areamaps-settings.php
Expand Up @@ -18,7 +18,7 @@ public function verify_apikey() {
}

public function warning_notice() {
echo '<div class="update-nag"><p>'.sprintf(__('Please enter your google api key in <a href="%s" title="setting page">Setting page</a>','letsgo'), admin_url('edit.php?post_type=areamaps&page=area_settings') ).'</p></div>';
echo '<div class="update-nag"><p>'.sprintf(__('Please enter your ApiKey Google Maps in the <a href="%s" title="setting section">setting section</a>','letsgo'), admin_url('edit.php?post_type=areamaps&page=area_settings') ).'</p></div>';
}


Expand Down Expand Up @@ -58,15 +58,15 @@ public function register_settings() {

add_settings_field(
'areamaps_front_js', // ID
__('Include library Google Maps in the Front','letsgo'), // Include Library
__('Include Google Maps Library in the Front','letsgo'), // Include Library
[ $this, 'input_front_jsmap' ], // Callback
'settingareamaps', // Page
'gowoo-seccion' // Section
);

add_settings_field(
'areamaps_admin_js', // ID
__('Include library Google Maps in the Admin Panel','letsgo'), // Include Library
__('Include Google Maps Library in the Admin Panel','letsgo'), // Include Library
[ $this, 'input_admin_jsmap' ], // Callback
'settingareamaps', // Page
'gowoo-seccion' // Section
Expand Down Expand Up @@ -109,7 +109,7 @@ public function input_apikey() {

echo '<label for="areamaps_apikey">
<input type="text" id="areamaps_apikey" name="areamaps_options[areamaps_apikey]" value="'.$input_key.'" /></label>
<p>'.sprintf(__('Enter your google account api key. You can generate a key <a href="%s" target="_blank">here</a>','letsgo'),$this->url_apikey).'.</p><br />';
<p>'.sprintf(__('Enter your ApiKey Google Maps. You can generate a key <a href="%s" target="_blank">here</a>','letsgo'),$this->url_apikey).'.</p><br />';
}


Expand All @@ -120,7 +120,7 @@ public function input_front_jsmap() {

echo '<label for="areamaps_front_js">
<input type="checkbox" id="areamaps_front_js" name="areamaps_options[areamaps_front_js]" value="1" '.$checked.' /></label>
<p>'.__('If you uncheck this option, you should add manually the library Google Maps in the Front','letsgo').'</p>';
<p>'.__('If you uncheck this option, you should add manually the Google Maps Library in the Front','letsgo').'</p>';
}

public function input_admin_jsmap() {
Expand All @@ -130,7 +130,7 @@ public function input_admin_jsmap() {

echo '<label for="areamaps_admin_js">
<input type="checkbox" id="areamaps_admin_js" name="areamaps_options[areamaps_admin_js]" value="1" '.$checked.' /></label>
<p>'.__('If you uncheck this option, you should add manually the library Google Maps in the Admin Panel','letsgo').'</p>';
<p>'.__('If you uncheck this option, you should add manually the Google Maps Library in the Admin Panel','letsgo').'</p>';
}

public function input_handle() {
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
@@ -1,3 +1,6 @@
2019-01-02 - version 1.2.1
* Fix : Bug JS frontmap

2018-12-27 - version 1.2.0
* Tested in WP 5.0.2
* Accept handle js input
Expand Down
54 changes: 27 additions & 27 deletions includes/class-areamaps-cpt.php
Expand Up @@ -7,39 +7,39 @@ public function __construct() {

public function register_cpt() {
$labels = array(
'name' => __('Delivery Area', 'letsgo'),
'menu_name' => __('Delivery Area', 'letsgo'),
'name_admin_bar' => __('List Areas', 'letsgo'),
'all_items' => __('List Areas', 'letsgo'),
'singular_name' => __('List Areas', 'letsgo'),
'add_new' => __('Add New Area', 'letsgo'),
'add_new_item' => __('Add New Area','letsgo'),
'edit_item' => __('Edit Area','letsgo'),
'new_item' => __('New Area','letsgo'),
'view_item' => __('View Area','letsgo'),
'search_items' => __('Search Area','letsgo'),
'not_found' => __('Nothing found','letsgo'),
'not_found_in_trash' => __('Nothing found in Trash','letsgo'),
'parent_item_colon' => ''
'name' => __('Delivery Area', 'letsgo'),
'menu_name' => __('Delivery Area', 'letsgo'),
'name_admin_bar' => __('Areas List', 'letsgo'),
'all_items' => __('Areas List', 'letsgo'),
'singular_name' => __('Areas List', 'letsgo'),
'add_new' => __('Add New Area', 'letsgo'),
'add_new_item' => __('Add New Area','letsgo'),
'edit_item' => __('Edit Area','letsgo'),
'new_item' => __('New Area','letsgo'),
'view_item' => __('View Area','letsgo'),
'search_items' => __('Search Area','letsgo'),
'not_found' => __('Nothing found','letsgo'),
'not_found_in_trash' => __('Nothing found in Trash','letsgo'),
'parent_item_colon' => ''
);

$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => false,
'show_ui' => true,
'query_var' => true,
'labels' => $labels,
'public' => true,
'publicly_queryable' => false,
'show_ui' => true,
'query_var' => true,
//'menu_icon' => plugins_url( 'images/icon_star.png' , __FILE__ ),
'rewrite' => false,
'hierarchical' => false,
'rewrite' => false,
'hierarchical' => false,
//'menu_position' => 25,
'supports' => array('title', 'author'),
'exclude_from_search' => true,
'show_in_nav_menus' => false,
'can_export' => true,
'map_meta_cap' => true,
'capability_type' => 'areamap',
'capabilities' => array (
'exclude_from_search' => true,
'show_in_nav_menus' => false,
'can_export' => true,
'map_meta_cap' => true,
'capability_type' => 'areamap',
'capabilities' => array (
'edit_post' => 'edit_areamap',
'read_post' => 'read_areamap',
'delete_post' => 'delete_areamap',
Expand Down
5 changes: 2 additions & 3 deletions index.php
Expand Up @@ -3,8 +3,8 @@
Plugin Name: Delivery Area with Google Maps
Plugin URI: http://wordpress.org/extend/plugins/wp-delivery-area-with-google-maps/
Description: This plugin allows you create delivery areas in Google Maps and by a shortcode put it in everywhere
Version: 1.2.0
Author: LetsGoDev
Version: 1.2.1
Author: Lets Go Dev
Author URI: https://www.letsgodev.com
Developer: Alexander
Developer URI: https://www.letsgodev.com
Expand All @@ -23,7 +23,6 @@
define('AREAGM_PLUGIN_BASE' , plugin_basename( __FILE__ ));



/**
* The core plugin class that is used to define internationalization,
* dashboard-specific hooks, and public-facing site hooks.
Expand Down
Binary file added languages/letsgo-es_ES.mo
Binary file not shown.
154 changes: 154 additions & 0 deletions languages/letsgo-es_ES.po
@@ -0,0 +1,154 @@
msgid ""
msgstr ""
"Project-Id-Version: Wordpress Delivery Area\n"
"POT-Creation-Date: 2018-12-31 01:17-0300\n"
"PO-Revision-Date: 2018-12-31 01:18-0300\n"
"Last-Translator: \n"
"Language-Team: Letsgodev\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.2\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-SearchPath-0: .\n"

#: admin/class-areamaps-admin.php:82
msgid "Support"
msgstr "Soporte"

#: admin/class-areamaps-admin.php:109 admin/class-areamaps-settings.php:21
#, php-format
msgid ""
"Please enter your ApiKey Google Maps in the <a href=\"%s\" title=\"setting "
"section\">setting section</a>"
msgstr ""
"Por favor ingresa tu ApiKey de Google Maps en la <a href=\"%s\" title="
"\"sección de ajustes\">sección de ajustes</a>"

#: admin/class-areamaps-admin.php:118
msgid "Please insert this shortcode in you page"
msgstr "Por favor inserta este shortcode en tu página"

#: admin/class-areamaps-admin.php:187
msgid "Shortcode"
msgstr "Shortcode"

#: admin/class-areamaps-settings.php:26
msgid "Settings"
msgstr "Ajustes"

#: admin/class-areamaps-settings.php:46
msgid "Settings Areamaps"
msgstr "Ajustes de Areamaps"

#: admin/class-areamaps-settings.php:53
msgid "API GoogleMaps"
msgstr "ApiKey Google Maps"

#: admin/class-areamaps-settings.php:61
msgid "Include Google Maps Library in the Front"
msgstr "Incluir Librería de Google Maps en el front"

#: admin/class-areamaps-settings.php:69
msgid "Include Google Maps Library in the Admin Panel"
msgstr "Incluir librería de Google Maps en el panel administrativo"

#: admin/class-areamaps-settings.php:77
msgid "Handle Js"
msgstr "Handle Js"

#: admin/class-areamaps-settings.php:85
msgid "Latitude Default"
msgstr "Latitud por defecto"

#: admin/class-areamaps-settings.php:93
msgid "Longitude Default"
msgstr "Longitud por defecto"

#: admin/class-areamaps-settings.php:112
#, php-format
msgid ""
"Enter your ApiKey Google Maps. You can generate a key <a href=\"%s\" target="
"\"_blank\">here</a>"
msgstr ""
"Por favor ingresa tu ApiKey de Google Maps en la <a href=\"%s\" title="
"\"sección de ajustes\">sección de ajustes</a>"

#: admin/class-areamaps-settings.php:123
msgid ""
"If you uncheck this option, you should add manually the Google Maps Library "
"in the Front"
msgstr ""
"Si tu desmarcas esta opción, debes agregar manualmente la librería de Google "
"Maps en el front"

#: admin/class-areamaps-settings.php:133
msgid ""
"If you uncheck this option, you should add manually the Google Maps Library "
"in the Admin Panel"
msgstr ""
"Si tu desmarcas esta opción, debes agregar manualmente la librería de Google "
"Maps in el panel administrativo"

#: admin/class-areamaps-settings.php:161
msgid "Options"
msgstr "Opciones"

#: admin/layouts/template_options.php:2
msgid "Area Delivery Settings"
msgstr "Ajustes de Areas de entrega"

#: admin/layouts/view-admin-maps.php:4
msgid "Address"
msgstr "Dirección"

#: admin/layouts/view-admin-maps.php:6
msgid "Search"
msgstr "Buscar"

#: admin/layouts/view-admin-maps.php:8
msgid "Line Color"
msgstr "Color de línea"

#: includes/class-areamaps-cpt.php:10 includes/class-areamaps-cpt.php:11
msgid "Delivery Area"
msgstr "Delivery Area"

#: includes/class-areamaps-cpt.php:12 includes/class-areamaps-cpt.php:13
#: includes/class-areamaps-cpt.php:14
msgid "Areas List"
msgstr "Lista de areas"

#: includes/class-areamaps-cpt.php:15 includes/class-areamaps-cpt.php:16
msgid "Add New Area"
msgstr "Agregar Area"

#: includes/class-areamaps-cpt.php:17
msgid "Edit Area"
msgstr "Editar Area"

#: includes/class-areamaps-cpt.php:18
msgid "New Area"
msgstr "Nueva Area"

#: includes/class-areamaps-cpt.php:19
msgid "View Area"
msgstr "Ver Area"

#: includes/class-areamaps-cpt.php:20
msgid "Search Area"
msgstr "Buscar Area"

#: includes/class-areamaps-cpt.php:21
msgid "Nothing found"
msgstr "Nada encontrado"

#: includes/class-areamaps-cpt.php:22
msgid "Nothing found in Trash"
msgstr "Nada encontrado en la basura"

#~ msgid "List Areas"
#~ msgstr "Lista de Areas"
4 changes: 2 additions & 2 deletions public/assets/js/frontmap_js.php
@@ -1,5 +1,5 @@
<?php header("Content-type: text/javascript"); ?>
<?php
<?php
header("Content-type: text/javascript");

if( !is_numeric($_GET['id']) )
exit;
Expand Down
10 changes: 5 additions & 5 deletions public/class-areamaps-public.php
Expand Up @@ -5,8 +5,8 @@ function __construct() {
//add_action('wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] ,20 );
add_shortcode('areamaps', [ $this, 'add_shortcode' ] );

add_action('wp_ajax_frontareamaps', [ $this, 'show_areamaps' ] );
add_action('wp_ajax_nopriv_frontareamaps', [ $this, 'show_areamaps' ] );
add_action('wp_ajax_frontmap_js', [ $this, 'show_areamaps' ] );
add_action('wp_ajax_nopriv_frontmap_js', [ $this, 'show_areamaps' ] );
}

function add_shortcode( $atts ) {
Expand All @@ -28,10 +28,10 @@ function add_shortcode( $atts ) {
if( $settings['areamaps_front_js'] == true &&
isset($settings['areamaps_handle']) && !empty($settings['areamaps_handle'])
) {
wp_enqueue_script($settings['areamaps_handle'], '//maps.googleapis.com/maps/api/js?key='.$settings['areamaps_apikey'].'&v=3.exp&libraries=geometry', array('jquery'), false, true);
wp_enqueue_script($settings['areamaps_handle'], '//maps.googleapis.com/maps/api/js?key='.$settings['areamaps_apikey'].'&libraries=geometry', array('jquery'), false, true);
}

wp_enqueue_script('areamaps-child-'.$param['id'], admin_url('admin-ajax.php?action=frontareamaps&id='.$param['id']), array($settings['areamaps_handle'],'jquery'), false, true);
wp_enqueue_script('areamaps-child-'.$param['id'], admin_url('admin-ajax.php?action=frontmap_js&id='.$param['id']), array($settings['areamaps_handle'],'jquery'), false, true);

echo '<div id="areamaps-'.$param['id'].'" style="'.$stylemaps.'"></div>';
}
Expand All @@ -43,7 +43,7 @@ function add_shortcode( $atts ) {
}

function show_areamaps() {
include_once AREAMAPS_PLUGIN_DIR. '/public/assets/js/frontmap_js.php';
include_once AREAGM_PLUGIN_DIR. '/public/assets/js/frontmap_js.php';
die();
}
}
Expand Down

0 comments on commit 6947f48

Please sign in to comment.