Changeset 1376138
- Timestamp:
- 03/22/2016 09:24:26 AM (10 years ago)
- Location:
- location-specific-menu-items-by-country
- Files:
-
- 2 edited
-
tags/1.0.3/CSMI.php (modified) (10 diffs)
-
trunk/CSMI.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
location-specific-menu-items-by-country/tags/1.0.3/CSMI.php
r1371991 r1376138 6 6 Author: Ryan Stutzman 7 7 Version: 1.0.3 8 Author URI: http://stutzman. asia/8 Author URI: http://stutzman.tech/ 9 9 */ 10 10 … … 41 41 ?> 42 42 <script type="text/javascript"> 43 jQuery(document).ready(function($) {43 jQuery(document).ready(function($) { 44 44 $("#download").click( 45 45 function () { … … 47 47 } 48 48 ); 49 });49 }); 50 50 </script> 51 51 <?php echo … … 55 55 <input type="submit" id="ignore" name="ignore" value="ignore" style="border: 0; background-color: transparent; color: grey; font-size: x-small; vertical-align: bottom; text-align: right;"/> 56 56 </p></div>'; 57 if ($_GET) {57 if ($_GET) { 58 58 if ( isset( $_GET[ 'download' ] ) ) { 59 59 $newfilev4 = file_get_contents( "https://sourceforge.net/projects/geoipupdate/files/GeoIPv4.dat/download", 0, $ctx ); … … 125 125 126 126 add_action( 'init', 'csmi_start_session' ); 127 function csmi_start_session( ) {128 if ( !session_id() ) {129 session_start( );127 function csmi_start_session() { 128 if ( !session_id() ) { 129 session_start(); 130 130 } 131 131 } … … 139 139 140 140 function __construct() { 141 if ( is_admin() ) {141 if ( is_admin() ) { 142 142 add_filter( 'wp_edit_nav_menu_walker', array( $this, 'csmi_edit_nav_menu_walker' ) ); 143 143 add_filter( 'wp_nav_menu_item_custom_fields', array( $this, 'csmi_settings' ), 12, 2 ); … … 176 176 <?php echo 'Set Visibility' ?> 177 177 <script type="text/javascript"> 178 jQuery(document).ready(function($) {178 jQuery(document).ready(function($) { 179 179 $(".chzn-select").chosen(); 180 180 }); … … 183 183 <?php 184 184 $vals = get_post_meta( $item_id, 'locations', true ); 185 foreach( $countries as $key => $value) {185 foreach( $countries as $key => $value ) { 186 186 ?> 187 187 <option value="<?php echo $key;?>"<?php echo is_array( $vals ) && in_array( $key, $vals ) ? "selected='selected'" : ''; ?>> <?php echo $value;?> </option> … … 238 238 /* Get user's country code from his or her IP address. */ 239 239 function csmi_get_country() { 240 if ( isset( $_SESSION[ 'user_country' ] ) && !current_user_can( 'manage_options' ) ) {241 $user_country = $_SESSION[ 'user_country' ];240 if ( isset( $_SESSION[ 'user_country' ] ) && !current_user_can( 'manage_options' ) ) { 241 $user_country = $_SESSION[ 'user_country' ]; 242 242 } else { 243 243 $upload_dir = wp_upload_dir(); … … 280 280 } 281 281 } else { 282 $user_country = "Can't locate IP: " . $ip_address; 282 $user_country = "Can't locate IP: " . $ip_address; 283 283 } 284 284 } -
location-specific-menu-items-by-country/trunk/CSMI.php
r1371988 r1376138 6 6 Author: Ryan Stutzman 7 7 Version: 1.0.3 8 Author URI: http://stutzman. asia/8 Author URI: http://stutzman.tech/ 9 9 */ 10 10 … … 41 41 ?> 42 42 <script type="text/javascript"> 43 jQuery(document).ready(function($) {43 jQuery(document).ready(function($) { 44 44 $("#download").click( 45 45 function () { … … 47 47 } 48 48 ); 49 });49 }); 50 50 </script> 51 51 <?php echo … … 55 55 <input type="submit" id="ignore" name="ignore" value="ignore" style="border: 0; background-color: transparent; color: grey; font-size: x-small; vertical-align: bottom; text-align: right;"/> 56 56 </p></div>'; 57 if ($_GET) {57 if ($_GET) { 58 58 if ( isset( $_GET[ 'download' ] ) ) { 59 59 $newfilev4 = file_get_contents( "https://sourceforge.net/projects/geoipupdate/files/GeoIPv4.dat/download", 0, $ctx ); … … 125 125 126 126 add_action( 'init', 'csmi_start_session' ); 127 function csmi_start_session( ) {128 if ( !session_id() ) {129 session_start( );127 function csmi_start_session() { 128 if ( !session_id() ) { 129 session_start(); 130 130 } 131 131 } … … 139 139 140 140 function __construct() { 141 if ( is_admin() ) {141 if ( is_admin() ) { 142 142 add_filter( 'wp_edit_nav_menu_walker', array( $this, 'csmi_edit_nav_menu_walker' ) ); 143 143 add_filter( 'wp_nav_menu_item_custom_fields', array( $this, 'csmi_settings' ), 12, 2 ); … … 176 176 <?php echo 'Set Visibility' ?> 177 177 <script type="text/javascript"> 178 jQuery(document).ready(function($) {178 jQuery(document).ready(function($) { 179 179 $(".chzn-select").chosen(); 180 180 }); … … 183 183 <?php 184 184 $vals = get_post_meta( $item_id, 'locations', true ); 185 foreach( $countries as $key => $value) {185 foreach( $countries as $key => $value ) { 186 186 ?> 187 187 <option value="<?php echo $key;?>"<?php echo is_array( $vals ) && in_array( $key, $vals ) ? "selected='selected'" : ''; ?>> <?php echo $value;?> </option> … … 238 238 /* Get user's country code from his or her IP address. */ 239 239 function csmi_get_country() { 240 if ( isset( $_SESSION[ 'user_country' ] ) && !current_user_can( 'manage_options' ) ) {241 $user_country = $_SESSION[ 'user_country' ];240 if ( isset( $_SESSION[ 'user_country' ] ) && !current_user_can( 'manage_options' ) ) { 241 $user_country = $_SESSION[ 'user_country' ]; 242 242 } else { 243 243 $upload_dir = wp_upload_dir(); … … 280 280 } 281 281 } else { 282 $user_country = "Can't locate IP: " . $ip_address; 282 $user_country = "Can't locate IP: " . $ip_address; 283 283 } 284 284 }
Note: See TracChangeset
for help on using the changeset viewer.