Version Description
- Fixed: Security issues
Download this release
Release Info
| Developer | 10web |
| Plugin | |
| Version | 1.0.60 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.59 to 1.0.60
- admin/controllers/GMWDController.php +151 -203
- admin/controllers/GMWDControllerMaps_gmwd.php +191 -247
- admin/controllers/GMWDControllerMarkers_gmwd.php +5 -106
- framework/functions.php +3 -12
- gmwd_admin_class.php +1 -1
- images/web-dorado.png +0 -0
- readme.txt +5 -3
- wd-google-maps.php +1 -1
admin/controllers/GMWDController.php
CHANGED
|
@@ -1,213 +1,161 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
class GMWDController {
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
|
|
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
check_admin_referer('nonce_gmwd', 'nonce_gmwd');
|
| 50 |
-
}
|
| 51 |
-
$this->$task();
|
| 52 |
-
}
|
| 53 |
-
else{
|
| 54 |
-
_e("Not found","bwg_back");
|
| 55 |
-
}
|
| 56 |
}
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
$data = array();
|
| 60 |
-
$
|
| 61 |
-
$
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
GMWDHelper::gmwd_redirect("admin.php?page=".GMWDHelper::get("page"));
|
| 65 |
-
|
| 66 |
-
}
|
| 67 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 68 |
-
// Getters & Setters //
|
| 69 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 70 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 71 |
-
// Private Methods //
|
| 72 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 73 |
-
protected function display() {
|
| 74 |
-
$view = $this->view;
|
| 75 |
-
$view->display();
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
protected function edit(){
|
| 79 |
-
$view = $this->view;
|
| 80 |
-
$id = (int)GMWDHelper::get('id');
|
| 81 |
-
$view->edit($id);
|
| 82 |
-
}
|
| 83 |
-
protected function explore(){
|
| 84 |
-
$view = $this->view;
|
| 85 |
-
$view->explore();
|
| 86 |
-
}
|
| 87 |
-
|
| 88 |
-
protected function save(){
|
| 89 |
-
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
protected function apply(){
|
| 93 |
-
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
protected function remove($table_name = ""){
|
| 98 |
-
global $wpdb;
|
| 99 |
-
$ids = isset($_POST["ids"]) ? $_POST["ids"] :(isset($_POST["id"]) ? array($_POST["id"]) : array());
|
| 100 |
-
if($table_name == ""){
|
| 101 |
-
$page = $this->page ? $this->page : "maps_gmwd";
|
| 102 |
-
$page = explode("_",$page);
|
| 103 |
-
$table_name = $wpdb->prefix . "gmwd_".$page[0];
|
| 104 |
-
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
-
if(empty($ids) === false){
|
| 108 |
-
|
| 109 |
-
foreach($ids as $id){
|
| 110 |
-
$where = array("id" => (int)$id);
|
| 111 |
-
$where_format = array('%d');
|
| 112 |
-
$wpdb->delete( $table_name, $where, $where_format);
|
| 113 |
-
}
|
| 114 |
-
GMWDHelper::message(__("Item(s) Succesfully Removed.","gmwd"),'updated');
|
| 115 |
-
}
|
| 116 |
-
else{
|
| 117 |
-
GMWDHelper::message(__("You must select at least one item.","gmwd"),'error');
|
| 118 |
-
}
|
| 119 |
-
if(GMWDHelper::get("ajax") != 1){
|
| 120 |
-
$this->display();
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
}
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
protected function cancel(){
|
| 127 |
-
GMWDHelper::gmwd_redirect("admin.php?page=".$this->page);
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
protected function publish($table_name = ""){
|
| 131 |
-
global $wpdb;
|
| 132 |
-
if(isset($_POST["ids"])){
|
| 133 |
-
$ids = $_POST["ids"] ;
|
| 134 |
-
}
|
| 135 |
-
elseif(isset($_POST["current_id"])){
|
| 136 |
-
$ids = array($_POST["current_id"]) ;
|
| 137 |
-
}
|
| 138 |
-
else{
|
| 139 |
-
$ids = array();
|
| 140 |
-
}
|
| 141 |
-
if(empty($ids) === false && isset($_POST["publish_unpublish"])){
|
| 142 |
-
$data = array("published" => (int)$_POST["publish_unpublish"]);
|
| 143 |
-
$where_format = array('%d');
|
| 144 |
-
$format = array('%d');
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
if($table_name == ""){
|
| 148 |
-
$page = $this->page ? $this->page : "maps_gmwd";
|
| 149 |
-
$page = explode("_",$page);
|
| 150 |
-
$table_name = $wpdb->prefix . "gmwd_".$page[0];
|
| 151 |
-
|
| 152 |
-
}
|
| 153 |
-
|
| 154 |
-
foreach ($ids as $id){
|
| 155 |
-
$where = array("id"=>(int)$id);
|
| 156 |
-
$wpdb->update($table_name, $data, $where, $format, $where_format );
|
| 157 |
-
|
| 158 |
-
}
|
| 159 |
-
}
|
| 160 |
-
if(GMWDHelper::get("ajax") != 1){
|
| 161 |
-
$publish_unpublish = $_POST["publish_unpublish"] == 1 ? __("Published","gmwd") : __("Unpublished","gmwd");
|
| 162 |
-
GMWDHelper::message(__("Item(s) Succesfully ","gmwd").$publish_unpublish.".",'updated');
|
| 163 |
-
$this->display();
|
| 164 |
-
}
|
| 165 |
-
}
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
protected function dublicate($table_name_widthout_prefix = ""){
|
| 169 |
-
global $wpdb;
|
| 170 |
-
if(isset($_POST["ids"])){
|
| 171 |
-
$ids = $_POST["ids"] ;
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
if($table_name_widthout_prefix == ""){
|
| 175 |
-
$page = explode("_",$this->page);
|
| 176 |
-
$table_name_widthout_prefix = "gmwd_".$page[0];
|
| 177 |
-
}
|
| 178 |
-
|
| 179 |
-
$table_name = $wpdb->prefix . $table_name_widthout_prefix;
|
| 180 |
-
$columns = GMWDModel::get_columns($table_name_widthout_prefix);
|
| 181 |
-
$column_types = GMWDModel::column_types($table_name_widthout_prefix);
|
| 182 |
-
if(empty($ids) === false){
|
| 183 |
-
foreach($ids as $id){
|
| 184 |
-
$row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $table_name . " WHERE id = '%d'", $id ));
|
| 185 |
-
$data = array();
|
| 186 |
-
$format = array();
|
| 187 |
-
foreach($columns as $column_name){
|
| 188 |
-
$data[$column_name] = esc_html(stripslashes($row->$column_name));
|
| 189 |
-
$format[] = $column_types[$column_name];
|
| 190 |
-
}
|
| 191 |
-
$data["id"] = "";
|
| 192 |
-
switch($this->page){
|
| 193 |
-
case "themes_gmwd":
|
| 194 |
-
$data["default"] = 0;
|
| 195 |
-
break;
|
| 196 |
-
}
|
| 197 |
-
|
| 198 |
-
$wpdb->insert( $table_name, $data, $format );
|
| 199 |
-
|
| 200 |
-
}
|
| 201 |
}
|
| 202 |
-
$
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
}
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 213 |
-
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
class GMWDController {
|
| 4 |
+
public $page;
|
| 5 |
+
public $task;
|
| 6 |
+
public $model;
|
| 7 |
+
public $view;
|
| 8 |
+
public function __construct() {
|
| 9 |
+
|
| 10 |
+
$page = GMWDHelper::get('page') ? GMWDHelper::get('page') : "maps_gmwd";
|
| 11 |
+
$this->page = $page;
|
| 12 |
+
$task = GMWDHelper::get('task') ? GMWDHelper::get('task') : "display";
|
| 13 |
+
$this->task = $task;
|
| 14 |
+
$model_class = 'GMWDModel' . ucfirst($this->page);
|
| 15 |
+
$view_class = 'GMWDView' . ucfirst($this->page);
|
| 16 |
+
require_once GMWD_DIR . "/admin/models/" . $model_class . ".php";
|
| 17 |
+
$this->model = new $model_class();
|
| 18 |
+
require_once GMWD_DIR . "/admin/views/" . $view_class . ".php";
|
| 19 |
+
$this->view = new $view_class($this->model);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
public function execute() {
|
| 23 |
+
|
| 24 |
+
$task = $this->task;
|
| 25 |
+
if ( method_exists($this, $task) ) {
|
| 26 |
+
if ( $task != "display" && $task != "edit" && $task != "select_icon" ) {
|
| 27 |
+
check_admin_referer('nonce_gmwd', 'nonce_gmwd');
|
| 28 |
+
}
|
| 29 |
+
$this->$task();
|
| 30 |
+
}
|
| 31 |
+
else {
|
| 32 |
+
_e("Not found", "bwg_back");
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
public function save_api_key() {
|
| 37 |
+
global $wpdb;
|
| 38 |
+
$data = array();
|
| 39 |
+
$data["value"] = esc_html(GMWDHelper::get("gmwd_api_key_general"));
|
| 40 |
+
$where = array( "name" => "map_api_key" );
|
| 41 |
+
$where_format = $format = array( '%s' );
|
| 42 |
+
$wpdb->update($wpdb->prefix . "gmwd_options", $data, $where, $format, $where_format);
|
| 43 |
+
GMWDHelper::gmwd_redirect("admin.php?page=" . GMWDHelper::get("page"));
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
protected function display() {
|
| 47 |
+
$view = $this->view;
|
| 48 |
+
$view->display();
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
protected function edit() {
|
| 52 |
+
$view = $this->view;
|
| 53 |
+
$id = (int) GMWDHelper::get('id');
|
| 54 |
+
$view->edit($id);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
protected function explore() {
|
| 58 |
+
$view = $this->view;
|
| 59 |
+
$view->explore();
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
protected function save() {}
|
| 63 |
+
|
| 64 |
+
protected function apply() {}
|
| 65 |
+
|
| 66 |
+
protected function remove( $table_name = "" ) {
|
| 67 |
+
global $wpdb;
|
| 68 |
+
$ids = isset($_POST["ids"]) ? $_POST["ids"] : (isset($_POST["id"]) ? array( $_POST["id"] ) : array());
|
| 69 |
+
if ( $table_name == "" ) {
|
| 70 |
+
$page = $this->page ? $this->page : "maps_gmwd";
|
| 71 |
+
$page = explode("_", $page);
|
| 72 |
+
$table_name = $wpdb->prefix . "gmwd_" . $page[0];
|
| 73 |
+
}
|
| 74 |
+
if ( empty($ids) === FALSE ) {
|
| 75 |
+
|
| 76 |
+
foreach ( $ids as $id ) {
|
| 77 |
+
$where = array( "id" => (int) $id );
|
| 78 |
+
$where_format = array( '%d' );
|
| 79 |
+
$wpdb->delete($table_name, $where, $where_format);
|
| 80 |
+
}
|
| 81 |
+
GMWDHelper::message(__("Item(s) Succesfully Removed.", "gmwd"), 'updated');
|
| 82 |
+
}
|
| 83 |
+
else {
|
| 84 |
+
GMWDHelper::message(__("You must select at least one item.", "gmwd"), 'error');
|
| 85 |
+
}
|
| 86 |
+
if ( GMWDHelper::get("ajax") != 1 ) {
|
| 87 |
+
$this->display();
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
|
| 91 |
+
protected function cancel() {
|
| 92 |
+
GMWDHelper::gmwd_redirect("admin.php?page=" . $this->page);
|
| 93 |
+
}
|
| 94 |
|
| 95 |
+
protected function publish( $table_name = "" ) {
|
| 96 |
+
global $wpdb;
|
| 97 |
+
if ( isset($_POST["ids"]) ) {
|
| 98 |
+
$ids = array_map('intval', $_POST["ids"]);
|
| 99 |
+
}
|
| 100 |
+
elseif ( isset($_POST["current_id"]) ) {
|
| 101 |
+
$ids = array( (int) $_POST["current_id"] );
|
| 102 |
+
}
|
| 103 |
+
else {
|
| 104 |
+
$ids = array();
|
| 105 |
+
}
|
| 106 |
+
if ( empty($ids) === FALSE && isset($_POST["publish_unpublish"]) ) {
|
| 107 |
+
$data = array( "published" => (int) $_POST["publish_unpublish"] );
|
| 108 |
+
$where_format = array( '%d' );
|
| 109 |
+
$format = array( '%d' );
|
| 110 |
+
if ( $table_name == "" ) {
|
| 111 |
+
$page = $this->page ? $this->page : "maps_gmwd";
|
| 112 |
+
$page = explode("_", $page);
|
| 113 |
+
$table_name = $wpdb->prefix . "gmwd_" . $page[0];
|
| 114 |
+
}
|
| 115 |
+
foreach ( $ids as $id ) {
|
| 116 |
+
$where = array( "id" => (int) $id );
|
| 117 |
+
$wpdb->update($table_name, $data, $where, $format, $where_format);
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
if ( GMWDHelper::get("ajax") != 1 ) {
|
| 121 |
+
$publish_unpublish = $_POST["publish_unpublish"] == 1 ? __("Published", "gmwd") : __("Unpublished", "gmwd");
|
| 122 |
+
GMWDHelper::message(__("Item(s) Succesfully ", "gmwd") . $publish_unpublish . ".", 'updated');
|
| 123 |
+
$this->display();
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
|
| 127 |
+
protected function dublicate( $table_name_widthout_prefix = "" ) {
|
| 128 |
+
global $wpdb;
|
| 129 |
+
if ( isset($_POST["ids"]) ) {
|
| 130 |
+
$ids = $_POST["ids"];
|
| 131 |
+
}
|
| 132 |
+
if ( $table_name_widthout_prefix == "" ) {
|
| 133 |
+
$page = explode("_", $this->page);
|
| 134 |
+
$table_name_widthout_prefix = "gmwd_" . $page[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
}
|
| 136 |
+
$table_name = $wpdb->prefix . $table_name_widthout_prefix;
|
| 137 |
+
$columns = GMWDModel::get_columns($table_name_widthout_prefix);
|
| 138 |
+
$column_types = GMWDModel::column_types($table_name_widthout_prefix);
|
| 139 |
+
if ( empty($ids) === FALSE ) {
|
| 140 |
+
foreach ( $ids as $id ) {
|
| 141 |
+
$row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $table_name . " WHERE id = '%d'", $id));
|
| 142 |
$data = array();
|
| 143 |
+
$format = array();
|
| 144 |
+
foreach ( $columns as $column_name ) {
|
| 145 |
+
$data[$column_name] = esc_html(stripslashes($row->$column_name));
|
| 146 |
+
$format[] = $column_types[$column_name];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
}
|
| 148 |
+
$data["id"] = "";
|
| 149 |
+
switch ( $this->page ) {
|
| 150 |
+
case "themes_gmwd":
|
| 151 |
+
$data["default"] = 0;
|
| 152 |
+
break;
|
| 153 |
+
}
|
| 154 |
+
$wpdb->insert($table_name, $data, $format);
|
| 155 |
+
}
|
| 156 |
}
|
| 157 |
+
$view = $this->view;
|
| 158 |
+
GMWDHelper::message(__("Item Succesfully Duplicated.", "gmwd"), 'updated');
|
| 159 |
+
$view->display();
|
| 160 |
+
}
|
| 161 |
+
}
|
|
|
|
|
|
admin/controllers/GMWDControllerMaps_gmwd.php
CHANGED
|
@@ -1,265 +1,209 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
class GMWDControllerMaps_gmwd extends GMWDController{
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 10 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 11 |
-
// Variables //
|
| 12 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 13 |
-
private $map;
|
| 14 |
-
private $shortcode_id = null;
|
| 15 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 16 |
-
// Constructor & Destructor //
|
| 17 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 18 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 19 |
-
// Public Methods //
|
| 20 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 21 |
-
public function display_pois(){
|
| 22 |
-
$this->view->display_pois();
|
| 23 |
-
|
| 24 |
-
}
|
| 25 |
-
public function remove($table_name = ""){
|
| 26 |
-
global $wpdb;
|
| 27 |
-
$ids = isset($_POST["ids"]) ? $_POST["ids"] :(isset($_POST["id"]) ? array($_POST["id"]) : array());
|
| 28 |
-
if(empty($ids) === false){
|
| 29 |
-
foreach($ids as $id){
|
| 30 |
-
$where = array("map_id" => (int)$id);
|
| 31 |
-
$where_format = array('%d');
|
| 32 |
-
$wpdb->delete( $wpdb->prefix ."gmwd_markers", $where, $where_format);
|
| 33 |
-
$wpdb->delete( $wpdb->prefix ."gmwd_polygons", $where, $where_format);
|
| 34 |
-
$wpdb->delete( $wpdb->prefix ."gmwd_polylines", $where, $where_format);
|
| 35 |
-
}
|
| 36 |
-
}
|
| 37 |
-
parent::remove($table_name);
|
| 38 |
-
}
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
| 48 |
}
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
protected function save(){
|
| 60 |
-
$this->store_data();
|
| 61 |
-
GMWDHelper::message(__("Item Succesfully Saved.","gmwd"),'updated');
|
| 62 |
-
$this->display();
|
| 63 |
-
}
|
| 64 |
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
$ids = array_map('intval', $_POST["ids"]);
|
| 95 |
-
}
|
|
|
|
| 96 |
$ids = sanitize_text_field($_POST["ids"]);
|
| 97 |
}
|
| 98 |
}
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
$format[] = $map_column_types[$column_name];
|
| 111 |
-
}
|
| 112 |
-
$data["id"] = "";
|
| 113 |
-
$max_shortcode_id = $wpdb->get_var("SELECT MAX(id) FROM ". $wpdb->prefix . "gmwd_shortcodes");
|
| 114 |
-
$data["shortcode_id"] = $max_shortcode_id + 1;
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
$wpdb->insert( $wpdb->prefix . "gmwd_maps", $data, $format );
|
| 118 |
-
$last_map_id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "gmwd_maps");
|
| 119 |
-
|
| 120 |
-
$this->shortcode_id = $max_shortcode_id + 1;
|
| 121 |
-
$this->map = $last_map_id;
|
| 122 |
-
$this->store_shortcode();
|
| 123 |
-
|
| 124 |
-
foreach($pois as $poi){
|
| 125 |
-
$columns = GMWDModel::get_columns("gmwd_".$poi);
|
| 126 |
-
unset($columns[0]);
|
| 127 |
-
$inserted_columns = $columns;
|
| 128 |
-
$inserted_columns[array_search("map_id",$inserted_columns)] = $last_map_id;
|
| 129 |
-
$columns = implode(",", $columns);
|
| 130 |
-
$inserted_columns = implode(",", $inserted_columns);
|
| 131 |
-
$rows_poi = $wpdb->query("INSERT INTO " . $wpdb->prefix . "gmwd_".$poi." (".$columns.")
|
| 132 |
-
SELECT ".$inserted_columns." FROM " . $wpdb->prefix . "gmwd_".$poi." WHERE map_id = '". (int)$id."'");
|
| 133 |
-
|
| 134 |
-
}
|
| 135 |
-
}
|
| 136 |
-
GMWDHelper::message(__("Item Succesfully Duplicated.","gmwd"),'updated');
|
| 137 |
-
}
|
| 138 |
-
else{
|
| 139 |
-
GMWDHelper::message(__("You Must Select At Least One Item.","gmwd"),'updated');
|
| 140 |
-
}
|
| 141 |
-
|
| 142 |
-
$view = $this->view;
|
| 143 |
-
$view->display();
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
private function store_data(){
|
| 147 |
-
$this->store_map_data();
|
| 148 |
-
if($this->shortcode_id){
|
| 149 |
-
$this->store_shortcode();
|
| 150 |
}
|
| 151 |
-
$
|
| 152 |
-
|
| 153 |
-
$
|
| 154 |
-
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
}
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
global $wpdb;
|
| 167 |
-
|
| 168 |
-
$columns = GMWDModel::get_columns("gmwd_maps");
|
| 169 |
-
$column_types = GMWDModel::column_types("gmwd_maps");
|
| 170 |
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
$max_shortcode_id = $wpdb->get_var("SELECT MAX(id) FROM ". $wpdb->prefix . "gmwd_shortcodes");
|
| 188 |
-
$data["published"] = 1;
|
| 189 |
-
$data["shortcode_id"] = $max_shortcode_id + 1;
|
| 190 |
-
$data["id"] = "";
|
| 191 |
-
|
| 192 |
-
$wpdb->insert( $wpdb->prefix . "gmwd_maps", $data, $format );
|
| 193 |
-
//$wpdb->print_error(); exit;
|
| 194 |
-
$id = $wpdb->get_var("SELECT MAX(id) FROM ". $wpdb->prefix . "gmwd_maps");
|
| 195 |
-
|
| 196 |
-
$this->shortcode_id = $max_shortcode_id + 1;
|
| 197 |
-
}
|
| 198 |
-
else{
|
| 199 |
-
$data["published"] = esc_html(GMWDHelper::get("published"));
|
| 200 |
-
$where = array("id"=>(int)GMWDHelper::get("id"));
|
| 201 |
-
$where_format = array('%d');
|
| 202 |
-
$wpdb->update( $wpdb->prefix . "gmwd_maps", $data, $where, $format, $where_format );
|
| 203 |
-
$id = GMWDHelper::get("id");
|
| 204 |
-
}
|
| 205 |
-
$this->map = $id;
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
}
|
| 209 |
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
foreach($_data as $key => $value){
|
| 219 |
-
if($key == "title" || $key == "address"){
|
| 220 |
-
$value = str_replace("@@@",'"',$value);
|
| 221 |
-
}
|
| 222 |
-
$data[$key] = sanitize_text_field(esc_html(stripslashes($value)));
|
| 223 |
-
$format[] = $data_types[$key];
|
| 224 |
-
}
|
| 225 |
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
}
|
| 249 |
-
|
| 250 |
-
}
|
| 251 |
-
|
| 252 |
-
}
|
| 253 |
-
|
| 254 |
-
private function store_shortcode(){
|
| 255 |
-
global $wpdb;
|
| 256 |
-
$data = array();
|
| 257 |
-
$data["tag_text"] = 'id='.$this->shortcode_id.' map='.$this->map;
|
| 258 |
-
$format = array('%s');
|
| 259 |
-
$wpdb->insert( $wpdb->prefix . "gmwd_shortcodes", $data, $format );
|
| 260 |
-
|
| 261 |
}
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
class GMWDControllerMaps_gmwd extends GMWDController {
|
| 4 |
+
private $map;
|
| 5 |
+
private $shortcode_id = NULL;
|
| 6 |
+
public function display_pois() {
|
| 7 |
+
$this->view->display_pois();
|
| 8 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
public function remove( $table_name = "" ) {
|
| 11 |
+
global $wpdb;
|
| 12 |
+
$ids = isset($_POST["ids"]) ? $_POST["ids"] : (isset($_POST["id"]) ? array( $_POST["id"] ) : array());
|
| 13 |
+
if ( empty($ids) === FALSE ) {
|
| 14 |
+
foreach ( $ids as $id ) {
|
| 15 |
+
$where = array( "map_id" => (int) $id );
|
| 16 |
+
$where_format = array( '%d' );
|
| 17 |
+
$wpdb->delete($wpdb->prefix . "gmwd_markers", $where, $where_format);
|
| 18 |
+
$wpdb->delete($wpdb->prefix . "gmwd_polygons", $where, $where_format);
|
| 19 |
+
$wpdb->delete($wpdb->prefix . "gmwd_polylines", $where, $where_format);
|
| 20 |
+
}
|
| 21 |
}
|
| 22 |
+
parent::remove($table_name);
|
| 23 |
+
}
|
| 24 |
|
| 25 |
+
public function map_data() {
|
| 26 |
+
$map_model = GMWDHelper::get_model("maps");
|
| 27 |
+
$id = (int) $_POST["map"];
|
| 28 |
+
if ( $id ) {
|
| 29 |
+
$row = $map_model->get_row($id);
|
| 30 |
+
echo json_encode($row);
|
| 31 |
+
die();
|
| 32 |
+
}
|
| 33 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
protected function cancel() {
|
| 36 |
+
GMWDHelper::gmwd_redirect("admin.php?page=maps_gmwd");
|
| 37 |
+
}
|
| 38 |
|
| 39 |
+
protected function save() {
|
| 40 |
+
$this->store_data();
|
| 41 |
+
GMWDHelper::message(__("Item Succesfully Saved.", "gmwd"), 'updated');
|
| 42 |
+
$this->display();
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
public function apply() {
|
| 46 |
+
$this->store_data();
|
| 47 |
+
GMWDHelper::gmwd_redirect("admin.php?page=maps_gmwd&task=edit&id=" . $this->map . "&message_id=1&active_main_tab=" . GMWDHelper::get('active_main_tab') . "&active_settings_tab=" . GMWDHelper::get('active_settings_tab') . "&active_poi_tab=" . GMWDHelper::get('active_poi_tab'));
|
| 48 |
+
GMWDHelper::message(__("Item Succesfully Saved.", "gmwd"), 'updated');
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
public function for_preview() {
|
| 52 |
+
$response = array();
|
| 53 |
+
$url = admin_url('index.php?page=gmwd_preview');
|
| 54 |
+
$url = add_query_arg(array( "map_id" => $this->map ), $url);
|
| 55 |
+
$response["url"] = $url;
|
| 56 |
+
$response["map_id"] = $this->map;
|
| 57 |
+
echo json_encode($response);
|
| 58 |
+
die();
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
protected function save2copy() {
|
| 62 |
+
$this->store_data();
|
| 63 |
+
GMWDHelper::message(__("Item Succesfully Saved.", "gmwd"), 'updated');
|
| 64 |
+
$this->display();
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
protected function dublicate( $table_name = "" ) {
|
| 68 |
+
global $wpdb;
|
| 69 |
+
$ids = array();
|
| 70 |
+
if ( isset($_POST["ids"]) ) {
|
| 71 |
+
if ( is_array($_POST["ids"]) ) {
|
| 72 |
$ids = array_map('intval', $_POST["ids"]);
|
| 73 |
+
}
|
| 74 |
+
else {
|
| 75 |
$ids = sanitize_text_field($_POST["ids"]);
|
| 76 |
}
|
| 77 |
}
|
| 78 |
+
if ( empty($ids) === FALSE ) {
|
| 79 |
+
$map_columns = GMWDModel::get_columns("gmwd_maps");
|
| 80 |
+
$map_column_types = GMWDModel::column_types("gmwd_maps");
|
| 81 |
+
$pois = array( "markers", "polygons", "polylines" );
|
| 82 |
+
foreach ( $ids as $id ) {
|
| 83 |
+
$row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "gmwd_maps WHERE id = '%d'", (int) $id));
|
| 84 |
+
$data = array();
|
| 85 |
+
$format = array();
|
| 86 |
+
foreach ( $map_columns as $column_name ) {
|
| 87 |
+
$data[$column_name] = esc_html(stripslashes($row->$column_name));
|
| 88 |
+
$format[] = $map_column_types[$column_name];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
}
|
| 90 |
+
$data["id"] = "";
|
| 91 |
+
$max_shortcode_id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "gmwd_shortcodes");
|
| 92 |
+
$data["shortcode_id"] = $max_shortcode_id + 1;
|
| 93 |
+
$wpdb->insert($wpdb->prefix . "gmwd_maps", $data, $format);
|
| 94 |
+
$last_map_id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "gmwd_maps");
|
| 95 |
+
$this->shortcode_id = $max_shortcode_id + 1;
|
| 96 |
+
$this->map = $last_map_id;
|
| 97 |
+
$this->store_shortcode();
|
| 98 |
+
foreach ( $pois as $poi ) {
|
| 99 |
+
$columns = GMWDModel::get_columns("gmwd_" . $poi);
|
| 100 |
+
unset($columns[0]);
|
| 101 |
+
$inserted_columns = $columns;
|
| 102 |
+
$inserted_columns[array_search("map_id", $inserted_columns)] = $last_map_id;
|
| 103 |
+
$columns = implode(",", $columns);
|
| 104 |
+
$inserted_columns = implode(",", $inserted_columns);
|
| 105 |
+
$rows_poi = $wpdb->query("INSERT INTO " . $wpdb->prefix . "gmwd_" . $poi . " (" . $columns . ")
|
| 106 |
+
SELECT " . $inserted_columns . " FROM " . $wpdb->prefix . "gmwd_" . $poi . " WHERE map_id = '" . (int) $id . "'");
|
| 107 |
}
|
| 108 |
+
}
|
| 109 |
+
GMWDHelper::message(__("Item Succesfully Duplicated.", "gmwd"), 'updated');
|
| 110 |
+
}
|
| 111 |
+
else {
|
| 112 |
+
GMWDHelper::message(__("You Must Select At Least One Item.", "gmwd"), 'updated');
|
| 113 |
+
}
|
| 114 |
+
$view = $this->view;
|
| 115 |
+
$view->display();
|
| 116 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
+
private function store_data() {
|
| 119 |
+
$this->store_map_data();
|
| 120 |
+
if ( $this->shortcode_id ) {
|
| 121 |
+
$this->store_shortcode();
|
| 122 |
+
}
|
| 123 |
+
$markers_count = GMWDHelper::get("markers_count");
|
| 124 |
+
$data_markers = array();
|
| 125 |
+
for ( $i = 0; $i < $markers_count; $i++ ) {
|
| 126 |
+
$data_markers = array_merge($data_markers, json_decode(htmlspecialchars_decode(stripslashes(GMWDHelper::get("main_markers" . $i)))));
|
| 127 |
+
}
|
| 128 |
+
$data_polygons = json_decode(htmlspecialchars_decode(stripslashes(GMWDHelper::get("polygons"))));
|
| 129 |
+
$data_polylines = json_decode(htmlspecialchars_decode(stripslashes(GMWDHelper::get("polylines"))));
|
| 130 |
+
$this->store_poi_data("markers", $data_markers);
|
| 131 |
+
$this->store_poi_data("polygons", $data_polygons);
|
| 132 |
+
$this->store_poi_data("polylines", $data_polylines);
|
| 133 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
+
private function store_map_data() {
|
| 136 |
+
global $wpdb;
|
| 137 |
+
$columns = GMWDModel::get_columns("gmwd_maps");
|
| 138 |
+
$column_types = GMWDModel::column_types("gmwd_maps");
|
| 139 |
+
$data = array();
|
| 140 |
+
$format = array();
|
| 141 |
+
foreach ( $columns as $column_name ) {
|
| 142 |
+
$data[$column_name] = esc_html(stripslashes(GMWDHelper::get($column_name)));
|
| 143 |
+
$format[] = $column_types[$column_name];
|
| 144 |
+
}
|
| 145 |
+
$data["theme_id"] = 1;
|
| 146 |
+
$data["circle_line_width"] = 2;
|
| 147 |
+
$data["circle_line_color"] = '000';
|
| 148 |
+
$data["circle_line_opacity"] = 0.6;
|
| 149 |
+
$data["circle_fill_color"] = "7FDF16";
|
| 150 |
+
$data["circle_fill_opacity"] = 0.3;
|
| 151 |
+
$data["directions_window_width"] = 100;
|
| 152 |
+
$data["directions_window_width_unit"] = "%";
|
| 153 |
+
if ( GMWDHelper::get("id") == NULL || $this->task == "save2copy" ) {
|
| 154 |
+
$max_shortcode_id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "gmwd_shortcodes");
|
| 155 |
+
$data["published"] = 1;
|
| 156 |
+
$data["shortcode_id"] = $max_shortcode_id + 1;
|
| 157 |
+
$data["id"] = "";
|
| 158 |
+
$wpdb->insert($wpdb->prefix . "gmwd_maps", $data, $format);
|
| 159 |
+
$id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "gmwd_maps");
|
| 160 |
+
$this->shortcode_id = $max_shortcode_id + 1;
|
| 161 |
+
}
|
| 162 |
+
else {
|
| 163 |
+
$data["published"] = esc_html(GMWDHelper::get("published"));
|
| 164 |
+
$where = array( "id" => (int) GMWDHelper::get("id") );
|
| 165 |
+
$where_format = array( '%d' );
|
| 166 |
+
$wpdb->update($wpdb->prefix . "gmwd_maps", $data, $where, $format, $where_format);
|
| 167 |
+
$id = GMWDHelper::get("id");
|
| 168 |
+
}
|
| 169 |
+
$this->map = $id;
|
| 170 |
+
}
|
| 171 |
|
| 172 |
+
private function store_poi_data( $poi, $data_pois ) {
|
| 173 |
+
global $wpdb;
|
| 174 |
+
$data_types = GMWDModel::column_types("gmwd_" . $poi);
|
| 175 |
+
foreach ( $data_pois as $_data ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
+
$data = array();
|
| 178 |
+
$format = array();
|
| 179 |
+
foreach ( $_data as $key => $value ) {
|
| 180 |
+
if ( $key == "title" || $key == "address" ) {
|
| 181 |
+
$value = str_replace("@@@", '"', $value);
|
| 182 |
+
}
|
| 183 |
+
$data[$key] = sanitize_text_field(esc_html(stripslashes($value)));
|
| 184 |
+
$format[] = $data_types[$key];
|
| 185 |
+
}
|
| 186 |
+
//rewrite map id
|
| 187 |
+
$data["map_id"] = $this->map;
|
| 188 |
+
if ( $_data->id == "" || $this->task == "save2copy" ) {
|
| 189 |
+
//$data["published"] = 1;
|
| 190 |
+
$data["id"] = "";
|
| 191 |
+
$wpdb->insert($wpdb->prefix . "gmwd_" . $poi, $data, $format);
|
| 192 |
+
}
|
| 193 |
+
else {
|
| 194 |
+
//$data["published"] = esc_html($_data->published);
|
| 195 |
+
$where = array( "id" => $_data->id );
|
| 196 |
+
$where_format = array( '%d' );
|
| 197 |
+
$wpdb->update($wpdb->prefix . "gmwd_" . $poi, $data, $where, $format, $where_format);
|
| 198 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
}
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
private function store_shortcode() {
|
| 203 |
+
global $wpdb;
|
| 204 |
+
$data = array();
|
| 205 |
+
$data["tag_text"] = 'id=' . $this->shortcode_id . ' map=' . $this->map;
|
| 206 |
+
$format = array( '%s' );
|
| 207 |
+
$wpdb->insert($wpdb->prefix . "gmwd_shortcodes", $data, $format);
|
| 208 |
+
}
|
| 209 |
+
}
|
admin/controllers/GMWDControllerMarkers_gmwd.php
CHANGED
|
@@ -1,108 +1,7 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
class GMWDControllerMarkers_gmwd extends GMWDController{
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
// Constants //
|
| 9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 10 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 11 |
-
// Variables //
|
| 12 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 13 |
-
|
| 14 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 15 |
-
// Constructor & Destructor //
|
| 16 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 17 |
-
|
| 18 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 19 |
-
// Public Methods //
|
| 20 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 21 |
-
public function select_icon(){
|
| 22 |
-
$this->view->select_icon();
|
| 23 |
-
}
|
| 24 |
-
public function change_marker_size(){
|
| 25 |
-
global $wpdb;
|
| 26 |
-
$size = GMWDHelper::get("size");
|
| 27 |
-
$file_path = GMWDHelper::get("image_url");
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
if(strpos($file_path,"data:image/png;") !== false){
|
| 31 |
-
$filename = 'marker_'.time().'.png';
|
| 32 |
-
$uri = substr($file_path , strpos($file_path ,",")+1);
|
| 33 |
-
$file_path = GMWD_URL.'/images/markers/custom/customcreated/'.$filename;
|
| 34 |
-
file_put_contents(GMWD_DIR.'/images/markers/custom/customcreated/'.$filename, base64_decode($uri));
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
$base_name = substr(substr(substr($file_path, strpos($file_path, "markers")),7),0,-4);
|
| 38 |
-
$base_name = explode("_",$base_name);
|
| 39 |
-
|
| 40 |
-
$file_path = GMWD_URL.'/images/markers'.$base_name[0]."_".$base_name[1].".png";
|
| 41 |
-
|
| 42 |
-
$new_file_path_url = GMWD_URL.'/images/markers'.$base_name[0]."_".$base_name[1]."_".$size.".png";
|
| 43 |
-
$new_file_path_dir = GMWD_DIR.'/images/markers'.$base_name[0]."_".$base_name[1]."_".$size.".png";
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
if(file_exists($new_file_path_dir)){
|
| 47 |
-
echo $new_file_path_url; die();
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
list($img_width, $img_height, $type) = @getimagesize(htmlspecialchars_decode($file_path, ENT_COMPAT | ENT_QUOTES));
|
| 51 |
-
|
| 52 |
-
if (!$img_width || !$img_height) {
|
| 53 |
-
return false;
|
| 54 |
-
}
|
| 55 |
-
else{
|
| 56 |
-
$ratio = $img_width/$img_height;
|
| 57 |
-
$max_width = $size;
|
| 58 |
-
$max_height = $size/$ratio;
|
| 59 |
-
|
| 60 |
-
if (!function_exists('imagecreatetruecolor')) {
|
| 61 |
-
error_log('Function not found: imagecreatetruecolor');
|
| 62 |
-
return false;
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
ini_set('memory_limit', '-1');
|
| 66 |
-
|
| 67 |
-
if (($img_width / $img_height) >= ($max_width / $max_height)) {
|
| 68 |
-
$new_width = $img_width / ($img_height / $max_height);
|
| 69 |
-
$new_height = $max_height;
|
| 70 |
-
}
|
| 71 |
-
else {
|
| 72 |
-
$new_width = $max_width;
|
| 73 |
-
$new_height = $img_height / ($img_width / $max_width);
|
| 74 |
-
}
|
| 75 |
-
|
| 76 |
-
$dst_x = 0 - ($new_width - $max_width) / 2;
|
| 77 |
-
$dst_y = 0 - ($new_height - $max_height) / 2;
|
| 78 |
-
$new_img = @imagecreatetruecolor($max_width, $max_height);
|
| 79 |
-
|
| 80 |
-
@imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0));
|
| 81 |
-
@imagealphablending($new_img, false);
|
| 82 |
-
@imagesavealpha($new_img, true);
|
| 83 |
-
$src_img = @imagecreatefrompng($file_path);
|
| 84 |
-
$write_image = 'imagepng';
|
| 85 |
-
$image_quality = 9;
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
$success = $src_img && @imagecopyresampled($new_img, $src_img, $dst_x, $dst_y, 0, 0, $new_width, $new_height, $img_width,$img_height) && $write_image($new_img, $new_file_path_dir, $image_quality);
|
| 90 |
-
// Free up memory (imagedestroy does not delete files):
|
| 91 |
-
@imagedestroy($src_img);
|
| 92 |
-
@imagedestroy($new_img);
|
| 93 |
-
ini_restore('memory_limit');
|
| 94 |
-
|
| 95 |
-
echo $new_file_path_url; die();
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
}
|
| 99 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 100 |
-
// Getters & Setters //
|
| 101 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 102 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 103 |
-
// Private Methods //
|
| 104 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 105 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 106 |
-
// Listeners //
|
| 107 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
| 108 |
-
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
class GMWDControllerMarkers_gmwd extends GMWDController {
|
| 4 |
+
public function select_icon() {
|
| 5 |
+
$this->view->select_icon();
|
| 6 |
+
}
|
| 7 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/functions.php
CHANGED
|
@@ -21,10 +21,9 @@ function gmwd_get_option($option_name)
|
|
| 21 |
return false;
|
| 22 |
}
|
| 23 |
|
| 24 |
-
function upgrade_pro($text = false)
|
| 25 |
-
|
| 26 |
-
$
|
| 27 |
-
$task = isset($_GET["task"]) ? $_GET["task"] : "";
|
| 28 |
?>
|
| 29 |
<div class="gmwd_upgrade wd-clear">
|
| 30 |
<div class="wd-left">
|
|
@@ -71,14 +70,6 @@ function upgrade_pro($text = false)
|
|
| 71 |
<div class="wd-cell wd-cell-valign-middle">
|
| 72 |
<a href="https://10web.io/plugins/wordpress-google-maps/" target="_blank">
|
| 73 |
<?php _e("UPGRADE TO PAID VERSION", "gmwd"); ?>
|
| 74 |
-
<!--<div class="wd-table">
|
| 75 |
-
<div class="wd-cell wd-cell-valign-middle">
|
| 76 |
-
<img src="<?php echo GMWD_URL; ?>/images/web-dorado.png" width="42px">
|
| 77 |
-
</div>
|
| 78 |
-
<div class="wd-cell wd-cell-valign-middle">
|
| 79 |
-
<?php _e("UPGRADE TO PAID VERSION", "gmwd"); ?>
|
| 80 |
-
</div>
|
| 81 |
-
</div>-->
|
| 82 |
</a>
|
| 83 |
</div>
|
| 84 |
</div>
|
| 21 |
return false;
|
| 22 |
}
|
| 23 |
|
| 24 |
+
function upgrade_pro($text = false) {
|
| 25 |
+
$page = isset($_GET["page"]) ? sanitize_text_field($_GET["page"]) : "";
|
| 26 |
+
$task = isset($_GET["task"]) ? sanitize_term_field($_GET["task"]) : "";
|
|
|
|
| 27 |
?>
|
| 28 |
<div class="gmwd_upgrade wd-clear">
|
| 29 |
<div class="wd-left">
|
| 70 |
<div class="wd-cell wd-cell-valign-middle">
|
| 71 |
<a href="https://10web.io/plugins/wordpress-google-maps/" target="_blank">
|
| 72 |
<?php _e("UPGRADE TO PAID VERSION", "gmwd"); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
</a>
|
| 74 |
</div>
|
| 75 |
</div>
|
gmwd_admin_class.php
CHANGED
|
@@ -12,7 +12,7 @@ class GMWDAdmin
|
|
| 12 |
// Variables //
|
| 13 |
////////////////////////////////////////////////////////////////////////////////////////
|
| 14 |
protected static $instance = null;
|
| 15 |
-
private static $version = '1.0.
|
| 16 |
////////////////////////////////////////////////////////////////////////////////////////
|
| 17 |
// Constructor & Destructor //
|
| 18 |
////////////////////////////////////////////////////////////////////////////////////////
|
| 12 |
// Variables //
|
| 13 |
////////////////////////////////////////////////////////////////////////////////////////
|
| 14 |
protected static $instance = null;
|
| 15 |
+
private static $version = '1.0.60';
|
| 16 |
////////////////////////////////////////////////////////////////////////////////////////
|
| 17 |
// Constructor & Destructor //
|
| 18 |
////////////////////////////////////////////////////////////////////////////////////////
|
images/web-dorado.png
DELETED
|
Binary file
|
readme.txt
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
-
===
|
| 2 |
Contributors: webdorado,10web,wdsupport
|
| 3 |
Tags: google map, google maps, map, map markers, maps, directions, google map plugin, google maps plugin, map plugin, wp google map, wp google maps, google map widget
|
| 4 |
Requires at least: 3.4
|
| 5 |
Tested up to: 5.2
|
| 6 |
-
Stable tag: 1.0.
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
| 10 |
-
10Web Google Maps is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.
|
| 11 |
|
| 12 |
== Description ==
|
| 13 |
|
|
@@ -139,6 +139,8 @@ Activate 10Web Google Maps by going to Plugins and pressing Activate button.
|
|
| 139 |
|
| 140 |
== Changelog ==
|
| 141 |
|
|
|
|
|
|
|
| 142 |
|
| 143 |
= 1.0.59 =
|
| 144 |
* Fixed: Security issues
|
| 1 |
+
=== 10Web Map Builder for Google Maps ===
|
| 2 |
Contributors: webdorado,10web,wdsupport
|
| 3 |
Tags: google map, google maps, map, map markers, maps, directions, google map plugin, google maps plugin, map plugin, wp google map, wp google maps, google map widget
|
| 4 |
Requires at least: 3.4
|
| 5 |
Tested up to: 5.2
|
| 6 |
+
Stable tag: 1.0.60
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
| 10 |
+
10Web Maps Builder for Google Maps is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.
|
| 11 |
|
| 12 |
== Description ==
|
| 13 |
|
| 139 |
|
| 140 |
== Changelog ==
|
| 141 |
|
| 142 |
+
= 1.0.60 =
|
| 143 |
+
* Fixed: Security issues
|
| 144 |
|
| 145 |
= 1.0.59 =
|
| 146 |
* Fixed: Security issues
|
wd-google-maps.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
* Plugin Name: 10Web Google Maps
|
| 5 |
* Plugin URI: https://10web.io/plugins/wordpress-google-maps/
|
| 6 |
* Description: 10Web Google Maps is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.
|
| 7 |
-
* Version: 1.0.
|
| 8 |
* Author: 10Web
|
| 9 |
* Author URI: https://10web.io/plugins
|
| 10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
| 4 |
* Plugin Name: 10Web Google Maps
|
| 5 |
* Plugin URI: https://10web.io/plugins/wordpress-google-maps/
|
| 6 |
* Description: 10Web Google Maps is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.
|
| 7 |
+
* Version: 1.0.60
|
| 8 |
* Author: 10Web
|
| 9 |
* Author URI: https://10web.io/plugins
|
| 10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
