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


PHP Sobi::Date方法代码示例

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


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

示例1: addRepo

 private function addRepo()
 {
     if (!SPFactory::mainframe()->checkToken()) {
         Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::WARNING, 0, __LINE__, __FILE__);
         $this->response(Sobi::Url('extensions.browse'), SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), false, SPC::ERROR_MSG);
         exit;
     }
     $connection = SPFactory::Instance('services.remote');
     $repo = trim(preg_replace('/[^a-zA-Z0-9\\.\\-\\_]/', null, SPRequest::string('repository')));
     $ssl = $connection->certificate($repo);
     if (isset($ssl['err'])) {
         SPFactory::mainframe()->cleanBuffer()->customHeader();
         //$response = sprintf( 'The connection could not be validated (error number %s). %s', $ssl[ 'err' ], $ssl[ 'msg' ] );
         $response = SPLang::e('NOT_VALIDATED', $ssl['err'], $ssl['msg']);
         echo json_encode(array('message' => array('type' => SPC::ERROR_MSG, 'text' => $response)));
         exit;
     } else {
         $cert = array();
         $file = SPFactory::Instance('base.fs.file', SPLoader::path('etc.repos.' . str_replace('.', '_', $repo), 'front', false, 'xml'));
         $cert['url'] = 'https://' . $repo;
         $cert['certificate']['serialNumber'] = $ssl['serialNumber'];
         $cert['certificate']['validFrom'] = Sobi::Date($ssl['validFrom_time_t']);
         $cert['certificate']['validTo'] = Sobi::Date($ssl['validTo_time_t']);
         $cert['certificate']['subject'] = $ssl['subject'];
         $cert['certificate']['issuer'] = $ssl['issuer'];
         $cert['certificate']['hash'] = $ssl['hash'];
         $def = SPFactory::Instance('types.array', $cert);
         $file->content($def->toXML($cert, 'repository'));
         $file->save();
         /** @var $view SPExtensionsView */
         $view =& SPFactory::View('extensions', true)->assign($this->_task, 'task')->assign($cert['certificate'], 'certificate')->determineTemplate('extensions', 'certificate');
         ob_start();
         $view->display();
         $response = ob_get_contents();
         $response = str_replace('id="SobiPro"', 'id="SpRepoModal"', $response);
         SPFactory::mainframe()->cleanBuffer()->customHeader();
         echo json_encode(array('message' => array('type' => SPC::INFO_MSG, 'response' => $response)));
         exit;
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:40,代码来源:extensions.php


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