Dotclear

Changeset 3872:39861f53bcc0


Ignore:
Timestamp:
09/12/18 14:45:17 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Use ... token for variable argument list rather than func_get_args() whenever is possible

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • admin/help.php

    r3731 r3872  
    1212dcPage::check('usage,contentadmin'); 
    1313 
    14 $helpPage = function () { 
     14$helpPage = function (...$args) { 
    1515    $ret = array('content' => '', 'title' => ''); 
    1616 
    17     $args = func_get_args(); 
    1817    if (empty($args)) { 
    1918        return $ret; 
  • inc/admin/lib.dc.page.php

    r3861 r3872  
    619619    } 
    620620 
    621     public static function helpBlock() 
     621    public static function helpBlock(...$params) 
    622622    { 
    623623        global $core; 
     
    627627        } 
    628628 
    629         $args = func_get_args(); 
    630         $args = new ArrayObject($args); 
     629        $args = new ArrayObject($params); 
    631630 
    632631        # --BEHAVIOR-- adminPageHelpBlock 
     
    914913    } 
    915914 
    916     public static function jsConfirmClose() 
    917     { 
    918         $args = func_get_args(); 
     915    public static function jsConfirmClose(...$args) 
     916    { 
    919917        if (count($args) > 0) { 
    920918            foreach ($args as $k => $v) { 
    921919                $args[$k] = "'" . html::escapeJS($v) . "'"; 
    922920            } 
    923             $args = implode(',', $args); 
     921            $params = implode(',', $args); 
    924922        } else { 
    925             $args = ''; 
     923            $params = ''; 
    926924        } 
    927925 
     
    929927        self::jsLoad('js/confirm-close.js') . 
    930928        '<script type="text/javascript">' . "\n" . 
    931         "confirmClosePage = new confirmClose(" . $args . "); " . 
     929        "confirmClosePage = new confirmClose(" . $params . "); " . 
    932930        "confirmClose.prototype.prompt = '" . html::escapeJS(__('You have unsaved changes.')) . "'; " . 
    933931            "</script>\n"; 
  • inc/core/class.dc.auth.php

    r3731 r3872  
    375375     * @return mixed 
    376376     */ 
    377     public function sudo($f) 
     377    public function sudo($f, ...$args) 
    378378    { 
    379379        if (!is_callable($f)) { 
    380380            throw new Exception($f . ' function doest not exist'); 
    381381        } 
    382  
    383         $args = func_get_args(); 
    384         array_shift($args); 
    385382 
    386383        if ($this->user_admin) { 
  • inc/core/class.dc.core.php

    r3866 r3872  
    376376    @return    <b>string</b> Behavior concatened result 
    377377     */ 
    378     public function callBehavior($behavior) 
     378    public function callBehavior($behavior, ...$args) 
    379379    { 
    380380        if (isset($this->behaviors[$behavior])) { 
    381             $args = func_get_args(); 
    382             array_shift($args); 
    383  
    384381            $res = ''; 
    385382 
  • inc/core/class.dc.media.php

    r3731 r3872  
    158158    } 
    159159 
    160     protected function callFileHandler($type, $event) 
     160    protected function callFileHandler($type, $event, ...$args) 
    161161    { 
    162162        if (!empty($this->file_handler[$type][$event])) { 
    163             $args = func_get_args(); 
    164             array_shift($args); 
    165             array_shift($args); 
    166  
    167163            foreach ($this->file_handler[$type][$event] as $f) { 
    168164                call_user_func_array($f, $args); 
  • inc/core/class.dc.update.php

    r3795 r3872  
    172172    } 
    173173 
    174     public function setForcedFiles() 
    175     { 
    176         $this->forced_files = func_get_args(); 
     174    public function setForcedFiles(...$args) 
     175    { 
     176        $this->forced_files = $args; 
    177177    } 
    178178 
  • plugins/importExport/inc/flat/class.flat.backup.php

    r3731 r3872  
    124124    } 
    125125 
    126     public function drop() 
     126    public function drop(...$args) 
    127127    { 
    128         foreach (func_get_args() as $n) { 
     128        foreach ($args as $n) { 
    129129            if (isset($this->__data[$n])) { 
    130130                unset($this->__data[$n]); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map