[wp-trac] Re: [WordPress Trac] #2781: Notice: Undefined variable: template in c:\Inetpub\wwwroot\wp\wp-admin\admin-functions.php on line 1504

WordPress Trac wp-trac at lists.automattic.com
Sat Jun 3 19:31:40 GMT 2006


#2781: Notice: Undefined variable: template in c:\Inetpub\wwwroot\wp\wp-admin
\admin-functions.php on line 1504
----------------------------+-----------------------------------------------
       Id:  2781            |      Status:  new                     
Component:  Administration  |    Modified:  Sat Jun  3 19:31:40 2006
 Severity:  normal          |   Milestone:                          
 Priority:  normal          |     Version:  2.0.2                   
    Owner:  anonymous       |    Reporter:  Denis-de-Bernardy       
----------------------------+-----------------------------------------------
Comment (by Denis-de-Bernardy):

 likewise:


 {{{
 function get_theme_data($theme_file) {
         $theme_data = implode('', file($theme_file));
         preg_match("|Theme Name:(.*)|i", $theme_data, $theme_name);
         preg_match("|Theme URI:(.*)|i", $theme_data, $theme_uri);
         preg_match("|Description:(.*)|i", $theme_data, $description);
         preg_match("|Author:(.*)|i", $theme_data, $author_name);
         preg_match("|Author URI:(.*)|i", $theme_data, $author_uri);
         preg_match("|Template:(.*)|i", $theme_data, $template);
         if ( preg_match("|Version:(.*)|i", $theme_data, $version) )
                 $version = $version[1];
         else
                 $version ='';
         if ( preg_match("|Status:(.*)|i", $theme_data, $status) )
                 $status = $status[1];
         else
                 $status ='publish';

         $description = isset($description[1]) ?
 wptexturize($description[1]) : '';

         $name = isset($theme_name[1]) ? $theme_name[1] : '';
         $name = trim($name);
         $theme = $name;

         if ( isset($author_name[1]) && isset($author_uri[1]) && '' ==
 $author_uri[1] ) {
                 $author = $author_name[1];
         } elseif (isset($author_name[1]) && isset($author_uri[1])) {
                 $author = '<a href="' . $author_uri[1] . '" title="' .
 __('Visit author homepage') . '">' . $author_name[1] . '</a>';
         } else {
                 $author = '';
         }

         $template = isset($template[1]) ? $template[1] : '';

         return array('Name' => $name, 'Title' => $theme, 'Description' =>
 $description, 'Author' => $author, 'Version' => $version, 'Template' =>
 $template, 'Status' => $status);
 }

 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2781>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list