Changeset 2300 for plugins/licenseBootstrap
- Timestamp:
- 06/06/10 00:25:20 (13 years ago)
- Location:
- plugins/licenseBootstrap
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/licenseBootstrap/_admin.php
r1561 r2300 3 3 # This file is part of licenseBootstrap, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 18 18 'plugin.php?p=licenseBootstrap','index.php?pf=licenseBootstrap/icon.png', 19 19 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 ); 21 22 ?> -
plugins/licenseBootstrap/_define.php
r1866 r2300 3 3 # This file is part of licenseBootstrap, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 17 17 /* Description*/ "Add license to your plugins and themes", 18 18 /* Author */ "JC Denis", 19 /* Version */ '0. 2',19 /* Version */ '0.3', 20 20 /* Permissions */ null 21 21 ); 22 /* date */ #20 09110922 /* date */ #20100604 23 23 ?> -
plugins/licenseBootstrap/_install.php
r1866 r2300 3 3 # This file is part of licenseBootstrap, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 20 20 try 21 21 { 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'); 25 25 } 26 26 $default_license = 'gpl2'; … … 28 28 $default_headers = licenseBootstrap::getDefaultLicenses(); 29 29 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); 44 39 45 40 $core->setVersion('licenseBootstrap',$new_version); -
plugins/licenseBootstrap/_prepend.php
r1866 r2300 3 3 # This file is part of licenseBootstrap, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 15 15 global $__autoload,$core; 16 16 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'; 21 19 22 if ($core->blog->settings->licensebootstrap_packman_behavior) 20 $core->blog->settings->addNamespace('licenseBootstrap'); 21 if ($core->blog->settings->licenseBootstrap->licensebootstrap_packman_behavior) 23 22 { 24 $core->addBehavior( 25 'packmanBeforeCreatePackage', 26 array('licenseBootstrap','packmanBeforeCreatePackage') 27 ); 23 $core->addBehavior('packmanBeforeCreatePackage',array('licenseBootstrap','packmanBeforeCreatePackage')); 28 24 } 29 30 if ($core->blog->settings->licensebootstrap_translater_behavior) 25 if ($core->blog->settings->licenseBootstrap->licensebootstrap_translater_behavior) 31 26 { 32 $core->addBehavior( 33 'dcTranslaterAfterWriteLangFile', 34 array('licenseBootstrap','dcTranslaterAfterWriteLangFile') 35 ); 27 $core->addBehavior('dcTranslaterAfterWriteLangFile',array('licenseBootstrap','dcTranslaterAfterWriteLangFile')); 36 28 } 37 29 ?> -
plugins/licenseBootstrap/_uninstall.php
r1561 r2300 3 3 # This file is part of licenseBootstrap, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 31 31 /* action */ 'delete_all', 32 32 /* ns */ 'licenseBootstrap', 33 /* description */ __('delete all licenseBootstrap settings')33 /* description */ sprintf(__('delete all %s settings'),'licenseBootstrap') 34 34 ); 35 35 … … 38 38 /* action */ 'delete', 39 39 /* ns */ 'licenseBootstrap', 40 /* description */ __('delete licenseBootstrap plugin files')40 /* description */ sprintf(__('delete %s plugin files'),'licenseBootstrap') 41 41 ); 42 42 ?> -
plugins/licenseBootstrap/inc/class.license.bootstrap.php
r1866 r2300 3 3 # This file is part of licenseBootstrap, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 23 23 public $overwrite; 24 24 public $exclusion; 25 25 26 26 public function __construct($core,$extensions=null,$license=null,$head=null,$addfull=true,$overwrite=false,$exclusion='') 27 27 { … … 30 30 $this->exclusion = (string) $exclusion; 31 31 $this->license = (string) $license; 32 32 33 33 $this->extensions = self::getDefaultExtensions($extensions); 34 34 $this->head = self::getDefaultLicenses('head',$license,$head); 35 35 $this->full = self::getDefaultLicenses('full',$license); 36 36 } 37 37 38 38 public function moduleInfo($type,$id) 39 39 { 40 40 $info = array(); 41 41 42 42 if ($type == 'plugin') 43 43 { … … 53 53 $type = ''; 54 54 } 55 55 56 56 if ($type && $modules->moduleExists($id)) 57 57 { … … 61 61 $info['user_email'] = $this->core->auth->getInfo('user_email'); 62 62 } 63 63 64 64 return $info; 65 65 } 66 66 67 67 public function writeModuleLicense($type,$id) 68 68 { 69 69 $info = $this->moduleInfo($type,$id); 70 70 71 71 # Try if root is writable 72 72 if (!isset($info['root']) || !is_writable($info['root'])) … … 75 75 } 76 76 $root = $info['root']; 77 77 78 78 # Get license text 79 79 $head = self::parseInfo($type,$id,$info,$this->head[$this->license]); 80 80 $full = self::parseInfo($type,$id,$info,$this->full[$this->license]); 81 81 82 82 # Get files from module root 83 83 $files = self::scandir($root); … … 86 86 throw new Exception('Nothing to do'); 87 87 } 88 88 89 89 # Write full license file 90 90 if (!file_exists($root.'/LICENSE') || $overwrite) … … 92 92 files::putContent($root.'/LICENSE',$full); 93 93 } 94 94 95 95 # Write license header in files 96 96 foreach($files as $file) 97 97 { 98 98 if (!is_file($root.'/'.$file)) continue; 99 99 100 100 if (!empty($this->exclusion)) 101 101 { 102 102 if (preg_match($this->exclusion,$file)) continue; 103 103 } 104 104 105 105 $ext = files::getExtension($file) ; 106 106 $func = 'filesLicenseBootstrap::'.$ext.'File'; 107 107 if (!in_array($ext,$this->extensions) || !is_callable($func)) continue; 108 108 109 109 $content = file_get_contents($root.'/'.$file); 110 111 110 $content = call_user_func($func,$content,$head,$this->overwrite); 112 111 113 112 if (!empty($content)) 114 113 { … … 118 117 return true; 119 118 } 120 119 121 120 public function addFileLicense($type,$id,$file,$content) 122 121 { 123 122 $info = $this->moduleInfo($type,$id); 124 125 123 $head = self::parseInfo($type,$id,$info,$this->head); 126 124 127 125 if (!empty($this->exclusion)) 128 126 { 129 127 if (preg_match($this->exclusion,$file)) return $content; 130 128 } 131 129 132 130 $ext = files::getExtension($file) ; 133 131 $func = 'filesLicenseBootstrap::'.$ext.'File'; 134 132 if (!in_array($ext,$this->extensions) || !is_callable($func)) return $content; 135 133 136 134 return call_user_func($func,$content,$head[$this->license],$this->overwrite); 137 135 } 138 136 139 137 public static function getDefaultExtensions($exts=null) 140 138 { … … 142 140 if (null === $exts) $exts = $default; 143 141 elseif (!is_array($exts)) $exts = array($exts); 144 142 145 143 return array_intersect($default,$exts); 146 144 } 147 145 148 146 public static function getDefaultLicenses($type='head',$license=null,$content=null) 149 147 { … … 154 152 $rs = array($license => $content); 155 153 } 156 154 157 155 if ($license && !$content) 158 156 { … … 163 161 } 164 162 } 165 163 166 164 if (!$license) 167 165 { … … 177 175 return $rs; 178 176 } 179 177 180 178 private function parseInfo($type,$id,$info,$text) 181 179 { … … 204 202 ); 205 203 } 206 204 207 205 private static function scandir($path,$dir='',$res=array()) 208 206 { 209 207 $path = path::real($path); 210 208 if (!is_dir($path) || !is_readable($path)) return array(); 211 209 212 210 $files = files::scandir($path); 213 211 214 212 foreach($files AS $file) 215 213 { … … 228 226 return $res; 229 227 } 230 228 231 229 public static function encode($a) 232 230 { 233 231 return base64_encode(serialize($a)); 234 232 } 235 233 236 234 public static function decode($a) 237 235 { 238 236 return unserialize(base64_decode($a)); 239 237 } 240 238 241 239 public static function packmanBeforeCreatePackage($info,$a,$b,$c,$d) 242 240 { 243 241 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; 252 250 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); 255 253 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); 258 256 if (!is_array($headers)) $headers = self::getDefaulLicenses(); 259 257 260 258 $license = new licenseBootstrap($core,$exts,$license,$headers[$license],$addfull,$overwrite,$exclusion); 261 259 $license->writeModuleLicense($info['type'],$info['id']); … … 265 263 { 266 264 if (!$f) return; 267 265 268 266 global $core; 269 267 270 268 $id = ''; 271 269 $type = 'theme'; 272 270 $dir = path::real($file); 273 271 274 272 # Is a plugin 275 273 $plugins_roots = explode(PATH_SEPARATOR,DC_PLUGINS_ROOT); … … 314 312 # Not a plugin nor theme 315 313 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; 324 322 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); 327 325 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); 330 328 if (!is_array($headers)) $headers = self::getDefaultLicenses(); 331 329 332 330 $license = new licenseBootstrap($core,$exts,$license,$headers[$license],$addfull,$overwrite,$exclusion); 333 331 $content = $license->addFileLicense($type,$id,$file,$content); 334 332 335 333 files::putContent($file,$content); 336 334 } -
plugins/licenseBootstrap/inc/lib.license.bootstrap.index.php
r1561 r2300 3 3 # This file is part of licenseBootstrap, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 18 18 { 19 19 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 24 24 if (isset($_REQUEST['done']) && $_REQUEST['tab'] == $type) 25 { 25 26 echo '<p class="message">'.__('License successfully included').'</p>'; 26 27 } 28 27 29 if (!empty($modules) && is_array($modules)) 28 30 { 29 31 echo 30 '<form action="plugin.php" method="post">'.32 '<form id="module-form" action="plugin.php" method="post">'. 31 33 '<table class="clear"><tr>'. 32 34 '<th class="nowrap">'.__('Name').'</th>'. … … 36 38 '<th class="nowrap">'.__('Author').'</th>'. 37 39 '</tr>'; 38 40 39 41 foreach ($modules as $id => $module) 40 42 { … … 54 56 '<p><input type="hidden" name="p" value="licenseBootstrap" />'. 55 57 '<input type="hidden" name="type" value="'.$type.'" />'; 56 58 57 59 if ($redir) 60 { 58 61 echo '<input type="hidden" name="redir" value="'.html::escapeHTML($redir).'" />'; 59 62 } 63 60 64 echo 61 65 '<input type="submit" name="add_license" value="'.__('Add license').'" />'. … … 70 74 } 71 75 } 72 73 76 ?> -
plugins/licenseBootstrap/index.php
r1866 r2300 3 3 # This file is part of licenseBootstrap, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 15 15 16 16 $default_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : 'setting'; 17 $section = isset($_REQUEST['section']) ? $_REQUEST['section'] : ''; 17 18 18 19 # Default lists … … 20 21 $default_headers = licenseBootstrap::getDefaultLicenses(); 21 22 22 # Modules lists23 $themes = new dcModules($core);24 $themes->loadModules($core->blog->themes_path,null);25 $plugins = $core->plugins;26 27 23 # 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; 32 28 if (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); 34 30 if (!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); 36 32 if (!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; 43 36 44 37 try … … 47 40 if (isset($_POST['reset_settings'])) 48 41 { 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§ion='.$section.'&done=1'); 52 } 53 65 54 # Save settings 66 55 if (isset($_POST['save_settings'])) … … 69 58 $overwrite = !empty($_POST['overwrite']); 70 59 $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(); 75 62 $exclusion = $_POST['exclusion']; 76 63 $packman_behavior = !empty($_POST['packman_behavior']); 77 64 $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§ion='.$section.'&done=1'); 93 76 } 94 77 # Object 95 78 $LB = new licenseBootstrap($core,$files_exts,$license,$licenses_headers[$license],$addfull,$overwrite,$exclusion); 96 97 79 98 80 # Add license to files 99 81 if (isset($_POST['add_license'])) 100 82 { 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'])) 103 84 { 104 85 throw new Exception('Nothing to pack'); 105 86 } 106 87 107 88 $type = $_POST['type'] == 'theme' ? 'theme' : 'plugin'; 108 89 $modules = array_keys($_POST['modules']); 109 90 110 91 foreach ($modules as $id) 111 92 { 112 93 $LB->writeModuleLicense($type,$id); 113 94 } 114 95 115 96 if (!empty($_POST['redir'])) 116 97 { … … 126 107 127 108 # 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).' › '. 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 { 109 echo 110 '<html><head><title>'.__('License bootstrap').'</title>'. 111 dcPage::jsLoad('index.php?pf=licenseBootstrap/js/main.js'). 112 '<script type="text/javascript">'."\n//<![CDATA[\n". 113 dcPage::jsVar('jcToolsBox.prototype.text_wait',__('Please wait')). 114 dcPage::jsVar('jcToolsBox.prototype.section',$section). 115 "\n//]]>\n</script>\n". 116 '</head><body>'. 117 '<h2>'.__('License bootstrap'). 118 ' - <a class="button" href="'.$p_url.'&tab=plugin">'.__('Plugins').'</a>'. 119 ' - <a class="button" href="'.$p_url.'&tab=theme">'.__('Themes').'</a>'. 120 '</h2><hr class="clear" />'; 121 122 if ($default_tab == 'plugin') 123 { 124 libLicenseBootstrap::tab($core->plugins->getModules(),'plugin'); 125 } 126 elseif ($default_tab == 'theme') 127 { 128 $themes = new dcModules($core); 129 $themes->loadModules($core->blog->themes_path,null); 130 libLicenseBootstrap::tab($themes->getModules(),'theme'); 131 } 132 elseif ($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 } 155 140 echo ' 141 <form id="setting-form" method="post" action="'.$p_url.'"> 142 <fieldset id="settingfile"><legend>'.__('Files').'</legend> 156 143 <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 182 158 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 } 213 dcPage::helpBlock('licenseBootstrap'); 214 215 echo '<hr class="clear"/><p class="right"> 216 <a class="button" href="'.$p_url.'&tab=setting">'.__('Settings').'</a> - 205 217 licenseBootstrap - '.$core->plugins->moduleInfo('licenseBootstrap','version').' 206 218 <img alt="'.__('licenseBootstrap').'" src="index.php?pf=licenseBootstrap/icon.png" /> -
plugins/licenseBootstrap/locales/fr/main.lang.php
r1866 r2300 1 1 <?php 2 // Language: français3 // Module: licenseBootstrap - 0. 14 // Date: 20 09-11-09 11:16:015 // Translated with dcTranslater - 1. 32 // Language: Français 3 // Module: licenseBootstrap - 0.3 4 // Date: 2010-06-05 10:09:54 5 // Translated with dcTranslater - 1.4 6 6 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 8 11 $GLOBALS['__l10n']['License successfully included'] = 'Licence incluse avec succès'; 9 12 10 #inc/lib.license.bootstrap.index.php:3 213 #inc/lib.license.bootstrap.index.php:34 11 14 $GLOBALS['__l10n']['Name'] = 'Nom'; 12 15 13 #inc/lib.license.bootstrap.index.php:3 416 #inc/lib.license.bootstrap.index.php:36 14 17 $GLOBALS['__l10n']['Id'] = 'Id'; 15 18 16 #inc/lib.license.bootstrap.index.php:6 119 #inc/lib.license.bootstrap.index.php:65 17 20 $GLOBALS['__l10n']['Add license'] = 'Ajouter la licence'; 18 21 19 #inc/lib.license.bootstrap.index.php: 6722 #inc/lib.license.bootstrap.index.php:71 20 23 $GLOBALS['__l10n']['No available module'] = 'Pas de module disponibles'; 21 24 22 #index.php:138 25 #index.php:113 26 $GLOBALS['__l10n']['Please wait'] = 'Veulliez patienter'; 27 28 #index.php:134 29 #index.php:216 23 30 $GLOBALS['__l10n']['Settings'] = 'Paramètres'; 24 31 25 #index.php:1 4132 #index.php:138 26 33 $GLOBALS['__l10n']['Configuration successfully saved'] = 'Configuration sauvergardée avec succès'; 27 34 28 #index.php:14 535 #index.php:142 29 36 $GLOBALS['__l10n']['Files'] = 'Fichiers'; 30 37 31 #index.php:14 838 #index.php:145 32 39 $GLOBALS['__l10n']['Overwrite existing license'] = 'Écraser la licence existante'; 33 40 34 #index.php:1 5141 #index.php:148 35 42 $GLOBALS['__l10n']['Add full LICENSE file to module root'] = 'Ajouter le fichier de licence complet à la racine du module'; 36 43 37 #index.php:15 844 #index.php:155 38 45 $GLOBALS['__l10n']['Add license to the header of %s files'] = 'Ajouter la licence en entête de fichier %s'; 39 46 40 #index.php:1 6641 $GLOBALS['__l10n'][' Tricks'] = 'Astuces';47 #index.php:159 48 $GLOBALS['__l10n']['Exclusion:'] = 'Exclusion :'; 42 49 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 44 60 $GLOBALS['__l10n']['Add license before create package with plugin pacKman'] = 'Ajouter la licence avant de créer un paquetage avec le plugin pacKman'; 45 61 46 #index.php:1 7262 #index.php:196 47 63 $GLOBALS['__l10n']['Add license after create lang file with plugin translater'] = 'Ajouter la licence après avoir créé une traduction avec le plugin translater'; 48 64 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 56 66 $GLOBALS['__l10n']['Reset settings'] = 'Remise à zéro'; 57 67 -
plugins/licenseBootstrap/locales/fr/main.po
r1866 r2300 1 # Language: français2 # Module: licenseBootstrap - 0. 13 # Date: 20 09-11-09 11:16:014 # Translated with translater 1. 31 # Language: Français 2 # Module: licenseBootstrap - 0.3 3 # Date: 2010-06-05 10:09:54 4 # Translated with translater 1.4 5 5 6 6 msgid "" 7 7 msgstr "" 8 8 "Content-Type: text/plain; charset=UTF-8\n" 9 "Project-Id-Version: licenseBootstrap 0. 1\n"9 "Project-Id-Version: licenseBootstrap 0.3\n" 10 10 "POT-Creation-Date: \n" 11 "PO-Revision-Date: 20 09-11-09T11:16:01+00:00\n"11 "PO-Revision-Date: 2010-06-05T10:09:54+00:00\n" 12 12 "Last-Translator: JC Denis\n" 13 13 "Language-Team: \n" … … 15 15 "Content-Transfer-Encoding: 8bit\n" 16 16 17 #: inc/lib.license.bootstrap.index.php:25 17 #: inc/lib.license.bootstrap.index.php:22 18 msgid "Extensions" 19 msgstr "Extensions" 20 21 #: inc/lib.license.bootstrap.index.php:26 18 22 msgid "License successfully included" 19 23 msgstr "Licence incluse avec succès" 20 24 21 #: inc/lib.license.bootstrap.index.php:3 225 #: inc/lib.license.bootstrap.index.php:34 22 26 msgid "Name" 23 27 msgstr "Nom" 24 28 25 #: inc/lib.license.bootstrap.index.php:3 429 #: inc/lib.license.bootstrap.index.php:36 26 30 msgid "Id" 27 31 msgstr "Id" 28 32 29 #: inc/lib.license.bootstrap.index.php:6 133 #: inc/lib.license.bootstrap.index.php:65 30 34 msgid "Add license" 31 35 msgstr "Ajouter la licence" 32 36 33 #: inc/lib.license.bootstrap.index.php: 6737 #: inc/lib.license.bootstrap.index.php:71 34 38 msgid "No available module" 35 39 msgstr "Pas de module disponibles" 36 40 37 #: index.php:138 41 #: index.php:113 42 msgid "Please wait" 43 msgstr "Veulliez patienter" 44 45 #: index.php:134 46 #: index.php:216 38 47 msgid "Settings" 39 48 msgstr "Paramètres" 40 49 41 #: index.php:1 4150 #: index.php:138 42 51 msgid "Configuration successfully saved" 43 52 msgstr "Configuration sauvergardée avec succès" 44 53 45 #: index.php:14 554 #: index.php:142 46 55 msgid "Files" 47 56 msgstr "Fichiers" 48 57 49 #: index.php:14 858 #: index.php:145 50 59 msgid "Overwrite existing license" 51 60 msgstr "Écraser la licence existante" 52 61 53 #: index.php:1 5162 #: index.php:148 54 63 msgid "Add full LICENSE file to module root" 55 64 msgstr "Ajouter le fichier de licence complet à la racine du module" 56 65 57 #: index.php:15 866 #: index.php:155 58 67 msgid "Add license to the header of %s files" 59 68 msgstr "Ajouter la licence en entête de fichier %s" 60 69 61 #: index.php:1 6662 msgid " Tricks"63 msgstr " Astuces"70 #: index.php:159 71 msgid "Exclusion:" 72 msgstr "Exclusion :" 64 73 65 #: index.php:169 74 #: index.php:164 75 msgid "Headers" 76 msgstr "Entêtes" 77 78 #: index.php:173 79 msgid "License %s:" 80 msgstr "Licence %s :" 81 82 #: index.php:182 83 msgid "Behaviors" 84 msgstr "Comportements" 85 86 #: index.php:189 66 87 msgid "Add license before create package with plugin pacKman" 67 88 msgstr "Ajouter la licence avant de créer un paquetage avec le plugin pacKman" 68 89 69 #: index.php:1 7290 #: index.php:196 70 91 msgid "Add license after create lang file with plugin translater" 71 92 msgstr "Ajouter la licence après avoir créé une traduction avec le plugin translater" 72 93 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 82 95 msgid "Reset settings" 83 96 msgstr "Remise à zéro" -
plugins/licenseBootstrap/release.txt
r1866 r2300 1 0.3 20100605 2 * Switched to DC 2.2 3 * Changed admin interface (easy, light, fast) 4 1 5 0.2 20091109 2 6 * Changed lots of things
Note: See TracChangeset
for help on using the changeset viewer.