Пример #1
0
function convert($number)
{
    // Если длина номера больше 6, значит, это нормальный номер, а не какой то служебный,
    // Будем пробовать его тарифицировать.
    if (strlen($number) > 6) {
        // Городские номера
        if (strlen($number) == 7) {
            // Код нашего города 391. Замените этот код на Ваш при необходимости
            $number = '7391' . $number;
        }
        // Неверно набранные номера тоже удаляем
        if (strlen($number) == 8 || strlen($number) == 9) {
            writeln("wrong CDR number: " . $number);
            return false;
        }
        // Номера на мобильные и МГ, которые были набраны без 8ки
        if (strlen($number) == 10) {
            // Добавляем 7 вначале
            $number = '7' . $number;
        }
        // Международная связь
        if (preg_match('/^810/', $number)) {
            $number = preg_replace("/^810/", "", $number);
        }
        // Межгород
        if (substr($number, 0, 1) == 8) {
            $number = '7' . substr($number, 1);
        }
        return $number;
    } else {
        // иначе возвращаем false.
        // В этом случае, данная CDR запись не будет передана на обработку остальным плагинам-обработчикам
        return false;
    }
}
Пример #2
0
 public function kill()
 {
     if ($this->exists()) {
         writeln("<comment>Kill elasticsearch container {$this->container}</comment>");
         $command = Env::evalDocker() . "docker rm -f {$this->container}";
         runLocally($command);
     }
 }
Пример #3
0
 public function stop()
 {
     try {
         writeln("Stop docker-machine {$this->name}");
         $output = runLocally("docker-machine stop {$this->name}");
         writeln("<comment>Docker-machine {$this->name} stopped</comment>");
     } catch (Exception $ex) {
     }
 }
Пример #4
0
/**
 * Creates count down with 1 sec steps
 * 
 * @param String $text the text of the countdown
 * @param int $secs number of seconds for the countdown
 **/
function count_down($text, $secs)
{
    writeln($text);
    writeln("Press CTRL+C to interrupt the countdown.");
    for (; $secs > 0; $secs--) {
        echo $secs . ".. ";
        sleep(1);
    }
    writeln();
    // new line after the countdown
}
Пример #5
0
function testConcreteFactory($bookFactoryInstance)
{
    // вызываем  метод создания PHP книги - наш код не зависит от того какое именно издательство
    // передано (фабрика какого именно издательства передана) для реализации создания книг
    $phpBookOne = $bookFactoryInstance->makePHPBook();
    writeln('Автор первой книги  по PHP: ' . $phpBookOne->getAuthor());
    writeln('Заголовок первой книги  по PHP: ' . $phpBookOne->getTitle());
    $phpBookTwo = $bookFactoryInstance->makePHPBook();
    writeln('Автор второй книги по PHP: ' . $phpBookTwo->getAuthor());
    writeln('Заголовок второй книги по PHP:: ' . $phpBookTwo->getTitle());
    $mySqlBook = $bookFactoryInstance->makeMySQLBook();
    writeln('Автор  книги по MySQL: ' . $mySqlBook->getAuthor());
    writeln(' Заголовок книги по MySQL: ' . $mySqlBook->getTitle());
}
Пример #6
0
 public function kill()
 {
     if ($this->exists()) {
         writeln('<comment>Kill web container</comment>');
         $command = "docker rm -f {$this->container}";
         Helpers::doLocal($command);
     }
     $command = "cd {$this->dir} && docker images";
     $output = Helpers::doLocal($command);
     if (preg_match('/' . $this->image . '\\s.*latest\\s*([[:alnum:]]+).*/i', $output, $matches)) {
         $command = "cd {$this->dir} && docker rmi {$this->image}";
         Helpers::doLocal($command);
     }
 }
Пример #7
0
function search_result($title, $link, $zid, $time, $body)
{
    global $server_name;
    global $protocol;
    $date = date("Y-m-d H:i", $time);
    if ($zid == "") {
        $by = "Anonymous Coward";
    } else {
        $by = "<a href=\"" . user_page_link($zid) . "\">{$zid}</a>";
    }
    writeln("<article>");
    writeln("\t<h1><a href=\"{$link}\">{$title}</a></h1>");
    writeln("\t<h2>{$protocol}://{$server_name}{$link}</h2>");
    writeln("\t<h3>by {$by} on {$date}</h3>");
    writeln("\t<p>{$body}</p>");
    writeln("</article>");
}
Пример #8
0
 public static function ensure($actionType)
 {
     $envToCheck = [];
     if ($actionType == 'docker') {
         $envToCheck = ['container'];
     }
     foreach ($envToCheck as $key => $name) {
         try {
             $value = env($name);
         } catch (\Exception $ex) {
             $value = null;
         }
         if (!$value) {
             $stage = null;
             if (input()->hasArgument('stage')) {
                 $stage = input()->getArgument('stage');
             }
             writeln("<fg=red>Environment variable '{$name}' is missing in '{$stage}', please define before running this command!</fg=red>");
             die;
         }
     }
 }
Пример #9
0
        return $this->author;
    }
    function getTitle()
    {
        return $this->title;
    }
}
class BookAdapter
{
    private $book;
    function __construct(SimpleBook $book_in)
    {
        $this->book = $book_in;
    }
    function getAuthorAndTitle()
    {
        return $this->book->getTitle() . ' by ' . $this->book->getAuthor();
    }
}
// client
writeln('BEGIN TESTING ADAPTER PATTERN');
writeln('');
$book = new SimpleBook("Gamma, Helm, Johnson, and Vlissides", "Design Patterns");
$bookAdapter = new BookAdapter($book);
writeln('Author and Title: ' . $bookAdapter->getAuthorAndTitle());
writeln('');
writeln('END TESTING ADAPTER PATTERN');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
Пример #10
0
 public function update(AbstractSubject $subject)
 {
     writeln('*IN PATTERN OBSERVER - NEW PATTERN GOSSIP ALERT*');
     writeln(' new favorite patterns: ' . $subject->getFavorites());
     writeln('*IN PATTERN OBSERVER - PATTERN GOSSIP ALERT OVER*');
 }
Пример #11
0
<?php

ini_set('display_errors', '1');
function __autoload($class_name)
{
    set_include_path('class');
    include_once $class_name . '.php';
}
// client
writeln('BEGIN TESTING FACADE PATTERN');
writeln('');
$book = new Book('Design Patterns', 'Gamma, Helm, Johnson, and Vlissides');
writeln('Original book title: ' . $book->getTitle());
writeln('');
$bookTitleReversed = CaseReverseFacade::reverseStringCase($book->getTitle());
writeln('Reversed book title: ' . $bookTitleReversed);
writeln('');
writeln('END TESTING FACADE PATTERN');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
Пример #12
0
require 'recipe/drupal8.php';
server('prod', '146.185.128.63', 9999)->user('deploy')->identityFile()->stage('production')->env('deploy_path', '/usr/share/nginx/html/kristiankaadk');
set('repository', 'git@github.com:kaa4ever/kristiankaadk.git');
task('deploy:permissions', function () {
    run('if [ -d {{deploy_path}}/shared ]; then sudo chown -R deploy:deploy {{deploy_path}}/shared; fi');
    run('if [ -d {{deploy_path}}/releases ]; then sudo chown -R deploy:deploy {{deploy_path}}/releases; fi');
});
task('docker:reboot', function () {
    cd('{{release_path}}');
    run('docker stop kristiankaa.site || true');
    run('docker rm kristiankaa.site || true');
    run('docker-compose -f docker-compose.prod.yml up -d');
});
task('drush:make', function () {
    writeln("<info>Drush: Building site</info>");
    run('docker exec kristiankaa.site bash -c "cd /var/www/html && drush make site.make -y"');
});
task('drush:updb', function () {
    writeln("<info>Drush: Updating database</info>");
    run('docker exec kristiankaa.site drush updb -y --root=/var/www/html');
});
task('drush:cache', function () {
    writeln("<info>Drush: Rebuilding cache</info>");
    run('docker exec kristiankaa.site drush cr --root=/var/www/html');
});
after('deploy:prepare', 'deploy:permissions');
after('deploy:update_code', 'docker:reboot');
after('deploy:update_code', 'drush:make');
after('deploy', 'drush:updb');
after('deploy', 'drush:cache');
Пример #13
0
$flyweightFactory = new FlyweightFactory();
$flyweightBookShelf1 = new FlyweightBookShelf();
$flyweightBook1 = $flyweightFactory->getBook(1);
$flyweightBookShelf1->addBook($flyweightBook1);
$flyweightBook2 = $flyweightFactory->getBook(1);
$flyweightBookShelf1->addBook($flyweightBook2);
writeln('test 1 - show the two books are the same book');
if ($flyweightBook1 === $flyweightBook2) {
    writeln('1 and 2 are the same');
} else {
    writeln('1 and 2 are not the same');
}
writeln('');
writeln('test 2 - with one book on one self twice');
writeln($flyweightBookShelf1->showBooks());
writeln('');
$flyweightBookShelf2 = new FlyweightBookShelf();
$flyweightBook1 = $flyweightFactory->getBook(2);
$flyweightBookShelf2->addBook($flyweightBook1);
$flyweightBookShelf1->addBook($flyweightBook1);
writeln('test 3 - book shelf one');
writeln($flyweightBookShelf1->showBooks());
writeln('');
writeln('test 3 - book shelf two');
writeln($flyweightBookShelf2->showBooks());
writeln('');
writeln('END TESTING FLYWEIGHT PATTERN');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
Пример #14
0
writeln('<td class="left_col">');
print_left_bar("account", "feed");
writeln('</td>');
writeln('<td class="fill">');
writeln('<table class="fill">');
writeln('	<tr>');
for ($c = 0; $c < 3; $c++) {
    writeln('		<td class="feed_box">');
    writeln('			<table class="zebra">');
    $r = 0;
    $row = run_sql("select feed_user.fid, title from feed_user inner join feed on feed_user.fid = feed.fid where zid = ? and col = ? order by pos", array($auth_zid, $c));
    if (count($row) == 0) {
        writeln('				<tr><td>(no feeds)</td></tr>');
    }
    for ($i = 0; $i < count($row); $i++) {
        writeln('				<tr>');
        writeln('					<td>' . $row[$i]["title"] . '</td>');
        writeln('					<td class="right"><a href="remove?fid=' . $row[$i]["fid"] . '"><span class="icon_16" style="background-image: url(/images/remove-16.png)">Remove</span></a></td>');
        writeln('				</tr>');
        $r = $r ? 0 : 1;
    }
    writeln('			</table>');
    writeln('			<div class="right"><a href="add?col=' . $c . '"><span class="icon_16" style="background-image: url(/images/add-16.png)">Add</span></a></div>');
    writeln('		</td>');
}
writeln('	</tr>');
writeln('</table>');
writeln('</td>');
writeln('</tr>');
writeln('</table>');
print_footer();
Пример #15
0
$book1 = clone $sqlProto;
$book1->setTitle('SQL For Cats');
writeln('Book 1 topic: ' . $book1->getTopic());
writeln('Book 1 title: ' . $book1->getTitle());
writeln('');
$book2 = clone $phpProto;
$book2->setTitle('OReilly Learning PHP 5');
writeln('Book 2 topic: ' . $book2->getTopic());
writeln('Book 2 title: ' . $book2->getTitle());
writeln('');
$book3 = clone $sqlProto;
$book3->setTitle('OReilly Learning SQL');
writeln('Book 3 topic: ' . $book3->getTopic());
writeln('Book 3 title: ' . $book3->getTitle());
writeln('');
writeln('END TESTING PROTOTYPE PATTERN');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
class SubObject
{
    static $instances = 0;
    public $instance;
    public function __construct()
    {
        $this->instance = ++self::$instances;
    }
    public function __clone()
    {
        $this->instance = ++self::$instances;
Пример #16
0
function print_noscript()
{
    global $server_name;
    global $auth_zid;
    global $auth_user;
    global $protocol;
    writeln('<noscript>');
    writeln('<div class="balloon">');
    writeln('<h1>JavaScript Disabled</h1>');
    writeln('<p>Which is fine! But you are currently browsing the JavaScript version of this page. Please do one of the following:</p>');
    writeln('<ul>');
    writeln('	<li>Enable scripts from <b>' . $server_name . '</b></li>');
    if ($auth_zid == "") {
        writeln('	<li>Sign in and uncheck the "Use JavaScript" option on your account settings page.</li>');
        writeln('	<li>Click <a href="">this link</a> to get a cookie that disables JavaScript. (not working yet)</li>');
    } else {
        writeln('	<li>Uncheck the "Use JavaScript" option on your <a href="' . user_page_link($auth_zid) . 'settings">account settings page</a>.</li>');
    }
    writeln('</ul>');
    writeln('</div>');
    writeln('</noscript>');
}
Пример #17
0
<?php

/**
 * Init WP with noncens data
 */
task('init:wp', function () {
    writeln('Initialize WP to get WP-CLI working');
    runLocally('cd web && wp core install --url=http://something.dev --title=wp --admin_user=admin --admin_password=admin --admin_email=arne@nada.se');
});
/**
 * Gets the latest from prod
 */
task('init:pull', function () {
    writeln('Pull remote version of WP');
    runLocally('dep pull production', 999);
});
task('init', ['init:wp', 'init:pull']);
Пример #18
0
function render_sliders($sid, $pid, $qid)
{
    global $hide_value;
    global $expand_value;
    if ($sid != 0) {
        $row = run_sql("select count(cid) as comments from comment where sid = ?", array($sid));
    } elseif ($pid != 0) {
        $row = run_sql("select count(cid) as comments from comment where pid = ?", array($pid));
    } elseif ($qid != 0) {
        $row = run_sql("select count(cid) as comments from comment where qid = ?", array($qid));
    }
    $total = (int) $row[0]["comments"];
    writeln('<div class="comment_header">');
    writeln('	<table class="fill">');
    writeln('		<tr>');
    if ($sid != 0) {
        writeln('			<td style="width: 20%"><a href="/post?sid=' . $sid . '" class="icon_16" style="background-image: url(\'/images/chat-16.png\')">Reply</a></td>');
    } elseif ($pid != 0) {
        writeln('			<td style="width: 20%"><a href="/post?pid=' . $pid . '" class="icon_16" style="background-image: url(\'/images/chat-16.png\')">Reply</a></td>');
    } elseif ($qid != 0) {
        writeln('			<td style="width: 20%"><a href="/post?qid=' . $qid . '" class="icon_16" style="background-image: url(\'/images/chat-16.png\')">Reply</a></td>');
    }
    writeln('			<td style="width: 30%">');
    writeln('				<table>');
    writeln('					<tr>');
    writeln('						<td>Hide</td>');
    writeln('						<td><input id="slider_hide" name="slider_hide" type="range" value="' . $hide_value . '" min="-1" max="5" onchange="update_hide_slider()"/></td>');
    writeln('						<td id="label_hide">' . $hide_value . '</td>');
    writeln('					</tr>');
    writeln('				</table>');
    writeln('			</td>');
    writeln('			<td style="width: 30%">');
    writeln('				<table>');
    writeln('					<tr>');
    writeln('						<td>Expand</td>');
    writeln('						<td><input id="slider_expand" name="slider_expand" type="range" value="' . $expand_value . '" min="-1" max="5" onchange="update_expand_slider()"/></td>');
    writeln('						<td id="label_expand">' . $expand_value . '</td>');
    writeln('					</tr>');
    writeln('				</table>');
    writeln('			</td>');
    writeln('			<td style="width: 20%; text-align: right">' . $total . ' comments</td>');
    writeln('		</tr>');
    writeln('	</table>');
    writeln('</div>');
    writeln('<div id="comment_box"></div>');
}
Пример #19
0
writeln('');
//load BookList for test data
$bookList = new BookList();
$inBook1 = new Book('PHP for Cats', 'Larry Truett');
$inBook2 = new Book('MySQL for Cats', 'Larry Truett');
$bookList->addBook($inBook1);
$bookList->addBook($inBook2);
$interpreter = new Interpreter($bookList);
writeln('test 1 - invalid request missing "book"');
writeln($interpreter->interpret('author 1'));
writeln('');
writeln('test 2 - valid book author request');
writeln($interpreter->interpret('book author 1'));
writeln('');
writeln('test 3 - valid book title request');
writeln($interpreter->interpret('book title 2'));
writeln('');
writeln('test 4 - valid book author title request');
writeln($interpreter->interpret('book author title 1'));
writeln('');
writeln('test 5 - invalid request with invalid book number');
writeln($interpreter->interpret('book title 3'));
writeln('');
writeln('test 6 - invalid request with nuo numeric book number');
writeln($interpreter->interpret('book title one'));
writeln('');
writeln('END TESTING INTERPRETER PATTERN');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
Пример #20
0
                    if (file_put_contents($tmpFile, $contents) > 0) {
                        if (basename($file) === 'yii.tpl') {
                            upload($tmpFile, "{$releaseDir}/" . $target);
                            run('chmod +x ' . "{$releaseDir}/" . $target);
                        } else {
                            run("mkdir -p {$releaseDir}/" . dirname($target));
                            upload($tmpFile, "{$releaseDir}/" . $target);
                        }
                        $success = true;
                    }
                } catch (\Exception $e) {
                    $success = false;
                }
                // Delete tmp file
                unlink($tmpFile);
            }
            if ($success) {
                writeln(sprintf("<info>✔</info> %s", $file->getRelativePathname()));
            } else {
                writeln(sprintf("<fg=red>✘</fg=red> %s", $file->getRelativePathname()));
            }
        }
        $theme = env('app.theme');
        $finder = new \Symfony\Component\Finder\Finder();
        $iterator = $finder->ignoreDotFiles(false)->files()->name('/\\.*$/')->in(getcwd() . '/themes/' . $theme . '/build');
        foreach ($iterator as $file) {
            upload($file, "{$releaseDir}/" . $file->getRelativePathname());
            writeln(sprintf("<info>✔</info> %s", $file->getRelativePathname()));
        }
    }
})->desc('Configures your local development environment')->onlyForStage('local');
Пример #21
0
        return $this->author;
    }
    function getTitle()
    {
        return $this->title;
    }
    function getAuthorAndTitle()
    {
        return $this->getTitle() . ' by ' . $this->getAuthor();
    }
}
writeln('BEGIN TESTING STRATEGY PATTERN');
writeln('');
$book = new Book('PHP for Cats', 'Larry Truett');
$strategyContextC = new StrategyContext('C');
$strategyContextE = new StrategyContext('E');
$strategyContextS = new StrategyContext('S');
writeln('test 1 - show name context C');
writeln($strategyContextC->showBookTitle($book));
writeln('');
writeln('test 2 - show name context E');
writeln($strategyContextE->showBookTitle($book));
writeln('');
writeln('test 3 - show name context S');
writeln($strategyContextS->showBookTitle($book));
writeln('');
writeln('END TESTING STRATEGY PATTERN');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
Пример #22
0
env('current', function () {
    return run("readlink {{deploy_path}}/current")->toString();
});
/**
 * Show current release number.
 */
task('current', function () {
    writeln('Current release: ' . basename(env('current')));
})->desc('Show current release.');
/**
 * Cleanup old releases.
 */
task('cleanup', function () {
    $releases = env('releases_list');
    $keep = get('keep_releases');
    while ($keep > 0) {
        array_shift($releases);
        --$keep;
    }
    foreach ($releases as $release) {
        run("rm -rf {{deploy_path}}/releases/{$release}");
    }
    run("cd {{deploy_path}} && if [ -e release ]; then rm release; fi");
    run("cd {{deploy_path}} && if [ -h release ]; then rm release; fi");
})->desc('Cleaning up old releases');
/**
 * Success message
 */
task('success', function () {
    writeln("<info>Successfully deployed!</info>");
})->once()->setPrivate();
Пример #23
0
function right_box($buttons, $style = "")
{
    if ($style == "") {
        writeln('<div class="right_box">');
    } else {
        writeln('<div class="right_box" style="' . $style . '">');
    }
    if (string_has($buttons, "<")) {
        writeln($buttons);
    } else {
        $a = explode(",", $buttons);
        for ($i = 0; $i < count($a); $i++) {
            $value = trim($a[$i]);
            $name = strtolower($value);
            $name = str_replace(" ", "_", $name);
            writeln('<input type="submit" name="' . $name . '" value="' . $value . '"/>');
        }
    }
    writeln('</div>');
}
Пример #24
0
    $body = http_post_string("body", array("len" => 64000, "valid" => "[ALL]"));
    $in_reply_to = http_post_string("in_reply_to", array("required" => false, "len" => 250, "valid" => "[a-z][A-Z][0-9]-_.@+-"));
    send_web_mail($to, $subject, $body, $in_reply_to);
    header("Location: /mail/");
    die;
}
$to = http_get_string("to", array("required" => false, "len" => 250, "valid" => "[a-z][A-Z][0-9]-_.<>@+ "));
$mid = http_get_int("mid", array("required" => false));
if ($mid > 0) {
    $message = db_get_rec("mail", $mid);
    $in_reply_to = $message["message_id"];
    $to = $message["mail_from"];
    $subject = $message["subject"];
    if (substr($subject, 0, 4) != "Re: ") {
        $subject = "Re: {$subject}";
    }
} else {
    $in_reply_to = "";
    $subject = "";
}
print_header("Mail", array("Inbox"), array("inbox"), array("/mail/"));
writeln('<form method="post">');
writeln('<input name="in_reply_to" type="hidden" value="' . $in_reply_to . '"/>');
beg_tab();
print_row(array("caption" => "To", "text_key" => "to", "text_value" => $to));
print_row(array("caption" => "Subject", "text_key" => "subject", "text_value" => $subject));
print_row(array("caption" => "Body", "textarea_key" => "body", "textarea_height" => 500));
end_tab();
right_box("Send");
writeln('</form>');
                if (basename($file) === 'main-local.php.tpl') {
                    $length = 32;
                    $bytes = openssl_random_pseudo_bytes($length);
                    $key = strtr(substr(base64_encode($bytes), 0, $length), '+/=', '_-.');
                    $contents = preg_replace('/(("|\')cookieValidationKey("|\')\\s*=>\\s*)(""|\'\')/', "\\1'{$key}'", $contents);
                }
                $target = preg_replace('/\\.tpl$/', '', $file->getRelativePathname());
                // Put contents and upload tmp file to server
                if (file_put_contents($tmpFile, $contents) > 0) {
                    if (basename($file) === 'yii.tpl') {
                        upload($tmpFile, "{$releaseDir}/" . $target);
                        run('chmod +x ' . "{$releaseDir}/" . $target);
                    } else {
                        run("mkdir -p {$releaseDir}/" . dirname($target));
                        upload($tmpFile, "{$releaseDir}/" . $target);
                    }
                    $success = true;
                }
            } catch (\Exception $e) {
                $success = false;
            }
            // Delete tmp file
            unlink($tmpFile);
        }
        if ($success) {
            writeln(sprintf("<info>✔</info> %s", $file->getRelativePathname()));
        } else {
            writeln(sprintf("<fg=red>✘</fg=red> %s", $file->getRelativePathname()));
        }
    }
})->desc('Make configure files for your stage');
Пример #26
0
<?php

/* (c) Anton Medvedev <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Deployer;

desc('Rollback to previous release');
task('rollback', function () {
    $releases = get('releases_list');
    if (isset($releases[1])) {
        $releaseDir = "{{deploy_path}}/releases/{$releases[1]}";
        // Symlink to old release.
        run("cd {{deploy_path}} && {{bin/symlink}} {$releaseDir} current");
        // Remove release
        run("rm -rf {{deploy_path}}/releases/{$releases[0]}");
        if (isVerbose()) {
            writeln("Rollback to `{$releases[1]}` release was successful.");
        }
    } else {
        writeln("<comment>No more releases you can revert to.</comment>");
    }
});
Пример #27
0
/**
 * Upload file or directory to current server.
 * @param string $local
 * @param string $remote
 * @throws \RuntimeException
 */
function upload($local, $remote)
{
    $server = Context::get()->getServer();
    $local = env()->parse($local);
    $remote = env()->parse($remote);
    if (is_file($local)) {
        writeln("Upload file <info>{$local}</info> to <info>{$remote}</info>");
        $server->upload($local, $remote);
    } elseif (is_dir($local)) {
        writeln("Upload from <info>{$local}</info> to <info>{$remote}</info>");
        $finder = new Symfony\Component\Finder\Finder();
        $files = $finder->files()->ignoreUnreadableDirs()->ignoreVCS(true)->ignoreDotFiles(false)->in($local);
        /** @var $file \Symfony\Component\Finder\SplFileInfo */
        foreach ($files as $file) {
            $server->upload($file->getRealPath(), $remote . '/' . $file->getRelativePathname());
        }
    } else {
        throw new \RuntimeException("Uploading path '{$local}' does not exist.");
    }
}
Пример #28
0
    {
        $this->topic = 'Equity Bank';
    }
    function __clone()
    {
    }
}
writeln('Prototype Testing started');
writeln('');
$cytPro = new cytonnWebPrototype();
$equPro = new equityWebPrototype();
$web1 = clone $cytPro;
$web1->setTitle('Cytonn Investment Portal');
writeln('Web 1 Main Page: ' . $web1->getMainPage());
writeln('Web1 1 title: ' . $web1->getTitle());
writeln('');
$web2 = clone $equPro;
$web2->setTitle('Equity Bank online banking Portal');
writeln('Web 2 Main Page: ' . $web2->getMainPage());
writeln('Web 2 title: ' . $web2->getTitle());
writeln('');
$web3 = clone $cytPro;
$web3->setTitle('Cytonn Technologies');
writeln('Web 3 Main Page: ' . $web3->getMainPage());
writeln('Web 3 title: ' . $web3->getTitle());
writeln('');
writeln('Sucsessfull prototype Design pattern test');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
Пример #29
0
    run('{{bin/php}} {{release_path}}/artisan migrate --force');
});
desc('Execute artisan migrate:rollback');
task('artisan:migrate:rollback', function () {
    $output = run('{{bin/php}} {{release_path}}/artisan migrate:rollback --force');
    writeln('<info>' . $output . '</info>');
});
desc('Execute artisan migrate:status');
task('artisan:migrate:status', function () {
    $output = run('{{bin/php}} {{release_path}}/artisan migrate:status');
    writeln('<info>' . $output . '</info>');
});
desc('Execute artisan db:seed');
task('artisan:db:seed', function () {
    $output = run('{{bin/php}} {{release_path}}/artisan db:seed --force');
    writeln('<info>' . $output . '</info>');
});
desc('Execute artisan cache:clear');
task('artisan:cache:clear', function () {
    run('{{bin/php}} {{release_path}}/artisan cache:clear');
});
desc('Execute artisan config:cache');
task('artisan:config:cache', function () {
    run('{{bin/php}} {{release_path}}/artisan config:cache');
});
desc('Execute artisan route:cache');
task('artisan:route:cache', function () {
    run('{{bin/php}} {{release_path}}/artisan route:cache');
});
desc('Execute artisan view:clear');
task('artisan:view:clear', function () {
Пример #30
0
writeln('	</tr>');
for ($i = 0; $i < count($row); $i++) {
    if ($row[$i]["zid"] == "") {
        $author = 'Anonymous Coward';
    } else {
        $author = '<a href="' . user_page_link($row[$i]["zid"]) . '">' . $row[$i]["zid"] . '</a>';
    }
    if ($row[$i]["editor"] == "") {
        $editor = '';
    } else {
        $editor = '<a href="' . user_page_link($row[$i]["editor"]) . '">' . $row[$i]["editor"] . '</a>';
    }
    if ($row[$i]["sid"] > 0) {
        $status = '<a href="/story/' . $row[$i]["sid"] . '">Published</a>';
    } else {
        if ($row[$i]["closed"] == 1) {
            $status = "Closed (" . ($row[$i]["reason"] == "" ? "no reason" : $row[$i]["reason"]) . ")";
        } else {
            $status = "Voting";
        }
    }
    writeln('	<tr>');
    writeln('		<td style="white-space: nowrap">' . date("Y-m-d H:i", $row[$i]["time"]) . '</td>');
    writeln('		<td><a href="/pipe/' . $row[$i]["pid"] . '">' . $row[$i]["title"] . '</a></td>');
    writeln('		<td>' . $author . '</td>');
    writeln('		<td>' . $editor . '</td>');
    writeln('		<td>' . $status . '</td>');
    writeln('	</tr>');
}
end_tab();
print_footer();