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


PHP Context::isCLI方法代码示例

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


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

示例1: getTextColor

 public function getTextColor()
 {
     if (!\thebuggenie\core\framework\Context::isCLI()) {
         \thebuggenie\core\framework\Context::loadLibrary('ui');
     }
     $rgb = hex2rgb($this->_itemdata);
     return 0.299 * $rgb['red'] + 0.587 * $rgb['green'] + 0.114 * $rgb['blue'] > 170 ? '#333' : '#FFF';
 }
开发者ID:shoreless-Limited,项目名称:thebuggenie,代码行数:8,代码来源:Status.php

示例2: _parse_add_toc

 protected function _parse_add_toc($matches)
 {
     if (framework\Context::isCLI()) {
         return '';
     }
     return framework\Action::returnComponentHTML('publish/toc', array('toc' => $this->toc));
 }
开发者ID:underblaze,项目名称:thebuggenie-4.1.0,代码行数:7,代码来源:TextParser.php

示例3: getArticleLinkTag

 public function getArticleLinkTag($matches, $parser)
 {
     $article_link = $matches[0];
     $parser->addInternalLinkOccurrence($article_link);
     $article_name = $this->getSpacedName($matches[0]);
     if (!framework\Context::isCLI()) {
         framework\Context::loadLibrary('ui');
         return link_tag(make_url('publish_article', array('article_name' => $matches[0])), $article_name);
     } else {
         return $matches[0];
     }
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:12,代码来源:Publish.php

示例4: _construct

 public function _construct(\b2db\Row $row, $foreign_key = null)
 {
     if (framework\Context::isCLI()) {
         $this->_hostname = php_uname('n');
     } else {
         $hostprefix = !array_key_exists('HTTPS', $_SERVER) || $_SERVER['HTTPS'] == '' || $_SERVER['HTTPS'] == 'off' ? 'http' : 'https';
         $this->_is_secure = (bool) ($hostprefix == 'https');
         if (isset($_SERVER["HTTP_X_FORWARDED_HOST"]) && $_SERVER["HTTP_X_FORWARDED_HOST"] != "") {
             $this->_hostname = "{$hostprefix}://{$_SERVER["HTTP_X_FORWARDED_HOST"]}";
         } else {
             $this->_hostname = "{$hostprefix}://{$_SERVER['SERVER_NAME']}";
         }
         $port = $_SERVER['SERVER_PORT'];
         if ($port != 80) {
             $this->_hostname .= ":{$port}";
         }
     }
 }
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:18,代码来源:Scope.php

示例5: getAgileTextColor

 public function getAgileTextColor()
 {
     if (!framework\Context::isCLI()) {
         framework\Context::loadLibrary('ui');
     }
     $rgb = hex2rgb($this->_scrumcolor);
     if (!$rgb) {
         return '#333';
     }
     return 0.299 * $rgb['red'] + 0.587 * $rgb['green'] + 0.114 * $rgb['blue'] > 170 ? '#333' : '#FFF';
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:11,代码来源:Issue.php

示例6: processIncomingEmailAccount

 public function processIncomingEmailAccount(IncomingEmailAccount $account)
 {
     $count = 0;
     if ($emails = $account->getUnprocessedEmails()) {
         try {
             $current_user = framework\Context::getUser();
             foreach ($emails as $email) {
                 $user = $this->getOrCreateUserFromEmailString($email->from);
                 if ($user instanceof User) {
                     if (framework\Context::isCLI() || framework\Context::getUser()->getID() != $user->getID()) {
                         framework\Context::switchUserContext($user);
                     }
                     $message = $account->getMessage($email);
                     $data = $message->getBodyPlain() ? $message->getBodyPlain() : strip_tags($message->getBodyHTML());
                     if ($data) {
                         if (mb_detect_encoding($data, 'UTF-8', true) === false) {
                             $data = utf8_encode($data);
                         }
                         $new_data = '';
                         foreach (explode("\n", $data) as $line) {
                             $line = trim($line);
                             if ($line) {
                                 $line = preg_replace('/^(_{2,}|-{2,})$/', "<hr>", $line);
                                 $new_data .= $line . "\n";
                             } else {
                                 $new_data .= "\n";
                             }
                         }
                         $data = nl2br($new_data, false);
                     }
                     // Parse the subject, and obtain the issues.
                     $parsed_commit = Issue::getIssuesFromTextByRegex(mb_decode_mimeheader($email->subject));
                     $issues = $parsed_commit["issues"];
                     // If any issues were found, add new comment to each issue.
                     if ($issues) {
                         foreach ($issues as $issue) {
                             $text = preg_replace('#(^\\w.+:\\n)?(^>.*(\\n|$))+#mi', "", $data);
                             $text = trim($text);
                             if (!$this->processIncomingEmailCommand($text, $issue) && $user->canPostComments()) {
                                 $comment = new Comment();
                                 $comment->setContent($text);
                                 $comment->setPostedBy($user);
                                 $comment->setTargetID($issue->getID());
                                 $comment->setTargetType(Comment::TYPE_ISSUE);
                                 $comment->save();
                             }
                         }
                     } else {
                         if ($user->canReportIssues($account->getProject())) {
                             $issue = new Issue();
                             $issue->setProject($account->getProject());
                             $issue->setTitle(mb_decode_mimeheader($email->subject));
                             $issue->setDescription($data);
                             $issue->setPostedBy($user);
                             $issue->setIssuetype($account->getIssuetype());
                             $issue->save();
                             // Append the new issue to the list of affected issues. This
                             // is necessary in order to process the attachments properly.
                             $issues[] = $issue;
                         }
                     }
                     // If there was at least a single affected issue, and mail
                     // contains attachments, add those attachments to related issues.
                     if ($issues && $message->hasAttachments()) {
                         foreach ($message->getAttachments() as $attachment_no => $attachment) {
                             echo 'saving attachment ' . $attachment_no;
                             $name = iconv_mime_decode($attachment['filename'], ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
                             $new_filename = framework\Context::getUser()->getID() . '_' . NOW . '_' . basename($name);
                             if (framework\Settings::getUploadStorage() == 'files') {
                                 $files_dir = framework\Settings::getUploadsLocalpath();
                                 $filename = $files_dir . $new_filename;
                             } else {
                                 $filename = $name;
                             }
                             Logging::log('Creating issue attachment ' . $filename . ' from attachment ' . $attachment_no);
                             echo 'Creating issue attachment ' . $filename . ' from attachment ' . $attachment_no;
                             $content_type = $attachment['type'] . '/' . $attachment['subtype'];
                             $file = new File();
                             $file->setRealFilename($new_filename);
                             $file->setOriginalFilename(basename($name));
                             $file->setContentType($content_type);
                             $file->setDescription($name);
                             $file->setUploadedBy(framework\Context::getUser());
                             if (framework\Settings::getUploadStorage() == 'database') {
                                 $file->setContent($attachment['data']);
                             } else {
                                 Logging::log('Saving file ' . $new_filename . ' with content from attachment ' . $attachment_no);
                                 file_put_contents($new_filename, $attachment['data']);
                             }
                             $file->save();
                             // Attach file to each related issue.
                             foreach ($issues as $issue) {
                                 $issue->attachFile($file);
                             }
                         }
                     }
                     $count++;
                 }
             }
         } catch (\Exception $e) {
//.........这里部分代码省略.........
开发者ID:Alexssssss,项目名称:thebuggenie,代码行数:101,代码来源:Mailing.php


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