Dotclear

Changeset 1490


Ignore:
Timestamp:
09/24/09 13:57:07 (14 years ago)
Author:
xave
Message:

a first look at plugins.

Location:
plugins/mkcompat
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/mkcompat/class.dc.mkcompat216.php

    r1489 r1490  
    4545          return false; 
    4646     } 
    47  
     47      
    4848     public static function themeUpgrade ($theme_path) 
    4949     { 
     
    7171          if ($count > 0) files::putContent($filename,$newcontents); 
    7272     } 
     73      
     74     public static function pluginNeedUpgrade ($theme_path) 
     75     { 
     76          $dir_contents = files::getDirList($theme_path); 
     77          foreach ($dir_contents['files'] as $file) 
     78          { 
     79               if (files::getExtension($file) == 'js') 
     80                    if (strpos(file_get_contents($file),'[@') != false) 
     81                         return true; 
     82               if (files::getExtension($file) == 'php') 
     83                    if (strpos($contents = file_get_contents($file),'[@') != false) 
     84                         if (preg_match_all('/<script(.*?)<\/script>/s',$contents,$scripts)) 
     85                         { 
     86                              foreach ($scripts[0] as $script) 
     87                                   if (strpos($script,'[@') != false) 
     88                                        return true; 
     89                         } 
     90          } 
     91          return false; 
     92     } 
    7393} 
    7494?> 
  • plugins/mkcompat/index.php

    r1489 r1490  
    6565               if ($v['root_writable']) 
    6666               { 
    67                     echo "\n".'<td><form action="'.$p_url.'" method="post">'. 
    68                     form::hidden('root',$v['root'])."\n". 
    69                     form::hidden('type','theme')."\n". 
    70                     form::hidden('name',$v['name'])."\n". 
    71                     $core->formNonce()."\n". 
    72                     '<input type="submit" name="action" value="'.__('Upgrade').'"></input>'."\n". 
    73                     '</form></td>'."\n"; 
     67                    echo '<td><form action="'.$p_url.'" method="post">'. 
     68                    form::hidden('root',$v['root']). 
     69                    form::hidden('type','theme'). 
     70                    form::hidden('name',$v['name']). 
     71                    $core->formNonce(). 
     72                    '<input type="submit" name="action" value="'.__('Upgrade').'"></input>'. 
     73                    '</form></td>'; 
    7474               } else { 
    7575                    echo '<td>'.__('You do not have sufficient rights to upgrade this theme.').'</td>'; 
     
    8585     } 
    8686?> 
     87      <h2><?php echo __('Plugins requiring an upgrade'); ?></h2> 
     88<?php 
     89     $plugins = $core->plugins->getModules(); 
     90      
     91     foreach ($plugins as $k => $v) 
     92     { 
     93          if (!mkcompat::pluginNeedUpgrade($v['root'])) unset($plugins[$k]); 
     94     } 
     95      
     96     if (count($plugins) > 0) 
     97     { 
     98          echo '<table>'; 
     99          foreach ($plugins as $k => $v) 
     100          { 
     101               echo '<tr><th title="'.$v['desc'].'">'.$v['name'].'</th>'. 
     102                    '<td>'.$v['author'].'</td>'. 
     103                    '<td>'.$v['version'].'</td>'; 
     104                
     105               if ($v['root_writable']) 
     106               { 
     107                    echo '<td><form action="'.$p_url.'" method="post">'. 
     108                    form::hidden('root',$v['root']). 
     109                    form::hidden('type','plugin'). 
     110                    form::hidden('name',$v['name']). 
     111                    $core->formNonce(). 
     112                    '<input type="submit" name="action" value="'.__('Upgrade').'"></input>'. 
     113                    '</form></td>'; 
     114               } else { 
     115                    echo '<td>'.__('You do not have sufficient rights to upgrade this plugin.').'</td>'; 
     116               } 
     117                     
     118               echo '</tr>'; 
     119          } 
     120          echo '</table>'; 
     121     } 
     122     else 
     123     { 
     124          echo '<p>'.__('Upgrade does not seem to be required for any plugin.').'</p>'; 
     125     } 
     126?> 
    87127  </body> 
    88128</html> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map