includes/plugins.php
changeset 1145 21ef2f8feb59
parent 1081 745200a9cc2a
child 1216 4125e19d3b27
equal deleted inserted replaced
1144:fcb2be1428e7 1145:21ef2f8feb59
   186     if ( empty($contents) )
   186     if ( empty($contents) )
   187     {
   187     {
   188       return array();
   188       return array();
   189     }
   189     }
   190     
   190     
       
   191     // The "\r?" in this regular expression is the result of an embarrassing failure during a job related meeting.
       
   192     // I was demoing the authoring of an Enano plugin and simply could not figure out why the plugin would not
       
   193     // show up in the admin panel.
       
   194 
   191     $regexp = '#^/\*\*!([a-z0-9_]+)'  // block header and type
   195     $regexp = '#^/\*\*!([a-z0-9_]+)'  // block header and type
   192             . '(([\s]+[a-z0-9_]+[\s]*=[\s]*".+?"[\s]*;)*)' // parameters
   196             . '(([\s]+[a-z0-9_]+[\s]*=[\s]*".+?"[\s]*;)*)' // parameters
   193             . '[\s]*\*\*' . "\n"      // spacing and header close
   197             . '[\s]*\*\*' . "\r?\n"      // spacing and header close
   194             . '([\w\W]+?)' . "\n"     // value
   198             . '([\w\W]+?)' . "\r?\n"     // value
   195             . '\*\*!\*/'              // closing comment
   199             . '\*\*!\*/'              // closing comment
   196             . '#m';
   200             . '#m';
   197             
   201             
   198     // Match out all blocks
   202     // Match out all blocks
   199     $results = preg_match_all($regexp, $contents, $blocks);
   203     $results = preg_match_all($regexp, $contents, $blocks);