Changeset 362962
- Timestamp:
- 03/21/2011 05:54:56 PM (15 years ago)
- Location:
- content-sort
- Files:
-
- 2 edited
-
tags/2.0b/content-sort.class.php (modified) (7 diffs)
-
trunk/content-sort.class.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
content-sort/tags/2.0b/content-sort.class.php
r362897 r362962 20 20 21 21 $mounted_posts = get_option('content-sort-list'); 22 $mounted_posts = array_reverse($mounted_posts); // flippa på den23 22 24 23 if($mounted_posts){ 24 $mounted_posts = array_reverse($mounted_posts); // flippa på den 25 25 foreach ($mounted_posts as $value) { 26 26 if($value){ … … 45 45 // Hämta en html-kodad postlista, som kan returneras till jquery 46 46 if(!empty($result)){ 47 // $search_result_posts = explode(",", $result); 47 48 $return = $this->getPosts($result); 48 49 } … … 53 54 // Använd post_id för att hämta fram postlistan 54 55 private function getPosts($result){ 55 56 56 if(!empty($result)){ 57 57 foreach ( $result as $post_id ){ … … 71 71 $posts_in_grid = $result = get_option('content-sort-list'); 72 72 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"); 74 74 $result = $this->getPostIdAsStringObj($result); 75 75 $search_result_posts = explode(",", $result); // gör en array på uppsöka poster … … 77 77 if(!empty($posts_in_grid)){ 78 78 $result = $this->removeFromArray($posts_in_grid, $search_result_posts); // remove mounted posts from the arr 79 } else { 80 $result = $search_result_posts; 79 81 } 80 82 … … 99 101 if($sorted_list){ 100 102 update_option('content-sort-list',$sorted_list); 103 } else { 104 delete_option('content-sort-list'); 101 105 } 102 106 } … … 105 109 // lite messig, borde göras om helt 106 110 function removeInSortedList($post_id){ 107 global $wpdb;108 111 if(isset($post_id)){ 109 112 $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 20 20 21 21 $mounted_posts = get_option('content-sort-list'); 22 $mounted_posts = array_reverse($mounted_posts); // flippa på den23 22 24 23 if($mounted_posts){ 24 $mounted_posts = array_reverse($mounted_posts); // flippa på den 25 25 foreach ($mounted_posts as $value) { 26 26 if($value){ … … 45 45 // Hämta en html-kodad postlista, som kan returneras till jquery 46 46 if(!empty($result)){ 47 // $search_result_posts = explode(",", $result); 47 48 $return = $this->getPosts($result); 48 49 } … … 53 54 // Använd post_id för att hämta fram postlistan 54 55 private function getPosts($result){ 55 56 56 if(!empty($result)){ 57 57 foreach ( $result as $post_id ){ … … 71 71 $posts_in_grid = $result = get_option('content-sort-list'); 72 72 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"); 74 74 $result = $this->getPostIdAsStringObj($result); 75 75 $search_result_posts = explode(",", $result); // gör en array på uppsöka poster … … 77 77 if(!empty($posts_in_grid)){ 78 78 $result = $this->removeFromArray($posts_in_grid, $search_result_posts); // remove mounted posts from the arr 79 } else { 80 $result = $search_result_posts; 79 81 } 80 82 … … 99 101 if($sorted_list){ 100 102 update_option('content-sort-list',$sorted_list); 103 } else { 104 delete_option('content-sort-list'); 101 105 } 102 106 } … … 105 109 // lite messig, borde göras om helt 106 110 function removeInSortedList($post_id){ 107 global $wpdb;108 111 if(isset($post_id)){ 109 112 $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.