Plugin Directory

Changeset 1376138


Ignore:
Timestamp:
03/22/2016 09:24:26 AM (10 years ago)
Author:
Ryan Stutzman
Message:

Cleaned up code

Location:
location-specific-menu-items-by-country
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • location-specific-menu-items-by-country/tags/1.0.3/CSMI.php

    r1371991 r1376138  
    66Author:         Ryan Stutzman
    77Version:        1.0.3
    8 Author URI:     http://stutzman.asia/
     8Author URI:     http://stutzman.tech/
    99*/
    1010
     
    4141            ?>
    4242            <script type="text/javascript">
    43             jQuery(document).ready(function($){
     43            jQuery(document).ready(function($) {
    4444                $("#download").click(
    4545                    function () {
     
    4747                    }
    4848                );
    49              });
     49            });
    5050            </script>
    5151            <?php echo
     
    5555            <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;"/>
    5656            </p></div>';
    57             if ($_GET){
     57            if ($_GET) {
    5858                if ( isset( $_GET[ 'download' ] ) ) {
    5959                    $newfilev4 = file_get_contents( "https://sourceforge.net/projects/geoipupdate/files/GeoIPv4.dat/download", 0, $ctx );
     
    125125
    126126add_action( 'init', 'csmi_start_session' );
    127 function csmi_start_session( ) {
    128     if( !session_id( ) ) {
    129         session_start( );
     127function csmi_start_session() {
     128    if ( !session_id() ) {
     129        session_start();
    130130    }
    131131}
     
    139139
    140140    function __construct() {
    141         if( is_admin() ) {
     141        if ( is_admin() ) {
    142142            add_filter( 'wp_edit_nav_menu_walker', array( $this, 'csmi_edit_nav_menu_walker' ) );
    143143            add_filter( 'wp_nav_menu_item_custom_fields', array( $this, 'csmi_settings' ), 12, 2 );
     
    176176                    <?php echo 'Set Visibility' ?>
    177177                    <script type="text/javascript">
    178                         jQuery(document).ready(function($){
     178                        jQuery(document).ready(function($) {
    179179                            $(".chzn-select").chosen();
    180180                        });
     
    183183                    <?php
    184184                    $vals = get_post_meta( $item_id, 'locations', true );
    185                     foreach($countries as $key => $value) {
     185                    foreach( $countries as $key => $value ) {
    186186                    ?>
    187187                        <option value="<?php echo $key;?>"<?php echo is_array( $vals ) && in_array( $key, $vals ) ? "selected='selected'" : ''; ?>> <?php echo $value;?> </option>
     
    238238/* Get user's country code from his or her IP address. */
    239239    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' ];
    242242        } else {
    243243            $upload_dir = wp_upload_dir();
     
    280280                }
    281281            } else {
    282                 $user_country = "Can't locate IP: " . $ip_address;             
     282                $user_country = "Can't locate IP: " . $ip_address;
    283283            }
    284284        }
  • location-specific-menu-items-by-country/trunk/CSMI.php

    r1371988 r1376138  
    66Author:         Ryan Stutzman
    77Version:        1.0.3
    8 Author URI:     http://stutzman.asia/
     8Author URI:     http://stutzman.tech/
    99*/
    1010
     
    4141            ?>
    4242            <script type="text/javascript">
    43             jQuery(document).ready(function($){
     43            jQuery(document).ready(function($) {
    4444                $("#download").click(
    4545                    function () {
     
    4747                    }
    4848                );
    49              });
     49            });
    5050            </script>
    5151            <?php echo
     
    5555            <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;"/>
    5656            </p></div>';
    57             if ($_GET){
     57            if ($_GET) {
    5858                if ( isset( $_GET[ 'download' ] ) ) {
    5959                    $newfilev4 = file_get_contents( "https://sourceforge.net/projects/geoipupdate/files/GeoIPv4.dat/download", 0, $ctx );
     
    125125
    126126add_action( 'init', 'csmi_start_session' );
    127 function csmi_start_session( ) {
    128     if( !session_id( ) ) {
    129         session_start( );
     127function csmi_start_session() {
     128    if ( !session_id() ) {
     129        session_start();
    130130    }
    131131}
     
    139139
    140140    function __construct() {
    141         if( is_admin() ) {
     141        if ( is_admin() ) {
    142142            add_filter( 'wp_edit_nav_menu_walker', array( $this, 'csmi_edit_nav_menu_walker' ) );
    143143            add_filter( 'wp_nav_menu_item_custom_fields', array( $this, 'csmi_settings' ), 12, 2 );
     
    176176                    <?php echo 'Set Visibility' ?>
    177177                    <script type="text/javascript">
    178                         jQuery(document).ready(function($){
     178                        jQuery(document).ready(function($) {
    179179                            $(".chzn-select").chosen();
    180180                        });
     
    183183                    <?php
    184184                    $vals = get_post_meta( $item_id, 'locations', true );
    185                     foreach($countries as $key => $value) {
     185                    foreach( $countries as $key => $value ) {
    186186                    ?>
    187187                        <option value="<?php echo $key;?>"<?php echo is_array( $vals ) && in_array( $key, $vals ) ? "selected='selected'" : ''; ?>> <?php echo $value;?> </option>
     
    238238/* Get user's country code from his or her IP address. */
    239239    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' ];
    242242        } else {
    243243            $upload_dir = wp_upload_dir();
     
    280280                }
    281281            } else {
    282                 $user_country = "Can't locate IP: " . $ip_address;             
     282                $user_country = "Can't locate IP: " . $ip_address;
    283283            }
    284284        }
Note: See TracChangeset for help on using the changeset viewer.