저자: XE Developers (developers@xpressengine.com)
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind('xe.seo', function ($app) {
         $setting = new Setting($app['xe.config'], $app['xe.storage'], $app['xe.media'], $app['xe.keygen']);
         return new SeoHandler([new BasicImporter($app['xe.frontend'], $app['request']), new OpenGraphImporter($app['xe.frontend'], $app['request']), new TwitterCardImporter($app['xe.frontend'], $app['request'], $setting->get('twitterUsername'))], $setting, $app['xe.translator']);
     }, true);
     $this->app->bind(SeoHandler::class, 'xe.seo');
 }
예제 #2
0
 public function testSet()
 {
     list($cfg, $storage, $media, $keygen) = $this->getMocks();
     $instance = new Setting($cfg, $storage, $media, $keygen);
     $id = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
     $mockConfig = m::mock('Xpressengine\\Config\\ConfigEntity');
     $mockConfig->shouldReceive('get')->once()->with('uuid')->andReturnNull();
     $keygen->shouldReceive('generate')->once()->andReturn($id);
     $mockConfig->shouldReceive('set')->once()->with('uuid', $id);
     $cfg->shouldReceive('set')->once()->with(m::on(function () {
         return true;
     }), ['foo' => 'bar', 'baz' => 'qux'])->andReturn($mockConfig);
     $cfg->shouldReceive('modify')->once()->with($mockConfig);
     $instance->set(['foo' => 'bar', 'baz' => 'qux']);
 }
예제 #3
0
 /**
  * Make title text
  *
  * @param SeoUsable $item item instance
  * @return string
  */
 protected function makeTitle(SeoUsable $item = null)
 {
     if ($item) {
         return $item->getTitle() . ' - ' . $this->translator->trans($this->setting->get('mainTitle'));
     }
     return implode(' - ', [$this->translator->trans($this->setting->get('mainTitle')), $this->translator->trans($this->setting->get('subTitle'))]);
 }