Plugin Directory

Changeset 1586685


Ignore:
Timestamp:
02/01/2017 06:05:36 PM (9 years ago)
Author:
ionutmorariu
Message:

CHG: double slt prefix to avoid collisions

Location:
scale-lite-tools/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • scale-lite-tools/trunk/assets/js/admin.sl-maps.js

    r1586656 r1586685  
    1616      }
    1717      function codeAddress(callback) {
    18         var address = document.getElementById('slt-gmap-center-map-location').value;
     18        var address = document.getElementById('slt_meta-center-map-location').value;
    1919        (function(){
    2020          geocoder.geocode( { 'address': address}, function(results, status) {
     
    2525                  position: results[0].geometry.location
    2626              });
    27               document.getElementById("slt-gmap-latitude").value = results[0].geometry.location.lng();
    28               document.getElementById("slt-gmap-longitude").value = results[0].geometry.location.lat();
     27              document.getElementById("slt_meta-latitude").value = results[0].geometry.location.lng();
     28              document.getElementById("slt_meta-longitude").value = results[0].geometry.location.lat();
    2929              callback(results[0].geometry.location,map);
    3030            } else {
  • scale-lite-tools/trunk/inc/sl-google-maps/class-slt-gmap-markers-meta-fields.php

    r1586608 r1586685  
    1414  private $fields = array(
    1515    array(
    16       'id' => 'slt-gmarker-location-address',
     16      'id' => 'slt_meta-location-address',
    1717      'label' => 'Location address',
    1818      'type' => 'textarea',
    1919    ),
    2020    array(
    21       'id' => 'slt-gmarker-title',
     21      'id' => 'slt_meta-title',
    2222      'label' => 'Info window title',
    2323      'type' => 'text',
    2424    ),
    2525    array(
    26       'id' => 'slt-gmarker-description',
     26      'id' => 'slt_meta-description',
    2727      'label' => 'Info window description',
    2828      'type' => 'textarea',
    2929    ),
    3030    array(
    31       'id' => 'slt-gmarker-icon',
     31      'id' => 'slt_meta-icon',
    3232      'label' => 'Icon',
    3333      'type' => 'url',
     
    6666   */
    6767  public function add_meta_box_callback( $post ) {
    68     wp_nonce_field( 'slt_gmap_options_data', 'slt_gmap_options_nonce' );
     68    wp_nonce_field( 'slt_gmarker_data', 'slt_gmarker_nonce' );
    6969    $this->generate_fields( $post );
    7070  }
     
    7777    foreach ( $this->fields as $field ) {
    7878      $label = '<label for="' . $field['id'] . '">' . $field['label'] . '</label>';
    79       $db_value = get_post_meta( $post->ID, 'slt_gmap_options_' . $field['id'], true );
     79      $db_value = get_post_meta( $post->ID, 'slt_gmarker_' . $field['id'], true );
    8080      switch ( $field['type'] ) {
    8181        case 'select':
     
    133133   */
    134134  public function save_post( $post_id ) {
    135     if ( ! isset( $_POST['slt_gmap_options_nonce'] ) )
     135    if ( ! isset( $_POST['slt_gmarker_nonce'] ) )
    136136      return $post_id;
    137137
    138     $nonce = $_POST['slt_gmap_options_nonce'];
    139     if ( !wp_verify_nonce( $nonce, 'slt_gmap_options_data' ) )
     138    $nonce = $_POST['slt_gmarker_nonce'];
     139    if ( !wp_verify_nonce( $nonce, 'slt_gmarker_data' ) )
    140140      return $post_id;
    141141
     
    153153            break;
    154154        }
    155         update_post_meta( $post_id, 'slt_gmap_options_' . $field['id'], $_POST[ $field['id'] ] );
     155        update_post_meta( $post_id, 'slt_gmarker_' . $field['id'], $_POST[ $field['id'] ] );
    156156      } else if ( $field['type'] === 'checkbox' ) {
    157         update_post_meta( $post_id, 'slt_gmap_options_' . $field['id'], '0' );
     157        update_post_meta( $post_id, 'slt_gmarker_' . $field['id'], '0' );
    158158      }
    159159    }
  • scale-lite-tools/trunk/inc/sl-google-maps/class-slt-gmap-meta-fields.php

    r1586656 r1586685  
    1414  private $fields = array(
    1515    array(
    16       'id' => 'slt-gmap-center-map-location',
     16      'id' => 'slt_meta-center-map-location',
    1717      'label' => 'Center map location',
    1818      'type' => 'textarea',
    1919    ),
    2020    array(
    21       'id' => 'slt-gmap-latitude',
     21      'id' => 'slt_meta-latitude',
    2222      'label' => 'Latitude',
    2323      'type' => 'text',
    2424    ),
    2525    array(
    26       'id' => 'slt-gmap-longitude',
     26      'id' => 'slt_meta-longitude',
    2727      'label' => 'Longitude',
    2828      'type' => 'text',
    2929    ),
    3030    array(
    31       'id' => 'slt-gmap-markers',
     31      'id' => 'slt_meta-markers',
    3232      'label' => 'Add markers to map',
    3333      'placeholder' => 'id1,id2,id3',
     
    3535    ),
    3636    array(
    37       'id' => 'slt-gmap-html-id',
     37      'id' => 'slt_meta-html-id',
    3838      'label' => 'HTML ID',
    3939      'type' => 'text',
    4040    ),
    4141    array(
    42       'id' => 'slt-gmap-width',
     42      'id' => 'slt_meta-width',
    4343      'label' => 'Width of map',
    4444      'type' => 'number',
    4545    ),
    4646    array(
    47       'id' => 'slt-gmap-height',
     47      'id' => 'slt_meta-height',
    4848      'label' => 'Height of map',
    4949      'type' => 'number',
    5050    ),
    5151    array(
    52       'id' => 'slt-gmap-map-type',
     52      'id' => 'slt_meta-map-type',
    5353      'label' => 'Map type',
    5454      'type' => 'select',
     
    6161    ),
    6262    array(
    63       'id' => 'slt-gmap-zoom',
     63      'id' => 'slt_meta-zoom',
    6464      'label' => 'Zoom',
    6565      'type' => 'number',
    6666    ),
    6767    array(
    68       'id' => 'slt-gmap-show-marker-info-box',
     68      'id' => 'slt_meta-show-marker-info-box',
    6969      'label' => 'Show marker info box',
    7070      'type' => 'checkbox',
    71     ),
     71    )
    7272  );
    7373
     
    104104  public function add_meta_box_callback( $post ) {
    105105    echo '<div id="preview_map_container" class="preview_map_container"></div>';
    106     wp_nonce_field( 'slt_gmap_options_data', 'slt_gmap_options_nonce' );
     106    wp_nonce_field( 'slt_gmap_data', 'slt_gmap_nonce' );
    107107    $this->generate_fields( $post );
    108108  }
     
    115115    foreach ( $this->fields as $field ) {
    116116      $label = '<label for="' . $field['id'] . '">' . $field['label'] . '</label>';
    117       $db_value = get_post_meta( $post->ID, 'slt_gmap_options_' . $field['id'], true );
     117      $db_value = get_post_meta( $post->ID, 'slt_gmap_' . $field['id'], true );
    118118      switch ( $field['type'] ) {
    119119        case 'select':
     
    136136        case 'textarea':
    137137          switch ( $field['id'] ) {
    138             case 'slt-gmap-center-map-location':
     138            case 'slt_meta-center-map-location':
    139139              if(empty($db_value)) {
    140140                $db_value = '350 5th Ave, New York, NY 10118, USA';
     
    156156              );
    157157              break;
    158             case 'map-markers':
     158            case 'slt_slt_meta-markers':
    159159              ($field['placeholder']) ? $field['placeholder']:'';
    160160              $input = sprintf(
     
    186186        default:
    187187          switch ( $field['id'] ) {
    188             case 'slt-gmap-html-id':
     188            case 'slt_slt_meta-html-id':
    189189              $input = sprintf(
    190190                '<input %s id="%s" name="%s" type="%s" value="%s"><p class="description">Unique HTML ID for the map.</p>',
     
    196196              );
    197197              break;
    198             case 'slt-gmap-width':
     198            case 'slt_slt_meta-width':
    199199              $input = sprintf(
    200200                '<input %s id="%s" name="%s" type="%s" value="%s"><p class="description">Width of the map in pixels. e.g. 350. If empty, it defaults to 100%%.</p>',
     
    206206              );
    207207              break;
    208             case 'slt-gmap-height':
     208            case 'slt_slt_meta-height':
    209209              $input = sprintf(
    210210                '<input %s id="%s" name="%s" type="%s" value="%s"><p class="description">Height of the map in pixels. e.g. 520</p>',
     
    216216              );
    217217              break;
    218             case 'slt-gmap-map-latitude':
     218            case 'slt_slt_meta-latitude':
    219219              $input = sprintf(
    220220                '<input %s id="%s" name="%s" type="%s" value="%s"><p class="description">Latitude coordinate of where your map will be centered</p>',
     
    226226              );
    227227              break;
    228             case 'slt-gmap-map-longitude':
     228            case 'slt_slt_meta-longitude':
    229229              $input = sprintf(
    230230                '<input %s id="%s" name="%s" type="%s" value="%s"><p class="description">Longitude coordinate of where your map will be centered</p>',
     
    266266   */
    267267  public function save_post( $post_id ) {
    268     if ( ! isset( $_POST['slt_gmap_options_nonce'] ) )
     268    if ( ! isset( $_POST['slt_gmap_nonce'] ) )
    269269      return $post_id;
    270270
    271     $nonce = $_POST['slt_gmap_options_nonce'];
    272     if ( !wp_verify_nonce( $nonce, 'slt_gmap_options_data' ) )
     271    $nonce = $_POST['slt_gmap_nonce'];
     272    if ( !wp_verify_nonce( $nonce, 'slt_gmap_data' ) )
    273273      return $post_id;
    274274
     
    286286            break;
    287287        }
    288         update_post_meta( $post_id, 'slt_gmap_options_' . $field['id'], $_POST[ $field['id'] ] );
     288        update_post_meta( $post_id, 'slt_gmap_' . $field['id'], $_POST[ $field['id'] ] );
    289289      } else if ( $field['type'] === 'checkbox' ) {
    290         update_post_meta( $post_id, 'slt_gmap_options_' . $field['id'], '0' );
     290        update_post_meta( $post_id, 'slt_gmap_' . $field['id'], '0' );
    291291      }
    292292    }
  • scale-lite-tools/trunk/inc/sl-google-maps/render-cpt.php

    r1586656 r1586685  
    109109  if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
    110110    // post meta
    111     $map_latitude = get_post_meta(get_the_ID(),'slt_gmap_options_slt-gmap-latitude',true);
    112     $map_longitude = get_post_meta(get_the_ID(),'slt_gmap_options_slt-gmap-longitude',true);
    113     $map_markers = explode(',', get_post_meta(get_the_ID(),'slt_gmap_options_slt-gmap-markers',true));
    114     $html_id = get_post_meta(get_the_ID(),'slt_gmap_options_slt-gmap-html-id',true);
    115     $width = get_post_meta(get_the_ID(),'slt_gmap_options_slt-gmap-width',true);
    116     $height = get_post_meta(get_the_ID(),'slt_gmap_options_slt-gmap-height',true);
    117     $map_type = get_post_meta(get_the_ID(),'slt_gmap_options_slt-gmap-map-type',true);
    118     $zoom = get_post_meta(get_the_ID(),'slt_gmap_options_slt-gmap-zoom',true);
    119     $show_info_titles = get_post_meta(get_the_ID(),'slt_gmap_options_slt-gmap-show-marker-info-box',true);
     111    $map_latitude = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-latitude',true);
     112    $map_longitude = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-longitude',true);
     113    $map_markers = explode(',', get_post_meta(get_the_ID(),'slt_gmap_slt_meta-markers',true));
     114    $html_id = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-html-id',true);
     115    $width = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-width',true);
     116    $height = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-height',true);
     117    $map_type = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-map-type',true);
     118    $zoom = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-zoom',true);
     119    $show_info_titles = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-show-marker-info-box',true);
    120120
    121121    global $mapsArray;
Note: See TracChangeset for help on using the changeset viewer.