Plugin Directory

Changeset 582455


Ignore:
Timestamp:
08/06/2012 10:51:01 PM (14 years ago)
Author:
bartee
Message:

The name of the plugin reference file was included case insensitive. Made it case sensitive

File:
1 edited

Legend:

Unmodified
Added
Removed
  • shortcode-reference/branches/20120726_include_fix/lib/ShortcodeReference.php

    r318972 r582455  
    1616     * @var ReflectionFunction
    1717     */
    18     private $_function_reflection;
     18    private $_function_reflection;
     19
     20    /**
     21     * @var string
     22     */
     23    private $_filepath;
    1924   
    2025    /**
     
    6974            $this->_known_tags = array();
    7075            $desc = $this->_function_reflection->getDocComment();
    71             $matches = preg_split('/\n/',$desc);
    7276            $parsed_desc = '';
    73             $start_pattern = '/w*\/\*\*w*/';
    74             foreach ($matches as $match) {
    75                 if (preg_match($start_pattern, $match,$submatch)){
    76                     // skip it
    77                 } else if (preg_match('/w*\*\//',$match,$submatch)){
    78                     $offset = strpos($match,'*/')-1;
    79                     $final_line.= trim(substr($match,0,-$offset)).'
     77            if ($desc){
     78                $matches = preg_split('/\n/',$desc);
     79                $start_pattern = '/w*\/\*\*w*/';
     80                foreach ($matches as $match) {
     81                    if (preg_match($start_pattern, $match,$submatch)){
     82                        // skip it
     83                    } else if (preg_match('/w*\*\//',$match,$submatch)){
     84                        $offset = strpos($match,'*/')-1;
     85                        $final_line.= trim(substr($match,0,-$offset)).'
    8086';
    81                     if ($final_line != ''){
    82                         $parsed_desc .= $final_line;
    83                     }
    84                 } else if (preg_match('/w*\*/',$match,$submatch)){
    85                     if (preg_match('/@/',$match,$submatch)){
    86                         $offset = strpos($match,'@')+1;
    87                         $tag = trim(substr($match,$offset,strlen($match)-$offset));
    88                         $this->addTagFromString($tag);
    89                     } else {
    90                         $offset = strpos($match,'*')+1;
    91                         $parsed_desc .= trim(substr($match,$offset,strlen($match)-$offset)).'
    92     ';
     87                        if ($final_line != ''){
     88                            $parsed_desc .= $final_line;
     89                        }
     90                    } else if (preg_match('/w*\*/',$match,$submatch)){
     91                        if (preg_match('/@/',$match,$submatch)){
     92                            $offset = strpos($match,'@')+1;
     93                            $tag = trim(substr($match,$offset,strlen($match)-$offset));
     94                            $this->addTagFromString($tag);
     95                        } else {
     96                            $offset = strpos($match,'*')+1;
     97                            $parsed_desc .= trim(substr($match,$offset,strlen($match)-$offset)).'
     98        ';
     99                        }
    93100                    }
    94101                }
     
    108115    public function getReference(){
    109116        $absolute_path = $this->_function_reflection->getFileName();
     117        $this->_filepath = $absolute_path;
    110118        if (strpos($absolute_path, ABSPATH)>=0){
    111119            /**
     
    126134   
    127135    /**
     136     * Retrieve the absolute file path
     137     *
     138     * @return string
     139     */
     140    public function getFilePath(){
     141        return $this->_filepath;
     142    }
     143   
     144    /**
    128145     * Get the options for the function
    129146     *
     
    160177     */
    161178    public function getUrl(){
     179       
    162180        if (!$this->_url){
     181           
    163182            $is_plugin = strpos($this->getReference(),'Plugin:');
    164183            if ($this->getReference() == 'WordPress function'){
     
    166185                $this->_url ='http://codex.wordpress.org/index.php?title=Special:Search&search='.$this->_shortcode.'_Shortcode';
    167186            } else if ($is_plugin !== false){
    168                
    169                 $plugin_path = str_replace('Plugin: ','',$this->getReference());
    170                 $plugin_info = get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin_path.'/'.$plugin_path.'.php');
     187                $plugin_info = get_plugin_data($this->_filepath);
    171188               
    172189                if (is_array($plugin_info) && key_exists('PluginURI',$plugin_info)){
Note: See TracChangeset for help on using the changeset viewer.