Plugin Directory

Changeset 700341

Timestamp:
04/19/2013 02:31:18 PM (11 years ago)
Author:
emirpprime
Message:

v0.9.1

Clean up PHP errors
Migrate to Options array
Housekeeping

Location:
pubmed-publist/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • pubmed-publist/trunk/includes/admin.php

    r700339 r700341  
    44 **/
    55
    6 <<<<<<< HEAD
    76//TODO: Add Purge cache buttons / functions.
    87//TODO: Add cache settings
    98//TODO: Add PMID exclude setting.
    109
    11 =======
    12 >>>>>>> Initial Commit
    1310/* settings link in plugin management screen */
    1411function pm_pubmed_settings_link( $links ) {
     
    135132            if(isset($key)) {
    136133                $val = trim(wp_kses($val, ''));
    137 <<<<<<< HEAD
    138134            } // end if
    139135        } // end foreach
     
    143139            update_option('pm_publist_settings', $input);
    144140        }
    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 if
    153         } // end foreach
    154 >>>>>>> Initial Commit
    155141        return $input;
    156142    }
     
    163149    }
    164150    public function pm_publist_create_searchString_field($int){
    165 <<<<<<< HEAD
    166151        $options = get_option('pm_publist_settings');
    167152        ?><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><?php
    170 >>>>>>> Initial Commit
    171153    }
    172154    public function pm_publist_use_info(){
  • pubmed-publist/trunk/includes/core.php

    r700339 r700341  
    2929    $total = $show+$extra;
    3030
    31 <<<<<<< HEAD
    3231    $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 Commit
    3632    $pubs = get_transient( $transient );
    3733    if ( false === $pubs ) {
     
    174170
    175171            $xmlCache = pm_publist_DIR.'pm_cache.xml';
    176 <<<<<<< HEAD
    177172            //TODO: Sort caching out. Remove age chack from pubmedrequest.php and ue just this???
    178173            //Easier to get var from settings here.
    179 =======
    180 >>>>>>> Initial Commit
    181174            $xmlcache_time = 60*60; // 1 hour
    182175            $timedif = @(time() - filemtime($xmlCache));
     
    200193                        return false;
    201194                    } else {
    202 <<<<<<< HEAD
    203195                        $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 Commit
    214196                        $data = http_build_query($strings);
    215197
     
    242224        ////Create page
    243225        $pubs = '<ul class="pm_publist '.$class.'">'.implode($lmbpubs[0]).'</ul>';
    244 <<<<<<< HEAD
    245226        global $show;
    246227        global $total;
    247228        if($show != $total) {
    248 =======
    249         if($lmbpubs[1]) {
    250 >>>>>>> Initial Commit
    251229            //TODO: Add CSS / JS / Shortcode for this:
    252230            //$pubs .= do_shortcode('[toggle title="More papers"]<ul class="'.$class.'>'.implode($lmbpubs[1]).'</ul>[/toggle]');
     
    254232        };
    255233
    256 <<<<<<< HEAD
    257234        //for next time write transient cache file.
    258235        //but only if no error (basic check using length)
     
    260237        if (strlen($pubs) > 500){
    261238            set_transient($transient, $pubs, 60*30);
    262 =======
    263         //for next time
    264         //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 Commit
    270239        }
    271240    }
  • pubmed-publist/trunk/pm_publist.php

    r700339 r700341  
    33Plugin Name: PubMed Publist
    44Description: Shortcodes to display a list of publications from PubMed
    5 <<<<<<< HEAD
    65Version: 0.9.1
    7 =======
    8 Version: 0.9
    9 >>>>>>> Initial Commit
    106Author: Phil Banks
    117*/
  • pubmed-publist/trunk/pm_pubmedrequest.php

    r700339 r700341  
    22////If Cache is good - use it
    33//define some variables.
    4 <<<<<<< HEAD
    54//TODO: Use options to set this cache time
    65//TODO: Check there isn't a WP function for writing to disk. Problems on some hosts???
    7 =======
    8 >>>>>>> Initial Commit
    96$cache_time = 60*60*2; // 2 hours
    107$cache_file = dirname(__FILE__).'/pm_cache.xml';
     
    1714else {
    1815        $nodes = array();
    19 <<<<<<< HEAD
    2016        if(isset($_POST["searchString1"])) {
    2117            $search1 = 'http://www.ncbi.nlm.nih.gov/pubmed?term='.$_POST["searchString1"].'&report=xml';
     
    4440
    4541        //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 Commit
    7742        $node_count = count($nodes);
    7843        $curl_arr = array();
     
    9459
    9560
    96 <<<<<<< HEAD
    97 =======
    98 
    99 >>>>>>> Initial Commit
    10061        //function to clean PubMed data so it is valid XML.
    10162        function cleanPubmed($dirtyPubmed) {
     
    11071            $query = array();
    11172            foreach ($xml1->PubmedArticle as $paper) {
    112                 $query[] = sprintf('(MedlineCitation/PMID != %s)',$paper->MedlineCitation->PMID);
     73            $query[] = sprintf('(MedlineCitation/PMID != %s)',$paper->MedlineCitation->PMID);
    11374            }
    11475            $query = implode('and', $query);
     
    11677            $xmlClean = '<Document>';
    11778            foreach ($xml2->xpath(sprintf('PubmedArticle[%s]', $query)) as $paper) {
    118                 $xmlClean .= $paper->asXML();
     79            $xmlClean .= $paper->asXML();
    11980            }
    12081            $xmlClean .= '</Document>';
     
    142103
    143104
    144 <<<<<<< HEAD
    145105        //Loop through set nodes and clean/convert
    146 =======
    147         //Loop through set nodes and process them
    148 >>>>>>> Initial Commit
    149106        for($i = 0; $i < $node_count; $i++) {
    150107            $num = $i+1;
     
    154111            ${"xml$num"} = new SimpleXMLElement(${"search$num"});
    155112        }
    156 <<<<<<< HEAD
    157113        //Loop through nodes and dedupe/merge
    158 =======
    159 
    160 >>>>>>> Initial Commit
    161114        $output = $xml1;
    162115        if ($node_count > 1) {
    163116            for($i = 0; $i < $node_count-1; $i++) {
    164117                $num = $i+2;
    165 <<<<<<< HEAD
    166 =======
    167                 error_log($num);
    168 
    169 >>>>>>> Initial Commit
    170118                ${"xml$num.clean"} = dedupeXML($output,${"xml$num"});
    171119                $output = mergeXML($output,${"xml$num.clean"});
  • pubmed-publist/trunk/readme.txt

    r700340 r700341  
    5757== Changelog ==
    5858
     59
     60
     61
     62
    5963= 0.9 =
    60 
    6164* Initial Beta Release
Note: See TracChangeset for help on using the changeset viewer.