コード例 #1
0
ファイル: ArquivoLog.php プロジェクト: p21sistemas/log
 /**
  * Metodo padrão de execução do log
  *
  * @return Log
  */
 public function executar()
 {
     $this->logArquivo->parse();
     $this->logArquivo->getLog()->setInicio(new \Datetime());
     $this->logArquivo->getLog()->setFim(new \Datetime());
     $this->logArquivo->getLog()->setIp($this->request->getServer('REMOTE_ADDR'));
     $this->logArquivo->getLog()->setMensagem('Log arquivo de ' . $this->logArquivo->getTipo() . ': ' . $this->logArquivo->getNome());
     $this->logArquivo->getLog()->setTipo(LogArquivo::TIPO);
     $this->logArquivo->getLog()->setUsuario($this->usuario);
     $this->logArquivo->getLog()->setRoute($this->request->getRequestUri());
     return $this->logArquivo->getLog();
 }
コード例 #2
0
ファイル: OperacaoLog.php プロジェクト: p21sistemas/log
 /**
  * Metodo padrão de execução do log
  * 
  * @return Log
  */
 public function executar()
 {
     $this->logCadastro->setOperacao($this->operacao);
     $this->logCadastro->parse();
     $this->logCadastro->getLog()->setInicio(new \Datetime());
     $this->logCadastro->getLog()->setFim(new \Datetime());
     $this->logCadastro->getLog()->setIp($this->request->getServer('REMOTE_ADDR'));
     $this->logCadastro->getLog()->setMensagem($this->operacao . ' - ' . get_class($this->logCadastro->getEntity()));
     $this->logCadastro->getLog()->setTipo(LogCadastro::TIPO);
     $this->logCadastro->getLog()->setUsuario($this->usuario);
     $this->logCadastro->getLog()->setRoute($this->request->getRequestUri());
     return $this->logCadastro->getLog();
 }
コード例 #3
0
ファイル: Router.php プロジェクト: waydelyle/mobicms
 public function __construct(Request $request)
 {
     $uri = substr($request->getRequestUri(), strlen($request->getBaseUrl()));
     if ($pos = strpos($uri, '?')) {
         $uri = substr($uri, 0, $pos);
     }
     $this->path = array_filter(explode('/', trim($uri, '/')));
     $this->config = (new Routes())->routesMap;
     $this->module = $this->getModule();
     $this->dir = $this->config[$this->module];
 }
コード例 #4
0
ファイル: InitMetaTags.php プロジェクト: samsonasik/unnamed
 /**
  * This function will generate all meta tags needed for SEO optimisation.
  *
  * @param array $content
  */
 public function __invoke(array $content = [])
 {
     $description = !empty($content['description']) ? $content['description'] : $this->settings->__invoke('general', 'site_description');
     $keywords = !empty($content['keywords']) ? $content['keywords'] : $this->settings->__invoke('general', 'site_keywords');
     $text = !empty($content['text']) ? $content['text'] : $this->settings->__invoke('general', 'site_text');
     $preview = !empty($content['preview']) ? $content['preview'] : '';
     $title = !empty($content['title']) ? $content['title'] : $this->settings->__invoke('general', 'site_name');
     $this->placeholder->append("\r\n<meta itemprop='name' content='" . $this->settings->__invoke('general', 'site_name') . "'>\r\n");
     // must be set from db
     $this->placeholder->append("<meta itemprop='description' content='" . substr(strip_tags($text), 0, 150) . "'>\r\n");
     $this->placeholder->append("<meta itemprop='title' content='" . $title . "'>\r\n");
     $this->placeholder->append("<meta itemprop='image' content='" . $preview . "'>\r\n");
     $this->headMeta->appendName('keywords', $keywords);
     $this->headMeta->appendName('description', $description);
     $this->headMeta->appendName('viewport', 'width=device-width, initial-scale=1.0');
     $this->headMeta->appendName('generator', $this->settings->__invoke('general', 'site_name'));
     $this->headMeta->appendName('apple-mobile-web-app-capable', 'yes');
     $this->headMeta->appendName('application-name', $this->settings->__invoke('general', 'site_name'));
     $this->headMeta->appendName('mobile-web-app-capable', 'yes');
     $this->headMeta->appendName('HandheldFriendly', 'True');
     $this->headMeta->appendName('MobileOptimized', '320');
     $this->headMeta->appendName('apple-mobile-web-app-status-bar-style', 'black-translucent');
     $this->headMeta->appendName('author', 'Stanimir Dimitrov - stanimirdim92@gmail.com');
     $this->headMeta->appendName('twitter:card', 'summary');
     $this->headMeta->appendName('twitter:site', '@' . $this->settings->__invoke('general', 'site_name'));
     $this->headMeta->appendName('twitter:title', substr(strip_tags($title), 0, 70));
     // max 70 chars
     $this->headMeta->appendName('twitter:description', substr(strip_tags($text), 0, 200));
     $this->headMeta->appendName('twitter:image', $preview);
     // max 1MB
     $this->headMeta->appendProperty('og:image', $preview);
     $this->headMeta->appendProperty('og:title', $title);
     $this->headMeta->appendProperty('og:description', $description);
     $this->headMeta->appendProperty('og:type', 'article');
     $this->headMeta->appendProperty('og:url', $this->request->getUri()->getHost() . $this->request->getRequestUri());
 }
コード例 #5
0
ファイル: RequestTest.php プロジェクト: Rovak/zf2
 /**
  * @dataProvider serverHostnameProvider
  * @param array  $server
  * @param string $name
  * @param string $value
  */
 public function testServerHostnameProvider(array $server, $expectedHost, $expectedRequestUri)
 {
     $_SERVER = $server;
     $request = new Request();
     $host = $request->getUri()->getHost();
     $this->assertEquals($expectedHost, $host);
     $requestUri = $request->getRequestUri();
     $this->assertEquals($expectedRequestUri, $requestUri);
 }
コード例 #6
0
ファイル: CacheService.php プロジェクト: gotcms/gotcms
 /**
  * Determine the page to save from the request
  *
  * @param HttpRequest $request Http Request
  *
  * @throws \RuntimeException
  * @return string
  */
 protected function createId(HttpRequest $request)
 {
     return md5(sprintf('%s-%s-%s', $request->getServer('HTTPS'), $request->getServer('HTTP_HOST'), $request->getRequestUri()));
 }
コード例 #7
0
ファイル: RequestTest.php プロジェクト: pnaq57/zf2demo
 /**
  * @dataProvider serverHostnameProvider
  * @param array  $server
  * @param string $name
  * @param string $value
  */
 public function testServerHostnameProvider(array $server, $expectedHost, $expectedPort, $expectedRequestUri)
 {
     $_SERVER = $server;
     $request = new Request();
     $host = $request->getUri()->getHost();
     $this->assertEquals($expectedHost, $host);
     $uriParts = parse_url($_SERVER['REQUEST_URI']);
     if (isset($uriParts['scheme'])) {
         $scheme = $request->getUri()->getScheme();
         $this->assertEquals($uriParts['scheme'], $scheme);
     }
     $port = $request->getUri()->getPort();
     $this->assertEquals($expectedPort, $port);
     $requestUri = $request->getRequestUri();
     $this->assertEquals($expectedRequestUri, $requestUri);
 }