当前位置: 首页>>代码示例>>PHP>>正文


PHP String::build方法代码示例

本文整理汇总了PHP中String::build方法的典型用法代码示例。如果您正苦于以下问题:PHP String::build方法的具体用法?PHP String::build怎么用?PHP String::build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在String的用法示例。


在下文中一共展示了String::build方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionIndex

 public function actionIndex($isForced = false, $isDebug = false)
 {
     $console = Console::getInstance($isForced, $isDebug);
     $console->debugStart('Entered');
     //        if (mail('evgeniy.siderka@hyuna.bb', 'test', 'test message')) {
     //            $console->writeLine('OK');
     //        } else {
     //            $console->writeLine('Failure');
     //        }
     $newExecutors = Site::getNewExecutors('2015-11-19 12:20:00');
     $report = '';
     foreach ($newExecutors as $e) {
         $sites = Site::model()->findAllByAttributes(array('executor_id' => $e));
         if (count($sites) < 1) {
             continue;
         }
         $report .= String::build('Positions for "{keyword}" ({date_from} - {date_to})', array('keyword' => $sites[0]->keyword->name, 'date_from' => Time::toPretty($sites[0]->updated_at), 'date_to' => Time::toPretty($sites[count($sites) - 1]->updated_at))) . PHP_EOL;
         foreach ($sites as $s) {
             $report .= String::build('{position}: {site}', array('position' => $s->position, 'site' => String::rebuildUrl($s->link, false, false, true, false))) . PHP_EOL;
         }
     }
     $console->writeLine($report);
     $console->debugEnd();
     return;
 }
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:25,代码来源:TestCommand.php

示例2: fetch

 protected function fetch($userAgent = null, $cookie = null, $referrer = null, \Proxy $proxy = null)
 {
     sleep(Settings::getValue(Settings::GOOGLE_SEARCH_COOLDOWN));
     $body = file_get_contents($this->getUrl());
     $json = json_decode($body);
     if ($json->responseStatus != 200) {
         throw new Exception(String::build('Can\'t fetch results from {search_engine}. Response status: {status} ({details})', array('search_engine' => $this->getSearchEngine(), 'status' => $json->responseStatus, 'details' => $json->responseDetails)));
     }
     return $json->responseData->results;
 }
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:10,代码来源:GoogleSearchEngine.php

示例3: array

    
    <div class="row">
        <?php 
echo Chtml::submitButton('Add');
?>
    </div>
    
    <?php 
echo CHtml::endForm();
?>
</div>

<div>
    <?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'grvKeywords', 'dataProvider' => $keyword->search(), 'filter' => $keyword, 'htmlOptions' => array(), 'columns' => array(array('name' => 'name', 'header' => 'Keyword', 'type' => 'raw', 'value' => function ($e) {
    return String::build('<a href="{link}" title="Added on {created_at}">{keyword}</a>', array('link' => Yii::app()->createUrl('site/keywordDetails', array('keywordId' => $e->id)), 'created_at' => Time::toPretty($e->created_at), 'keyword' => $e->name));
}), array('name' => 'search_engine', 'header' => 'Search Engine', 'value' => function ($e) {
    return ucwords($e->search_engine);
}), array('name' => 'status', 'header' => 'Status', 'type' => 'raw', 'value' => function ($e) {
    return CHtml::tag('span', array('title' => String::build('Last Check: {last_check} Next Check: {next_check}', array('last_check' => Time::toPretty($e->checked_at), 'next_check' => $e->period ? date(Time::FORMAT_PRETTY, strtotime($e->checked_at) + $e->period) : 'No autocheck'))), ucwords($e->status));
}))));
?>
</div>

<script type="text/javascript">

$("#ddlPeriod").change(function () {
    $("#txfPeriod").val($(this).val());
});

</script>
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:30,代码来源:keywords.php

示例4: timestamp

 /**
  * Get microtime string
  * @return string
  */
 private function timestamp()
 {
     $microtime = microtime(true);
     $microtimeString = sprintf('%03d', ($microtime - floor($microtime)) * 1000);
     return String::build('{0}{1}: ', array(gmdate('H:i:s.', $microtime), $microtimeString));
 }
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:10,代码来源:Console.php

示例5: array

echo Executor::model()->count();
?>
</p>
<p>Pending keywords: <?php 
echo Keyword::model()->count('status = \'' . Keyword::STATUS_PENDING . '\'');
?>
</p>

<h3>Active Executors</h3>

<div>
    <?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'grvKeywords', 'dataProvider' => $executor->searchActive(), 'htmlOptions' => array(), 'columns' => array(array('name' => 'id', 'header' => 'ID', 'value' => function ($e) {
    return $e->id;
}), array('name' => 'keyword_id', 'header' => 'Keyword', 'value' => function ($e) {
    return String::build('{keyword_id}: {keyword}', array('keyword' => $e->keyword->name, 'keyword_id' => $e->keyword_id));
}), array('header' => 'Search Engine', 'value' => function ($e) {
    return ucwords($e->keyword->search_engine);
}), array('name' => 'status', 'header' => 'Status', 'value' => function ($e) {
    return ucwords($e->status);
}), array('name' => 'message', 'header' => 'Message', 'value' => function ($e) {
    return $e->message;
}), array('name' => 'created_at', 'header' => 'Created', 'value' => function ($e) {
    return Time::toPretty($e->created_at);
}), array('name' => 'updated_at', 'header' => 'Updated', 'value' => function ($e) {
    return Time::toPretty($e->updated_at);
}), array('header' => '', 'type' => 'raw', 'value' => function ($e) {
    if ($e->status == Executor::STATUS_ERROR) {
        return CHtml::link('Terminate', Yii::app()->createUrl('site/terminateExecutor', array('executorId' => $e->id)));
    }
}))));
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:31,代码来源:statistics.php

示例6: array

    </div>
    
    <?php 
echo CHtml::endForm();
?>
</div>

<p><a href="<?php 
echo Yii::app()->createUrl('site/reportsBrowse');
?>
">Browse Reports</a></p>

<div>
    <?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'grvKeywords', 'dataProvider' => $report->search(), 'filter' => $report, 'htmlOptions' => array(), 'columns' => array(array('name' => 'email', 'header' => 'Email', 'type' => 'raw', 'value' => function ($e) {
    return String::build('<span title="Added on {created_at}">{email}</span>', array('email' => $e->email, 'created_at' => Time::toPretty($e->created_at)));
}), array('name' => 'last_send_at', 'header' => 'Last Update', 'filter' => false, 'value' => function ($e) {
    return Time::toPretty($e->last_send_at);
}), array('header' => 'Next Update', 'value' => function ($e) {
    return date(Time::FORMAT_PRETTY, strtotime($e->last_send_at) + $e->period);
}), array('header' => '', 'type' => 'raw', 'value' => function ($e) {
    $links = '';
    if (time() - strtotime($e->last_send_at) > 600) {
        $links .= CHtml::link('Send Now', Yii::app()->createUrl('site/reportsSend', array('reportId' => $e->id))) . '&nbsp;';
    }
    $links .= Chtml::link('Delete', Yii::app()->createUrl('site/reportsDelete', array('reportId' => $e->id)));
    return $links;
}))));
?>
</div>
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:30,代码来源:reports.php

示例7: array

<?php

/* @var $this SiteController */
$this->pageTitle = Yii::app()->name;
?>

<div>
    <?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'grvLeads', 'dataProvider' => $site->searchLeads(), 'columns' => array(array('name' => 'domain', 'header' => 'Domain', 'value' => function ($e) {
    return $e->domain;
}), array('name' => 'keyword', 'header' => 'Keyword', 'value' => function ($e) {
    return $e->keyword->name;
}), array('name' => 'created_at', 'header' => 'Added On', 'type' => 'raw', 'value' => function ($e) {
    return CHtml::tag('span', array('title' => String::build('by {search_engine} on {position} position', array('search_engine' => $e->keyword->search_engine, 'position' => $e->position))), Time::toPretty($e->created_at));
}))));
?>
</div>
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:17,代码来源:index.php

示例8: getUrl

 public function getUrl()
 {
     return String::build('http://ajax.googleapis.com/ajax/services/search/web?v=1.0&hl=it&rsz=8&q={query}{startPosition}', array('query' => urlencode($this->query), 'startPosition' => $this->pageNumber > 1 ? '&start=' . ($this->pageNumber - 1) * $this->positionsPerPage - 1 : ''));
 }
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:4,代码来源:GoogleSearchEngineIt.php

示例9: wrapLinks

 /**
  * Find text with web address and wrap it to tag 'a'
  * @param string $string
  * @return string
  */
 public static function wrapLinks($string)
 {
     $pattern = '/(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\+\\:\\?\\=\\&\\/\\w\\.-]*)*\\/?/';
     $result = array();
     preg_match_all($pattern, $string, $result);
     foreach ($result[0] as $l) {
         $string = str_replace($l, String::build('<a href="{link}">{link}</a>', array('link' => $l)), $string);
     }
     return $string;
 }
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:15,代码来源:String.php

示例10: getUrl

 protected function getUrl()
 {
     return String::build('http://www.bing.com/search?q={query}&first={startPosition}', array('query' => urlencode(str_replace(' ', '+', $this->query)), 'startPosition' => $this->pageNumber > 0 ? $this->pageNumber * $this->positionsPerPage : '0'));
 }
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:4,代码来源:BingSearchEngine.php

示例11: send

 public function send()
 {
     $reportHtml;
     if (!($reportHtml = $this->generate())) {
         return false;
     }
     $title = Yii::app()->name . ' Report';
     $body = String::build('<h1>{title}</h1><br /><br />{report}', array('title' => $title, 'report' => $reportHtml));
     $headers = 'From: noreply@ad-center.com' . PHP_EOL;
     $headers .= 'Content-type: text/html' . PHP_EOL;
     if (mail($this->email, $title, $body, $headers)) {
         $this->last_send_at = date(Time::FORMAT_STANDART);
         $this->update();
         file_put_contents(Yii::app()->basePath . '/reports/' . date(Time::FORMAT_STANDART) . '.html', $body);
     } else {
         throw new Exception('Can\'t send report to ' . $this->email);
     }
 }
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:18,代码来源:Report.php


注:本文中的String::build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。