Changeset 700341
- Timestamp:
- 04/19/2013 02:31:18 PM (11 years ago)
- Location:
- pubmed-publist/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pubmed-publist/trunk/includes/admin.php
r700339 r700341 4 4 **/ 5 5 6 <<<<<<< HEAD7 6 //TODO: Add Purge cache buttons / functions. 8 7 //TODO: Add cache settings 9 8 //TODO: Add PMID exclude setting. 10 9 11 =======12 >>>>>>> Initial Commit13 10 /* settings link in plugin management screen */ 14 11 function pm_pubmed_settings_link( $links ) { … … 135 132 if(isset($key)) { 136 133 $val = trim(wp_kses($val, '')); 137 <<<<<<< HEAD138 134 } // end if 139 135 } // end foreach … … 143 139 update_option('pm_publist_settings', $input); 144 140 } 145 =======146 147 if(get_option('pm_publist_'.$key) === FALSE){148 add_option('pm_publist_'.$key, $val);149 }else{150 update_option('pm_publist_'.$key, $val);151 }152 } // end if153 } // end foreach154 >>>>>>> Initial Commit155 141 return $input; 156 142 } … … 163 149 } 164 150 public function pm_publist_create_searchString_field($int){ 165 <<<<<<< HEAD166 151 $options = get_option('pm_publist_settings'); 167 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 168 =======169 ?><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><?php170 >>>>>>> Initial Commit171 153 } 172 154 public function pm_publist_use_info(){ -
pubmed-publist/trunk/includes/core.php
r700339 r700341 29 29 $total = $show+$extra; 30 30 31 <<<<<<< HEAD32 31 $transient = 'pm_pubmedlist'.$show.$extra.$class.$layout; 33 =======34 if ($layout) : $transient = 'pm_pubmedlist'.$show.$total.$class.$layout; else : $transient = 'pm_pubmedlist'.$show.$total.$class.$layout; endif;35 >>>>>>> Initial Commit36 32 $pubs = get_transient( $transient ); 37 33 if ( false === $pubs ) { … … 174 170 175 171 $xmlCache = pm_publist_DIR.'pm_cache.xml'; 176 <<<<<<< HEAD177 172 //TODO: Sort caching out. Remove age chack from pubmedrequest.php and ue just this??? 178 173 //Easier to get var from settings here. 179 =======180 >>>>>>> Initial Commit181 174 $xmlcache_time = 60*60; // 1 hour 182 175 $timedif = @(time() - filemtime($xmlCache)); … … 200 193 return false; 201 194 } else { 202 <<<<<<< HEAD203 195 $strings = get_option('pm_publist_settings'); 204 =======205 //TODO: must be a better way of handling this.206 $strings = array();207 if (get_option('test_searchString1')) { array_push($strings,get_option('test_searchString1')); };208 if (get_option('test_searchString2')) { array_push($strings,get_option('test_searchString2')); };209 if (get_option('test_searchString3')) { array_push($strings,get_option('test_searchString3')); };210 if (get_option('test_searchString4')) { array_push($strings,get_option('test_searchString4')); };211 if (get_option('test_searchString5')) { array_push($strings,get_option('test_searchString5')); };212 if (get_option('test_searchString6')) { array_push($strings,get_option('test_searchString6')); };213 >>>>>>> Initial Commit214 196 $data = http_build_query($strings); 215 197 … … 242 224 ////Create page 243 225 $pubs = '<ul class="pm_publist '.$class.'">'.implode($lmbpubs[0]).'</ul>'; 244 <<<<<<< HEAD245 226 global $show; 246 227 global $total; 247 228 if($show != $total) { 248 =======249 if($lmbpubs[1]) {250 >>>>>>> Initial Commit251 229 //TODO: Add CSS / JS / Shortcode for this: 252 230 //$pubs .= do_shortcode('[toggle title="More papers"]<ul class="'.$class.'>'.implode($lmbpubs[1]).'</ul>[/toggle]'); … … 254 232 }; 255 233 256 <<<<<<< HEAD257 234 //for next time write transient cache file. 258 235 //but only if no error (basic check using length) … … 260 237 if (strlen($pubs) > 500){ 261 238 set_transient($transient, $pubs, 60*30); 262 =======263 //for next time264 //write transient cache file.265 //but only if no error (basic check using length)266 if (strlen($pubs) > 500){267 //set_transient($transient, $pubs, 60*30);268 set_transient($transient, $pubs, 30);269 >>>>>>> Initial Commit270 239 } 271 240 } -
pubmed-publist/trunk/pm_publist.php
r700339 r700341 3 3 Plugin Name: PubMed Publist 4 4 Description: Shortcodes to display a list of publications from PubMed 5 <<<<<<< HEAD6 5 Version: 0.9.1 7 =======8 Version: 0.99 >>>>>>> Initial Commit10 6 Author: Phil Banks 11 7 */ -
pubmed-publist/trunk/pm_pubmedrequest.php
r700339 r700341 2 2 ////If Cache is good - use it 3 3 //define some variables. 4 <<<<<<< HEAD5 4 //TODO: Use options to set this cache time 6 5 //TODO: Check there isn't a WP function for writing to disk. Problems on some hosts??? 7 =======8 >>>>>>> Initial Commit9 6 $cache_time = 60*60*2; // 2 hours 10 7 $cache_file = dirname(__FILE__).'/pm_cache.xml'; … … 17 14 else { 18 15 $nodes = array(); 19 <<<<<<< HEAD20 16 if(isset($_POST["searchString1"])) { 21 17 $search1 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST["searchString1"].'&report=xml'; … … 44 40 45 41 //get PubMed data as XML using parallel cURL requests for speed. 46 =======47 //TODO: Make multi string compatible. Work out how to test how many then do appropriate for that many.48 if(isset($_POST["0"])) {49 $search1 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST["0"].'&report=xml';50 array_push($nodes, $search1);51 }52 if(isset($_POST["1"])) {53 $search2 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST["1"].'&report=xml';54 array_push($nodes, $search2);55 }56 if(isset($_POST["2"])) {57 $search3 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST["2"].'&report=xml';58 array_push($nodes, $search3);59 }60 if(isset($_POST["3"])) {61 $search4 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST["3"].'&report=xml';62 array_push($nodes, $search4);63 }64 if(isset($_POST["4"])) {65 $search5 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST["4"].'&report=xml';66 array_push($nodes, $search5);67 }68 if(isset($_POST["5"])) {69 $search6 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST["5"].'&report=xml';70 array_push($nodes, $search6);71 }72 73 74 //get PubMed data as XML using parallel cURL requests for speed.75 ////$nodes = array($search1, $search2, $search3, $search4, $search5, $search6);76 >>>>>>> Initial Commit77 42 $node_count = count($nodes); 78 43 $curl_arr = array(); … … 94 59 95 60 96 <<<<<<< HEAD97 =======98 99 >>>>>>> Initial Commit100 61 //function to clean PubMed data so it is valid XML. 101 62 function cleanPubmed($dirtyPubmed) { … … 110 71 $query = array(); 111 72 foreach ($xml1->PubmedArticle as $paper) { 112 73 $query[] = sprintf('(MedlineCitation/PMID != %s)',$paper->MedlineCitation->PMID); 113 74 } 114 75 $query = implode('and', $query); … … 116 77 $xmlClean = '<Document>'; 117 78 foreach ($xml2->xpath(sprintf('PubmedArticle[%s]', $query)) as $paper) { 118 79 $xmlClean .= $paper->asXML(); 119 80 } 120 81 $xmlClean .= '</Document>'; … … 142 103 143 104 144 <<<<<<< HEAD145 105 //Loop through set nodes and clean/convert 146 =======147 //Loop through set nodes and process them148 >>>>>>> Initial Commit149 106 for($i = 0; $i < $node_count; $i++) { 150 107 $num = $i+1; … … 154 111 ${"xml$num"} = new SimpleXMLElement(${"search$num"}); 155 112 } 156 <<<<<<< HEAD157 113 //Loop through nodes and dedupe/merge 158 =======159 160 >>>>>>> Initial Commit161 114 $output = $xml1; 162 115 if ($node_count > 1) { 163 116 for($i = 0; $i < $node_count-1; $i++) { 164 117 $num = $i+2; 165 <<<<<<< HEAD166 =======167 error_log($num);168 169 >>>>>>> Initial Commit170 118 ${"xml$num.clean"} = dedupeXML($output,${"xml$num"}); 171 119 $output = mergeXML($output,${"xml$num.clean"}); -
pubmed-publist/trunk/readme.txt
r700340 r700341 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.