Changeset 835197
- Timestamp:
- 01/08/2014 11:56:46 PM (12 years ago)
- Location:
- pubmed-posts/trunk
- Files:
-
- 2 edited
-
pubmed-posts.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pubmed-posts/trunk/pubmed-posts.php
r818923 r835197 4 4 Plugin URI: http://wordpress.org/plugins/pubmed-posts/ 5 5 Description: This plugin adds a dashboard widget that creates posts from <a href='http://www.ncbi.nlm.nih.gov/pubmed/'>PubMed</a> articles, plus a search widget that finds posts with specific article data. 6 Version: 1.1. 06 Version: 1.1.1 7 7 Author: sydcode 8 8 Author URI: http://profiles.wordpress.org/sydcode … … 43 43 protected static $instance = null; 44 44 const PLUGIN_SLUG = 'pubmed-posts'; 45 const PLUGIN_VERSION = '1.1. 0';45 const PLUGIN_VERSION = '1.1.1'; 46 46 const DEFAULT_TEMPLATE = <<<HTML 47 47 <p>[article_authors]</p> … … 577 577 */ 578 578 public function get_article_post($pmid) { 579 global $wpdb; 579 580 $pmid = trim($pmid); 580 $args = array( 581 'posts_per_page' => -1 582 ); 583 $posts = get_posts($args); 584 foreach($posts as $post) { 585 $data = get_post_meta($post->ID, 'PMID', true); 586 if (strtolower($data) == strtolower($pmid)) { 587 return $post->ID; 588 } 589 } 590 return 0; 581 $sql = $wpdb->prepare(" 582 SELECT post_id 583 FROM $wpdb->postmeta 584 WHERE meta_key = 'PMID' 585 AND meta_value = '%s' 586 ", $pmid); 587 $results = $wpdb->get_results($sql); 588 if (empty($results)) { 589 return 0; 590 } else { 591 return $results[0]->post_id; 592 } 591 593 } 592 594 -
pubmed-posts/trunk/readme.txt
r818923 r835197 3 3 Donate link: 4 4 Tags: posts, pubmed, research, academic, science, education, references, medical, abstracts, bibliography, pmid 5 Requires at least: 3.3 6 Tested up to: 3. 7.17 Stable tag: 1.1. 05 Requires at least: 3.3.0 6 Tested up to: 3.8.0 7 Stable tag: 1.1.1 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 45 45 == Changelog == 46 46 47 = 1.1.1 = 48 * Improved post checking 49 47 50 = 1.1.0 = 48 51 * Added search widget
Note: See TracChangeset
for help on using the changeset viewer.