Baikal\Core\Tools::getCopyrightNotice PHP Метод

getCopyrightNotice() статический публичный Метод

static public getCopyrightNotice ( $sLinePrefixChar = "#", $sLineSuffixChar = "", $sOpening = false, $sClosing = false )
    static function getCopyrightNotice($sLinePrefixChar = "#", $sLineSuffixChar = "", $sOpening = false, $sClosing = false)
    {
        if ($sOpening === false) {
            $sOpening = str_repeat("#", 78);
        }
        if ($sClosing === false) {
            $sClosing = str_repeat("#", 78);
        }
        $iYear = date("Y");
        $sCode = <<<CODE
Copyright notice

(c) {$iYear} Jérôme Schneider <[email protected]>
All rights reserved

http://baikal-server.com

This script is part of the Baïkal Server project. The Baïkal
Server project is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

The GNU General Public License can be found at
http://www.gnu.org/copyleft/gpl.html.

This script is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

This copyright notice MUST APPEAR in all copies of the script!
CODE;
        $sCode = "\n" . trim($sCode) . "\n";
        $aCode = explode("\n", $sCode);
        foreach (array_keys($aCode) as $iLineNum) {
            $aCode[$iLineNum] = trim($sLinePrefixChar . "\t" . $aCode[$iLineNum]);
        }
        if (trim($sOpening) !== "") {
            array_unshift($aCode, $sOpening);
        }
        if (trim($sClosing) !== "") {
            $aCode[] = $sClosing;
        }
        return implode("\n", $aCode);
    }

Usage Example

Пример #1
0
 protected function getConfigAsString()
 {
     if (file_exists($this->sConfigFilePath)) {
         $sContent = file_get_contents($this->sConfigFilePath);
         return str_replace(LF . CR, LF, $sContent);
     } else {
         $sConfig = "<?php\n" . \Baikal\Core\Tools::getCopyrightNotice() . "\n\n";
         $sConfig .= static::getDefaultConfig();
         return $sConfig;
     }
 }
All Usage Examples Of Baikal\Core\Tools::getCopyrightNotice