WordPress.org

Plugin Directory

Changeset 495434 for connections


Ignore:
Timestamp:
01/26/12 03:30:11 (2 years ago)
Author:
shazahm1@…
Message:
 
Location:
connections/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • connections/trunk/connections.php

    r487295 r495434  
    189189            define('CN_IMAGE_PATH', WP_CONTENT_DIR . '/connection_images/'); 
    190190            define('CN_IMAGE_BASE_URL', WP_CONTENT_URL . '/connection_images/'); 
     191             
     192             
     193            /* 
     194             * Enable for multi-site support. 
     195             *  
     196             * The plugin path and url will like need changed to support multisite too. 
     197             *  
     198             * The table prefixes will definitely need to be change to support the multisite db naming scheme 
     199             *  
     200             * NOTE: Per codex the constants shouldn't be used, which contradicts all the net tutorials. I'll have to look into this. 
     201             * http://codex.wordpress.org/Determining_Plugin_and_Content_Directories#Available_Functions 
     202             *  
     203             * There are functions. I wonder if the automatically resolve correctly for multisite. 
     204             */ 
     205            /*if( is_multisite() ) 
     206            { 
     207                define('CN_IMAGE_PATH', WP_CONTENT_DIR . '/blogs.dir/' . $blog_id . '/connection_images/'); 
     208                define('CN_IMAGE_BASE_URL', network_site_url('/wp-content/blogs.dir/' . $blog_id . '/connection_images/')); 
     209            } else { 
     210                define('CN_IMAGE_PATH', WP_CONTENT_DIR . '/connection_images/'); 
     211                define('CN_IMAGE_BASE_URL', WP_CONTENT_URL . '/connection_images/'); 
     212            } 
     213             
     214            if(is_multisite()){ 
     215                define('CN_CUSTOM_TEMPLATE_PATH', WP_CONTENT_DIR . '/blogs.dir/' . $blog_id . '/connections_templates'); 
     216                define('CN_CUSTOM_TEMPLATE_URL', network_site_url('/wp-content/blogs.dir/' . $blog_id . '/connections_templates/')); 
     217            } else { 
     218                define('CN_CUSTOM_TEMPLATE_PATH', WP_CONTENT_DIR . '/connections_templates'); 
     219                define('CN_CUSTOM_TEMPLATE_URL', WP_CONTENT_URL . '/connections_templates'); 
     220            }*/ 
    191221             
    192222            define('CN_ENTRY_TABLE', $wpdb->prefix . 'connections'); 
  • connections/trunk/includes/class.output.php

    r482778 r495434  
    495495         * // START -- Set the default attributes array. \\ 
    496496         */ 
    497         $defaultAtts = array( 'format' => '%prefix% %first% %middle% %last% %suffix%', 
    498                               'before' => '', 
     497        $defaultAtts = array( 'before' => '', 
    499498                              'after' => '', 
    500499                              'return' => FALSE 
  • connections/trunk/includes/class.terms.php

    r471033 r495434  
    3232         
    3333        $terms = $wpdb->get_results($query); 
    34          
     34        //print_r($terms); 
    3535        /* 
    3636         * Loop thru the results and build an array where key == parent ID and the value == the child objects 
     
    300300         
    301301        // If insert fails return NULL. 
    302         if (!$wpdb->query($wpdb->prepare($sql))) return; 
     302        $wpdb->query($sql); 
    303303        unset($sql); 
    304304         
    305         // Not quite sure how the wpdb class sets this variable??? 
    306         $term_id = (int) $wpdb->insert_id; 
    307          
    308          
    309305        $sql = "INSERT INTO " . CN_TERM_TAXONOMY_TABLE . " SET 
    310             term_id     = '" . $wpdb->escape($term_id) . "', 
     306            term_id     = '" . $wpdb->insert_id . "', 
    311307            taxonomy    = '" . $wpdb->escape($taxonomy) . "', 
    312308            description = '" . $wpdb->escape($description) . "', 
     
    317313         * @TODO: Error check the insert and return error 
    318314         */ 
    319         $wpdb->query($wpdb->prepare($sql)); 
     315        $wpdb->query($sql); 
    320316        unset($sql); 
    321317         
     
    407403    { 
    408404        global $wpdb; 
     405        $term = $this->getTermBy('id', $id, 'category'); 
    409406         
    410407        // Store the entry ids that are using the term to be deleted. 
    411         $termRelations = $wpdb->get_col($wpdb->prepare( "SELECT DISTINCT entry_id FROM " . CN_TERM_RELATIONSHIP_TABLE . " WHERE term_taxonomy_id = %d", (int) $id ) ); 
     408        $termRelations = $wpdb->get_col($wpdb->prepare( "SELECT DISTINCT entry_id FROM " . CN_TERM_RELATIONSHIP_TABLE . " WHERE term_taxonomy_id = %d", $term->term_taxonomy_id ) ); 
    412409         
    413410        $childrenTerms = $wpdb->get_col($wpdb->prepare( "SELECT term_taxonomy_id FROM " . CN_TERM_TAXONOMY_TABLE . " WHERE parent = %d", (int) $id ) ); 
     
    421418            $wpdb->query($wpdb->prepare("UPDATE " . CN_TERM_TAXONOMY_TABLE . " SET parent = %d WHERE parent = %d", (int) $parent, (int) $id )); 
    422419        } 
     420                 
     421        // Delete the term relationships. 
     422        // If delete fails return FALSE. 
     423        $wpdb->query($wpdb->prepare("DELETE FROM " . CN_TERM_RELATIONSHIP_TABLE . " WHERE term_taxonomy_id = %d", $term->term_taxonomy_id )); 
    423424         
    424425        // Delete the term taxonomy. 
    425426        // If delete fails return FALSE. 
    426         if (!$wpdb->query($wpdb->prepare("DELETE FROM " . CN_TERM_TAXONOMY_TABLE . " WHERE term_taxonomy_id = %d", $id ))) return FALSE; 
    427          
    428         // Delete the term relationships. 
    429         // If delete fails return FALSE. 
    430         $wpdb->query($wpdb->prepare("DELETE FROM " . CN_TERM_RELATIONSHIP_TABLE . " WHERE term_taxonomy_id = %d", $id )); 
     427        if (!$wpdb->query($wpdb->prepare("DELETE FROM " . CN_TERM_TAXONOMY_TABLE . " WHERE term_taxonomy_id = %d", $term->term_taxonomy_id ))) return FALSE; 
    431428         
    432429        // Delete the term if no taxonomies use it. 
     
    448445                $term = $this->getTermBy('slug', 'uncategorized', 'category'); 
    449446                 
    450                 $wpdb->query( $wpdb->prepare( "INSERT INTO " . CN_TERM_RELATIONSHIP_TABLE . " SET entry_id = %d, term_taxonomy_id = %d, term_order = 0", $entryID, $term->term_id) ); 
    451              
    452                 $termCount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM " . CN_TERM_RELATIONSHIP_TABLE . " WHERE term_taxonomy_id = %d", $term->term_id) ); 
    453                 $wpdb->query( $wpdb->prepare( "UPDATE " . CN_TERM_TAXONOMY_TABLE . " SET count = %d WHERE term_taxonomy_id = %d", $termCount, $term->term_id) ); 
     447                $wpdb->query( $wpdb->prepare( "INSERT INTO " . CN_TERM_RELATIONSHIP_TABLE . " SET entry_id = %d, term_taxonomy_id = %d, term_order = 0", $entryID, $term->term_taxonomy_id) ); 
     448             
     449                $termCount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM " . CN_TERM_RELATIONSHIP_TABLE . " WHERE term_taxonomy_id = %d", $term->term_taxonomy_id) ); 
     450                $wpdb->query( $wpdb->prepare( "UPDATE " . CN_TERM_TAXONOMY_TABLE . " SET count = %d WHERE term_taxonomy_id = %d", $termCount, $term->term_taxonomy_id) ); 
    454451            } 
    455452        } 
     
    523520             
    524521            // Purge all term relationships. 
    525             // $wpdb->query( $wpdb->prepare( "DELETE FROM " . CN_TERM_RELATIONSHIP_TABLE . " WHERE entry_id = %d", $entryID) ); 
    526522            $this->deleteTermRelationships($entryID); 
    527523        } 
     
    532528            foreach ($termIDs as $termID) 
    533529            { 
    534                 $wpdb->query( $wpdb->prepare( "INSERT INTO " . CN_TERM_RELATIONSHIP_TABLE . " SET entry_id = %d, term_taxonomy_id = %d, term_order = 0", $entryID, $termID) ); 
     530                $termTaxonomyID = $wpdb->get_var( 'SELECT term_taxonomy_id FROM ' . CN_TERM_TAXONOMY_TABLE . ' WHERE term_id=' . $termID ); 
     531                $wpdb->query( $wpdb->prepare( "INSERT INTO " . CN_TERM_RELATIONSHIP_TABLE . " SET entry_id = %d, term_taxonomy_id = %d, term_order = 0", $entryID, $termTaxonomyID) ); 
    535532            } 
    536533        } 
     
    567564            foreach ($termIDs as $termID) 
    568565            { 
     566                $termTaxonomyID = $wpdb->get_var( 'SELECT term_taxonomy_id FROM ' . CN_TERM_TAXONOMY_TABLE . ' WHERE term_id=' . $termID ); 
     567                $termCount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM " . CN_TERM_RELATIONSHIP_TABLE . " WHERE term_taxonomy_id = %d", $termTaxonomyID) ); 
     568                $wpdb->query( $wpdb->prepare( "UPDATE " . CN_TERM_TAXONOMY_TABLE . " SET count = %d WHERE term_taxonomy_id = %d", $termCount, $termTaxonomyID) ); 
     569                 
    569570                $termCount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM " . CN_TERM_RELATIONSHIP_TABLE . " WHERE term_taxonomy_id = %d", $termID) ); 
    570                 $wpdb->query( $wpdb->prepare( "UPDATE " . CN_TERM_TAXONOMY_TABLE . " SET count = %d WHERE term_taxonomy_id = %d", $termCount, $termID) ); 
    571571            } 
    572572        } 
     
    588588        global $wpdb; 
    589589         
    590         $termRelationships = $wpdb->get_col( $wpdb->prepare( "SELECT term_taxonomy_id FROM " . CN_TERM_RELATIONSHIP_TABLE . " WHERE entry_id = %d", $entryID ) ); 
     590        $termRelationships = $wpdb->get_col( $wpdb->prepare( "SELECT t.term_id FROM " . CN_TERMS_TABLE . " AS t INNER JOIN " . CN_TERM_TAXONOMY_TABLE . " AS tt ON t.term_id = tt.term_id INNER JOIN " . CN_TERM_RELATIONSHIP_TABLE . " AS tr ON tt.term_taxonomy_id = tr.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tr.entry_id = %d ", $entryID) ); 
    591591         
    592592        return $termRelationships; 
     
    607607        global $wpdb; 
    608608         
    609         // Purge all ralationships currently related to an entry if rationships exist. 
     609        // Purge all relationships currently related to an entry if rationships exist. 
    610610        if ( $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM " . CN_TERM_RELATIONSHIP_TABLE . " WHERE entry_id = %d", $entryID) ) ) 
    611611        { 
  • connections/trunk/js/cn-user.js

    r471033 r495434  
    11jQuery(document).ready(function($) { 
    2     jQuery('.connections-list').preloader({ 
     2    $('.connections-list').preloader({ 
    33        delay:200, 
    44        imgSelector:'.cn-image img.photo, .cn-image img.logo, .cn-image img.map, .cn-image img.screenshot', 
  • connections/trunk/readme.txt

    r492452 r495434  
    8787 
    8888= 0.7.2.6 01/XX/12 = 
    89 * FEATURE: Add a limit option to the [connetions] shortcode. 
     89* FEATURE: Add a limit option to the [connections] shortcode. 
     90* BUG: Changed jQuery to $ in the cn-user.js file on line 2. 
     91* BUG: Correct term relationships db. 
    9092* OTHER: Add the entry Title field to the Profile template. 
    9193* OTHER: Add wptexturize and wp_autop to the bio and notes fields via the cnUtility::sanitizeString method. 
Note: See TracChangeset for help on using the changeset viewer.