Dotclear


Ignore:
Timestamp:
03/08/18 17:58:39 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Code formatting (PSR-2)

Location:
plugins/buildtools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/buildtools/_admin.php

    r2566 r3730  
    1010# 
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    12 if (!defined('DC_CONTEXT_ADMIN')) { return; } 
     12if (!defined('DC_CONTEXT_ADMIN')) {return;} 
    1313$core->addBehavior('dcMaintenanceInit', array('dcBuildTools', 'maintenanceAdmin')); 
    1414 
    1515class dcBuildTools 
    1616{ 
    17      public static function maintenanceAdmin($maintenance) { 
    18           $maintenance->addTask('dcMaintenanceBuildtools'); 
    19      } 
     17    public static function maintenanceAdmin($maintenance) 
     18    { 
     19        $maintenance->addTask('dcMaintenanceBuildtools'); 
     20    } 
    2021} 
  • plugins/buildtools/_define.php

    r2566 r3730  
    1010# 
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    12 if (!defined('DC_RC_PATH')) { return; } 
     12if (!defined('DC_RC_PATH')) {return;} 
    1313 
    1414$this->registerModule( 
    15      /* Name */               "buildtools", 
    16      /* Description*/         "Internal build tools for dotclear team", 
    17      /* Author */             "dcTeam", 
    18      /* Version */            '1.0', 
    19      array( 
    20           'permissions' =>    'admin' 
    21      ) 
     15    "buildtools",                             // Name 
     16    "Internal build tools for dotclear team", // Description 
     17    "dcTeam",                                 // Author 
     18    '1.0',                                    // Version 
     19    array( 
     20        'permissions' => 'admin' 
     21    ) 
    2222); 
  • plugins/buildtools/_prepend.php

    r2095 r3730  
    11<?php 
    22 
    3 $__autoload['dcMaintenanceBuildtools'] = dirname(__FILE__).'/class.dc.maintenance.buildtools.php'; 
     3$__autoload['dcMaintenanceBuildtools'] = dirname(__FILE__) . '/class.dc.maintenance.buildtools.php'; 
  • plugins/buildtools/class.dc.maintenance.buildtools.php

    r2566 r3730  
    11<?php 
    2  
    32 
    43class dcMaintenanceBuildtools extends dcMaintenanceTask 
    54{ 
    6      protected $tab = 'dev'; 
    7      protected $group = 'l10n'; 
     5    protected $tab  = 'dev'; 
     6    protected $group = 'l10n'; 
    87 
    9      protected function init() 
    10      { 
    11           $this->task         = __('Generate fake l10n'); 
    12           $this->success           = __('fake l10n file generated.'); 
    13           $this->error        = __('Failed to generate fake l10n file.'); 
    14           $this->description  = __('Generate a php file that contents strings to translate that are not be done with core tools.'); 
    15      } 
     8    protected function init() 
     9    { 
     10        $this->task        = __('Generate fake l10n'); 
     11        $this->success     = __('fake l10n file generated.'); 
     12        $this->error       = __('Failed to generate fake l10n file.'); 
     13        $this->description = __('Generate a php file that contents strings to translate that are not be done with core tools.'); 
     14    } 
    1615 
    17      public function execute() 
    18      { 
    19           global $core; 
    20           $widget = $this->core->plugins->getModules("widgets"); 
    21           include $widget['root'].'/_default_widgets.php'; 
     16    public function execute() 
     17    { 
     18        global $core; 
     19        $widget = $this->core->plugins->getModules("widgets"); 
     20        include $widget['root'] . '/_default_widgets.php'; 
    2221 
    23           $faker = new l10nFaker($GLOBALS['core']); 
    24           $faker->generate_file(); 
    25           return true; 
    26      } 
     22        $faker = new l10nFaker($GLOBALS['core']); 
     23        $faker->generate_file(); 
     24        return true; 
     25    } 
    2726} 
    2827 
    29 class l10nFaker { 
    30      protected $core; 
    31      protected $bundled_plugins; 
     28class l10nFaker 
     29{ 
     30    protected $core; 
     31    protected $bundled_plugins; 
    3232 
    33      public function __construct($core) { 
    34           $this->core = $core; 
    35           $this->bundled_plugins = explode(',', DC_DISTRIB_PLUGINS); 
    36           $this->core->media = new dcMedia($this->core); 
    37      } 
     33    public function __construct($core) 
     34    { 
     35        $this->core            = $core; 
     36        $this->bundled_plugins = explode(',', DC_DISTRIB_PLUGINS); 
     37        $this->core->media     = new dcMedia($this->core); 
     38    } 
    3839 
    39      protected function fake_l10n($str) { 
    40           return sprintf('__("%s");'."\n",str_replace('"','\\"',$str)); 
    41      } 
    42      public function generate_file() { 
    43           global $__widgets; 
    44           global $__autoload; 
     40    protected function fake_l10n($str) 
     41    { 
     42        return sprintf('__("%s");' . "\n", str_replace('"', '\\"', $str)); 
     43    } 
     44    public function generate_file() 
     45    { 
     46        global $__widgets; 
     47        global $__autoload; 
    4548 
    46           $main = "<?php\n"; 
    47           $plugin = "<?php\n"; 
    48           $main .= "# Media sizes\n\n"; 
    49           foreach ($this->core->media->thumb_sizes as $k=> $v) { 
    50                $main .= $this->fake_l10n($v[2]); 
    51           } 
    52           $post_types = $this->core->getPostTypes(); 
    53           $main .= "\n# Post types \n\n"; 
    54           foreach ($post_types as $k => $v) { 
    55                $main .= $this->fake_l10n($v['label']); 
    56           } 
    57           $ws = $this->core->auth->user_prefs->favorites;   // Favs old school ! 
    58           if ($ws) { 
    59                $main .= "\n# Favorites \n\n"; 
    60                foreach ($ws->dumpPrefs() as $k => $v) { 
    61                     $fav = unserialize($v['value']); 
    62                     $main .= $this->fake_l10n($fav['title']); 
    63                } 
    64           } 
    65           file_put_contents(dirname($__autoload['dcCore']).'/_fake_l10n.php', $main); 
    66           $plugin .= "\n# Plugin names \n\n"; 
    67           foreach ($this->bundled_plugins as $id) { 
    68                $p = $this->core->plugins->getModules($id); 
    69                $plugin .= $this->fake_l10n($p['desc']); 
    70           } 
    71           $plugin .= "\n# Widget settings names \n\n"; 
    72           $widgets = $__widgets->elements(); 
    73           foreach ($widgets as $w) { 
    74                $plugin .= $this->fake_l10n($w->desc()); 
    75           } 
    76           mkdir(dirname(__FILE__)."/../_fake_plugin"); 
    77           file_put_contents(dirname(__FILE__).'/../_fake_plugin/_fake_l10n.php', $plugin); 
    78      } 
     49        $main  = "<?php\n"; 
     50        $plugin = "<?php\n"; 
     51        $main .= "# Media sizes\n\n"; 
     52        foreach ($this->core->media->thumb_sizes as $k => $v) { 
     53            $main .= $this->fake_l10n($v[2]); 
     54        } 
     55        $post_types = $this->core->getPostTypes(); 
     56        $main .= "\n# Post types \n\n"; 
     57        foreach ($post_types as $k => $v) { 
     58            $main .= $this->fake_l10n($v['label']); 
     59        } 
     60        $ws = $this->core->auth->user_prefs->favorites; // Favs old school ! 
     61        if ($ws) { 
     62            $main .= "\n# Favorites \n\n"; 
     63            foreach ($ws->dumpPrefs() as $k => $v) { 
     64                $fav = unserialize($v['value']); 
     65                $main .= $this->fake_l10n($fav['title']); 
     66            } 
     67        } 
     68        file_put_contents(dirname($__autoload['dcCore']) . '/_fake_l10n.php', $main); 
     69        $plugin .= "\n# Plugin names \n\n"; 
     70        foreach ($this->bundled_plugins as $id) { 
     71            $p = $this->core->plugins->getModules($id); 
     72            $plugin .= $this->fake_l10n($p['desc']); 
     73        } 
     74        $plugin .= "\n# Widget settings names \n\n"; 
     75        $widgets = $__widgets->elements(); 
     76        foreach ($widgets as $w) { 
     77            $plugin .= $this->fake_l10n($w->desc()); 
     78        } 
     79        mkdir(dirname(__FILE__) . "/../_fake_plugin"); 
     80        file_put_contents(dirname(__FILE__) . '/../_fake_plugin/_fake_l10n.php', $plugin); 
     81    } 
    7982} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map