-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpepro-mapify.php
More file actions
2967 lines (2855 loc) · 262 KB
/
pepro-mapify.php
File metadata and controls
2967 lines (2855 loc) · 262 KB
1
2
3
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
50
51
52
53
54
55
56
57
58
59
60
61
62
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/*
Plugin Name: PeproDev Branches Map
Description: List your branches on a beautiful map with clickable hotspots, supporting 70+ Google Maps custom styles, and integrates into WPBakery Page Builder
Contributors: amirhosseinhpv,peprodev
Tags: functionality, map, googlemaps, svg map, show branches on map, pin on map, popup, branch
Author: Pepro Dev. Group
Developer: Amirhosseinhpv
Author URI: https://pepro.dev/
Developer URI: https://hpv.im/
Plugin URI: https://pepro.dev/mapify
Version: 1.3.6
Stable tag: 1.3.6
Requires at least: 5.0
Tested up to: 5.9
Requires PHP: 5.6
Text Domain: mapify
Domain Path: /languages
Copyright: (c) 2020 Pepro Dev. Group, All rights reserved.
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
# @Last modified by: Amirhosseinhpv
# @Last modified time: 2021/03/27 17:09:32
defined("ABSPATH") or die("Pepro Branches Map :: Unauthorized Access!");
if (!class_exists("PeproBranchesMap")){
class PeproBranchesMap
{
private static $_instance = null;
private $td;
private $plugin_dir;
private $plugin_url;
private $assets_url;
private $plugin_basename;
private $plugin_file;
private $version;
private $db_slug;
private $title;
private $title_w;
private $db_table = null;
private $manage_links = array();
private $meta_links = array();
public function __construct()
{
global $wpdb;
$this->td = "mapify";
self::$_instance = $this;
$this->plugin_dir = plugin_dir_path(__FILE__);
$this->plugin_url = plugins_url("", __FILE__);
$this->assets_url = plugins_url("/assets/", __FILE__);
$this->plugin_basename = plugin_basename(__FILE__);
$this->plugin_file = __FILE__;
$this->version = "1.3.6";
$this->db_slug = $this->td;
$this->db_table = $wpdb->prefix . $this->db_slug;
$this->deactivateURI = null;
$this->deactivateICON = '<style>.dashicons-small::before { font-size: 1rem !important; box-shadow: none !important; background-color: transparent !important; color: inherit !important; }</style><span style="font-size: larger; line-height: 1rem; display: inline; vertical-align: text-top;" class="dashicons dashicons-dismiss" aria-hidden="true"></span> ';
$this->versionICON = '<span style="font-size: larger; line-height: 1rem; display: inline; vertical-align: text-top;" class="dashicons dashicons-admin-plugins" aria-hidden="true"></span> ';
$this->authorICON = '<span style="font-size: larger; line-height: 1rem; display: inline; vertical-align: text-top;" class="dashicons dashicons-admin-users" aria-hidden="true"></span> ';
$this->settingURL = '<span style="display: inline;float: none;padding: 0;" class="dashicons dashicons-admin-settings dashicons-small" aria-hidden="true"></span> ';
$this->submitionURL = '<span style="display: inline;float: none;padding: 0;" class="dashicons dashicons-images-alt dashicons-small" aria-hidden="true"></span> ';
$this->url = admin_url("admin.php?page={$this->db_slug}");
$this->title = __("Pepro Branches Map", $this->td);
$this->title_w = sprintf(__("%2\$s ver. %1\$s", $this->td), $this->version, $this->title);
add_action("init", array($this, 'init_plugin'));
}
public function init_plugin()
{
if ($this->_vc_activated()){
add_action("vc_before_init", array($this,"integrate_visual_composer"));
if ( function_exists('vc_add_shortcode_param')){
$jsfile = "{$this->assets_url}js/vc.init.js?" . current_time("timestamp"); // we've added timestamp to end of file url to prevent caching
vc_add_shortcode_param( "pepro_about", array($this,"vc_add_pepro_about"), $jsfile);
vc_add_shortcode_param( "dropdown_multi", array($this,"vc_add_pepro_dropdown_multi") );
vc_add_shortcode_param( "radio_image", array($this,"vc_add_pepro_radio_image") );
vc_add_shortcode_param( "pinmarkermaker", "__return_empty_string", "{$this->assets_url}js/pin.maker.js?" . current_time("timestamp"));
}
}
add_filter("plugin_action_links_{$this->plugin_basename}", array($this, 'plugins_row_links'));
add_action("plugin_row_meta", array( $this, 'plugin_row_meta' ), 10, 2);
add_action("admin_menu", array($this, 'admin_menu'));
add_action("admin_init", array($this, 'admin_init'));
add_action("admin_enqueue_scripts", array($this, 'admin_enqueue_scripts'));
add_action("admin_print_footer_scripts", array($this, 'admin_print_footer_scripts'));
add_shortcode("pepro-mapify", array($this,'mapify_shortcode'));
$this->add_mapify_cpt();
add_filter("the_content", array($this,"mapify_branch_template"));
include_once "$this->plugin_dir/assets/app/metabx.php";
}
public function mapify_branch_template($content)
{
global $post;
if ( is_singular() && in_the_loop() && is_main_query() && "mapify" == $post->post_type){
$contentTemplate = get_post_meta(get_the_ID() ,"place_details_content_template", true);
if (( "content" == $contentTemplate) || ("default" == $contentTemplate && "content" == get_option("{$this->db_slug}-template","post"))){
return apply_filters( "mapify-branches-single-post-template", $this->get_branches_template(), $post, get_the_ID() );
}
}
return $content;
}
public function get_branches_template()
{
ob_start();
$post_data = extract(array(
'title' => get_the_title(get_the_ID()),
'image' => get_the_post_thumbnail_url(get_the_ID(),'thumbnail') || false,
'imagel' => get_the_post_thumbnail_url(get_the_ID(),'large') || false,
'address' => get_post_meta( get_the_ID(), "place_details_address", true ),
'phone' => get_post_meta( get_the_ID(), "place_details_phone", true ),
'site' => get_post_meta( get_the_ID(), "place_details_site", true ),
'email' => get_post_meta( get_the_ID(), "place_details_email", true ),
'socailtw' => get_post_meta( get_the_ID(), "place_details_socailtw", true ),
'socailfb' => get_post_meta( get_the_ID(), "place_details_socailfb", true ),
'socailig' => get_post_meta( get_the_ID(), "place_details_socailig", true ),
'socailtg' => get_post_meta( get_the_ID(), "place_details_socailtg", true ),
'socailli' => get_post_meta( get_the_ID(), "place_details_socailli", true ),
'additional' => get_post_meta( get_the_ID(), "place_details_additional", true ),
'map_data' => get_post_meta( get_the_ID(), "place_details_map_data", true ),
'featured_img_url' => get_the_post_thumbnail_url(get_the_ID(),'full'),
));
$social = "<i class='fas fa-users icon-social'></i> <span class='label social'>" . __("On Social: ",$this->td) . "</span>";
$social .= empty($socailtw) ?: "<a href='$socailtw' title='".esc_attr__("Twitter",$this->td)."'><i class='icon-social fab fa-twitter'></i></a> ";
$social .= empty($socailfb) ?: "<a href='$socailfb' title='".esc_attr__("Facebook",$this->td)."'><i class='icon-social fab fa-facebook'></i></a> ";
$social .= empty($socailig) ?: "<a href='$socailig' title='".esc_attr__("Instagram",$this->td)."'><i class='icon-social fab fa-instagram'></i></a> ";
$social .= empty($socailtg) ?: "<a href='$socailtg' title='".esc_attr__("Telegram",$this->td)."'><i class='icon-social fab fa-telegram'></i></a> ";
$social .= empty($socailli) ?: "<a href='$socailli' title='".esc_attr__("LinkedIn",$this->td)."'><i class='icon-social fab fa-linkedin'></i></a> ";
wp_enqueue_style( "fontawesome", "//use.fontawesome.com/releases/v5.2.0/css/all.css" );
wp_enqueue_style( "branches-cpt", "{$this->assets_url}css/branches-single.css");
$map_data = json_decode( $map_data);
$latitude = $map_data->latitude;
$longitude = $map_data->longitude;
$getdirection = "<i class='fas fa-directions icon-direction'></i> <span class='label direction'>" . __("Get Direction: ",$this->td) . "</span>
<a class='mapify-btn-find-route google_map' href='https://www.google.com/maps/place/$latitude,$longitude/@$latitude,$longitude,12.0z'><i class='fas fa-map-marker-alt icon-direction'></i> ".__("Google Map",$this->td)."</a>
<a class='mapify-btn-find-route waze' href='https://www.waze.com/ul?ll=$latitude,$longitude&navigate=yes&zoom=12'><i class='fas fa-route icon-direction'></i> ".__("Waze",$this->td)."</a>
";
echo apply_filters( "pepro-mapify-branchestemplate_return", '
<div class="mapfiy-branch-details-container-parent">
<div class="mapfiy-branch-details-container">
<div class="mapfiy-branch-detail-item-container image">
<a href="'.esc_url($featured_img_url).'" rel="lightbox">'.get_the_post_thumbnail( null, 'medium', '' ).'</a>
</div>
<div class="mapfiy-branch-detail-item-container details">
<div class="mapify-title"><h2>'.$title.'</h2></div>
<div class="mapify-address"><i class="fas fa-map icon-map"></i> ' . __("Address: ",$this->td) . $address."<br/>".$getdirection.'</div>
<div class="mapify-contact">
<div class="mapify-phone">'.(!empty($phone)?"<i class='icon-contact fas fa-phone'></i> <span class='label phone'>".__("Phone: ",$this->td)."</span><a href='tel:$phone'>$phone</a>":"").'</div>
<div class="mapify-site">'.(!empty($site)?"<i class='icon-contact fas fa-globe'></i> <span class='label site'>".__("Site: ",$this->td)."</span><a href='$site'>$site</a>":"").'</div>
<div class="mapify-email">'.(!empty($email)?"<i class='icon-contact fas fa-envelope'></i> <span class='label email'>".__("Email: ",$this->td)."</span><a href='mailto:$email'>$email</a>":"").'</div>
</div>
<div class="mapify-social">'.(!empty($email)?$social:"").'</div>
</div>
</div>
<div class="mapfiy-branch-detail-item-container extras">
<div class="mapify-extras">'.$additional.'</div>
</div>
</div>
');
$tcona = ob_get_contents();
ob_end_clean();
return $tcona;
}
public function integrate_visual_composer()
{
wp_enqueue_style( "chosen", "{$this->assets_url}/css/chosen.min.css");
wp_enqueue_script( "chosen", "{$this->assets_url}/js/chosen.min.js", array("jquery"));
wp_register_script( "markermaker", "{$this->assets_url}/js/pin.maker.js", array("jquery"));
wp_localize_script( "markermaker", "markermaker", array(
"vc_pinmarkermaker_dirfolder" => "{$this->assets_url}img/markers",
"vc_pinmarkermaker_clipboard" => __("Click To Set as your Overwritten Pin image", $this->td),
"vc_pinmarkermaker_numbers" => __("Numbers", $this->td),
"vc_pinmarkermaker_character" => __("Character", $this->td),
"vc_pinmarkermaker_symbols" => __("Symbols", $this->td),
"default_template" => $this->get_default_popup_markup(),
) );
wp_enqueue_script( "markermaker");
$peproMapifyMaptypes = apply_filters( "pepro-mapify-vc-maptypes",array(
esc_html__("Google Maps", $this->td) => 'googlemap' ,
// esc_html__("OpenStreet", $this->td) => 'openstreet' ,
// esc_html__("CedarMaps", $this->td) => 'cedarmaps' ,
));
$list = get_posts(apply_filters( "pepro-mapify-vc-brancheslist-opt",array(
'numberposts' => -1,
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'mapify',)));
$lists = array();foreach ($list as $key) { $lists[$key->post_title] = $key->ID;}
$peproMapifyMapIDs = apply_filters( "pepro-mapify-vc-branches-ids",$lists);
$categories = get_categories(apply_filters( "pepro-mapify-vc-branchescats-opt",
array(
'taxonomy' => 'mapify_category',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => false,)));
$lists = array();foreach ($categories as $cat) { $lists[esc_html( $cat->name )] = $cat->slug; }
$peproMapifyMapCategories = apply_filters( "pepro-mapify-vc-branches-cats",$lists);
$lists = array(
esc_html_x( "Default", "googl-map-style-name", $this->td ) => "default",
esc_html_x( "Custom Style", "googl-map-style-name", $this->td ) => "custom",
esc_html_x( "Midnight", "googl-map-style-name", $this->td ) => "midnight",
esc_html_x( "Desert", "googl-map-style-name", $this->td ) => "desert",
esc_html_x( "Bright Colors", "googl-map-style-name", $this->td ) => "bright",
esc_html_x( "Ultra Light", "googl-map-style-name", $this->td ) => "ulight",
esc_html_x( "Assassin's Creed IV", "googl-map-style-name", $this->td ) => "accriv",
esc_html_x( "Grass is greener", "googl-map-style-name", $this->td) => "grass-is-greener",
esc_html_x( "Sin City", "googl-map-style-name", $this->td) => "sin-city",
esc_html_x( "The Propia Effect", "googl-map-style-name", $this->td) => "the-propia-effect",
esc_html_x( "Snazzy Maps", "googl-map-style-name", $this->td) => "snazzy-maps",
esc_html_x( "Light Green", "googl-map-style-name", $this->td) => "light-green",
esc_html_x( "Flat green", "googl-map-style-name", $this->td) => "flat-green",
esc_html_x( "Dark Electric", "googl-map-style-name", $this->td) => "dark-electric",
esc_html_x( "Two Tone", "googl-map-style-name", $this->td) => "two-tone",
esc_html_x( "Modest", "googl-map-style-name", $this->td) => "modest",
esc_html_x( "Flat Colors", "googl-map-style-name", $this->td) => "flat-colors",
esc_html_x( "Red Alert", "googl-map-style-name", $this->td) => "red-alert",
esc_html_x( "Creamy Red", "googl-map-style-name", $this->td) => "creamy-red",
esc_html_x( "Light and dark", "googl-map-style-name", $this->td) => "light-and-dark",
esc_html_x( "Uber 2017", "googl-map-style-name", $this->td) => "uber-2017",
esc_html_x( "Hints of Gold", "googl-map-style-name", $this->td) => "hints-of-gold",
esc_html_x( "Transport for London", "googl-map-style-name", $this->td) => "transport-for-london",
esc_html_x( "Old Dry Mud", "googl-map-style-name", $this->td) => "old-dry-mud",
esc_html_x( "Neon World", "googl-map-style-name", $this->td) => "neon-world",
esc_html_x( "Printable Map", "googl-map-style-name", $this->td) => "printable-map",
esc_html_x( "Captor", "googl-map-style-name", $this->td) => "captor",
esc_html_x( "Zombie Survival Map", "googl-map-style-name", $this->td) => "zombie-survival-map",
esc_html_x( "Wyborcza 2018", "googl-map-style-name", $this->td) => "wyborcza-2018",
esc_html_x( "Hot Pink", "googl-map-style-name", $this->td) => "hot-pink",
esc_html_x( "Dark Yellow", "googl-map-style-name", $this->td) => "dark-yellow",
esc_html_x( "Light Blue Water", "googl-map-style-name", $this->td) => "light-blue-water",
esc_html_x( "Chilled", "googl-map-style-name", $this->td) => "chilled",
esc_html_x( "Purple", "googl-map-style-name", $this->td) => "purple",
esc_html_x( "Night vision", "googl-map-style-name", $this->td) => "night-vision",
esc_html_x( "50 shades of blue", "googl-map-style-name", $this->td) => "50-shades-of-blue",
esc_html_x( "Carte Vierge", "googl-map-style-name", $this->td) => "carte-vierge",
esc_html_x( "Simplified Map", "googl-map-style-name", $this->td) => "simplified-map",
esc_html_x( "Inturlam Style 2", "googl-map-style-name", $this->td) => "inturlam-style-2",
esc_html_x( "Esperanto", "googl-map-style-name", $this->td) => "esperanto",
esc_html_x( "Nothing but roads", "googl-map-style-name", $this->td) => "nothing-but-roads",
esc_html_x( "Veins", "googl-map-style-name", $this->td) => "veins",
esc_html_x( "Blueprint", "googl-map-style-name", $this->td) => "blueprint",
esc_html_x( "PipBoy Maps", "googl-map-style-name", $this->td) => "pipboy-maps",
esc_html_x( "Tinia", "googl-map-style-name", $this->td) => "tinia",
esc_html_x( "BehanceHK", "googl-map-style-name", $this->td) => "behancehk",
esc_html_x( "St. Martin", "googl-map-style-name", $this->td) => "st-martin",
esc_html_x( "AutoMax", "googl-map-style-name", $this->td) => "automax",
esc_html_x( "Colorblind-friendly", "googl-map-style-name", $this->td) => "colorblind-friendly",
esc_html_x( "NightRider", "googl-map-style-name", $this->td) => "nightrider",
esc_html_x( "HCRE", "googl-map-style-name", $this->td) => "hcre",
esc_html_x( "Celestial Blue", "googl-map-style-name", $this->td) => "celestial-blue",
esc_html_x( "Best Ski Pros", "googl-map-style-name", $this->td) => "best-ski-pros",
esc_html_x( "Pokemon Go", "googl-map-style-name", $this->td) => "pokemon-go",
esc_html_x( "Vintage Brown", "googl-map-style-name", $this->td) => "vintage-old-golden-brown",
esc_html_x( "Apple Maps", "googl-map-style-name", $this->td) => "apple-maps-esque",
esc_html_x( "Unsaturated Browns", "googl-map-style-name", $this->td) => "unsaturated-browns",
esc_html_x( "Flat Map", "googl-map-style-name", $this->td) => "flat-map",
esc_html_x( "Multi Brand Net.", "googl-map-style-name", $this->td) => "multi-brand-network",
esc_html_x( "Retro", "googl-map-style-name", $this->td) => "retro",
esc_html_x( "Muted Blue", "googl-map-style-name", $this->td) => "muted-blue",
esc_html_x( "Neutral Blue", "googl-map-style-name", $this->td) => "neutral-blue",
esc_html_x( "Black & white", "googl-map-style-name", $this->td) => "black-and-white-without-labels",
esc_html_x( "Icy Blue", "googl-map-style-name", $this->td) => "icy-blue",
esc_html_x( "Hopper", "googl-map-style-name", $this->td) => "hopper",
esc_html_x( "Cobalt", "googl-map-style-name", $this->td) => "cobalt",
esc_html_x( "Night Vision", "googl-map-style-name", $this->td) => "night-visions",
esc_html_x( "Red Hues", "googl-map-style-name", $this->td) => "red-hues",
esc_html_x( "Roads only", "googl-map-style-name", $this->td) => "roads-only",
esc_html_x( "Flat Map with Labels", "googl-map-style-name", $this->td) => "flat-map-with-labels",
esc_html_x( "Mondrian", "googl-map-style-name", $this->td) => "mondrian",
esc_html_x( "Bright & Bubbly", "googl-map-style-name", $this->td) => "bright-and-bubbly",
esc_html_x( "Shades of Grey", "googl-map-style-name", $this->td) => "shades-of-grey",
);
$googlemapDesignsArray = apply_filters( "pepro-mapify-vc-googlemap-styles",$lists);
$lists = array(
"default" => "{$this->assets_url}img/map-style/gmapdefault.jpg",
"custom" => "{$this->assets_url}img/map-style/gmapcustom.jpg",
"midnight" => "{$this->assets_url}img/map-style/gmapmidnight.jpg",
"desert" => "{$this->assets_url}img/map-style/gmapdesert.jpg",
"bright" => "{$this->assets_url}img/map-style/gmapbright.jpg",
"ulight" => "{$this->assets_url}img/map-style/gmapulight.jpg",
"accriv" => "{$this->assets_url}img/map-style/gmapassassincreediv.jpg",
"grass-is-greener" => "{$this->assets_url}img/map-style/grass-is-greener.jpg",
"sin-city" => "{$this->assets_url}img/map-style/sin-city.jpg",
"the-propia-effect" => "{$this->assets_url}img/map-style/the-propia-effect.jpg",
"snazzy-maps" => "{$this->assets_url}img/map-style/snazzy-maps.jpg",
"light-green" => "{$this->assets_url}img/map-style/light-green.jpg",
"flat-green" => "{$this->assets_url}img/map-style/flat-green.jpg",
"dark-electric" => "{$this->assets_url}img/map-style/dark-electric.jpg",
"two-tone" => "{$this->assets_url}img/map-style/two-tone.jpg",
"modest" => "{$this->assets_url}img/map-style/modest.jpg",
"flat-colors" => "{$this->assets_url}img/map-style/flat-colors.jpg",
"red-alert" => "{$this->assets_url}img/map-style/red-alert.jpg",
"creamy-red" => "{$this->assets_url}img/map-style/creamy-red.jpg",
"light-and-dark" => "{$this->assets_url}img/map-style/light-and-dark.jpg",
"uber-2017" => "{$this->assets_url}img/map-style/uber-2017.jpg",
"hints-of-gold" => "{$this->assets_url}img/map-style/hints-of-gold.jpg",
"transport-for-london" => "{$this->assets_url}img/map-style/transport-for-london.jpg",
"old-dry-mud" => "{$this->assets_url}img/map-style/old-dry-mud.jpg",
"neon-world" => "{$this->assets_url}img/map-style/neon-world.jpg",
"printable-map" => "{$this->assets_url}img/map-style/printable-map.jpg",
"captor" => "{$this->assets_url}img/map-style/captor.jpg",
"zombie-survival-map" => "{$this->assets_url}img/map-style/zombie-survival-map.jpg",
"wyborcza-2018" => "{$this->assets_url}img/map-style/wyborcza-2018.jpg",
"hot-pink" => "{$this->assets_url}img/map-style/hot-pink.jpg",
"dark-yellow" => "{$this->assets_url}img/map-style/dark-yellow.jpg",
"light-blue-water" => "{$this->assets_url}img/map-style/light-blue-water.jpg",
"chilled" => "{$this->assets_url}img/map-style/chilled.jpg",
"purple" => "{$this->assets_url}img/map-style/purple.jpg",
"night-vision" => "{$this->assets_url}img/map-style/night-vision.jpg",
"50-shades-of-blue" => "{$this->assets_url}img/map-style/50-shades-of-blue.jpg",
"carte-vierge" => "{$this->assets_url}img/map-style/carte-vierge.jpg",
"simplified-map" => "{$this->assets_url}img/map-style/simplified-map.jpg",
"inturlam-style-2" => "{$this->assets_url}img/map-style/inturlam-style-2.jpg",
"esperanto" => "{$this->assets_url}img/map-style/esperanto.jpg",
"nothing-but-roads" => "{$this->assets_url}img/map-style/nothing-but-roads.jpg",
"veins" => "{$this->assets_url}img/map-style/veins.jpg",
"blueprint" => "{$this->assets_url}img/map-style/blueprint.jpg",
"pipboy-maps" => "{$this->assets_url}img/map-style/pipboy-maps.jpg",
"tinia" => "{$this->assets_url}img/map-style/tinia.jpg",
"behancehk" => "{$this->assets_url}img/map-style/behancehk.jpg",
"st-martin" => "{$this->assets_url}img/map-style/st-martin.jpg",
"automax" => "{$this->assets_url}img/map-style/automax.jpg",
"colorblind-friendly" => "{$this->assets_url}img/map-style/colorblind-friendly.jpg",
"nightrider" => "{$this->assets_url}img/map-style/nightrider.jpg",
"hcre" => "{$this->assets_url}img/map-style/hcre.jpg",
"celestial-blue" => "{$this->assets_url}img/map-style/celestial-blue.jpg",
"best-ski-pros" => "{$this->assets_url}img/map-style/best-ski-pros.jpg",
"pokemon-go" => "{$this->assets_url}img/map-style/pokemon-go.jpg",
"vintage-old-golden-brown" => "{$this->assets_url}img/map-style/vintage-old-golden-brown.jpg",
"apple-maps-esque" => "{$this->assets_url}img/map-style/apple-maps-esque.jpg",
"unsaturated-browns" => "{$this->assets_url}img/map-style/unsaturated-browns.jpg",
"flat-map" => "{$this->assets_url}img/map-style/flat-map.jpg",
"multi-brand-network" => "{$this->assets_url}img/map-style/multi-brand-network.jpg",
"retro" => "{$this->assets_url}img/map-style/retro.jpg",
"muted-blue" => "{$this->assets_url}img/map-style/muted-blue.jpg",
"neutral-blue" => "{$this->assets_url}img/map-style/neutral-blue.jpg",
"black-and-white-without-labels" => "{$this->assets_url}img/map-style/black-and-white-without-labels.jpg",
"icy-blue" => "{$this->assets_url}img/map-style/icy-blue.jpg",
"hopper" => "{$this->assets_url}img/map-style/hopper.jpg",
"cobalt" => "{$this->assets_url}img/map-style/cobalt.jpg",
"night-visions" => "{$this->assets_url}img/map-style/night-visions.jpg",
"red-hues" => "{$this->assets_url}img/map-style/red-hues.jpg",
"roads-only" => "{$this->assets_url}img/map-style/roads-only.jpg",
"flat-map-with-labels" => "{$this->assets_url}img/map-style/flat-map-with-labels.jpg",
"mondrian" => "{$this->assets_url}img/map-style/mondrian.jpg",
"bright-and-bubbly" => "{$this->assets_url}img/map-style/bright-and-bubbly.jpg",
"shades-of-grey" => "{$this->assets_url}img/map-style/shades-of-grey.jpg",
);
$googlemapDesignsPicArray = apply_filters( "pepro-mapify-vc-googlemap-styles-pics",$lists);
vc_map(
array(
"base" => "pepro-mapify",
"name" => esc_html__("Branches Map", $this->td),
"category" => esc_html__("Pepro Elements", "$this->td"),
"description" => esc_html__("List your branches on a beautiful svg map.", $this->td ),
"class" => "{$this->td}__class",
"icon" => "{$this->assets_url}img/peprodev.svg",
"show_settings_on_create" => true,
"admin_enqueue_css" => array("{$this->assets_url}/css/vc.init.css"),
"admin_enqueue_js" => array(),
"params" => array(
array(
"group" => esc_html_x("General","vc-tab", "$this->td" ),
"heading" => esc_html__("Select Branches", $this->td),
"description" => esc_html__("Select Branches to show on the map", $this->td),
"type" => "dropdown",
"param_name" => "branchtype",
"edit_field_class" => "vc_column vc_col-sm-6",
"admin_label" => false,
"save_always" => true,
"std" => "cat",
"value" => array(
esc_html__( "Select Branches by ID", $this->td ) => "id",
esc_html__( "Select Branches by Category", $this->td ) => "cat",
),
),
array(
"group" => esc_html_x("General","vc-tab", "$this->td" ),
"heading" => esc_html__("Handpick Branches ID", $this->td),
"param_name" => "branchids",
"type" => "dropdown_multi",
"class" => "chosen-select",
"edit_field_class" => "vc_column vc_col-sm-6",
"placeholder" => esc_html__("Select Categories", $this->td),
"admin_label" => false,
"description" => esc_html__("Handpick branches to show on map", $this->td),
"value" => $peproMapifyMapIDs,
'dependency' => array( 'element' => 'branchtype', 'value' => array( 'id' ), ),
),
array(
"group" => esc_html_x("General","vc-tab", "$this->td" ),
"heading" => esc_html__("Select Branches Category", $this->td),
"param_name" => "branchcat",
"type" => "dropdown_multi",
"edit_field_class" => "vc_column vc_col-sm-6",
"class" => "chosen-select",
"placeholder" => esc_html__("Select Categories", $this->td),
"admin_label" => false,
"description" => esc_html__("Select branch categories to show on map", $this->td),
"value" => $peproMapifyMapCategories,
'dependency' => array( 'element' => 'branchtype', 'value' => array( 'cat' ), ),
),
array(
"group" => esc_html_x("Design","vc-tab", "$this->td" ),
"heading" => esc_html__("Map Engine", $this->td),
"type" => "dropdown",
"edit_field_class" => "vc_column vc_col-sm-12",
"param_name" => "maptype",
"save_always" => true,
"admin_label" => false,
"description" => esc_html__("Select your desired map type", $this->td),
"std" => apply_filters( "pepro-mapify-maptypes-default","googlemap"),
"value" => $peproMapifyMaptypes,
),
array(
"group" => esc_html_x("Branches List","vc-tab", "$this->td" ),
"heading" => esc_html__("Show Branches List?", $this->td),
"type" => "checkbox",
"param_name" => "branchlistshow",
"edit_field_class" => "vc_column vc_col-sm-6",
"admin_label" => false,
),
array(
"group" => esc_html_x("Branches List","vc-tab", "$this->td" ),
"heading" => esc_html__("Show Branches Search?", $this->td),
"type" => "checkbox",
"edit_field_class" => "vc_column vc_col-sm-6",
"param_name" => "branchessearch",
"admin_label" => false,
'dependency' => array( 'element' => 'branchlistshow', 'value' => array( 'true' ), ),
),
array(
"group" => esc_html_x("Branches List","vc-tab", "$this->td" ),
"heading" => esc_html__("Branches List placement", $this->td),
"type" => "dropdown",
"edit_field_class" => "vc_column vc_col-sm-6",
"param_name" => "branchplacement",
"admin_label" => false,
"std" => "top",
"value" => array(
esc_html__( "Show at Top of Map", $this->td ) => "top" ,
esc_html__( "Show at Bottom of Map", $this->td ) => "bottom" ,
),
'dependency' => array( 'element' => 'branchlistshow', 'value' => array( 'true' ), ),
),
array(
"group" => esc_html_x("Branches List","vc-tab", "$this->td" ),
"heading" => esc_html__("Categorize Branches In List", $this->td),
"type" => "dropdown",
"edit_field_class" => "vc_column vc_col-sm-6",
"param_name" => "brancheslistcat",
"admin_label" => false,
"std" => "none",
"value" => array(
esc_html__( "Do not categorize branches in list", $this->td ) => "none" ,
esc_html__( "Categorize based on Branches Categories", $this->td ) => "category" ,
// esc_html__( "Categorize based on Branches Country", $this->td ) => "country" ,
// esc_html__( "Categorize based on Branches Provinces/States", $this->td ) => "states" ,
),
'dependency' => array( 'element' => 'branchlistshow', 'value' => array( 'true' ), ),
),
array(
"group" => esc_html_x("Marker Clusters","vc-tab", "$this->td" ),
"heading" => esc_html__("Cluster Branches Marker Pins on Map?", $this->td),
"description" => esc_html__("Create per-zoom-level clusters for large amounts of markers", $this->td ),
"type" => "checkbox",
"param_name" => "branchascluster",
"edit_field_class" => "vc_column vc_col-sm-4",
"std" => "true",
"admin_label" => false,
),
array(
"group" => esc_html_x("Marker Clusters","vc-tab", "$this->td" ),
"heading" => esc_html__("Clusters Grid Size", $this->td),
"type" => "textfield",
"param_name" => "clustergridsize",
"edit_field_class" => "vc_column vc_col-sm-4",
"std" => "100",
"admin_label" => false,
"description" => esc_html__( "The grid size of a cluster in pixels", $this->td ),
'dependency' => array( 'element' => 'branchascluster', 'value' => array( 'true' ), ),
),
array(
"group" => esc_html_x("Marker Clusters","vc-tab", "$this->td" ),
"heading" => esc_html__("Clusters Minimum Size", $this->td),
"type" => "textfield",
"param_name" => "clusterminsize",
"edit_field_class" => "vc_column vc_col-sm-4",
"std" => "2",
"description" => esc_html__( "The maximum number of markers can be part of a cluster", $this->td ),
"admin_label" => false,
'dependency' => array( 'element' => 'branchascluster', 'value' => array( 'true' ), ),
),
array(
"group" => esc_html_x("Marker Pin","vc-tab", "$this->td" ),
"heading" => esc_html__("Overwrite Marker Pin Images", $this->td),
"type" => "textfield",
"param_name" => "pinimage",
"description" => esc_html__( "Enter URL or use form below to generate your Pin image. This image will be overwritten to all branches marker", $this->td ),
"value" => "",
"admin_label" => false,
"edit_field_class" => "vc_column vc_col-sm-12",
"holder" => "div",
),
array(
"group" => esc_html_x("Marker Pin","vc-tab", "$this->td" ),
"heading" => esc_html__("Marker Pin Image Generator", $this->td),
"type" => "pinmarkermaker",
"param_name" => "pinimagehelper",
"edit_field_class" => "vc_column vc_col-sm-12 peprovc_pinimagegenerator",
"admin_label" => false,
),
array(
"group" => esc_html_x("Marker Pin","vc-tab", "$this->td" ),
"heading" => esc_html__("Marker Pin Click Action", $this->td),
"type" => "dropdown",
"param_name" => "pinaction",
"save_always" => true,
"admin_label" => false,
"edit_field_class" => "vc_column vc_col-sm-12",
"std" => "url",
"value" => array(
esc_html__( "Open URL", $this->td ) => "url" ,
esc_html__( "Open Popup", $this->td ) => "popup" ,
esc_html__( "Do Nothing", $this->td ) => "null" ,
),
),
array(
"group" => esc_html_x("Marker Pin","vc-tab", "$this->td" ),
"heading" => esc_html__("URL Target", $this->td),
"type" => "dropdown",
"param_name" => "pinurltarget",
"edit_field_class" => "vc_column vc_col-sm-12",
"save_always" => true,
"admin_label" => false,
"std" => "_blank",
"value" => array(
esc_html__( 'Same window', 'js_composer' ) => '_self',
esc_html__( 'New window', 'js_composer' ) => '_blank',
),
'dependency' => array( 'element' => 'pinaction', 'value' => array( 'url' ), ),
),
array(
"group" => esc_html_x("Marker Pin", "vc-tab", "$this->td" ),
"heading" => esc_html__("Marker Pin Popup Template (HTML)", "$this->td" ),
"edit_field_class" => "vc_column vc_col-sm-12",
"type" => "textarea_raw_html",
"holder" => "div",
"save_always" => true,
"admin_label" => false,
"param_name" => "popup_markup",
"value" => base64_encode($this->get_default_popup_markup()),
"description" => "<a id='mapify_load_default_markup' href='#'>" . __("Load Default Template", $this->td) . "</a><p class='mapify_markup_guide_container'>" . $this->get_default_popup_markup_help() . "</p>",
'dependency' => array( 'element' => 'pinaction', 'value' => array( 'popup' ), ),
),
array(
"group" => esc_html_x("Design","vc-tab", "$this->td" ),
"heading" => esc_html__("Default Center Coordinate", "$this->td" ),
"type" => "textfield",
"class" => "",
"edit_field_class" => "vc_column vc_col-sm-6",
"holder" => "div",
"admin_label" => false,
"param_name" => "center_coordinate",
"value" => "32.1001646,54.4637493",
"description" => __("Enter Default Center Coordinate in <i>latitude,longitude</i> format", $this->td),
),
array(
"group" => esc_html_x("Design","vc-tab", "$this->td" ),
"heading" => esc_html__("Default Zoom Level", "$this->td" ),
"type" => "textfield",
"class" => "",
"edit_field_class" => "vc_column vc_col-sm-6",
"holder" => "div",
"admin_label" => false,
"param_name" => "default_zoom",
"value" => "5",
),
array(
"group" => esc_html_x("Design","vc-tab", "$this->td" ),
"heading" => esc_html__("Default Loading Image", "$this->td" ),
"type" => "textfield",
"edit_field_class" => "vc_column vc_col-sm-6",
"holder" => "div",
"admin_label" => false,
"param_name" => "loading_image",
"value" => "{$this->assets_url}img/peprodev.svg",
"dependency" => array( 'element' => 'maptype', 'value' => array( 'googlemap' ), ),
),
array(
"group" => esc_html_x("Design", "vc-tab", "$this->td" ),
"heading" => esc_html__("Default Loading Color", "$this->td" ),
"type" => "textfield",
"edit_field_class" => "vc_column vc_col-sm-6",
"holder" => "div",
"admin_label" => false,
"param_name" => "loading_color",
"value" => "linear-gradient(120deg,#dd5542,#fd9d73)",
"dependency" => array( 'element' => 'maptype', 'value' => array( 'googlemap' ), ),
),
array(
"group" => esc_html_x("CSS", "vc-tab", "$this->td" ),
"heading" => esc_html__("Map Container's HTML ID", "$this->td" ),
"type" => "textfield",
"class" => "",
"edit_field_class" => "vc_column vc_col-sm-6",
"holder" => "div",
"admin_label" => false,
"param_name" => "el_id",
"value" => "",
),
array(
"group" => esc_html_x("CSS", "vc-tab", "$this->td" ),
"heading" => esc_html__("Map Container's HTML Class", "$this->td" ),
"type" => "textfield",
"class" => "",
"edit_field_class" => "vc_column vc_col-sm-6",
"holder" => "div",
"admin_label" => false,
"param_name" => "el_class",
"value" => "",
),
array(
"group" => esc_html_x("CSS","vc-tab","$this->td" ),
"heading" => esc_html__("Map Container's Width", "$this->td" ),
"type" => "textfield",
"class" => "",
"edit_field_class" => "vc_column vc_col-sm-6",
"holder" => "div",
"admin_label" => false,
"param_name" => "el_map_width",
"value" => "100%",
),
array(
"group" => esc_html_x("CSS","vc-tab", "$this->td" ),
"heading" => esc_html__("Map Container's Height", "$this->td" ),
"type" => "textfield",
"class" => "",
"edit_field_class" => "vc_column vc_col-sm-6",
"holder" => "div",
"admin_label" => false,
"param_name" => "el_map_height",
"value" => "500px",
),
array(
"group" => esc_html_x("Design", "vc-tab", "$this->td" ),
"heading" => esc_html__("G-Map Custom Logo", "$this->td" ),
"type" => "textfield",
"edit_field_class" => "vc_column vc_col-sm-6",
"holder" => "div",
"admin_label" => false,
"description" => __('Change G-Map default trademark logo at footer', $this->td),
"param_name" => "mapfooterimage",
"value" => "{$this->assets_url}img/peprodev.svg",
"dependency" => array( 'element' => 'maptype', 'value' => array( 'googlemap' ), ),
),
array(
"group" => esc_html_x("Design","vc-tab", "$this->td" ),
"heading" => esc_html__("Development Mode", "$this->td" ),
"type" => "checkbox",
"edit_field_class" => "vc_column vc_col-sm-3",
"holder" => "div",
"admin_label" => false,
"param_name" => "usegmapcopyright",
"description" => __('In development mode, API is skipped but "FOR DEVELOPMENT PURPOSES ONLY" watermark is added to map, And also styles will not work properly.', $this->td),
"dependency" => array( 'element' => 'maptype', 'value' => array( 'googlemap' ), ),
),
array(
"group" => esc_html_x("Design", "vc-tab","$this->td" ),
"heading" => esc_html__("Disable UI", "$this->td" ),
"type" => "checkbox",
"edit_field_class" => "vc_column vc_col-sm-3",
"holder" => "div",
"admin_label" => false,
"param_name" => "disabledefaultui",
"description" => __('No UI will be shown on Map, No Zoom Buttons, No Fullscreen Button and ...', $this->td),
"dependency" => array( 'element' => 'maptype', 'value' => array( 'googlemap' ), ),
),
array(
"group" => esc_html_x("Design","vc-tab", "$this->td" ),
"heading" => esc_html__("Select Style", "$this->td" ),
"type" => "radio_image",
"edit_field_class" => "vc_column vc_col-sm-6",
"holder" => "div",
"admin_label" => false,
"std" => "default",
"value" => $googlemapDesignsArray,
"images" => $googlemapDesignsPicArray,
"image_height" => "100px",
"image_width" => "100px",
"image_label" => true,
"param_name" => "map_defined_style",
"dependency" => array('element' => 'maptype','value' => array( 'googlemap' ),),
),
array(
"group" => esc_html_x("Design","vc-tab", "$this->td" ),
"heading" => esc_html__("Style Preview", "$this->td" ),
"type" => "textfield",
"edit_field_class" => "vc_column vc_col-sm-6 vc_sticky",
"holder" => "div",
"admin_label" => false,
"param_name" => "googlemap_style__preview",
"dependency" => array('element' => 'maptype','value' => array( 'googlemap' ),),
),
array(
"group" => esc_html_x("Design","vc-tab", "$this->td" ),
"heading" => esc_html__("Google Maps Custom Style", "$this->td" ),
"type" => "textarea_raw_html",
"edit_field_class" => "vc_column vc_col-sm-6 vc_sticky",
"holder" => "div",
"admin_label" => false,
"param_name" => "googlemap_style",
"description" => sprintf(__('Browse %s for beautiful pre-made styles.', $this->td),'<a target="_blank" href="https://snazzymaps.com">snazzymaps.com</a>'),
"dependency" => array('element' => 'maptype','value' => array( 'googlemap' ),),
),
array(
"group" => esc_html_x("CSS","vc-tab", "$this->td"),
"type" => "css_editor",
"param_name" => "css",
"save_always" => true,
"admin_label" => false,
),
array(
"group" => esc_html_x("Import / Export","vc-tab", "$this->td" ),
"type" => "pepro_about",
"param_name" => "maptype",
"save_always" => true,
"admin_label" => false,
),
),
)
);
}
public function vc_add_pepro_about($settings, $value)
{
// __("Import Done Successfully",$this->td)
ob_start();
$ct = current_time("timestamp");
?>
<script type="text/javascript">
GLOBAL_MAPIFY_VERSION = "<?=$this->version;?>";
GLOBAL_VC_VERSION = "<?=WPB_VC_VERSION;?>";
GLOBAL_PHP_VERSION = "<?=phpversion();?>";
GLOBAL_WP_VERSION = "<?=get_bloginfo('version');?>";
GLOBAL_IMPORT_DONE = "<?=__('Import Done Successfully',$this->td);?>";
</script>
<style media="screen">
div#mapify<?=$ct;?>{
display: block;
background: url('<?=plugins_url( "/assets/img/peprodev.svg",__FILE__ );?>');
min-height: 200px;
background-size: 53px;
background-position: bottom right;
background-repeat: no-repeat;
}
[dir=rtl] div#mapify<?=$ct;?>{
background-position: bottom left;
}
</style>
<div id="mapify<?=$ct;?>">
<textarea id="mapify-importexport" rows="8" cols="80" placeholder="<?=esc_attr__("Press 'Export Shortcode Configurations' to generate data",$this->td);?>"></textarea>
<p>
<button type="button" style="min-width: 40%;"
class="mapify-export vc_general vc_ui-button vc_ui-button-action vc_ui-button-shape-rounded"
data-caption="<?=__("Export Shortcode Configurations",$this->td);?>"
data-copied="<?=__("Successfully copied to clipboard !",$this->td);?>"><?=__("Export Shortcode Configurations",$this->td);?></button>
<button type="button" style="min-width: 40%;"
class="mapify-import vc_general vc_ui-button vc_ui-button-action vc_ui-button-shape-rounded"
data-empty="<?=__("Empty data! Paste your data in field above.",$this->td);?>"><?=__("Import Shortcode Configurations",$this->td);?></button>
</p>
</div>
<?php
$tcona = ob_get_contents();
ob_end_clean();
return $tcona;
}
public function vc_add_pepro_dropdown_multi( $param, $value )
{
$param_line = '';
$param_class = isset($param['class']) ? $param['class'] : "";
$param_line .= '<select multiple data-placeholder="'.esc_attr( $param['placeholder'] ).'" name="'. esc_attr( $param['param_name'] ).'" class="wpb_vc_param_value wpb-input wpb-select '. esc_attr( $param['param_name'] ).' '.esc_attr($param_class).' '. esc_attr($param['type']).'">';
foreach ( $param['value'] as $text_val => $val ) {
if ( is_numeric($text_val) && (is_string($val) || is_numeric($val)) ) {
$text_val = $val;
}
$text_val = $text_val;$selected = '';
if(!is_array($value)) {
$param_value_arr = explode(',',$value);
} else {
$param_value_arr = $value;
}
if ($value!=='' && in_array($val, $param_value_arr)) {
$selected = ' selected="selected"';
}
$param_line .= '<option class="'.$val.'" value="'.$val.'"'.$selected.'>'.$text_val.'</option>';
}
$param_line .= '</select>';
return $param_line;
}
public function vc_add_pepro_radio_image( $param, $value )
{
$image_label = empty($param['image_label']) ? false : ((true == $param['image_label']) ? true : false);
$imgwidth = empty($param['image_width']) ? "100px" : esc_attr($param['image_width']);
$show_input = empty($param['show_input']) ? "hidden" : "text";
$input_pos = empty($param['input_pos']) ? "bottom" : (("top" == $param['input_pos'])?"top":"bottom");
$imgheight = empty($param['image_height']) ? "100px" : esc_attr($param['image_height']);
$param_class = isset($param['class']) ? $param['class'] : "";
$param_line = '<style>.peprodevvcradiolabl span { margin-top: 0.7rem; }.peprodevvcradiolabl {margin-bottom: .5rem; display: inline-flex; flex-direction: column; place-content: center; place-items: center; }.peprodevvcinputforradio:checked + label > img { box-shadow: 0 0 0 3px white,0 0 0 6px #e05a46; } .peprodevvcinputforradio + label > img { border-radius: 5px; }.wpb_vc_param_value.radio_image{ display: flex; flex-wrap: wrap; justify-content: flex-start; }
.vcpepro_radio_item_container.'.$param['param_name'].' { flex: 0 1 calc('.$imgwidth.' + 1.2rem); margin-bottom: 5px; width: auto;text-align: center;}</style>';
if ("bottom" !== $input_pos){$param_line .= '<input type="'.$show_input.'" value="'.$value.'" id="'.$param['param_name'].'" name="'.$param['param_name'].'" class="wpb_vc_param_value wpb-input">';}
$param_line .= '<div class="wpb_vc_param_value '. esc_attr( $param['param_name'] ).' '.esc_attr( $param_class ).' '. esc_attr($param['type']).'">';
foreach ( $param['value'] as $text_val => $val ) {
if ( is_numeric($text_val) && (is_string($val) || is_numeric($val)) ) { $text_val = $val; }
$text_val = $text_val; $selected = ''; $img = "";
if(!is_array($value)) {
$param_value_arr = explode(',',$value);
} else {
$param_value_arr = $value;
}
if ($value !== '' && in_array($val, $param_value_arr)) { $selected = ' checked'; }
$dnoneinpuit = "";
if (!empty($param['images'][$val])){
$img = $param['images'][$val];
$text_val = "<img id='{$param['param_name']}_$val' title='$text_val' style='width:$imgwidth; height:$imgheight;' alt='$text_val' src='$img' />" . (true===$image_label?"<span>$text_val</span>":"");
$dnoneinpuit = "display: none;";
}
$param_line .=
'<div class="vcpepro_radio_item_container '.esc_attr( $param['param_name'] )." $val ".' ">
<input style="width: auto;'.$dnoneinpuit.'" type="radio" name="peprodev_'. esc_attr( $param['param_name'] ).'"
class="wpb_vc_param_value peprodevvcinputforradio '."{$param['param_name']} $val".'" id="peprodev_'.$param['param_name']."_".$val.'"
value="'.$val.'" '.$selected.' />
<label class="vc_radio-label peprodevvcradiolabl" for="peprodev_'.esc_attr( $param['param_name'] )."_".$val.'">'.$text_val.'</label>
</div>';
}
$param_line .= '</div>';
if ("bottom" === $input_pos){$param_line .= '<input type="'.$show_input.'" value="'.$value.'" id="'.$param['param_name'].'" name="'.$param['param_name'].'" class="wpb_vc_param_value wpb-input">';}
$param_line .= '<script>jQuery("input.wpb_vc_param_value.'.$param['param_name'].'").change(function(){var s = jQuery(this).val();jQuery("#'.$param['param_name'].'").val(s);});</script>';
return $param_line;
}
public function plugins_row_links($links)
{
foreach ($this->get_manage_links() as $title => $href) {
array_unshift($links, "<a href='$href' target='_self'>$title</a>");
}
$a = new SimpleXMLElement($links["deactivate"]);
$this->deactivateURI = "<a href='".$a['href']."'>".$this->deactivateICON.$a[0]."</a>";
unset($links["deactivate"]);
return $links;
}
public function plugin_row_meta($links, $file)
{
if ($this->plugin_basename === $file) {
// unset($links[1]);
unset($links[2]);
$icon_attr = array(
'style' => array(
'font-size: larger;',
'line-height: 1rem;',
'display: inline;',
'vertical-align: text-top;',
),
);
foreach ($this->get_meta_links() as $id => $link) {
$title = (!empty($link['icon'])) ? self::do_icon($link['icon'], $icon_attr) . ' ' . esc_html($link['title']) : esc_html($link['title']);
$links[ $id ] = '<a href="' . esc_url($link['url']) . '" title="'.esc_attr($link['description']).'" target="'.(empty($link['target'])?"_blank":$link['target']).'">' . $title . '</a>';
}
$links[0] = $this->versionICON . $links[0];
$links[1] = $this->authorICON . $links[1];
$links["deactivate"] = $this->deactivateURI;
}
return $links;
}
public static function do_icon($icon, $attr = array(), $content = '')
{
$class = '';
if (false === strpos($icon, '/') && 0 !== strpos($icon, 'data:') && 0 !== strpos($icon, 'http')) {
// It's an icon class.
$class .= ' dashicons ' . $icon;
} else {
// It's a Base64 encoded string or file URL.
$class .= ' vaa-icon-image';
$attr = self::merge_attr($attr, array(
'style' => array( 'background-image: url("' . $icon . '") !important' ),
));
}
if (! empty($attr['class'])) {
$class .= ' ' . (string) $attr['class'];
}
$attr['class'] = $class;
$attr['aria-hidden'] = 'true';
$attr = self::parse_to_html_attr($attr);
return '<span ' . $attr . '>' . $content . '</span>';
}
public static function parse_to_html_attr($array)
{
$str = '';
if (is_array($array) && ! empty($array)) {
foreach ($array as $attr => $value) {
if (is_array($value)) {
$value = implode(' ', $value);
}
$array[ $attr ] = esc_attr($attr) . '="' . esc_attr($value) . '"';
}
$str = implode(' ', $array);
}
return $str;
}
public function get_meta_links()
{
if (!empty($this->meta_links)) {return $this->meta_links;}
$this->meta_links = array(
'support' => array(
'title' => __('Support', $this->td),
'description' => __('Support', $this->td),
'icon' => 'dashicons-admin-site',
'target' => '_blank',
'url' => "mailto:support@pepro.dev?subject={$this->title}",
),
);
return $this->meta_links;
}
public function get_manage_links()
{
if (!empty($this->manage_links)) {return $this->manage_links; }
$this->manage_links = array(
$this->settingURL . __("Settings", $this->td) => "$this->url",
);
return $this->manage_links;
}
public static function activation_hook()
{
}
public static function deactivation_hook()
{
}
public static function uninstall_hook()
{
$ppa = new PeproBranchesMap;
if (get_option("{$ppa->db_slug}-clearunistall", "no") === "yes") {
$cf7Database_class_options = $ppa->get_setting_options();
foreach ($cf7Database_class_options as $options) {
$opparent = $options["name"];
foreach ($options["data"] as $optname => $optvalue) {
unregister_setting($opparent, $optname);
delete_option($optname);
}
}
}
}
public function plugins_loaded()
{
load_plugin_textdomain($this->td, false, dirname(plugin_basename(__FILE__))."/languages/");
}
public function get_setting_options()
{
return array(
array(
"name" => "{$this->db_slug}_general",
"data" => array(
"{$this->db_slug}-clearunistall" => "no",
"{$this->db_slug}-cleardbunistall" => "no",
"{$this->db_slug}-googlemapAPI" => "",
"{$this->db_slug}-openstreetAPI" => "",
"{$this->db_slug}-cedarmapsAPI" => "",
"{$this->db_slug}-template" => "content",
)
),
);
}
protected function add_mapify_cpt()
{
$labels = array(
'name' => _x( 'Branch', 'Post Type General Name', $this->td),
'singular_name' => _x( 'Branch', 'Post Type Singular Name', $this->td),
'menu_name' => __( 'Branches', $this->td),
'name_admin_bar' => __( 'Branch', $this->td),
'archives' => __( 'Branch Archives', $this->td),
'attributes' => __( 'Branch Attributes', $this->td),
'parent_item_colon' => __( 'Parent Branch:', $this->td),
'all_items' => __( 'All Branches', $this->td),
'add_new_item' => __( 'Add New Branch', $this->td),
'add_new' => __( 'Add New', $this->td),
'new_item' => __( 'New Branch', $this->td),
'edit_item' => __( 'Edit Branch', $this->td),