Dotclear


Ignore:
Timestamp:
06/06/10 00:25:20 (13 years ago)
Author:
JcDenis
Message:

licenseBootstrap 0.3

  • Switched to DC 2.2
  • Changed admin interface (easy, light, fast)
Location:
plugins/licenseBootstrap
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • plugins/licenseBootstrap/_admin.php

    r1561 r2300  
    33# This file is part of licenseBootstrap, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    1818     'plugin.php?p=licenseBootstrap','index.php?pf=licenseBootstrap/icon.png', 
    1919     preg_match('/plugin.php\?p=licenseBootstrap(&.*)?$/',$_SERVER['REQUEST_URI']), 
    20      $core->auth->check('admin',$core->blog->id)); 
     20     $core->auth->check('admin',$core->blog->id) 
     21); 
    2122?> 
  • plugins/licenseBootstrap/_define.php

    r1866 r2300  
    33# This file is part of licenseBootstrap, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    1717     /* Description*/         "Add license to your plugins and themes", 
    1818     /* Author */        "JC Denis", 
    19      /* Version */       '0.2', 
     19     /* Version */       '0.3', 
    2020     /* Permissions */        null 
    2121); 
    22      /* date */          #20091109 
     22     /* date */          #20100604 
    2323?> 
  • plugins/licenseBootstrap/_install.php

    r1866 r2300  
    33# This file is part of licenseBootstrap, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    2020try 
    2121{ 
    22      if (!version_compare(DC_VERSION,'2.1.5','>=')) { 
    23  
    24           throw new Exception('licenseBootstrap plugin requires Dotclear 2.1.5'); 
     22     if (version_compare(DC_VERSION,'2.2-beta','<')) 
     23     { 
     24          throw new Exception('licenseBootstrap plugin requires Dotclear 2.2'); 
    2525     } 
    2626     $default_license = 'gpl2'; 
     
    2828     $default_headers = licenseBootstrap::getDefaultLicenses(); 
    2929 
    30      $s =& $core->blog->settings; 
    31  
    32      $s->setNamespace('licenseBootstrap'); 
    33      $s->put('licensebootstrap_addfull',true); 
    34      $s->put('licensebootstrap_overwrite',false); 
    35      $s->put('licensebootstrap_license',$default_license); 
    36      $s->put('licensebootstrap_files_exts', 
    37           licenseBootstrap::encode($default_exts)); 
    38      $s->put('licensebootstrap_licenses_headers', 
    39           licenseBootstrap::encode($default_headers)); 
    40      $s->put('licensebootstrap_exclusion','/(\/locales\/)/'); 
    41      $s->put('licensebootstrap_packman_behavior',false); 
    42      $s->put('licensebootstrap_translater_behavior',false); 
    43      $s->setNamespace('system'); 
     30     $core->blog->settings->addNamespace('licenseBootstrap'); 
     31     $core->blog->settings->licenseBootstrap->put('licensebootstrap_addfull',true,'boolean','Add complete licence file',false,true); 
     32     $core->blog->settings->licenseBootstrap->put('licensebootstrap_overwrite',false,'boolean','Overwrite existing licence',false,true); 
     33     $core->blog->settings->licenseBootstrap->put('licensebootstrap_license',$default_license,'string','default licence',false,true); 
     34     $core->blog->settings->licenseBootstrap->put('licensebootstrap_files_exts',licenseBootstrap::encode($default_exts),'string','List of files to include licenceEnable xiti',false,true); 
     35     $core->blog->settings->licenseBootstrap->put('licensebootstrap_licenses_headers',licenseBootstrap::encode($default_headers),'string','File header licence text',false,true); 
     36     $core->blog->settings->licenseBootstrap->put('licensebootstrap_exclusion','/(\/locales\/)/','string','Path to exlude',false,true); 
     37     $core->blog->settings->licenseBootstrap->put('licensebootstrap_packman_behavior',false,'boolean','Add LicenceBootstrap to plugin pacKman',false,true); 
     38     $core->blog->settings->licenseBootstrap->put('licensebootstrap_translater_behavior',false,'boolean','Add LicenceBootstrap to plugin translater',false,true); 
    4439 
    4540     $core->setVersion('licenseBootstrap',$new_version); 
  • plugins/licenseBootstrap/_prepend.php

    r1866 r2300  
    33# This file is part of licenseBootstrap, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    1515global $__autoload,$core; 
    1616 
    17 $__autoload['licenseBootstrap'] =  
    18      dirname(__FILE__).'/inc/class.license.bootstrap.php'; 
    19 $__autoload['libLicenseBootstrap'] =  
    20      dirname(__FILE__).'/inc/lib.license.bootstrap.index.php'; 
     17$__autoload['licenseBootstrap'] = dirname(__FILE__).'/inc/class.license.bootstrap.php'; 
     18$__autoload['libLicenseBootstrap'] = dirname(__FILE__).'/inc/lib.license.bootstrap.index.php'; 
    2119 
    22 if ($core->blog->settings->licensebootstrap_packman_behavior) 
     20$core->blog->settings->addNamespace('licenseBootstrap'); 
     21if ($core->blog->settings->licenseBootstrap->licensebootstrap_packman_behavior) 
    2322{ 
    24      $core->addBehavior( 
    25           'packmanBeforeCreatePackage', 
    26           array('licenseBootstrap','packmanBeforeCreatePackage') 
    27      ); 
     23     $core->addBehavior('packmanBeforeCreatePackage',array('licenseBootstrap','packmanBeforeCreatePackage')); 
    2824} 
    29  
    30 if ($core->blog->settings->licensebootstrap_translater_behavior) 
     25if ($core->blog->settings->licenseBootstrap->licensebootstrap_translater_behavior) 
    3126{ 
    32      $core->addBehavior( 
    33           'dcTranslaterAfterWriteLangFile', 
    34           array('licenseBootstrap','dcTranslaterAfterWriteLangFile') 
    35      ); 
     27     $core->addBehavior('dcTranslaterAfterWriteLangFile',array('licenseBootstrap','dcTranslaterAfterWriteLangFile')); 
    3628} 
    3729?> 
  • plugins/licenseBootstrap/_uninstall.php

    r1561 r2300  
    33# This file is part of licenseBootstrap, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    3131     /* action */ 'delete_all', 
    3232     /* ns */ 'licenseBootstrap', 
    33      /* description */ __('delete all licenseBootstrap settings') 
     33     /* description */ sprintf(__('delete all %s settings'),'licenseBootstrap') 
    3434); 
    3535 
     
    3838     /* action */ 'delete', 
    3939     /* ns */ 'licenseBootstrap', 
    40      /* description */ __('delete licenseBootstrap plugin files') 
     40     /* description */ sprintf(__('delete %s plugin files'),'licenseBootstrap') 
    4141); 
    4242?> 
  • plugins/licenseBootstrap/inc/class.license.bootstrap.php

    r1866 r2300  
    33# This file is part of licenseBootstrap, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    2323     public $overwrite; 
    2424     public $exclusion; 
    25  
     25      
    2626     public function __construct($core,$extensions=null,$license=null,$head=null,$addfull=true,$overwrite=false,$exclusion='') 
    2727     { 
     
    3030          $this->exclusion = (string) $exclusion; 
    3131          $this->license = (string) $license; 
    32  
     32           
    3333          $this->extensions = self::getDefaultExtensions($extensions); 
    3434          $this->head = self::getDefaultLicenses('head',$license,$head); 
    3535          $this->full = self::getDefaultLicenses('full',$license); 
    3636     } 
    37  
     37      
    3838     public function moduleInfo($type,$id) 
    3939     { 
    4040          $info = array(); 
    41  
     41           
    4242          if ($type == 'plugin') 
    4343          { 
     
    5353               $type = ''; 
    5454          } 
    55  
     55           
    5656          if ($type && $modules->moduleExists($id)) 
    5757          { 
     
    6161               $info['user_email'] = $this->core->auth->getInfo('user_email'); 
    6262          } 
    63  
     63           
    6464          return $info; 
    6565     } 
    66  
     66      
    6767     public function writeModuleLicense($type,$id) 
    6868     { 
    6969          $info = $this->moduleInfo($type,$id); 
    70  
     70           
    7171          # Try if root is writable 
    7272          if (!isset($info['root']) || !is_writable($info['root'])) 
     
    7575          } 
    7676          $root = $info['root']; 
    77  
     77           
    7878          # Get license text 
    7979          $head = self::parseInfo($type,$id,$info,$this->head[$this->license]); 
    8080          $full = self::parseInfo($type,$id,$info,$this->full[$this->license]); 
    81  
     81           
    8282          # Get files from module root 
    8383          $files = self::scandir($root); 
     
    8686               throw new Exception('Nothing to do'); 
    8787          } 
    88  
     88           
    8989          # Write full license file 
    9090          if (!file_exists($root.'/LICENSE') || $overwrite) 
     
    9292               files::putContent($root.'/LICENSE',$full); 
    9393          } 
    94  
     94           
    9595          # Write license header in files 
    9696          foreach($files as $file) 
    9797          { 
    9898               if (!is_file($root.'/'.$file)) continue; 
    99  
     99                
    100100               if (!empty($this->exclusion)) 
    101101               { 
    102102                    if (preg_match($this->exclusion,$file)) continue; 
    103103               } 
    104  
     104                
    105105               $ext = files::getExtension($file) ; 
    106106               $func = 'filesLicenseBootstrap::'.$ext.'File'; 
    107107               if (!in_array($ext,$this->extensions) || !is_callable($func)) continue; 
    108  
     108                
    109109               $content = file_get_contents($root.'/'.$file); 
    110  
    111110               $content = call_user_func($func,$content,$head,$this->overwrite); 
    112  
     111                
    113112               if (!empty($content)) 
    114113               { 
     
    118117          return true; 
    119118     } 
    120  
     119      
    121120     public function addFileLicense($type,$id,$file,$content) 
    122121     { 
    123122          $info = $this->moduleInfo($type,$id); 
    124  
    125123          $head = self::parseInfo($type,$id,$info,$this->head); 
    126  
     124           
    127125          if (!empty($this->exclusion)) 
    128126          { 
    129127               if (preg_match($this->exclusion,$file)) return $content; 
    130128          } 
    131  
     129           
    132130          $ext = files::getExtension($file) ; 
    133131          $func = 'filesLicenseBootstrap::'.$ext.'File'; 
    134132          if (!in_array($ext,$this->extensions) || !is_callable($func)) return $content; 
    135  
     133           
    136134          return call_user_func($func,$content,$head[$this->license],$this->overwrite); 
    137135     } 
    138  
     136      
    139137     public static function getDefaultExtensions($exts=null) 
    140138     { 
     
    142140          if (null === $exts) $exts = $default; 
    143141          elseif (!is_array($exts)) $exts = array($exts); 
    144  
     142           
    145143          return array_intersect($default,$exts); 
    146144     } 
    147  
     145      
    148146     public static function getDefaultLicenses($type='head',$license=null,$content=null) 
    149147     { 
     
    154152               $rs = array($license => $content); 
    155153          } 
    156  
     154           
    157155          if ($license && !$content) 
    158156          { 
     
    163161               } 
    164162          } 
    165  
     163           
    166164          if (!$license) 
    167165          { 
     
    177175          return $rs; 
    178176     } 
    179  
     177           
    180178     private function parseInfo($type,$id,$info,$text) 
    181179     { 
     
    204202          ); 
    205203     } 
    206  
     204      
    207205     private static function scandir($path,$dir='',$res=array()) 
    208206     { 
    209207          $path = path::real($path); 
    210208          if (!is_dir($path) || !is_readable($path)) return array(); 
    211  
     209           
    212210          $files = files::scandir($path); 
    213  
     211           
    214212          foreach($files AS $file) 
    215213          { 
     
    228226          return $res; 
    229227     } 
    230  
     228      
    231229     public static function encode($a) 
    232230     { 
    233231          return base64_encode(serialize($a)); 
    234232     } 
    235  
     233      
    236234     public static function decode($a) 
    237235     { 
    238236          return unserialize(base64_decode($a)); 
    239237     } 
    240  
     238      
    241239     public static function packmanBeforeCreatePackage($info,$a,$b,$c,$d) 
    242240     { 
    243241          global $core; 
    244  
    245           $s =& $core->blog->settings; 
    246  
    247           $addfull = (boolean) $s->licensebootstrap_addfull; 
    248           $overwrite = (boolean) $s->licensebootstrap_overwrite; 
    249           $exclusion = $s->licensebootstrap_exclusion; 
    250  
    251           $license = $s->licensebootstrap_license; 
     242           
     243          $core->blog->settings->addNamespace('licenseBootstrap'); 
     244           
     245          $addfull = (boolean) $core->blog->settings->licenseBootstrap->licensebootstrap_addfull; 
     246          $overwrite = (boolean) $core->blog->settings->licenseBootstrap->licensebootstrap_overwrite; 
     247          $exclusion = $core->blog->settings->licenseBootstrap->licensebootstrap_exclusion; 
     248           
     249          $license = $core->blog->settings->licenseBootstrap->licensebootstrap_license; 
    252250          if (empty($license)) $license = 'gpl2'; 
    253  
    254           $exts = licenseBootstrap::decode($s->licensebootstrap_files_exts); 
     251           
     252          $exts = licenseBootstrap::decode($core->blog->settings->licenseBootstrap->licensebootstrap_files_exts); 
    255253          if (!is_array($exts)) $exts = self::getDefaultExtensions(); 
    256  
    257           $headers = licenseBootstrap::decode($s->licensebootstrap_licenses_headers); 
     254           
     255          $headers = licenseBootstrap::decode($core->blog->settings->licenseBootstrap->licensebootstrap_licenses_headers); 
    258256          if (!is_array($headers)) $headers = self::getDefaulLicenses(); 
    259  
     257           
    260258          $license = new licenseBootstrap($core,$exts,$license,$headers[$license],$addfull,$overwrite,$exclusion); 
    261259          $license->writeModuleLicense($info['type'],$info['id']); 
     
    265263     { 
    266264          if (!$f) return; 
    267  
     265           
    268266          global $core; 
    269  
     267           
    270268          $id = ''; 
    271269          $type = 'theme'; 
    272270          $dir = path::real($file); 
    273  
     271           
    274272          # Is a plugin 
    275273          $plugins_roots = explode(PATH_SEPARATOR,DC_PLUGINS_ROOT); 
     
    314312          # Not a plugin nor theme 
    315313          if (empty($id)) return; 
    316  
    317           $s =& $core->blog->settings; 
    318  
    319           $addfull = (boolean) $s->licensebootstrap_addfull; 
    320           $overwrite = (boolean) $s->licensebootstrap_overwrite; 
    321           $exclusion = $s->licensebootstrap_exclusion; 
    322  
    323           $license = $s->licensebootstrap_license; 
     314           
     315          $core->blog->settings->addNamespace('licenseBootstrap'); 
     316           
     317          $addfull = (boolean) $core->blog->settings->licenseBootstrap->licensebootstrap_addfull; 
     318          $overwrite = (boolean) $core->blog->settings->licenseBootstrap->licensebootstrap_overwrite; 
     319          $exclusion = $core->blog->settings->licenseBootstrap->licensebootstrap_exclusion; 
     320           
     321          $license = $core->blog->settings->licenseBootstrap->licensebootstrap_license; 
    324322          if (empty($license)) $license = 'gpl2'; 
    325  
    326           $exts = licenseBootstrap::decode($s->licensebootstrap_files_exts); 
     323           
     324          $exts = licenseBootstrap::decode($core->blog->settings->licenseBootstrap->licensebootstrap_files_exts); 
    327325          if (!is_array($exts)) $exts = self::getDefaultExtensions(); 
    328  
    329           $headers = licenseBootstrap::decode($s->licensebootstrap_licenses_headers); 
     326           
     327          $headers = licenseBootstrap::decode($core->blog->settings->licenseBootstrap->licensebootstrap_licenses_headers); 
    330328          if (!is_array($headers)) $headers = self::getDefaultLicenses(); 
    331  
     329           
    332330          $license = new licenseBootstrap($core,$exts,$license,$headers[$license],$addfull,$overwrite,$exclusion); 
    333331          $content = $license->addFileLicense($type,$id,$file,$content); 
    334  
     332           
    335333          files::putContent($file,$content); 
    336334     } 
  • plugins/licenseBootstrap/inc/lib.license.bootstrap.index.php

    r1561 r2300  
    33# This file is part of licenseBootstrap, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    1818     { 
    1919          if (!in_array($type,array('theme','plugin'))) return; 
    20  
    21           echo  
    22           '<div class="multi-part" id="'.$type.'" title="'.__($type).'">'; 
    23  
     20           
     21          echo '<div>'. 
     22          '<h3>'.($type == 'theme' ? __('Themes') : __('Extensions')).'</h3>'; 
     23           
    2424          if (isset($_REQUEST['done']) && $_REQUEST['tab'] == $type) 
     25          { 
    2526               echo '<p class="message">'.__('License successfully included').'</p>'; 
    26  
     27          } 
     28           
    2729          if (!empty($modules) && is_array($modules)) 
    2830          { 
    2931               echo 
    30                '<form action="plugin.php" method="post">'. 
     32               '<form id="module-form" action="plugin.php" method="post">'. 
    3133               '<table class="clear"><tr>'. 
    3234               '<th class="nowrap">'.__('Name').'</th>'. 
     
    3638               '<th class="nowrap">'.__('Author').'</th>'. 
    3739               '</tr>'; 
    38  
     40                
    3941               foreach ($modules as $id => $module) 
    4042               {     
     
    5456               '<p><input type="hidden" name="p" value="licenseBootstrap" />'. 
    5557               '<input type="hidden" name="type" value="'.$type.'" />'; 
    56  
     58                
    5759               if ($redir) 
     60               { 
    5861                    echo '<input type="hidden" name="redir" value="'.html::escapeHTML($redir).'" />'; 
    59  
     62               } 
     63                
    6064               echo 
    6165               '<input type="submit" name="add_license" value="'.__('Add license').'" />'. 
     
    7074     } 
    7175} 
    72  
    7376?> 
  • plugins/licenseBootstrap/index.php

    r1866 r2300  
    33# This file is part of licenseBootstrap, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    1515 
    1616$default_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : 'setting'; 
     17$section = isset($_REQUEST['section']) ? $_REQUEST['section'] : ''; 
    1718 
    1819# Default lists 
     
    2021$default_headers = licenseBootstrap::getDefaultLicenses(); 
    2122 
    22 # Modules lists 
    23 $themes = new dcModules($core); 
    24 $themes->loadModules($core->blog->themes_path,null); 
    25 $plugins = $core->plugins; 
    26  
    2723# Settings 
    28 $s =& $core->blog->settings; 
    29 $addfull = (boolean) $s->licensebootstrap_addfull; 
    30 $overwrite = (boolean) $s->licensebootstrap_overwrite; 
    31 $license = $s->licensebootstrap_license; 
     24$core->blog->settings->addNamespace('licenseBootstrap'); 
     25$addfull = (boolean) $core->blog->settings->licenseBootstrap->licensebootstrap_addfull; 
     26$overwrite = (boolean) $core->blog->settings->licenseBootstrap->licensebootstrap_overwrite; 
     27$license = $core->blog->settings->licenseBootstrap->licensebootstrap_license; 
    3228if (empty($license)) $license = 'gpl2'; 
    33 $files_exts = licenseBootstrap::decode($s->licensebootstrap_files_exts); 
     29$files_exts = licenseBootstrap::decode($core->blog->settings->licenseBootstrap->licensebootstrap_files_exts); 
    3430if (!is_array($files_exts)) $files_exts = $default_exts; 
    35 $licenses_headers = licenseBootstrap::decode($s->licensebootstrap_licenses_headers); 
     31$licenses_headers = licenseBootstrap::decode($core->blog->settings->licenseBootstrap->licensebootstrap_licenses_headers); 
    3632if (!is_array($licenses_headers)) $licenses_headers = array(); 
    37 $exclusion = $s->licensebootstrap_exclusion; 
    38  
    39 # Add to packman 
    40 $packman_behavior = $s->licensebootstrap_packman_behavior; 
    41 # Add to translater 
    42 $translater_behavior = $s->licensebootstrap_translater_behavior; 
     33$exclusion = $core->blog->settings->licenseBootstrap->licensebootstrap_exclusion; 
     34$packman_behavior = $core->blog->settings->licenseBootstrap->licensebootstrap_packman_behavior; 
     35$translater_behavior = $core->blog->settings->licenseBootstrap->licensebootstrap_translater_behavior; 
    4336 
    4437try 
     
    4740     if (isset($_POST['reset_settings'])) 
    4841     { 
    49           $s->setNamespace('licenseBootstrap'); 
    50           $s->put('licensebootstrap_addfull',true); 
    51           $s->put('licensebootstrap_overwrite',false); 
    52           $s->put('licensebootstrap_license','gpl2'); 
    53           $s->put('licensebootstrap_files_exts', 
    54                licenseBootstrap::encode($default_exts)); 
    55           $s->put('licensebootstrap_licenses_headers', 
    56                licenseBootstrap::encode($default_headers)); 
    57           $s->put('licensebootstrap_exclusion',''); 
    58           $s->put('licensebootstrap_packman_behavior',false); 
    59           $s->put('licensebootstrap_translater_behavior',false); 
    60           $s->setNamespace('system'); 
    61  
    62           http::redirect($p_url.'&tab=setting&done=1'); 
    63      } 
    64  
     42          $core->blog->settings->licenseBootstrap->put('licensebootstrap_addfull',true); 
     43          $core->blog->settings->licenseBootstrap->put('licensebootstrap_overwrite',false); 
     44          $core->blog->settings->licenseBootstrap->put('licensebootstrap_license','gpl2'); 
     45          $core->blog->settings->licenseBootstrap->put('licensebootstrap_files_exts',licenseBootstrap::encode($default_exts)); 
     46          $core->blog->settings->licenseBootstrap->put('licensebootstrap_licenses_headers',licenseBootstrap::encode($default_headers)); 
     47          $core->blog->settings->licenseBootstrap->put('licensebootstrap_exclusion',''); 
     48          $core->blog->settings->licenseBootstrap->put('licensebootstrap_packman_behavior',false); 
     49          $core->blog->settings->licenseBootstrap->put('licensebootstrap_translater_behavior',false); 
     50           
     51          http::redirect($p_url.'&tab=setting&section='.$section.'&done=1'); 
     52     } 
     53      
    6554     # Save settings 
    6655     if (isset($_POST['save_settings'])) 
     
    6958          $overwrite = !empty($_POST['overwrite']); 
    7059          $license = $_POST['license']; 
    71           $files_exts = is_array($_POST['files_exts']) ?  
    72                $_POST['files_exts'] : array(); 
    73           $licenses_headers = is_array($_POST['licenses_headers']) ?  
    74                $_POST['licenses_headers'] : array(); 
     60          $files_exts = is_array($_POST['files_exts']) ? $_POST['files_exts'] : array(); 
     61          $licenses_headers = is_array($_POST['licenses_headers']) ? $_POST['licenses_headers'] : array(); 
    7562          $exclusion = $_POST['exclusion']; 
    7663          $packman_behavior = !empty($_POST['packman_behavior']); 
    7764          $translater_behavior = !empty($_POST['translater_behavior']); 
    78  
    79           $s->setNamespace('licenseBootstrap'); 
    80           $s->put('licensebootstrap_addfull',$addfull); 
    81           $s->put('licensebootstrap_overwrite',$overwrite); 
    82           $s->put('licensebootstrap_license',$license); 
    83           $s->put('licensebootstrap_files_exts', 
    84                licenseBootstrap::encode($files_exts)); 
    85           $s->put('licensebootstrap_licenses_headers', 
    86                licenseBootstrap::encode($licenses_headers)); 
    87           $s->put('licensebootstrap_exclusion',$exclusion); 
    88           $s->put('licensebootstrap_packman_behavior',$packman_behavior); 
    89           $s->put('licensebootstrap_translater_behavior',$translater_behavior); 
    90           $s->setNamespace('system'); 
    91  
    92           http::redirect($p_url.'&tab=setting&done=1'); 
     65           
     66          $core->blog->settings->licenseBootstrap->put('licensebootstrap_addfull',$addfull); 
     67          $core->blog->settings->licenseBootstrap->put('licensebootstrap_overwrite',$overwrite); 
     68          $core->blog->settings->licenseBootstrap->put('licensebootstrap_license',$license); 
     69          $core->blog->settings->licenseBootstrap->put('licensebootstrap_files_exts',licenseBootstrap::encode($files_exts)); 
     70          $core->blog->settings->licenseBootstrap->put('licensebootstrap_licenses_headers',licenseBootstrap::encode($licenses_headers)); 
     71          $core->blog->settings->licenseBootstrap->put('licensebootstrap_exclusion',$exclusion); 
     72          $core->blog->settings->licenseBootstrap->put('licensebootstrap_packman_behavior',$packman_behavior); 
     73          $core->blog->settings->licenseBootstrap->put('licensebootstrap_translater_behavior',$translater_behavior); 
     74           
     75          http::redirect($p_url.'&tab=setting&section='.$section.'&done=1'); 
    9376     } 
    9477     # Object 
    9578     $LB = new licenseBootstrap($core,$files_exts,$license,$licenses_headers[$license],$addfull,$overwrite,$exclusion); 
    96  
    97  
     79      
    9880     # Add license to files 
    9981     if (isset($_POST['add_license'])) 
    10082     { 
    101           if (!isset($_POST['type'])  
    102            || empty($_POST['modules']) || !is_array($_POST['modules'])) 
     83          if (!isset($_POST['type']) || empty($_POST['modules']) || !is_array($_POST['modules'])) 
    10384          { 
    10485               throw new Exception('Nothing to pack'); 
    10586          } 
    106  
     87           
    10788          $type = $_POST['type'] == 'theme' ? 'theme' : 'plugin'; 
    10889          $modules = array_keys($_POST['modules']); 
    109  
     90           
    11091          foreach ($modules as $id) 
    11192          { 
    11293               $LB->writeModuleLicense($type,$id); 
    11394          } 
    114  
     95           
    11596          if (!empty($_POST['redir'])) 
    11697          { 
     
    126107 
    127108# Display 
    128 echo ' 
    129 <html><head><title>'.__('License bootstrap').'</title> 
    130 '.dcPage::jsLoad('js/_posts_list.js').dcPage::jsPageTabs($default_tab).' 
    131 </head><body> 
    132 <h2>'.html::escapeHTML($core->blog->name).' &rsaquo; '. 
    133 __('License bootstrap').'</h2>'; 
    134  
    135 libLicenseBootstrap::tab($plugins->getModules(),'plugin'); 
    136 libLicenseBootstrap::tab($themes->getModules(),'theme'); 
    137  
    138 echo '<div class="multi-part" id="setting" title="'. __('Settings').'">'; 
    139  
    140 if (isset($_REQUEST['done']) && $default_tab == 'setting') 
    141      echo '<p class="message">'.__('Configuration successfully saved').'</p>'; 
    142  
    143 echo ' 
    144 <form method="post" action="'.$p_url.'"> 
    145 <fieldset><legend>'.__('Files').'</legend> 
    146 <p><label class="classic">'. 
    147 form::checkbox(array('overwrite'),'1',$overwrite).' '. 
    148 __('Overwrite existing license').'</label></p> 
    149 <p><label class="classic">'. 
    150 form::checkbox(array('addfull'),'1',$addfull).' '. 
    151 __('Add full LICENSE file to module root').'</label></p>'; 
    152  
    153 foreach($default_exts as $ext) 
    154 { 
     109echo  
     110'<html><head><title>'.__('License bootstrap').'</title>'. 
     111dcPage::jsLoad('index.php?pf=licenseBootstrap/js/main.js'). 
     112'<script type="text/javascript">'."\n//<![CDATA[\n". 
     113dcPage::jsVar('jcToolsBox.prototype.text_wait',__('Please wait')). 
     114dcPage::jsVar('jcToolsBox.prototype.section',$section). 
     115"\n//]]>\n</script>\n". 
     116'</head><body>'. 
     117'<h2>'.__('License bootstrap'). 
     118' - <a class="button" href="'.$p_url.'&amp;tab=plugin">'.__('Plugins').'</a>'. 
     119' - <a class="button" href="'.$p_url.'&amp;tab=theme">'.__('Themes').'</a>'. 
     120'</h2><hr class="clear" />'; 
     121 
     122if ($default_tab == 'plugin') 
     123{ 
     124     libLicenseBootstrap::tab($core->plugins->getModules(),'plugin'); 
     125} 
     126elseif ($default_tab == 'theme') 
     127{ 
     128     $themes = new dcModules($core); 
     129     $themes->loadModules($core->blog->themes_path,null); 
     130     libLicenseBootstrap::tab($themes->getModules(),'theme'); 
     131} 
     132elseif ($default_tab == 'setting') 
     133{ 
     134     echo '<div><h3>'. __('Settings').'</h3>'; 
     135      
     136     if (isset($_REQUEST['done'])) 
     137     { 
     138          echo '<p class="message">'.__('Configuration successfully saved').'</p>'; 
     139     } 
    155140     echo ' 
     141     <form id="setting-form" method="post" action="'.$p_url.'"> 
     142     <fieldset id="settingfile"><legend>'.__('Files').'</legend> 
    156143     <p><label class="classic">'. 
    157      form::checkbox(array('files_exts[]'),$ext,in_array($ext,$files_exts)).' '. 
    158      sprintf(__('Add license to the header of %s files'),$ext).'</label></p>'; 
    159 } 
    160  
    161 echo ' 
    162 <p><label>'.__('Exclusion:'). 
    163 form::field('exclusion',60,255,html::escapeHTML($exclusion)).' 
    164 </label></p> 
    165 </fieldset> 
    166 <fieldset><legend>'.__('Tricks').'</legend> 
    167 <p><label class="classic">'. 
    168 form::checkbox(array('packman_behavior'),'1',$packman_behavior).' '. 
    169 __('Add license before create package with plugin pacKman').'</label></p> 
    170 <p><label class="classic">'. 
    171 form::checkbox(array('translater_behavior'),'1',$translater_behavior).' '. 
    172 __('Add license after create lang file with plugin translater').'</label></p> 
    173 </fieldset> 
    174 <fieldset><legend>'.__('Headers').'</legend>'; 
    175  
    176 foreach($default_headers as $type => $header) 
    177 { 
    178      $text = isset($licenses_headers[$type]) ? 
    179           $licenses_headers[$type] :  
    180           $header; 
    181  
     144     form::checkbox(array('overwrite'),'1',$overwrite).' '. 
     145     __('Overwrite existing license').'</label></p> 
     146     <p><label class="classic">'. 
     147     form::checkbox(array('addfull'),'1',$addfull).' '. 
     148     __('Add full LICENSE file to module root').'</label></p>'; 
     149      
     150     foreach($default_exts as $ext) 
     151     { 
     152          echo ' 
     153          <p><label class="classic">'. 
     154          form::checkbox(array('files_exts[]'),$ext,in_array($ext,$files_exts)).' '. 
     155          sprintf(__('Add license to the header of %s files'),$ext).'</label></p>'; 
     156     } 
     157      
    182158     echo ' 
    183      <p><label class="classic">'. 
    184      form::radio(array('license'),$type,($license == $type)).' '. 
    185      sprintf(__('License %s:'),$type).'</label></p> 
    186      <p class="area">'. 
    187      form::textarea('licenses_headers['.$type.']',50,10,html::escapeHTML($text)).' 
    188      </p>'; 
    189 } 
    190 echo ' 
    191 </fieldset> 
    192 <p class="clear"> 
    193 <input type="submit" name="save_settings" value="'.__('save').'" />  
    194 <input type="submit" name="reset_settings" value="'.__('Reset settings').'" />'. 
    195 $core->formNonce(). 
    196 form::hidden(array('tab'),'settings'). 
    197 form::hidden(array('p'),'licenseBootstrap').' 
    198 </p> 
    199 </form> 
    200 </div> 
    201 '.dcPage::helpBlock('licenseBootstrap').' 
    202  
    203 <hr class="clear"/> 
    204 <p class="right"> 
     159     <p><label>'.__('Exclusion:'). 
     160     form::field('exclusion',60,255,html::escapeHTML($exclusion)).' 
     161     </label></p> 
     162     </fieldset> 
     163      
     164     <fieldset id="settingheader"><legend>'.__('Headers').'</legend>'; 
     165      
     166     foreach($default_headers as $type => $header) 
     167     { 
     168          $text = isset($licenses_headers[$type]) ? $licenses_headers[$type] : $header; 
     169           
     170          echo ' 
     171          <p><label class="classic">'. 
     172          form::radio(array('license'),$type,($license == $type)).' '. 
     173          sprintf(__('License %s:'),$type).'</label></p> 
     174          <p class="area">'. 
     175          form::textarea('licenses_headers['.$type.']',50,10,html::escapeHTML($text)).' 
     176          </p>'; 
     177     } 
     178     echo '</fieldset>'; 
     179      
     180     if ($core->plugins->moduleExists('pacKman') || $core->plugins->moduleExists('translater')) 
     181     { 
     182          echo '<fieldset id="settingbehavior"><legend>'.__('Behaviors').'</legend>'; 
     183           
     184          if ($core->plugins->moduleExists('pacKman')) 
     185          { 
     186               echo ' 
     187               <p><label class="classic">'. 
     188               form::checkbox(array('packman_behavior'),'1',$packman_behavior).' '. 
     189               __('Add license before create package with plugin pacKman').'</label></p>'; 
     190          } 
     191          if ($core->plugins->moduleExists('translater')) 
     192          { 
     193               echo ' 
     194               <p><label class="classic">'. 
     195               form::checkbox(array('translater_behavior'),'1',$translater_behavior).' '. 
     196               __('Add license after create lang file with plugin translater').'</label></p>'; 
     197          } 
     198          echo '</fieldset>'; 
     199     } 
     200      
     201     echo ' 
     202     <p class="clear"> 
     203     <input type="submit" name="save_settings" value="'.__('save').'" />  
     204     <input type="submit" name="reset_settings" value="'.__('Reset settings').'" />'. 
     205     $core->formNonce(). 
     206     form::hidden(array('section'),$section). 
     207     form::hidden(array('tab'),'settings'). 
     208     form::hidden(array('p'),'licenseBootstrap').' 
     209     </p> 
     210     </form> 
     211     </div>'; 
     212} 
     213dcPage::helpBlock('licenseBootstrap'); 
     214 
     215echo '<hr class="clear"/><p class="right"> 
     216<a class="button" href="'.$p_url.'&amp;tab=setting">'.__('Settings').'</a> -  
    205217licenseBootstrap - '.$core->plugins->moduleInfo('licenseBootstrap','version').'&nbsp; 
    206218<img alt="'.__('licenseBootstrap').'" src="index.php?pf=licenseBootstrap/icon.png" /> 
  • plugins/licenseBootstrap/locales/fr/main.lang.php

    r1866 r2300  
    11<?php 
    2 // Language: français  
    3 // Module: licenseBootstrap - 0.1 
    4 // Date: 2009-11-09 11:16:01  
    5 // Translated with dcTranslater - 1.3  
     2// Language: Français  
     3// Module: licenseBootstrap - 0.3 
     4// Date: 2010-06-05 10:09:54  
     5// Translated with dcTranslater - 1.4  
    66 
    7 #inc/lib.license.bootstrap.index.php:25 
     7#inc/lib.license.bootstrap.index.php:22 
     8$GLOBALS['__l10n']['Extensions'] = 'Extensions'; 
     9 
     10#inc/lib.license.bootstrap.index.php:26 
    811$GLOBALS['__l10n']['License successfully included'] = 'Licence incluse avec succès'; 
    912 
    10 #inc/lib.license.bootstrap.index.php:32 
     13#inc/lib.license.bootstrap.index.php:34 
    1114$GLOBALS['__l10n']['Name'] = 'Nom'; 
    1215 
    13 #inc/lib.license.bootstrap.index.php:34 
     16#inc/lib.license.bootstrap.index.php:36 
    1417$GLOBALS['__l10n']['Id'] = 'Id'; 
    1518 
    16 #inc/lib.license.bootstrap.index.php:61 
     19#inc/lib.license.bootstrap.index.php:65 
    1720$GLOBALS['__l10n']['Add license'] = 'Ajouter la licence'; 
    1821 
    19 #inc/lib.license.bootstrap.index.php:67 
     22#inc/lib.license.bootstrap.index.php:71 
    2023$GLOBALS['__l10n']['No available module'] = 'Pas de module disponibles'; 
    2124 
    22 #index.php:138 
     25#index.php:113 
     26$GLOBALS['__l10n']['Please wait'] = 'Veulliez patienter'; 
     27 
     28#index.php:134 
     29#index.php:216 
    2330$GLOBALS['__l10n']['Settings'] = 'Paramètres'; 
    2431 
    25 #index.php:141 
     32#index.php:138 
    2633$GLOBALS['__l10n']['Configuration successfully saved'] = 'Configuration sauvergardée avec succès'; 
    2734 
    28 #index.php:145 
     35#index.php:142 
    2936$GLOBALS['__l10n']['Files'] = 'Fichiers'; 
    3037 
    31 #index.php:148 
     38#index.php:145 
    3239$GLOBALS['__l10n']['Overwrite existing license'] = 'Écraser la licence existante'; 
    3340 
    34 #index.php:151 
     41#index.php:148 
    3542$GLOBALS['__l10n']['Add full LICENSE file to module root'] = 'Ajouter le fichier de licence complet à la racine du module'; 
    3643 
    37 #index.php:158 
     44#index.php:155 
    3845$GLOBALS['__l10n']['Add license to the header of %s files'] = 'Ajouter la licence en entête de fichier %s'; 
    3946 
    40 #index.php:166 
    41 $GLOBALS['__l10n']['Tricks'] = 'Astuces'; 
     47#index.php:159 
     48$GLOBALS['__l10n']['Exclusion:'] = 'Exclusion :'; 
    4249 
    43 #index.php:169 
     50#index.php:164 
     51$GLOBALS['__l10n']['Headers'] = 'Entêtes'; 
     52 
     53#index.php:173 
     54$GLOBALS['__l10n']['License %s:'] = 'Licence %s :'; 
     55 
     56#index.php:182 
     57$GLOBALS['__l10n']['Behaviors'] = 'Comportements'; 
     58 
     59#index.php:189 
    4460$GLOBALS['__l10n']['Add license before create package with plugin pacKman'] = 'Ajouter la licence avant de créer un paquetage avec le plugin pacKman'; 
    4561 
    46 #index.php:172 
     62#index.php:196 
    4763$GLOBALS['__l10n']['Add license after create lang file with plugin translater'] = 'Ajouter la licence après avoir créé une traduction avec le plugin translater'; 
    4864 
    49 #index.php:174 
    50 $GLOBALS['__l10n']['Headers'] = 'Entêtes'; 
    51  
    52 #index.php:185 
    53 $GLOBALS['__l10n']['License %s:'] = 'Licence %s :'; 
    54  
    55 #index.php:194 
     65#index.php:204 
    5666$GLOBALS['__l10n']['Reset settings'] = 'Remise à zéro'; 
    5767 
  • plugins/licenseBootstrap/locales/fr/main.po

    r1866 r2300  
    1 # Language: français 
    2 # Module: licenseBootstrap - 0.1 
    3 # Date: 2009-11-09 11:16:01 
    4 # Translated with translater 1.3 
     1# Language: Français 
     2# Module: licenseBootstrap - 0.3 
     3# Date: 2010-06-05 10:09:54 
     4# Translated with translater 1.4 
    55 
    66msgid "" 
    77msgstr "" 
    88"Content-Type: text/plain; charset=UTF-8\n" 
    9 "Project-Id-Version: licenseBootstrap 0.1\n" 
     9"Project-Id-Version: licenseBootstrap 0.3\n" 
    1010"POT-Creation-Date: \n" 
    11 "PO-Revision-Date: 2009-11-09T11:16:01+00:00\n" 
     11"PO-Revision-Date: 2010-06-05T10:09:54+00:00\n" 
    1212"Last-Translator: JC Denis\n" 
    1313"Language-Team: \n" 
     
    1515"Content-Transfer-Encoding: 8bit\n" 
    1616 
    17 #: inc/lib.license.bootstrap.index.php:25 
     17#: inc/lib.license.bootstrap.index.php:22 
     18msgid "Extensions" 
     19msgstr "Extensions" 
     20 
     21#: inc/lib.license.bootstrap.index.php:26 
    1822msgid "License successfully included" 
    1923msgstr "Licence incluse avec succès" 
    2024 
    21 #: inc/lib.license.bootstrap.index.php:32 
     25#: inc/lib.license.bootstrap.index.php:34 
    2226msgid "Name" 
    2327msgstr "Nom" 
    2428 
    25 #: inc/lib.license.bootstrap.index.php:34 
     29#: inc/lib.license.bootstrap.index.php:36 
    2630msgid "Id" 
    2731msgstr "Id" 
    2832 
    29 #: inc/lib.license.bootstrap.index.php:61 
     33#: inc/lib.license.bootstrap.index.php:65 
    3034msgid "Add license" 
    3135msgstr "Ajouter la licence" 
    3236 
    33 #: inc/lib.license.bootstrap.index.php:67 
     37#: inc/lib.license.bootstrap.index.php:71 
    3438msgid "No available module" 
    3539msgstr "Pas de module disponibles" 
    3640 
    37 #: index.php:138 
     41#: index.php:113 
     42msgid "Please wait" 
     43msgstr "Veulliez patienter" 
     44 
     45#: index.php:134 
     46#: index.php:216 
    3847msgid "Settings" 
    3948msgstr "Paramètres" 
    4049 
    41 #: index.php:141 
     50#: index.php:138 
    4251msgid "Configuration successfully saved" 
    4352msgstr "Configuration sauvergardée avec succès" 
    4453 
    45 #: index.php:145 
     54#: index.php:142 
    4655msgid "Files" 
    4756msgstr "Fichiers" 
    4857 
    49 #: index.php:148 
     58#: index.php:145 
    5059msgid "Overwrite existing license" 
    5160msgstr "Écraser la licence existante" 
    5261 
    53 #: index.php:151 
     62#: index.php:148 
    5463msgid "Add full LICENSE file to module root" 
    5564msgstr "Ajouter le fichier de licence complet à la racine du module" 
    5665 
    57 #: index.php:158 
     66#: index.php:155 
    5867msgid "Add license to the header of %s files" 
    5968msgstr "Ajouter la licence en entête de fichier %s" 
    6069 
    61 #: index.php:166 
    62 msgid "Tricks" 
    63 msgstr "Astuces" 
     70#: index.php:159 
     71msgid "Exclusion:" 
     72msgstr "Exclusion :" 
    6473 
    65 #: index.php:169 
     74#: index.php:164 
     75msgid "Headers" 
     76msgstr "Entêtes" 
     77 
     78#: index.php:173 
     79msgid "License %s:" 
     80msgstr "Licence %s :" 
     81 
     82#: index.php:182 
     83msgid "Behaviors" 
     84msgstr "Comportements" 
     85 
     86#: index.php:189 
    6687msgid "Add license before create package with plugin pacKman" 
    6788msgstr "Ajouter la licence avant de créer un paquetage avec le plugin pacKman" 
    6889 
    69 #: index.php:172 
     90#: index.php:196 
    7091msgid "Add license after create lang file with plugin translater" 
    7192msgstr "Ajouter la licence après avoir créé une traduction avec le plugin translater" 
    7293 
    73 #: index.php:174 
    74 msgid "Headers" 
    75 msgstr "Entêtes" 
    76  
    77 #: index.php:185 
    78 msgid "License %s:" 
    79 msgstr "Licence %s :" 
    80  
    81 #: index.php:194 
     94#: index.php:204 
    8295msgid "Reset settings" 
    8396msgstr "Remise à zéro" 
  • plugins/licenseBootstrap/release.txt

    r1866 r2300  
     10.3 20100605 
     2 * Switched to DC 2.2 
     3 * Changed admin interface (easy, light, fast) 
     4 
    150.2 20091109 
    26 * Changed lots of things 
Note: See TracChangeset for help on using the changeset viewer.

Sites map