Plugin Directory

Changeset 605758


Ignore:
Timestamp:
09/29/2012 12:33:03 PM (13 years ago)
Author:
wpler
Message:

Fix some errors

Location:
wpmu-linkmanager
Files:
10 added
2 edited

Legend:

Unmodified
Added
Removed
  • wpmu-linkmanager/trunk/readme.txt

    r605734 r605758  
    55Requires at least: 3.4.2
    66Tested up to: 3.4.2
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5656== Changelog ==
    5757
     58= 1.0.2 =
     59* Fix an error by saving new links into the table
     60* Fix an error by delete a link
     61* Fix an error for the conditional tags by printout the links
     62
    5863= 1.0.1 =
    5964* Fix an error by activation & deactivation for creating the tables
  • wpmu-linkmanager/trunk/wpmu_linkmanager.php

    r605734 r605758  
    33Plugin Name:        WPMU LinkManager
    44Description:        You works with a multisite and want manage your outgoing footer links into the themes of each blog? With this plugin you can manage into network admin your outgoing links for every registered blog into your multisite installation.
    5 Version:            1.0.1
     5Version:            1.0.2
    66Author:             WPler
    77Author URI:         http://www.wpler.com
     
    191191            $into[ 'linktext' ] = esc_attr( $_POST[ 'linktext' ] );
    192192            $into[ 'linktitle' ] = esc_attr( $_POST[ 'linktitle' ] );
    193             $into[ 'wpcondition' ] = esc_attr( $_POST[ 'condition' ] );
    194             if ( isset ( $_GET[ 'linkid' ] ) && $wpdb->update( $wpdb->prefix . 'wplerlm', $into, array( 'link_id' => absint( $_GET[ 'linkid' ] ) ), array( '%d', '%s', '%s', '%s', '%s', '%s', '%s' ), array( '%d' ) ) ) {
     193            $into[ 'wpcondition' ] = $_POST[ 'condition' ];
     194            if ( !empty( $_POST[ 'linkid' ] ) && $wpdb->update( $wpdb->base_prefix . 'wplerlm', $into, array( 'link_id' => absint( $_POST[ 'linkid' ] ) ), array( '%d', '%s', '%s', '%s', '%s', '%s', '%s' ), array( '%d' ) ) ) {
    195195                printf( '<div class="updated">%s</div>', __( 'The Link are saved to the table', wplerlm::get_textdomain() ) );
    196             } elseif ( $wpdb->insert( $wpdb->prefix . 'wplerlm', $into, array( '%d', '%s', '%s', '%s', '%s', '%s', '%s' ) ) !== FALSE ) {
     196            } elseif ( $wpdb->insert( $wpdb->base_prefix . 'wplerlm', $into, array( '%d', '%s', '%s', '%s', '%s', '%s', '%s' ) ) !== FALSE ) {
    197197                printf( '<div class="updated">%s</div>', __( 'The link are added to the table', wplerlm::get_textdomain() ) );
    198198            }
    199         } elseif ( !empty( $_GET[ 'linkid' ] ) && isset( $_GET[ 'delete' ] ) ) {
    200             $link = !$wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM {$wpdb->prefix}wplerlm WHERE link_id = %d", $_GET[ 'linkid' ] ), 0 );
    201             if ( !empty( $link ) && ( $link->link_id == absint( $_GET[ 'linkid' ] ) ) ) {
    202                 $wpdb->query( sprintf( "DELETE FROM {$wpdb->prefix}wplerlm WHERE link_id = %d", $link->link_id ) );
    203                 $wpdb->query( "OPTIMIZE TABLE {$wpdb->prefix}wplerlm" );
     199        } elseif ( !empty( $_GET[ 'linkid' ] ) && !empty( $_GET[ 'delete' ] ) ) {
     200            $link = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM {$wpdb->base_prefix}wplerlm WHERE link_id = %d", absint( $_GET[ 'linkid' ] ) ), 0 );
     201            if ( !empty( $link ) && ( $link[ 0 ] == absint( $_GET[ 'linkid' ] ) ) ) {
     202                $wpdb->query( sprintf( "DELETE FROM {$wpdb->base_prefix}wplerlm WHERE link_id = %d", $link[ 0 ] ) );
     203                $wpdb->query( "OPTIMIZE TABLE {$wpdb->base_prefix}wplerlm" );
    204204                printf( '<div class="updated">%s</div>', __( 'The Link was deleted', wplerlm::get_textdomain() ) );
    205205            }
    206206        } elseif ( !empty( $_GET[ 'linkid' ] ) ) {
    207             $link = $wpdb->get_row( $wpdb->prepare( "SELECT link_id, blog_id, tourl, rel, target, linktext, linktitle, wpcondition FROM {$wpdb->prefix}wplerlm WHERE link_id = %d", absint( $_GET[ 'linkid' ] ) ) );
     207            $link = $wpdb->get_row( $wpdb->prepare( "SELECT link_id, blog_id, tourl, rel, target, linktext, linktitle, wpcondition FROM {$wpdb->base_prefix}wplerlm WHERE link_id = %d", absint( $_GET[ 'linkid' ] ) ) );
    208208            $siteid = !empty( $link->blog_id ) ? absint( $link->blog_id ) : '';
    209209            $target = !empty( $link->target ) ? $link->target : '_blank';
     
    213213        <h2><span><?php _e( 'Add new link', wplerlm::get_textdomain()); ?></span></h2>
    214214        <form action="" method="post">
     215            <?php if ( !empty( $_GET[ 'linkid' ] ) ): ?>
     216            <input type="hidden" name="linkid" value="<?php echo $_GET[ 'linkid' ]; ?>" />
     217            <?php endif; ?>
    215218            <table class="form-table">
    216219                <tr>
     
    275278        if ( !empty( $links ) ) {
    276279            foreach( ( array ) $links as $link ) {
    277                 eval( '$show = ' . $link->wpcondition . ';' );
     280                eval( '$show = (' . $link->wpcondition . ');' );
    278281                if ( !empty( $link->wpcondition ) && TRUE === $show ) {
    279282                    printf(
     
    282285                        !empty( $link->target ) ? esc_attr( $link->target ) : '_self',
    283286                        !empty( $link->rel ) ? esc_attr( $link->rel ) : 'follow',
    284                         !empty( $link->linktitle ) ? esc_attr( $link->linkttile ) : '',
     287                        !empty( $link->linktitle ) ? esc_attr( $link->linktitle ) : '',
    285288                        !empty( $link->linktext ) ? esc_attr( $link->linktext ) : 'Link'
    286289                    );
Note: See TracChangeset for help on using the changeset viewer.