Changeset 700299
- Timestamp:
- 04/19/2013 01:13:18 PM (11 years ago)
- Location:
- pubmed-publist/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pubmed-publist/trunk/includes/admin.php
r700297 r700299 3 3 * Admin functions PubMed Publist plugin 4 4 **/ 5 6 7 8 5 9 6 10 /* settings link in plugin management screen */ … … 128 132 if(isset($key)) { 129 133 $val = trim(wp_kses($val, '')); 130 131 if(get_option('pm_publist_'.$key) === FALSE){132 add_option('pm_publist_'.$key, $val);133 }else{134 update_option('pm_publist_'.$key, $val);135 }136 134 } // end if 137 135 } // end foreach 136 137 138 139 140 138 141 return $input; 139 142 } … … 146 149 } 147 150 public function pm_publist_create_searchString_field($int){ 148 ?><textarea style="width:100%;" rows="5" id="searchString<?php echo $int;?>" name="array_key[searchString<?php echo $int;?>]"><?php echo get_option('pm_publist_searchString'.$int);?></textarea><?php 151 $options = get_option('pm_publist_settings'); 152 ?><textarea style="width:100%;" rows="5" id="searchString<?php echo $int;?>" name="array_key[searchString<?php echo $int;?>]"><?php echo $options['searchString'.$int];?></textarea><?php 149 153 } 150 154 public function pm_publist_use_info(){ -
pubmed-publist/trunk/includes/core.php
r700297 r700299 29 29 $total = $show+$extra; 30 30 31 if ($layout) : $transient = 'pm_pubmedlist'.$show.$total.$class.$layout; else : $transient = 'pm_pubmedlist'.$show.$total.$class.$layout; endif;31 ; 32 32 $pubs = get_transient( $transient ); 33 33 if ( false === $pubs ) { … … 170 170 171 171 $xmlCache = pm_publist_DIR.'pm_cache.xml'; 172 173 172 174 $xmlcache_time = 60*60; // 1 hour 173 175 $timedif = @(time() - filemtime($xmlCache)); … … 191 193 return false; 192 194 } else { 193 //TODO: must be a better way of handling this. 194 $strings = array(); 195 if (get_option('test_searchString1')) { array_push($strings,get_option('test_searchString1')); }; 196 if (get_option('test_searchString2')) { array_push($strings,get_option('test_searchString2')); }; 197 if (get_option('test_searchString3')) { array_push($strings,get_option('test_searchString3')); }; 198 if (get_option('test_searchString4')) { array_push($strings,get_option('test_searchString4')); }; 199 if (get_option('test_searchString5')) { array_push($strings,get_option('test_searchString5')); }; 200 if (get_option('test_searchString6')) { array_push($strings,get_option('test_searchString6')); }; 195 $strings = get_option('pm_publist_settings'); 201 196 $data = http_build_query($strings); 202 197 … … 229 224 ////Create page 230 225 $pubs = '<ul class="pm_publist '.$class.'">'.implode($lmbpubs[0]).'</ul>'; 231 if($lmbpubs[1]) { 226 global $show; 227 global $total; 228 if($show != $total) { 232 229 //TODO: Add CSS / JS / Shortcode for this: 233 230 //$pubs .= do_shortcode('[toggle title="More papers"]<ul class="'.$class.'>'.implode($lmbpubs[1]).'</ul>[/toggle]'); … … 235 232 }; 236 233 237 //for next time 238 //write transient cache file. 234 //for next time write transient cache file. 239 235 //but only if no error (basic check using length) 236 240 237 if (strlen($pubs) > 500){ 241 //set_transient($transient, $pubs, 60*30); 242 set_transient($transient, $pubs, 30); 238 set_transient($transient, $pubs, 60*30); 243 239 } 244 240 } -
pubmed-publist/trunk/pm_publist.php
r700297 r700299 3 3 Plugin Name: PubMed Publist 4 4 Description: Shortcodes to display a list of publications from PubMed 5 Version: 0.9 5 Version: 0.9 6 6 Author: Phil Banks 7 7 */ -
pubmed-publist/trunk/pm_pubmedrequest.php
r700297 r700299 2 2 ////If Cache is good - use it 3 3 //define some variables. 4 5 4 6 $cache_time = 60*60*2; // 2 hours 5 7 $cache_file = dirname(__FILE__).'/pm_cache.xml'; … … 12 14 else { 13 15 $nodes = array(); 14 //TODO: Make multi string compatible. Work out how to test how many then do appropriate for that many. 15 if(isset($_POST["0"])) { 16 $search1 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST["0"].'&report=xml'; 16 if(isset($_POST["searchString1"])) { 17 $search1 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST["searchString1"].'&report=xml'; 17 18 array_push($nodes, $search1); 18 19 } 19 if(isset($_POST[" 1"])) {20 $search2 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST[" 1"].'&report=xml';20 if(isset($_POST[""])) { 21 $search2 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST[""].'&report=xml'; 21 22 array_push($nodes, $search2); 22 23 } 23 if(isset($_POST[" 2"])) {24 $search3 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST[" 2"].'&report=xml';24 if(isset($_POST[""])) { 25 $search3 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST[""].'&report=xml'; 25 26 array_push($nodes, $search3); 26 27 } 27 if(isset($_POST[" 3"])) {28 $search4 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST[" 3"].'&report=xml';28 if(isset($_POST[""])) { 29 $search4 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST[""].'&report=xml'; 29 30 array_push($nodes, $search4); 30 31 } 31 if(isset($_POST[" 4"])) {32 $search5 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST[" 4"].'&report=xml';32 if(isset($_POST[""])) { 33 $search5 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST[""].'&report=xml'; 33 34 array_push($nodes, $search5); 34 35 } 35 if(isset($_POST[" 5"])) {36 $search6 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST[" 5"].'&report=xml';36 if(isset($_POST[""])) { 37 $search6 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST[""].'&report=xml'; 37 38 array_push($nodes, $search6); 38 39 } 39 40 40 41 41 //get PubMed data as XML using parallel cURL requests for speed. 42 ////$nodes = array($search1, $search2, $search3, $search4, $search5, $search6);43 42 $node_count = count($nodes); 44 43 $curl_arr = array(); … … 58 57 ${"search$num"} = curl_multi_getcontent ( $curl_arr[$i] ); 59 58 } 60 61 59 62 60 … … 105 103 106 104 107 //Loop through set nodes and process them105 //Loop through set nodes and 108 106 for($i = 0; $i < $node_count; $i++) { 109 107 $num = $i+1; … … 113 111 ${"xml$num"} = new SimpleXMLElement(${"search$num"}); 114 112 } 115 113 //Loop through nodes and dedupe/merge 116 114 $output = $xml1; 117 115 if ($node_count > 1) { 118 116 for($i = 0; $i < $node_count-1; $i++) { 119 117 $num = $i+2; 120 error_log($num);121 122 118 ${"xml$num.clean"} = dedupeXML($output,${"xml$num"}); 123 119 $output = mergeXML($output,${"xml$num.clean"}); -
pubmed-publist/trunk/readme.txt
r700298 r700299 57 57 == Changelog == 58 58 59 60 61 62 59 63 = 0.9 = 60 61 64 * Initial Beta Release
Note: See TracChangeset
for help on using the changeset viewer.