Plugin Directory

Changeset 1666057


Ignore:
Timestamp:
05/28/2017 06:25:58 PM (9 years ago)
Author:
robertreborobert
Message:

test

Location:
witty-map/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • witty-map/trunk/admin/class-wittymap-backend.php

    r1666055 r1666057  
    55 *
    66 * @class       witty_map_backend
    7  * @version     1
     7 * @version     1.0.1
    88 * @package     wittyMap/admin
    99 * @author      Robert John Concepcion
     
    6363        );
    6464
     65        add_meta_box(   'transaction_metabox',              //metabox slug
     66                        'Set as Featured Post in Home',     //metabox title
     67                        'set_as_featured',                  //callback function
     68                        'witty-map-settings',                   //custom post type
     69                        'side',                             //position
     70                        'default');     
     71
    6572        /**
    6673         * Will not continue if admin menu was not successfully create
     
    7481    public function register_options() {
    7582
    76         foreach (self::_opt_list() as $opt_key => $opt_arry):
     83        foreach (self::_opt_keys() as $opt_key):
    7784            register_setting( 'witty-map-settings-group', $opt_key );
    7885        endforeach;
     
    8794        do_settings_sections( 'witty-map-settings-group' );
    8895
    89         $key_value = self::_opt_list();
    90         foreach ($key_value as $opt_key => $opt_arry):
    91             $key_value[ $opt_key ]['value'] = esc_attr( get_option( $opt_key ) );
     96        $opt_keys = self::_opt_keys();
     97        $opt_keys_values = [];
     98        foreach ($opt_keys as $opt_key):
     99            $opt_keys_values[$opt_key] = esc_attr( get_option( $opt_key ) );
    92100        endforeach;
    93         $support->witty_template( 'admin', 'witty-map-option-page', [ 'opt_arr' => $key_value ] );
     101
     102
     103        $support->witty_template( 'admin', 'witty-map-option-page', $opt_keys_values );
    94104    }
    95105
    96     /**
    97      * Option page field declaration
    98      */
    99     private function _opt_list(){       
     106    private function _opt_keys(){
    100107
    101108        return [
    102             'googlemapapi_key'          => [
    103                 'template_name' =>  "witty-field-common",
    104                 'type'          =>  "text",
    105                 'label'         =>  "Google map api key",
    106                 'desc'          =>  "Witty map plugin required <a href='https://developers.google.com/maps/documentation/javascript/get-api-key' target='_blank'>google map api key</a>.",
    107                 'attrb'         =>  [
    108                     'id'    =>  'googlemapapi-key',
    109                     'class' =>  'regular-text'
    110                 ],
    111             ],
    112             'wittymap_loc'              => [
    113                 'template_name' =>  "witty-field-common",
    114                 'type'          =>  "text",
    115                 'label'         =>  "Map Center",
    116                 'desc'          =>  "Set Center of the map. Must be a valid longitude and latitude from google map, format : <b>longitude, latitude</b>",
    117                 'attrb' =>  [
    118                     'id'    =>  'wittymap-center',
    119                     'class' =>  'regular-text'
    120                 ],               
    121             ],
    122             'wittymap_def_zoom'         => [
    123                 'template_name' =>  "witty-field-common",
    124                 'type'          =>  "number",
    125                 'label'         =>  "Default Map Zoom",
    126                 'desc'          =>  "Zoom level of the map (the bigger the number the zoom it be). <b>default value : 5, max value : 18</b>",
    127                 'attrb' =>  [
    128                     'id'    =>  'wittymap-center',
    129                     'class' =>  'regular-text'
    130                 ],                     
    131             ],
    132             'wittymap_marker'           => [
    133                 'template_name' =>  "witty-field-imgbox",
    134                 'type'          =>  "",
    135                 'label'         =>  "Map Pointer",
    136                 'desc'          =>  "Use image as marker of the map.",
    137             ],
    138             'wittymap_draggable'        => [
    139                 'template_name' =>  "witty-field-checkbox",
    140                 'type'          =>  "",     
    141                 'label'         =>  "Draggable",
    142                 'desc'          =>  "Map can be drag to check other parts of the map.",
    143             ],
    144             'wittymap_doubleClickZoom'  => [
    145                 'template_name' =>  "witty-field-checkbox",
    146                 'type'          =>  "",
    147                 'label'         =>  "Double click will zoom",
    148                 'desc'          =>  "Enables/disables zoom and center on double click.",
    149             ],
    150             'wittymap_zoomControl'      => [
    151                 'template_name' =>  "witty-field-checkbox",
    152                 'type'          =>  "",
    153                 'label'         =>  "Zoom Control",
    154                 'desc'          =>  "Located at right bottom of the map.",
    155             ],
    156             'wittymap_scrollWheel'      => [
    157                 'template_name' =>  "witty-field-checkbox",
    158                 'type'          =>  "",
    159                 'label'         =>  "Scroll Wheel",
    160                 'desc'          =>  "If checked, disables scrollwheel zooming on the map.",
    161             ],
    162             'wittymap_streetView'       => [
    163                 'template_name' =>  "witty-field-checkbox",
    164                 'type'          =>  "",
    165                 'label'         =>  "Street View Control",
    166                 'desc'          =>  "Located at right bottom of the map",
    167             ],
     109            'googlemapapi_key',
     110            'wittymap_loc',
     111            'wittymap_def_zoom',
     112            'wittymap_marker',
     113            'wittymap_draggable',
     114            'wittymap_doubleClickZoom',
     115            'wittymap_zoomControl',
     116            'wittymap_scrollWheel',
     117            'wittymap_streetView',
     118            'wittymap_markerLabel',
     119            'wittymap_labelX',
     120            'wittymap_labelY',
    168121        ];
    169122    }
  • witty-map/trunk/admin/css/witty-map-admin.css

    r1666055 r1666057  
    2525    box-shadow: 0px 0px 0px 0px #000;
    2626}
     27
     28/**
     29 * Witty Map Tab
     30 */
     31#witty-map-tabs {
     32    border-bottom: 2px solid #0073aa;
     33}
     34#witty-map-tabs li {
     35    list-style: none;
     36    display: inline-block;
     37    margin: 0;
     38    margin-right: 10px;
     39}
     40#witty-map-tabs li a {
     41    text-decoration: none;
     42    font-size: 14px;
     43    text-transform: uppercase;
     44    color: #0073aa;
     45    padding: 9px 17px;
     46    display: block;
     47    outline: none !important;
     48    background: rgb(183, 211, 224);
     49}
     50#witty-map-tabs li a:focus,
     51#witty-map-tabs li a.active {
     52    color: #FFF;
     53    background:  #0073aa;
     54    -webkit-box-shadow: none;
     55    box-shadow: none;
     56}
     57
     58.witty-tabs-cont {
     59    display: none;
     60}
     61.witty-tabs-cont.active {
     62    display: block;
     63}
  • witty-map/trunk/admin/js/witty-map-settings.js

    r1666055 r1666057  
    8686    wittyAdmin.init();
    8787
     88    var wittyAdmin = {
     89
     90        init : function(){
     91
     92            this._registerEvents();
     93
     94        },
     95
     96
     97        tabSelector : function( e ){
     98
     99            e.preventDefault();
     100
     101            var ths = $( this );
     102
     103            var wittyTabsVal = $( this ).attr( 'href' );
     104
     105            $( ".witty-tabs-cont" ).hide();
     106
     107            $( "#witty-map-tabs a" ).not( this ).removeClass( 'active' );
     108           
     109            $( wittyTabsVal ).show( 0, function(){
     110                ths.addClass( "active" );
     111            });
     112
     113        },
     114
     115        _registerEvents : function(){
     116
     117            $( document ).on( 'click', '#witty-map-tabs a', this.tabSelector );
     118
     119
     120        }
     121
     122
     123    }
     124
     125    wittyAdmin.init();
     126
     127
    88128})(jQuery);     
  • witty-map/trunk/admin/partials/witty-map-option-page.php

    r1666055 r1666057  
    33 * Main View of witty map settings
    44 *
    5  * @version 1
     5 * @version 1.0.1
    66 * @author Robert John Conepcion
    77 */
    88 $support = new witty_support;
    99?>
     10<h1>Witty Map</h1>
     11<p class="description">Use <code>[witty-map]</code> in content area or <code>echo do_shortcode("[witty-map]");</code> in your code.</p><br>
     12
     13
    1014<div class="wrap">
    11     <h1>Witty Map Settings</h1>
     15    <ul id="witty-map-tabs">
     16        <li><a href="#witty-settings" class="active">Settings</a></li>
     17        <li><a href="#witty-marker">Marker</a></li>
     18        <li><a href="#witty-ui">Map Interface</a></li>
     19             
     20    </ul>   
     21</div>
     22
     23
     24<div class="wrap">
     25   
    1226    <form method="post" action="options.php">
    1327        <?php
     
    1933        do_action( "witty_map_after_form" );
    2034        ?>
    21         <table class="form-table">
    22             <tr valign="top">
    23                 <th scope="row">
    24                     <label>Short code</label>
    25                 </th>
    26                 <td>
    27                     <code>[witty-map]</code>
    28                      <p class="description">Use <code>[witty-map]</code> in content area and <code>echo do_shortcode("[witty-map]");</code> in your code.</p>
    29                 </td>
    30 
    31             </tr>       
     35     
    3236            <?php
    33                 foreach ($opt_arr as $key => $opt_val):
    34                     $support->witty_template( 'admin', 'witty-map-option-fields', [
    35                         'name'      =>  $key,           
    36                         'type'      =>  $opt_val['type'],
    37                         'value'     =>  $opt_val['value'],
    38                         'attrb'     =>  $opt_val['attrb'],
    39                         'template'  =>  $opt_val['template_name'],
    40                         'label'     =>  _x( $opt_val['label'] ,'witty_map'),
    41                         'desc'      =>  $opt_val['desc']             
    42                     ] );
    43                 endforeach;
     37                // foreach ($opt_arr as $key => $opt_val):
     38                //     $support->witty_template( 'admin', 'witty-map-option-fields', [
     39                //         'name'      =>  $key,           
     40                //         'type'      =>  $opt_val['type'],
     41                //         'value'     =>  $opt_val['value'],
     42                //         'attrb'     =>  $opt_val['attrb'],
     43                //         'template'  =>  $opt_val['template_name'],
     44                //         'label'     =>  _x( $opt_val['label'] ,'witty_map'),
     45                //         'desc'      =>  $opt_val['desc']             
     46                //     ] );
     47                // endforeach;
    4448            ?>
    45         </table>
     49       
     50        <div id="witty-settings" class="witty-tabs-cont active">
     51          <table class="form-table">
     52                <tr valign="top">
     53                    <th scope="row"> <label>Google map api key</label></th>
     54                    <td>
     55                        <?php
     56                            $support->witty_template( 'inc', 'witty-field-common', [
     57                                'type'  =>  'text',
     58                                'name'  =>  'googlemapapi_key',
     59                                'value' =>  $googlemapapi_key,
     60                                'attrb' =>  [
     61                                    'id'    =>  'googlemapapi-key',
     62                                    'class' =>  'regular-text'
     63                                ]
     64                            ] );
     65                        ?>
     66                        <p class="description">Witty map plugin required <a href='https://developers.google.com/maps/documentation/javascript/get-api-key' target='_blank'>google map api key</a>.</p>
     67                    </td>
     68                </tr>
     69
     70                <tr valign="top">
     71                    <th scope="row"> <label>Map Center</label></th>
     72                    <td>
     73                        <?php
     74                            $support->witty_template( 'inc', 'witty-field-common', [
     75                                'type'  =>  'text',
     76                                'name'  =>  'wittymap_loc',
     77                                'value' =>  $wittymap_loc,
     78                                'attrb' =>  [
     79                                    'id'    =>  'wittymap-center',
     80                                    'class' =>  'regular-text'
     81                                ]
     82                            ] );
     83                        ?>
     84                        <p class="description">Set Center of the map. Must be a valid longitude and latitude from google map, format : <b>longitude, latitude</b></p>
     85                    </td>
     86                </tr>
     87
     88                <tr valign="top">
     89                    <th scope="row"> <label>Default Map Zoom</label></th>
     90                    <td>
     91                        <?php
     92                            $support->witty_template( 'inc', 'witty-field-common', [
     93                                'type'  =>  'number',
     94                                'name'  =>  'wittymap_def_zoom',
     95                                'value' =>  $wittymap_def_zoom,
     96                                'attrb' =>  [
     97                                    'id'    =>  'wittymap-center',
     98                                    'class' =>  'regular-text'
     99                                ]
     100                            ] );
     101                        ?>
     102                        <p class="description">Zoom level of the map (the bigger the number the zoom it be). <b>default value : 5, max value : 18</b></p>
     103                    </td>
     104                </tr>
     105            </table> <!-- .form-table -->         
     106        </div> <!-- #witty-settings -->
     107 
     108
     109        <div id="witty-marker" class="witty-tabs-cont">
     110            <table class="form-table">
     111                <tr valign="top">
     112                    <th scope="row"> <label>Map Marker</label></th>
     113                    <td>
     114                        <?php
     115                            $support->witty_template( 'inc', 'witty-field-imgbox', [
     116                                'name'  =>  'wittymap_marker',
     117                                'value' =>  $wittymap_marker,
     118                            ] );
     119                        ?>
     120                        <p class="description">Use image as marker of the map.</p>
     121                    </td>
     122                </tr>
     123
     124                <tr valign="top">
     125                    <th scope="row"> <label>Location title</label></th>
     126                    <td>
     127                        <?php
     128                            $support->witty_template( 'inc', 'witty-field-common', [
     129                                'type'  =>  'text',
     130                                'name'  =>  'wittymap_markerLabel',
     131                                'value' =>  $wittymap_markerLabel,
     132                                'attrb' =>  [
     133                                    'id'    =>  'wittymap-label',
     134                                    'class' =>  'regular-text'
     135                                ]
     136                            ] );
     137                        ?>
     138                        <p class="description">Marker Optional Label</p>
     139                    </td>
     140                </tr>
     141
     142                <tr valign="top">
     143                    <th scope="row"> <label>Label X Axis</label></th>
     144                    <td>
     145                        <?php
     146                            $support->witty_template( 'inc', 'witty-field-common', [
     147                                'type'  =>  'number',
     148                                'name'  =>  'wittymap_labelX',
     149                                'value' =>  $wittymap_labelX
     150                            ] );
     151                        ?>
     152                        <span class="description">Label X Axis relative to the position of the Marker</span>
     153                    </td>
     154                </tr>
     155
     156                <tr valign="top">
     157                    <th scope="row"> <label>Label Y Axis</label></th>
     158                    <td>
     159                        <?php
     160                            $support->witty_template( 'inc', 'witty-field-common', [
     161                                'type'  =>  'number',
     162                                'name'  =>  'wittymap_labelY',
     163                                'value' =>  $wittymap_labelY
     164                            ] );
     165                        ?>
     166                        <span class="description">Label Y Axis relative to the position of the Marker</span>
     167                    </td>
     168                </tr>       
     169            </table>
     170        </div>
     171
     172        <div id="witty-ui" class="witty-tabs-cont">
     173            <table class="form-table">
     174                <tr valign="top">
     175                    <th scope="row"> <label>Draggable</label></th>
     176                    <td>
     177                        <?php
     178                            $support->witty_template( 'inc', 'witty-field-checkbox', [
     179                                'name'  =>  'wittymap_draggable',
     180                                'value' =>  $wittymap_draggable,
     181                            ] );
     182                        ?>
     183                        <span class="description">Map can be drag to check other parts of the map.</span>
     184                    </td>
     185                </tr>
     186
     187                <tr valign="top">
     188                    <th scope="row"> <label>Double click will zoom</label></th>
     189                    <td>
     190                        <?php
     191                            $support->witty_template( 'inc', 'witty-field-checkbox', [
     192                                'name'  =>  'wittymap_doubleClickZoom',
     193                                'value' =>  $wittymap_doubleClickZoom,
     194                            ] );
     195                        ?>
     196                        <span class="description">Enables/disables zoom and center on double click.</span>
     197                    </td>
     198                </tr>
     199
     200                <tr valign="top">
     201                    <th scope="row"> <label>Zoom Control</label></th>
     202                    <td>
     203                        <?php
     204                            $support->witty_template( 'inc', 'witty-field-checkbox', [
     205                                'name'  =>  'wittymap_zoomControl',
     206                                'value' =>  $wittymap_zoomControl,
     207                            ] );
     208                        ?>
     209                        <span class="description">Enables/disables zoom control.</span>
     210                    </td>
     211                </tr>
     212
     213                <tr valign="top">
     214                    <th scope="row"> <label>Scroll Wheel</label></th>
     215                    <td>
     216                        <?php
     217                            $support->witty_template( 'inc', 'witty-field-checkbox', [
     218                                'name'  =>  'wittymap_scrollWheel',
     219                                'value' =>  $wittymap_scrollWheel,
     220                            ] );
     221                        ?>
     222                        <span class="description">If checked, disables scrollwheel zooming on the map.</span>
     223                    </td>
     224                </tr>
     225
     226                <tr valign="top">
     227                    <th scope="row"> <label>Street View Control</label></th>
     228                    <td>
     229                        <?php
     230                            $support->witty_template( 'inc', 'witty-field-checkbox', [
     231                                'name'  =>  'wittymap_streetView',
     232                                'value' =>  $wittymap_streetView,
     233                            ] );
     234                        ?>
     235                        <span class="description">Located at right bottom of the map.</span>
     236                    </td>
     237                </tr>
     238
     239            </table>           
     240        </div>
     241
     242
    46243        <?php submit_button(); ?>
    47244    </form>
  • witty-map/trunk/public/class-wittymap-public.php

    r1666055 r1666057  
    2929    }
    3030
    31     /**
     31    /**markerwithlabel.js
    3232     * Enqueue files
    3333     */
     
    3636        wp_enqueue_style(   'witty-map', WITTY_DIR_URL . '/public/css/witty-map-base.css' );
    3737        wp_enqueue_script(  'googlemap-api', 'https://maps.googleapis.com/maps/api/js?key=' . $this->gmap_api, [], '', true );
     38        wp_enqueue_script(  'markerwithlabel', WITTY_DIR_URL . '/public/js/markerwithlabel.js', [], '', true );
    3839        wp_enqueue_script(  'witty-map', WITTY_DIR_URL . '/public/js/googlemap.js', [], '', true );
    3940        wp_localize_script( 'witty-map', 'wm', [
     
    4647            'wittyMapScrollWheel'=> get_option( 'wittymap_scrollWheel' ),
    4748            'wittyMapStreetView'=> get_option( 'wittymap_streetView' ),
     49            'wittyMapLabel'=> get_option( 'wittymap_markerLabel' ),
     50            'wittyMapLabelX'=> get_option( 'wittymap_labelX' ),
     51            'wittyMapLabelY'=> get_option( 'wittymap_labelY' ),
    4852        ] );
    4953    }
  • witty-map/trunk/public/css/witty-map-base.css

    r1666055 r1666057  
    1010    background-color: #eaeaea;
    1111}
     12#witty-map-wrap .witty-label {
     13    color: #75352d;
     14    font: 600 14px arial;
     15    text-align: center;
     16    width: 160px;
     17    background-color: rgba(234, 234, 234, 0.7);
     18    padding: 2px 0px;
     19    line-height: 1;
     20    border-radius: 4px;
     21}
  • witty-map/trunk/public/js/googlemap.js

    r1666055 r1666057  
    44 * Renders map in the front end.
    55 *
    6  * @version 1
     6 * @version 1.01
    77 * @author Robert John conecpcion
    88 */
     
    1414
    1515    var marker;
     16
     17    var labelX = parseInt(wm.wittyMapLabelX);
     18
     19    var labelY = parseInt(wm.wittyMapLabelY);
     20
     21    var mapLabel = wm.wittyMapLabel ? wm.wittyMapLabel : false;
    1622
    1723    var googlemap = {
     
    2935
    3036            this.plotMarker( location );
    31 
    3237        },
    3338
     
    3540         * Marker of witty map
    3641         */
    37         plotMarker : function( latlng ){
     42        plotMarker : function(latlng){
    3843
    39             marker = new google.maps.Marker({
     44            var args = {
    4045                position: latlng,
    4146                map: map,
     47                icon : wm.wittyMapMarker,
    4248                animation: google.maps.Animation.DROP,
    43                 icon : wm.wittyMapMarker,
    44             });
     49            }
    4550
     51            if(mapLabel){
     52                args['labelContent']    =   mapLabel;
     53                args['labelAnchor']     =   new google.maps.Point( labelX, labelY );
     54                args['labelClass']      =   "witty-label";
     55            }
     56
     57            marker = new MarkerWithLabel( args );
    4658        },
    4759
  • witty-map/trunk/readme.txt

    r1666055 r1666057  
    55Requires at least: 4
    66Tested up to: 4.7.4
    7 Stable tag: 0.0.2
     7Stable tag: 1.0.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1111Witty Map, add google map in content area or in template file (using shortcode). Most important you can customize its view.
    1212
    13 == Witty Map has following features ==
     13== Description ==
    1414
    15 *   Set center of the map.
    16 *   Set Zoom level.
    17 *   Modify default map pointer/marker.
    18 *   Enable / Disble dragging.
    19 *   Enable / Disable zoom and center on double click.
    20 *   Enable / Disable zoom control.
    21 *   Enable / Disable Scroll wheel.
    22 *   Enable / Disable street view control.
     15Witty map can :
     16* Set Marker Label.
     17* Marker Label location ( x and y axis )
     18* Set center of the map.
     19* Set Zoom level.
     20* Modify default map pointer/marker.
     21* Enable / Disble dragging.
     22* Enable / Disable zoom and center on double click.
     23* Enable / Disable zoom control.
     24* Enable / Disable Scroll wheel.
     25* Enable / Disable street view control.
     26
     27
     28== Installation ==
     29
     30Download the witty map then paste it the plugin directory. or download it via plugin menu of admin's backend.
    2331
    2432== Frequently Asked Questions ==
     33
     34= Can I change the style of marker label? =
     35Yes, using CSS, just target this class .witty-label.
     36
     37Example : #witty-map-wrap .witty-label { background-color : #000; color : #FFF; }
    2538
    2639= How to show witty map in content area? =
     
    3750
    3851add( 'witty_map_after', [your function] );
     52
     53
     54== Changelog ==
     55
     56= 1.0.1 =
     57* Improve admin interface
     58* Map Marker Label
     59* Marker Label location ( x and y axis )
     60* Fix errors ( undefined values ) when wp_debug is on
     61
     62= 0.0.2 =
     63* Set center of the map.
     64* Set Zoom level.
     65* Modify default map pointer/marker.
     66* Enable / Disble dragging.
     67* Enable / Disable zoom and center on double click.
     68* Enable / Disable zoom control.
     69* Enable / Disable Scroll wheel.
     70* Enable / Disable street view control.
     71
     72= 0.0.1 =
     73* initilize
     74
     75== Upgrade Notice ==
     76
     77= 1.0.1 =
     78Fix some error, improve admin interface and enabled map marker label feature.
  • witty-map/trunk/witty-map.php

    r1666055 r1666057  
    44Plugin URI: 
    55Description: Witty Map, add google map in content                                                                   area or in template file (using shortcode). Most important you can                                                              customize its view.
    6 Version:     0.0.2
     6Version:     1.0.1
    77Author:      Robert John Concepcion
    88Author URI:  https://github.com/robert-john-concepcion
     
    5959            update_option( 'wittymap_scrollWheel', 1 );
    6060            update_option( 'wittymap_streetView', 1 );
     61            update_option( 'wittymap_labelX', 0 );
     62            update_option( 'wittymap_labelY', 0 );         
    6163           
    6264        }
Note: See TracChangeset for help on using the changeset viewer.