Plugin Directory

Changeset 362962


Ignore:
Timestamp:
03/21/2011 05:54:56 PM (15 years ago)
Author:
johannesfosseus
Message:

bugfix

Location:
content-sort
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • content-sort/tags/2.0b/content-sort.class.php

    r362897 r362962  
    2020
    2121            $mounted_posts = get_option('content-sort-list');
    22             $mounted_posts = array_reverse($mounted_posts); // flippa på den
    2322
    2423            if($mounted_posts){
     24                $mounted_posts = array_reverse($mounted_posts); // flippa på den
    2525                foreach ($mounted_posts as $value) {
    2626                    if($value){
     
    4545        // Hämta en html-kodad postlista, som kan returneras till jquery
    4646        if(!empty($result)){
     47//          $search_result_posts = explode(",", $result);
    4748            $return = $this->getPosts($result);
    4849        }
     
    5354    // Använd post_id för att hämta fram postlistan
    5455    private function getPosts($result){
    55 
    5656        if(!empty($result)){
    5757            foreach ( $result as $post_id ){
     
    7171        $posts_in_grid = $result = get_option('content-sort-list');
    7272
    73         $result = $wpdb->get_results("SELECT ID FROM {$wpdb->prefix}posts WHERE post_type = \"post\" AND post_status = \"publish\" AND post_title LIKE \"%".$word."%\" LIMIT 20");
     73        $result = $wpdb->get_results("SELECT ID FROM {$wpdb->prefix}posts WHERE post_type = \"post\" AND post_status = \"publish\" AND post_title LIKE \"%".$word."%\" LIMIT 10");
    7474        $result = $this->getPostIdAsStringObj($result);
    7575        $search_result_posts = explode(",", $result); // gör en array på uppsöka poster
     
    7777        if(!empty($posts_in_grid)){
    7878            $result = $this->removeFromArray($posts_in_grid, $search_result_posts); // remove mounted posts from the arr
     79        } else {
     80            $result = $search_result_posts;
    7981        }
    8082
     
    99101        if($sorted_list){
    100102            update_option('content-sort-list',$sorted_list);
     103        } else {
     104            delete_option('content-sort-list');
    101105        }
    102106    }
     
    105109    // lite messig, borde göras om helt
    106110    function removeInSortedList($post_id){
    107         global $wpdb;
    108111        if(isset($post_id)){
    109112            $posts_in_grid_arr = get_option('content-sort-list'); // get all post_id in the grid
  • content-sort/trunk/content-sort.class.php

    r362897 r362962  
    2020
    2121            $mounted_posts = get_option('content-sort-list');
    22             $mounted_posts = array_reverse($mounted_posts); // flippa på den
    2322
    2423            if($mounted_posts){
     24                $mounted_posts = array_reverse($mounted_posts); // flippa på den
    2525                foreach ($mounted_posts as $value) {
    2626                    if($value){
     
    4545        // Hämta en html-kodad postlista, som kan returneras till jquery
    4646        if(!empty($result)){
     47//          $search_result_posts = explode(",", $result);
    4748            $return = $this->getPosts($result);
    4849        }
     
    5354    // Använd post_id för att hämta fram postlistan
    5455    private function getPosts($result){
    55 
    5656        if(!empty($result)){
    5757            foreach ( $result as $post_id ){
     
    7171        $posts_in_grid = $result = get_option('content-sort-list');
    7272
    73         $result = $wpdb->get_results("SELECT ID FROM {$wpdb->prefix}posts WHERE post_type = \"post\" AND post_status = \"publish\" AND post_title LIKE \"%".$word."%\" LIMIT 20");
     73        $result = $wpdb->get_results("SELECT ID FROM {$wpdb->prefix}posts WHERE post_type = \"post\" AND post_status = \"publish\" AND post_title LIKE \"%".$word."%\" LIMIT 10");
    7474        $result = $this->getPostIdAsStringObj($result);
    7575        $search_result_posts = explode(",", $result); // gör en array på uppsöka poster
     
    7777        if(!empty($posts_in_grid)){
    7878            $result = $this->removeFromArray($posts_in_grid, $search_result_posts); // remove mounted posts from the arr
     79        } else {
     80            $result = $search_result_posts;
    7981        }
    8082
     
    99101        if($sorted_list){
    100102            update_option('content-sort-list',$sorted_list);
     103        } else {
     104            delete_option('content-sort-list');
    101105        }
    102106    }
     
    105109    // lite messig, borde göras om helt
    106110    function removeInSortedList($post_id){
    107         global $wpdb;
    108111        if(isset($post_id)){
    109112            $posts_in_grid_arr = get_option('content-sort-list'); // get all post_id in the grid
Note: See TracChangeset for help on using the changeset viewer.