diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..589cb89d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,23 @@ +root = true + +[*] +end_of_line = lf +indent_style = space +charset = utf-8 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{yml,twig,php}] +indent_size = 4 + +[*.{js,json,scss,css}] +indent_size = 2 + +[.travis-ci.yml] +indent_size = 2 + +[composer.json] +indent_size = 4 + +[Makefile] +indent_style = tab diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..87c36a44 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,23 @@ +Delete this sentence after you read the "Issues" paragraph from the +"guidelines for contributing" link above. + +If you are reporting a bug, please try to fill in the following, otherwise +remove it along with this sentence. + +| Question | Answer +|----------------|------------------------------- +| Bundle version | composer show sonata-project/* +| Symfony version| composer show symfony/* +| php version | php --version + +# Error message + +``` +Error message goes here +``` + +# Steps to reproduce + +# Expected results + +# Actual results diff --git a/.php_cs b/.php_cs index d0d370fa..4f1d17dd 100644 --- a/.php_cs +++ b/.php_cs @@ -1,20 +1,29 @@ in(array(__DIR__)) - ->exclude(array('Tests/Fixtures')) -; +/* + * DO NOT EDIT THIS FILE! + * + * It's auto-generated by sonata-project/dev-kit package. + * + * Package `sllh/php-cs-fixer-styleci-bridge` is required to get it working. + */ + +require_once __DIR__.'/vendor/sllh/php-cs-fixer-styleci-bridge/autoload.php'; + +use SLLH\StyleCIBridge\ConfigBridge; +use Symfony\CS\Fixer\Contrib\HeaderCommentFixer; + +$header = << + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +HeaderCommentFixer::setHeader($header); -return Symfony\CS\Config\Config::create() - ->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL) - ->fixers(array( - '-unalign_double_arrow', - '-unalign_equals', - 'align_double_arrow', - 'newline_after_open_tag', - 'ordered_use', - 'long_array_syntax', - )) +return ConfigBridge::create() ->setUsingCache(true) - ->finder($finder) ; diff --git a/.styleci.yml b/.styleci.yml new file mode 100644 index 00000000..a275a203 --- /dev/null +++ b/.styleci.yml @@ -0,0 +1,22 @@ +# DO NOT EDIT THIS FILE! +# +# It's auto-generated by sonata-project/dev-kit package. +# +# Package `sllh/php-cs-fixer-styleci-bridge` is required to get it working. + +preset: symfony + +enabled: + - newline_after_open_tag + - ordered_class_elements + - ordered_use + - long_array_syntax +# Comment strict rules for the moment. Should be uncomment later to see StyleCI PR results +# - strict +# - strict_param +# - php_unit_construct +# - php_unit_strict + +finder: + exclude: + - 'Tests/Fixtures' diff --git a/.travis.yml b/.travis.yml index 4182edc9..02c2f5cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,62 +1,73 @@ +# DO NOT EDIT THIS FILE! +# +# It's auto-generated by sonata-project/dev-kit package. + language: php php: - - hhvm + - '5.3' + - '5.4' + - '5.5' + - '5.6' + - '7.0' - nightly + - hhvm sudo: false cache: directories: - - $HOME/.composer/cache - - $HOME/.cache/pip + - $HOME/.composer/cache/files env: global: - - PATH="$HOME/.composer/vendor/bin:$PATH" + - PATH="$HOME/.local/bin:$PATH" - SYMFONY_DEPRECATIONS_HELPER=weak - TARGET=test matrix: fast_finish: true include: - - php: 7.0 - env: TARGET=cs_dry_run - - php: 7.0 + - php: '7.0' env: TARGET=docs - - php: 5.3 - env: COMPOSER_FLAGS="--prefer-lowest --prefer-stable" - - php: 5.6 + - php: '5.3' + env: COMPOSER_FLAGS="--prefer-lowest" + - php: '7.0' env: SYMFONY_VERSION=2.3.* - - php: 5.6 + - php: '7.0' + env: SYMFONY_VERSION=2.6.* + - php: '7.0' env: SYMFONY_VERSION=2.7.* - - php: 5.6 + - php: '7.0' env: SYMFONY_VERSION=2.8.* - - php: 5.5 + - php: '7.0' env: SYMFONY_VERSION=3.0.* - - php: 5.6 - env: SYMFONY_VERSION=3.0.* - - php: 7.0 - env: SYMFONY_VERSION=3.0.* - + - php: '7.0' + env: SYMFONY_VERSION=dev-master@dev + - php: '7.0' + env: SYMFONY_DEPRECATIONS_HELPER=0 allow_failures: - - php: hhvm - php: nightly + - php: hhvm + - env: SYMFONY_DEPRECATIONS_HELPER=0 + - env: SYMFONY_VERSION=dev-master@dev + +before_install: + - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then mv "$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini" /tmp; fi; + - if [ "$TARGET" = 'test' ]; then composer self-update --stable; fi; + - if [ "$TARGET" = 'test' ]; then composer config --quiet --global github-oauth.github.com $GITHUB_OAUTH_TOKEN; fi; + - if [ "$TARGET" = 'test' ]; then sed --in-place "s/\"dev-master\":/\"dev-${TRAVIS_COMMIT}\":/" composer.json; fi; + - if [ "$TARGET" = 'test' -a "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi; + +install: + - if [ "$TARGET" = 'test' ]; then mkdir "$HOME/bin"; fi; + - if [[ "$TARGET" = 'test' && "$TRAVIS_PHP_VERSION" < '5.6' ]]; then wget https://phar.phpunit.de/phpunit-old.phar --output-document="$HOME/bin/phpunit"; fi + - if [[ "$TARGET" = 'test' && ! "$TRAVIS_PHP_VERSION" < '5.6' ]]; then wget https://phar.phpunit.de/phpunit.phar --output-document="$HOME/bin/phpunit"; fi + - if [ "$TARGET" = 'test' ]; then chmod u+x "$HOME/bin/phpunit"; fi; + - if [ "$TARGET" = 'test' ]; then travis_wait composer update --prefer-dist --no-interaction --prefer-stable $COMPOSER_FLAGS; fi; + - if [ "$TARGET" = 'docs' ]; then pip install -r Resources/doc/requirements.txt --user `whoami`; fi; before_script: - - (phpenv config-rm xdebug.ini || exit 0) - - mkdir -p ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d && echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - composer selfupdate - - composer config -q -g github-oauth.github.com $GITHUB_OAUTH_TOKEN - - composer global require phpunit/phpunit:@stable fabpot/php-cs-fixer --no-update - - composer global update --prefer-dist --no-interaction - - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi; - - travis_wait composer update --prefer-dist --no-interaction $COMPOSER_FLAGS - - export PATH=$HOME/.local/bin:$PATH - - pip install -r Resources/doc/requirements.txt --user `whoami` - -script: - - make $TARGET - -notifications: - webhooks: https://sonata-project.org/bundles/seo/master/travis + - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then mv /tmp/xdebug.ini "$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d"; fi; + +script: make $TARGET diff --git a/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php b/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php index 092b6a68..752e4150 100644 --- a/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php +++ b/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php @@ -1,7 +1,7 @@ * @@ -71,6 +71,20 @@ public function getName() return sprintf('Breadcrumb %s', $this->context); } + /** + * {@inheritdoc} + */ + public function configureSettings(OptionsResolver $resolver) + { + parent::configureSettings($resolver); + + $resolver->setDefaults(array( + 'menu_template' => 'SonataSeoBundle:Block:breadcrumb.html.twig', + 'include_homepage_link' => true, + 'context' => false, + )); + } + /** * @return FactoryInterface */ @@ -87,20 +101,6 @@ protected function getContext() return $this->context; } - /** - * {@inheritdoc} - */ - public function configureSettings(OptionsResolver $resolver) - { - parent::configureSettings($resolver); - - $resolver->setDefaults(array( - 'menu_template' => 'SonataSeoBundle:Block:breadcrumb.html.twig', - 'include_homepage_link' => true, - 'context' => false, - )); - } - /** * Initialize breadcrumb menu. * diff --git a/Block/Breadcrumb/HomepageBreadcrumbBlockService.php b/Block/Breadcrumb/HomepageBreadcrumbBlockService.php index 62a58eec..cebebd3d 100644 --- a/Block/Breadcrumb/HomepageBreadcrumbBlockService.php +++ b/Block/Breadcrumb/HomepageBreadcrumbBlockService.php @@ -1,7 +1,7 @@ * diff --git a/Block/Social/BaseFacebookSocialPluginsBlockService.php b/Block/Social/BaseFacebookSocialPluginsBlockService.php index f08d05b2..cf7a16c7 100644 --- a/Block/Social/BaseFacebookSocialPluginsBlockService.php +++ b/Block/Social/BaseFacebookSocialPluginsBlockService.php @@ -1,7 +1,7 @@ * @@ -27,7 +27,7 @@ abstract class BaseFacebookSocialPluginsBlockService extends BaseBlockService */ protected $colorschemeList = array( 'light' => 'form.label_colorscheme_light', - 'dark' => 'form.label_colorscheme_dark', + 'dark' => 'form.label_colorscheme_dark', ); /** @@ -38,7 +38,7 @@ public function execute(BlockContextInterface $blockContext, Response $response $settings = $blockContext->getSettings(); return $this->renderResponse($blockContext->getTemplate(), array( - 'block' => $blockContext->getBlock(), + 'block' => $blockContext->getBlock(), 'settings' => $settings, ), $response); } diff --git a/Block/Social/BaseTwitterButtonBlockService.php b/Block/Social/BaseTwitterButtonBlockService.php index 8c80923a..ff227ced 100644 --- a/Block/Social/BaseTwitterButtonBlockService.php +++ b/Block/Social/BaseTwitterButtonBlockService.php @@ -1,7 +1,7 @@ * @@ -26,45 +26,45 @@ abstract class BaseTwitterButtonBlockService extends BaseBlockService * @var string[] */ protected $languageList = array( - 'fr' => 'fr', - 'en' => 'en', - 'ar' => 'ar', - 'ja' => 'ja', - 'es' => 'es', - 'de' => 'de', - 'it' => 'it', - 'id' => 'id', - 'pt' => 'pt', - 'ko' => 'ko', - 'tr' => 'tr', - 'ru' => 'ru', - 'nl' => 'nl', - 'fil' => 'fil', - 'msa' => 'msa', + 'fr' => 'fr', + 'en' => 'en', + 'ar' => 'ar', + 'ja' => 'ja', + 'es' => 'es', + 'de' => 'de', + 'it' => 'it', + 'id' => 'id', + 'pt' => 'pt', + 'ko' => 'ko', + 'tr' => 'tr', + 'ru' => 'ru', + 'nl' => 'nl', + 'fil' => 'fil', + 'msa' => 'msa', 'zh-tw' => 'zh-tw', 'zh-cn' => 'zh-cn', - 'hi' => 'hi', - 'no' => 'no', - 'sv' => 'sv', - 'fi' => 'fi', - 'da' => 'da', - 'pl' => 'pl', - 'hu' => 'hu', - 'fa' => 'fa', - 'he' => 'he', - 'ur' => 'ur', - 'th' => 'th', - 'uk' => 'uk', - 'ca' => 'ca', - 'el' => 'el', - 'eu' => 'eu', - 'cs' => 'cs', - 'af' => 'af', + 'hi' => 'hi', + 'no' => 'no', + 'sv' => 'sv', + 'fi' => 'fi', + 'da' => 'da', + 'pl' => 'pl', + 'hu' => 'hu', + 'fa' => 'fa', + 'he' => 'he', + 'ur' => 'ur', + 'th' => 'th', + 'uk' => 'uk', + 'ca' => 'ca', + 'el' => 'el', + 'eu' => 'eu', + 'cs' => 'cs', + 'af' => 'af', 'xx-lc' => 'xx-lc', - 'gl' => 'gl', - 'ro' => 'ro', - 'hr' => 'hr', - 'ckb' => 'ckb', + 'gl' => 'gl', + 'ro' => 'ro', + 'hr' => 'hr', + 'ckb' => 'ckb', 'en-gb' => 'en-gb', ); @@ -76,7 +76,7 @@ public function execute(BlockContextInterface $blockContext, Response $response $settings = $blockContext->getSettings(); return $this->renderResponse($blockContext->getTemplate(), array( - 'block' => $blockContext->getBlock(), + 'block' => $blockContext->getBlock(), 'settings' => $settings, ), $response); } diff --git a/Block/Social/EmailShareButtonBlockService.php b/Block/Social/EmailShareButtonBlockService.php index e9e35ee0..835414a1 100644 --- a/Block/Social/EmailShareButtonBlockService.php +++ b/Block/Social/EmailShareButtonBlockService.php @@ -1,7 +1,7 @@ * @@ -33,8 +33,8 @@ public function configureSettings(OptionsResolver $resolver) { $resolver->setDefaults(array( 'template' => 'SonataSeoBundle:Block:block_email_share_button.html.twig', - 'subject' => null, - 'body' => null, + 'subject' => null, + 'body' => null, )); } @@ -47,11 +47,11 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) 'keys' => array( array('subject', 'text', array( 'required' => false, - 'label' => 'form.label_subject', + 'label' => 'form.label_subject', )), array('body', 'text', array( 'required' => false, - 'label' => 'form.label_body', + 'label' => 'form.label_body', )), ), 'translation_domain' => 'SonataSeoBundle', @@ -63,11 +63,11 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) */ public function execute(BlockContextInterface $blockContext, Response $response = null) { - $block = $blockContext->getBlock(); + $block = $blockContext->getBlock(); $settings = array_merge($blockContext->getSettings(), $block->getSettings()); return $this->renderResponse($blockContext->getTemplate(), array( - 'block' => $blockContext->getBlock(), + 'block' => $blockContext->getBlock(), 'settings' => $settings, ), $response); } diff --git a/Block/Social/FacebookLikeBoxBlockService.php b/Block/Social/FacebookLikeBoxBlockService.php index 2b1adfca..6a651929 100644 --- a/Block/Social/FacebookLikeBoxBlockService.php +++ b/Block/Social/FacebookLikeBoxBlockService.php @@ -1,7 +1,7 @@ * @@ -31,14 +31,14 @@ class FacebookLikeBoxBlockService extends BaseFacebookSocialPluginsBlockService public function configureSettings(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'template' => 'SonataSeoBundle:Block:block_facebook_like_box.html.twig', - 'url' => null, - 'width' => null, - 'height' => null, + 'template' => 'SonataSeoBundle:Block:block_facebook_like_box.html.twig', + 'url' => null, + 'width' => null, + 'height' => null, 'colorscheme' => $this->colorschemeList['light'], - 'show_faces' => true, + 'show_faces' => true, 'show_header' => true, - 'show_posts' => false, + 'show_posts' => false, 'show_border' => true, )); } @@ -52,36 +52,36 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) 'keys' => array( array('url', 'url', array( 'required' => false, - 'label' => 'form.label_url', + 'label' => 'form.label_url', )), array('width', 'integer', array( 'required' => false, - 'label' => 'form.label_width', + 'label' => 'form.label_width', )), array('height', 'integer', array( 'required' => false, - 'label' => 'form.label_height', + 'label' => 'form.label_height', )), array('colorscheme', 'choice', array( 'required' => true, - 'choices' => $this->colorschemeList, - 'label' => 'form.label_colorscheme', + 'choices' => $this->colorschemeList, + 'label' => 'form.label_colorscheme', )), array('show_faces', 'checkbox', array( 'required' => false, - 'label' => 'form.label_show_faces', + 'label' => 'form.label_show_faces', )), array('show_header', 'checkbox', array( 'required' => false, - 'label' => 'form.label_show_header', + 'label' => 'form.label_show_header', )), array('show_posts', 'checkbox', array( 'required' => false, - 'label' => 'form.label_show_posts', + 'label' => 'form.label_show_posts', )), array('show_border', 'checkbox', array( 'required' => false, - 'label' => 'form.label_show_border', + 'label' => 'form.label_show_border', )), ), 'translation_domain' => 'SonataSeoBundle', diff --git a/Block/Social/FacebookLikeButtonBlockService.php b/Block/Social/FacebookLikeButtonBlockService.php index fdba8aa8..24737b2b 100644 --- a/Block/Social/FacebookLikeButtonBlockService.php +++ b/Block/Social/FacebookLikeButtonBlockService.php @@ -1,7 +1,7 @@ * @@ -29,17 +29,17 @@ class FacebookLikeButtonBlockService extends BaseFacebookSocialPluginsBlockServi * @var string[] */ protected $layoutList = array( - 'standard' => 'form.label_layout_standard', - 'box_count' => 'form.label_layout_box_count', + 'standard' => 'form.label_layout_standard', + 'box_count' => 'form.label_layout_box_count', 'button_count' => 'form.label_layout_button_count', - 'button' => 'form.label_layout_button', + 'button' => 'form.label_layout_button', ); /** * @var string[] */ protected $actionTypes = array( - 'like' => 'form.label_action_like', + 'like' => 'form.label_action_like', 'recommend' => 'form.label_action_recommend', ); @@ -49,14 +49,14 @@ class FacebookLikeButtonBlockService extends BaseFacebookSocialPluginsBlockServi public function configureSettings(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'template' => 'SonataSeoBundle:Block:block_facebook_like_button.html.twig', - 'url' => null, - 'width' => null, - 'show_faces' => true, - 'share' => true, - 'layout' => $this->layoutList['standard'], + 'template' => 'SonataSeoBundle:Block:block_facebook_like_button.html.twig', + 'url' => null, + 'width' => null, + 'show_faces' => true, + 'share' => true, + 'layout' => $this->layoutList['standard'], 'colorscheme' => $this->colorschemeList['light'], - 'action' => $this->actionTypes['like'], + 'action' => $this->actionTypes['like'], )); } @@ -69,34 +69,34 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) 'keys' => array( array('url', 'url', array( 'required' => false, - 'label' => 'form.label_url', + 'label' => 'form.label_url', )), array('width', 'integer', array( 'required' => false, - 'label' => 'form.label_width', + 'label' => 'form.label_width', )), array('show_faces', 'checkbox', array( 'required' => false, - 'label' => 'form.label_show_faces', + 'label' => 'form.label_show_faces', )), array('share', 'checkbox', array( 'required' => false, - 'label' => 'form.label_share', + 'label' => 'form.label_share', )), array('layout', 'choice', array( 'required' => true, - 'choices' => $this->layoutList, - 'label' => 'form.label_layout', + 'choices' => $this->layoutList, + 'label' => 'form.label_layout', )), array('colorscheme', 'choice', array( 'required' => true, - 'choices' => $this->colorschemeList, - 'label' => 'form.label_colorscheme', + 'choices' => $this->colorschemeList, + 'label' => 'form.label_colorscheme', )), array('action', 'choice', array( 'required' => true, - 'choices' => $this->actionTypes, - 'label' => 'form.label_action', + 'choices' => $this->actionTypes, + 'label' => 'form.label_action', )), ), 'translation_domain' => 'SonataSeoBundle', diff --git a/Block/Social/FacebookSendButtonBlockService.php b/Block/Social/FacebookSendButtonBlockService.php index 7b12042f..a7decdfb 100644 --- a/Block/Social/FacebookSendButtonBlockService.php +++ b/Block/Social/FacebookSendButtonBlockService.php @@ -1,7 +1,7 @@ * @@ -31,10 +31,10 @@ class FacebookSendButtonBlockService extends BaseFacebookSocialPluginsBlockServi public function configureSettings(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'template' => 'SonataSeoBundle:Block:block_facebook_send_button.html.twig', - 'url' => null, - 'width' => null, - 'height' => null, + 'template' => 'SonataSeoBundle:Block:block_facebook_send_button.html.twig', + 'url' => null, + 'width' => null, + 'height' => null, 'colorscheme' => $this->colorschemeList['light'], )); } @@ -48,20 +48,20 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) 'keys' => array( array('url', 'url', array( 'required' => false, - 'label' => 'form.label_url', + 'label' => 'form.label_url', )), array('width', 'integer', array( 'required' => false, - 'label' => 'form.label_width', + 'label' => 'form.label_width', )), array('height', 'integer', array( 'required' => false, - 'label' => 'form.label_height', + 'label' => 'form.label_height', )), array('colorscheme', 'choice', array( 'required' => true, - 'choices' => $this->colorschemeList, - 'label' => 'form.label_colorscheme', + 'choices' => $this->colorschemeList, + 'label' => 'form.label_colorscheme', )), ), 'translation_domain' => 'SonataSeoBundle', diff --git a/Block/Social/FacebookShareButtonBlockService.php b/Block/Social/FacebookShareButtonBlockService.php index 606fcaf6..73c76fc6 100644 --- a/Block/Social/FacebookShareButtonBlockService.php +++ b/Block/Social/FacebookShareButtonBlockService.php @@ -1,7 +1,7 @@ * @@ -29,12 +29,12 @@ class FacebookShareButtonBlockService extends BaseFacebookSocialPluginsBlockServ * @var string[] */ protected $layoutList = array( - 'box_count' => 'form.label_layout_box_count', + 'box_count' => 'form.label_layout_box_count', 'button_count' => 'form.label_layout_button_count', - 'button' => 'form.label_layout_button', - 'icon_link' => 'form.label_layout_icon_link', - 'icon' => 'form.label_layout_icon', - 'link' => 'form.label_layout_link', + 'button' => 'form.label_layout_button', + 'icon_link' => 'form.label_layout_icon_link', + 'icon' => 'form.label_layout_icon', + 'link' => 'form.label_layout_link', ); /** @@ -44,9 +44,9 @@ public function configureSettings(OptionsResolver $resolver) { $resolver->setDefaults(array( 'template' => 'SonataSeoBundle:Block:block_facebook_share_button.html.twig', - 'url' => null, - 'width' => null, - 'layout' => $this->layoutList['box_count'], + 'url' => null, + 'width' => null, + 'layout' => $this->layoutList['box_count'], )); } @@ -59,16 +59,16 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) 'keys' => array( array('url', 'url', array( 'required' => false, - 'label' => 'form.label_url', + 'label' => 'form.label_url', )), array('width', 'integer', array( 'required' => false, - 'label' => 'form.label_width', + 'label' => 'form.label_width', )), array('layout', 'choice', array( 'required' => true, - 'choices' => $this->layoutList, - 'label' => 'form.label_layout', + 'choices' => $this->layoutList, + 'label' => 'form.label_layout', )), ), 'translation_domain' => 'SonataSeoBundle', diff --git a/Block/Social/PinterestPinButtonBlockService.php b/Block/Social/PinterestPinButtonBlockService.php index 993a1812..b39bbe04 100644 --- a/Block/Social/PinterestPinButtonBlockService.php +++ b/Block/Social/PinterestPinButtonBlockService.php @@ -1,7 +1,7 @@ * @@ -34,11 +34,11 @@ class PinterestPinButtonBlockService extends BaseBlockService public function configureSettings(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'template' => 'SonataSeoBundle:Block:block_pinterest_pin_button.html.twig', - 'size' => null, - 'shape' => null, - 'url' => null, - 'image' => null, + 'template' => 'SonataSeoBundle:Block:block_pinterest_pin_button.html.twig', + 'size' => null, + 'shape' => null, + 'url' => null, + 'image' => null, 'description' => null, )); } @@ -52,25 +52,25 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) 'keys' => array( array('url', 'url', array( 'required' => false, - 'label' => 'form.label_url', + 'label' => 'form.label_url', )), array('image', 'text', array( 'required' => false, - 'label' => 'form.label_image', + 'label' => 'form.label_image', )), array('description', 'text', array( 'required' => false, - 'label' => 'form.label_description', + 'label' => 'form.label_description', )), array('size', 'integer', array( 'required' => false, - 'label' => 'form.label_size', + 'label' => 'form.label_size', )), array('shape', 'choice', array( 'required' => false, - 'choices' => array( + 'choices' => array( 'rectangular' => 'form.label_shape_rectangular', - 'round' => 'form.label_shape_round', + 'round' => 'form.label_shape_round', ), 'label' => 'form.label_shape', )), @@ -84,11 +84,11 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) */ public function execute(BlockContextInterface $blockContext, Response $response = null) { - $block = $blockContext->getBlock(); + $block = $blockContext->getBlock(); $settings = array_merge($blockContext->getSettings(), $block->getSettings()); return $this->renderResponse($blockContext->getTemplate(), array( - 'block' => $blockContext->getBlock(), + 'block' => $blockContext->getBlock(), 'settings' => $settings, ), $response); } diff --git a/Block/Social/TwitterEmbedTweetBlockService.php b/Block/Social/TwitterEmbedTweetBlockService.php index 7eef3454..19e9a5a8 100644 --- a/Block/Social/TwitterEmbedTweetBlockService.php +++ b/Block/Social/TwitterEmbedTweetBlockService.php @@ -1,7 +1,7 @@ * @@ -31,8 +31,8 @@ class TwitterEmbedTweetBlockService extends BaseTwitterButtonBlockService { const TWITTER_OEMBED_URI = 'https://api.twitter.com/1/statuses/oembed.json'; - const TWEET_URL_PATTERN = '%^(https://)(www.)?(twitter.com/)(.*)(/status)(es)?(/)([0-9]*)$%i'; - const TWEET_ID_PATTERN = '%^([0-9]*)$%'; + const TWEET_URL_PATTERN = '%^(https://)(www.)?(twitter.com/)(.*)(/status)(es)?(/)([0-9]*)$%i'; + const TWEET_ID_PATTERN = '%^([0-9]*)$%'; /** * {@inheritdoc} @@ -74,15 +74,15 @@ public function execute(BlockContextInterface $blockContext, Response $response public function configureSettings(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'template' => 'SonataSeoBundle:Block:block_twitter_embed.html.twig', - 'tweet' => '', - 'maxwidth' => null, - 'hide_media' => false, + 'template' => 'SonataSeoBundle:Block:block_twitter_embed.html.twig', + 'tweet' => '', + 'maxwidth' => null, + 'hide_media' => false, 'hide_thread' => false, 'omit_script' => false, - 'align' => 'none', - 'related' => null, - 'lang' => $this->languageList, + 'align' => 'none', + 'related' => null, + 'lang' => $this->languageList, )); } @@ -94,55 +94,65 @@ public function buildEditForm(FormMapper $form, BlockInterface $block) $form->add('settings', 'sonata_type_immutable_array', array( 'keys' => array( array('tweet', 'textarea', array( - 'required' => true, - 'label' => 'form.label_tweet', - 'help_block' => 'form.help_tweet', + 'required' => true, + 'label' => 'form.label_tweet', + 'help_block' => 'form.help_tweet', )), array('maxwidth', 'integer', array( - 'required' => false, - 'label' => 'form.label_maxwidth', + 'required' => false, + 'label' => 'form.label_maxwidth', 'help_block' => 'form.help_maxwidth', )), array('hide_media', 'checkbox', array( - 'required' => false, - 'label' => 'form.label_hide_media', + 'required' => false, + 'label' => 'form.label_hide_media', 'help_block' => 'form.help_hide_media', )), array('hide_thread', 'checkbox', array( - 'required' => false, - 'label' => 'form.label_hide_thread', + 'required' => false, + 'label' => 'form.label_hide_thread', 'help_block' => 'form.help_hide_thread', )), array('omit_script', 'checkbox', array( - 'required' => false, - 'label' => 'form.label_omit_script', + 'required' => false, + 'label' => 'form.label_omit_script', 'help_block' => 'form.help_omit_script', )), array('align', 'choice', array( 'required' => false, - 'choices' => array( - 'left' => 'form.label_align_left', - 'right' => 'form.label_align_right', + 'choices' => array( + 'left' => 'form.label_align_left', + 'right' => 'form.label_align_right', 'center' => 'form.label_align_center', - 'none' => 'form.label_align_none', + 'none' => 'form.label_align_none', ), 'label' => 'form.label_align', )), array('related', 'text', array( - 'required' => false, - 'label' => 'form.label_related', + 'required' => false, + 'label' => 'form.label_related', 'help_block' => 'form.help_related', )), array('lang', 'choice', array( 'required' => true, - 'choices' => $this->languageList, - 'label' => 'form.label_lang', + 'choices' => $this->languageList, + 'label' => 'form.label_lang', )), ), 'translation_domain' => 'SonataSeoBundle', )); } + /** + * {@inheritdoc} + */ + public function getBlockMetadata($code = null) + { + return new Metadata($this->getName(), (!is_null($code) ? $code : $this->getName()), false, 'SonataSeoBundle', array( + 'class' => 'fa fa-twitter', + )); + } + /** * Returns supported API parameters from settings. * @@ -173,7 +183,7 @@ protected function getSupportedApiParams() */ protected function buildUri($uriMatched, array $settings) { - $apiParams = $settings; + $apiParams = $settings; $supportedParams = $this->getSupportedApiParams(); if ($uriMatched) { @@ -194,14 +204,4 @@ protected function buildUri($uriMatched, array $settings) return sprintf('%s?%s', self::TWITTER_OEMBED_URI, implode('&', $parameters)); } - - /** - * {@inheritdoc} - */ - public function getBlockMetadata($code = null) - { - return new Metadata($this->getName(), (!is_null($code) ? $code : $this->getName()), false, 'SonataSeoBundle', array( - 'class' => 'fa fa-twitter', - )); - } } diff --git a/Block/Social/TwitterFollowButtonBlockService.php b/Block/Social/TwitterFollowButtonBlockService.php index ce17af7e..432ef2f3 100644 --- a/Block/Social/TwitterFollowButtonBlockService.php +++ b/Block/Social/TwitterFollowButtonBlockService.php @@ -1,7 +1,7 @@ * @@ -31,12 +31,12 @@ class TwitterFollowButtonBlockService extends BaseTwitterButtonBlockService public function configureSettings(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'template' => 'SonataSeoBundle:Block:block_twitter_follow_button.html.twig', - 'user' => null, + 'template' => 'SonataSeoBundle:Block:block_twitter_follow_button.html.twig', + 'user' => null, 'show_username' => true, - 'large_button' => false, - 'opt_out' => false, - 'language' => $this->languageList['en'], + 'large_button' => false, + 'opt_out' => false, + 'language' => $this->languageList['en'], )); } @@ -49,24 +49,24 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) 'keys' => array( array('user', 'text', array( 'required' => true, - 'label' => 'form.label_user', + 'label' => 'form.label_user', )), array('show_username', 'checkbox', array( 'required' => false, - 'label' => 'form.label_show_username', + 'label' => 'form.label_show_username', )), array('large_button', 'checkbox', array( 'required' => false, - 'label' => 'form.label_large_button', + 'label' => 'form.label_large_button', )), array('opt_out', 'checkbox', array( 'required' => false, - 'label' => 'form.label_opt_out', + 'label' => 'form.label_opt_out', )), array('language', 'choice', array( 'required' => true, - 'choices' => $this->languageList, - 'label' => 'form.label_language', + 'choices' => $this->languageList, + 'label' => 'form.label_language', )), ), 'translation_domain' => 'SonataSeoBundle', diff --git a/Block/Social/TwitterHashtagButtonBlockService.php b/Block/Social/TwitterHashtagButtonBlockService.php index 6e0fb90f..60da805a 100644 --- a/Block/Social/TwitterHashtagButtonBlockService.php +++ b/Block/Social/TwitterHashtagButtonBlockService.php @@ -1,7 +1,7 @@ * @@ -31,14 +31,14 @@ class TwitterHashtagButtonBlockService extends BaseTwitterButtonBlockService public function configureSettings(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'template' => 'SonataSeoBundle:Block:block_twitter_hashtag_button.html.twig', - 'url' => null, - 'hashtag' => null, - 'text' => null, - 'recommend' => null, + 'template' => 'SonataSeoBundle:Block:block_twitter_hashtag_button.html.twig', + 'url' => null, + 'hashtag' => null, + 'text' => null, + 'recommend' => null, 'large_button' => false, - 'opt_out' => false, - 'language' => $this->languageList['en'], + 'opt_out' => false, + 'language' => $this->languageList['en'], )); } @@ -51,32 +51,32 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) 'keys' => array( array('hashtag', 'text', array( 'required' => true, - 'label' => 'form.label_hashtag', + 'label' => 'form.label_hashtag', )), array('text', 'text', array( 'required' => false, - 'label' => 'form.label_text', + 'label' => 'form.label_text', )), array('recommend', 'text', array( 'required' => false, - 'label' => 'form.label_recommend', + 'label' => 'form.label_recommend', )), array('url', 'url', array( 'required' => false, - 'label' => 'form.label_url', + 'label' => 'form.label_url', )), array('large_button', 'checkbox', array( 'required' => false, - 'label' => 'form.label_large_button', + 'label' => 'form.label_large_button', )), array('opt_out', 'checkbox', array( 'required' => false, - 'label' => 'form.label_opt_out', + 'label' => 'form.label_opt_out', )), array('language', 'choice', array( 'required' => true, - 'choices' => $this->languageList, - 'label' => 'form.label_language', + 'choices' => $this->languageList, + 'label' => 'form.label_language', )), ), 'translation_domain' => 'SonataSeoBundle', diff --git a/Block/Social/TwitterMentionButtonBlockService.php b/Block/Social/TwitterMentionButtonBlockService.php index bd9166ec..eaec5e26 100644 --- a/Block/Social/TwitterMentionButtonBlockService.php +++ b/Block/Social/TwitterMentionButtonBlockService.php @@ -1,7 +1,7 @@ * @@ -31,13 +31,13 @@ class TwitterMentionButtonBlockService extends BaseTwitterButtonBlockService public function configureSettings(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'template' => 'SonataSeoBundle:Block:block_twitter_mention_button.html.twig', - 'user' => null, - 'text' => null, - 'recommend' => null, + 'template' => 'SonataSeoBundle:Block:block_twitter_mention_button.html.twig', + 'user' => null, + 'text' => null, + 'recommend' => null, 'large_button' => false, - 'opt_out' => false, - 'language' => $this->languageList['en'], + 'opt_out' => false, + 'language' => $this->languageList['en'], )); } @@ -50,28 +50,28 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) 'keys' => array( array('user', 'text', array( 'required' => true, - 'label' => 'form.label_user', + 'label' => 'form.label_user', )), array('text', 'text', array( 'required' => false, - 'label' => 'form.label_text', + 'label' => 'form.label_text', )), array('recommend', 'text', array( 'required' => false, - 'label' => 'form.label_recommend', + 'label' => 'form.label_recommend', )), array('large_button', 'checkbox', array( 'required' => false, - 'label' => 'form.label_large_button', + 'label' => 'form.label_large_button', )), array('opt_out', 'checkbox', array( 'required' => false, - 'label' => 'form.label_opt_out', + 'label' => 'form.label_opt_out', )), array('language', 'choice', array( 'required' => true, - 'choices' => $this->languageList, - 'label' => 'form.label_language', + 'choices' => $this->languageList, + 'label' => 'form.label_language', )), ), 'translation_domain' => 'SonataSeoBundle', diff --git a/Block/Social/TwitterShareButtonBlockService.php b/Block/Social/TwitterShareButtonBlockService.php index 6a62f2c3..fae9203a 100644 --- a/Block/Social/TwitterShareButtonBlockService.php +++ b/Block/Social/TwitterShareButtonBlockService.php @@ -1,7 +1,7 @@ * @@ -31,16 +31,16 @@ class TwitterShareButtonBlockService extends BaseTwitterButtonBlockService public function configureSettings(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'template' => 'SonataSeoBundle:Block:block_twitter_share_button.html.twig', - 'url' => null, - 'text' => null, - 'show_count' => true, - 'via' => null, - 'recommend' => null, - 'hashtag' => null, + 'template' => 'SonataSeoBundle:Block:block_twitter_share_button.html.twig', + 'url' => null, + 'text' => null, + 'show_count' => true, + 'via' => null, + 'recommend' => null, + 'hashtag' => null, 'large_button' => false, - 'opt_out' => false, - 'language' => $this->languageList['en'], + 'opt_out' => false, + 'language' => $this->languageList['en'], )); } @@ -53,40 +53,40 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) 'keys' => array( array('url', 'url', array( 'required' => false, - 'label' => 'form.label_url', + 'label' => 'form.label_url', )), array('text', 'text', array( 'required' => false, - 'label' => 'form.label_text', + 'label' => 'form.label_text', )), array('show_count', 'checkbox', array( 'required' => false, - 'label' => 'form.label_show_count', + 'label' => 'form.label_show_count', )), array('via', 'text', array( 'required' => false, - 'label' => 'form.label_via', + 'label' => 'form.label_via', )), array('recommend', 'text', array( 'required' => false, - 'label' => 'form.label_recommend', + 'label' => 'form.label_recommend', )), array('hashtag', 'text', array( 'required' => false, - 'label' => 'form.label_hashtag', + 'label' => 'form.label_hashtag', )), array('large_button', 'checkbox', array( 'required' => false, - 'label' => 'form.label_large_button', + 'label' => 'form.label_large_button', )), array('opt_out', 'checkbox', array( 'required' => false, - 'label' => 'form.label_opt_out', + 'label' => 'form.label_opt_out', )), array('language', 'choice', array( 'required' => true, - 'choices' => $this->languageList, - 'label' => 'form.label_language', + 'choices' => $this->languageList, + 'label' => 'form.label_language', )), ), 'translation_domain' => 'SonataSeoBundle', diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 044c54c2..90ba04f8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,53 +1,205 @@ -Sonata respects the symfony’s conventions about contributing to the code. So before going further please review the [contributing documentation of Symfony](http://symfony.com/doc/current/contributing/code/patches.html#make-a-pull-request). +# Sonata project contribution -## Reporting bugs +Thanks for you interest onto Sonata projects! -If you happen to find a bug, we kindly request you to report it. However, before submitting it, please: +## Summary - * Check the [project documentation available online](https://sonata-project.org/bundles/) +* [Issues](#issues) +* [Pull Requests](#pull-requests) +* [Label rules]() -Then, if it appears that it’s a real bug, you may report it using Github by following these 3 points: +## Issues - * Check if the bug is not already reported! - * A clear title to resume the issue - * A description of the workflow needed to reproduce the bug, +First, check if you are up to date: is your version still supported, and are +you using the latest patch version? -> _NOTE:_ Don’t hesitate giving as much information as you can (OS, PHP version extensions …) +If you are not sure this is a bug, consider posting your question on [Stack +Overflow](http://stackoverflow.com), using one of the sonata tags. +If you happen to find a bug, we kindly request you to report it. However, +before submitting it, please check the [project documentation available +online](https://sonata-project.org/bundles/). -## Pull requests +Then, if it appears that it is indeed a real bug, you may report it using +Github by following these points are taken care of: -### Matching coding standards +* Check if the bug is not already reported! +* A clear title to sum up the issue +* A description of the workflow needed to reproduce the bug. Please try to make + sentence, dumping an error message by itself is not great. +* If your issue is an error page, you must provide us with a stack trace. With + recent versions of Symfony, you can even get stack traces as plain text at the +end of the page. Just look for "Stack Trace (Plain Text)", and copy/paste what +you see. **Do not** make a screenshot of the stack trace, as screenshots are +not indexed by search engines and will make it difficult for other people to +find your bug report. +* Screenshots should be considered additional data, and therefore, you should + always provide a textual description of the bug. It is strongly recommended +to provide them when reporting UI-related bugs. +* If you need to provide code, make sure you know how to get syntactic + coloration, in particular with [fenced code +blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/). +When you feel the code is to long, use external code pastebin like +https://gist.github.com/ or http://hastebin.com/ . If this is not sufficient, +just create a repository to show the issue. -Before each commit, be sure to match sonata coding standards by running the following command for fix: +> _NOTE:_ Don't hesitate giving as much information as you can (OS, PHP +> version, extensions...) + +## Pull Requests + +All the sonata team will be glad to review your code changes propositions! :smile: + +But please, read the following before. + +### Coding style + +Each project follows [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/) +and [Symfony Coding Standards](http://symfony.com/doc/current/contributing/code/standards.html) for coding style, +[PSR-4](http://www.php-fig.org/psr/psr-4/) for autoloading. + +Please [install PHP Coding Standard Fixer](http://cs.sensiolabs.org/#installation) +and run this command before committing your modifications: ```bash -make cs +php-cs-fixer fix --verbose ``` -And then, add fixed file to your commit before push. +### Writing a Pull Request + +#### The content + +Ideally, a Pull Request should concern one and **only one** subject, so that it +remains clear, and independent changes can be merged quickly. + +If you want to fix a typo and improve the performance of a process, you should +try as much as possible to it in a **separate** PR, so that we can quickly +merge one while discussing the other. + +The goal is to have a clear commit history and make possible revert easier. + +If you found an issue/typo while writing your change that is not related to +your work, please do another PR for that. In some rare cases, you might be +forced to do it on the same PR. In this kind of situation, please add a comment +on your PR explaining why you feel it is the case. + +#### The Change log + +On each PR, the `CHANGELOG.md` file **has to be updated**. + +There are few cases where the `CHANGELOG.md` file should not be touched: + +* When you fix a bug on an unreleased feature. +* When your PR concerns only the documentation (fix or improvement). + +The change log note has to be put below the `## [Unreleased]` section. + +Your note can be put on one of these sections: + +* `Added` for new features. +* `Changed` for changes in existing functionality. +* `Deprecated` for deprecation of features that will be removed in next major release. +* `Removed` for deprecated features removed in this release. +* `Fixed` for any bug fixes. +* `Security` to invite users to upgrade in case of vulnerabilities. + +More information about the followed changelog format: [keepachangelog.com](http://keepachangelog.com/) + +#### The base branch + +Before writing a PR, you have to check on which branch your changes should be based. + +Each project follows [semver](http://semver.org/) convention for release management. -Be sure to add only **your modified files**. If another files are fixed by cs tools, just revert it before commit. +Here is a short table resuming on which you have to start: -### Sending a Pull Request +Kind of modification | Backward Compatible (BC) | Type of release | Branch to target | Label | +-------------------- | ------------------------ | --------------- | ----------------------- | ----- | +Bug fixes | Yes | Patch | `2.x` | | +Bug fixes | No (Only if no choice) | Major | `master` | | +Feature | Yes | Minor | `2.x` | | +Feature | No (Only if no choice) | Major | `master` | | +Deprecation | Yes (Have to) | Minor | `2.x` | | +Deprecation removal | No (Can't be) | Major | `master` | | -When you send a PR, just make sure that: +Notes: + * Branch `2.x` is the branch of the **latest stable** minor release and + has to be used for Backward compatible PRs. + * If you PR is not **Backward Compatible** but can be, it **must** be: + * Changing a function/method signature? Prefer create a new one and deprecated the old one. + * Code deletion? Don't. Please deprecate it instead. + * If your BC PR is accepted, you can do a new one on the `master` branch which remove the deprecated code. + * SYMFONY DOC REF (same logic)? -* You add valid test cases. -* Tests are green. -* The related documentation is up-to-date. -* You make the PR on the same branch you based your changes on. If you see commits -that you did not make in your PR, you're doing it wrong. -* Also don't forget to add a comment when you update a PR with a ping to the maintainer (``@username``), so he/she will get a notification. +Be aware that pull requests with BC breaks could be not accepted +or reported for next major release if BC is not possible. -## Contributing to the documentation +If you are not sure of what to do, don't hesitate to open an issue about your PR project. -You need to install the python tool to check and validate the sphinx syntax: +#### The commit message - pip install -r Resources/doc/requirements.txt +Sonata is a big project with many contributors, and a big part of the job is +being able to understand the code at all times, be it when submitting a PR or +looking at the history. Good commit messages are crucial to achieve this goal. -and you can check the documentation with the command: +There are already a few articles (or even single purpose websites) about this, +we cannot recommend enough the following: - cd Resources/doc/ - rm -rf _build && sphinx-build -W -b html -d _build/doctrees . _build/html +* http://rakeroutes.com/blog/deliberate-git +* http://stopwritingramblingcommitmessages.com +* http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html -The html will be available in the ``_build/html`` folder. +To sum them up, the commit message has to be crystal clear and of course, +related to the PR content. + +The first line of the commit message must be short, keep it under 50 +characters. It must say concisely but *precisely* what you did. The other +lines, if needed, should contain a complete description of *why* you did this. + +Bad commit message subject: + +``` +Update README.md +``` + +Good commit message subject : + +``` +Document how to install the project +``` + +Also, when you specify what you did avoid commit message subjects with "Fix bug +in such and such feature". Saying you are fixing something implies the previous +implementation was wrong and yours is right, which might not be even true. +Instead, state unquestionable technical facts about your changes, not opinions. +Then, in the commit description, explain why you did that and how it fixes +something. +``` +call foo::bar() instead of bar::baz() + +This fixes a bug that arises when doing this or that, because baz() needs a +flux capacitor object that might not be defined. +Fixes #42 +``` + +The description is optional but strongly recommended. It could be asked by the +team if needed. PR will often lead to complicated, hard-to-read conversations +with many links to other web pages. + +The commit description should be able to live without what is said in the PR, +and should ideally sum it up in a crystal clear way, so that people do not have +to open a web browser to understand what you did. +Links to PRs/Issues and external references are of course welcome, but should +not be considered enough. When you reference an issue, make sure to use one of +the keywords described in [the dedicated github +article](https://help.github.com/articles/closing-issues-via-commit-messages/). + +Good commit message with description : + +``` +Change web UI background color to pink + +This is a consensus made on #4242 in addition to #1337. + +We agreed that blank color is boring and so deja vu. Pink is the new way to do. +``` +(Obviously, this commit is fake. :wink:) diff --git a/Command/SitemapGeneratorCommand.php b/Command/SitemapGeneratorCommand.php index f5127c0d..d3233ee1 100644 --- a/Command/SitemapGeneratorCommand.php +++ b/Command/SitemapGeneratorCommand.php @@ -1,7 +1,7 @@ * @@ -42,7 +42,7 @@ public function configure() $this->addOption('sitemap_path', null, InputOption::VALUE_OPTIONAL, 'Set the sitemap relative path (if in a specific folder)', ''); $this->setDescription('Create a sitemap'); - $this->setHelp(<<setHelp(<<<'EOT' The sonata:seo:sitemap command create new sitemap files (index + sitemap). EOT diff --git a/DependencyInjection/Compiler/BreadcrumbBlockServicesCompilerPass.php b/DependencyInjection/Compiler/BreadcrumbBlockServicesCompilerPass.php index 9b82053c..bec80af7 100644 --- a/DependencyInjection/Compiler/BreadcrumbBlockServicesCompilerPass.php +++ b/DependencyInjection/Compiler/BreadcrumbBlockServicesCompilerPass.php @@ -1,7 +1,7 @@ * diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index bc670887..05f6e31f 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\SeoBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; diff --git a/DependencyInjection/SonataSeoExtension.php b/DependencyInjection/SonataSeoExtension.php index d474095f..8864348a 100644 --- a/DependencyInjection/SonataSeoExtension.php +++ b/DependencyInjection/SonataSeoExtension.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\SeoBundle\DependencyInjection; use Symfony\Component\Config\FileLocator; @@ -43,6 +52,19 @@ public function load(array $configs, ContainerBuilder $container) ->replaceArgument(1, $config['encoding']); } + /** + * Add class to compile. + */ + public function configureClassesToCompile() + { + $this->addClassesToCompile(array( + 'Sonata\\SeoBundle\\Seo\\SeoPage', + 'Sonata\\SeoBundle\\Seo\\SeoPageInterface', + 'Sonata\\SeoBundle\\Sitemap\\SourceManager', + 'Sonata\\SeoBundle\\Twig\\Extension\\SeoExtension', + )); + } + /** * Configure the default seo page. * @@ -122,12 +144,12 @@ protected function configureSitemap(array $config, ContainerBuilder $container) protected function fixConfiguration(array $config) { foreach ($config['sitemap']['doctrine_orm'] as $pos => $sitemap) { - $sitemap['group'] = isset($sitemap['group']) ? $sitemap['group'] : false; - $sitemap['types'] = isset($sitemap['types']) ? $sitemap['types'] : array(); + $sitemap['group'] = isset($sitemap['group']) ? $sitemap['group'] : false; + $sitemap['types'] = isset($sitemap['types']) ? $sitemap['types'] : array(); $sitemap['connection'] = isset($sitemap['connection']) ? $sitemap['connection'] : 'doctrine.dbal.default_connection'; - $sitemap['route'] = isset($sitemap['route']) ? $sitemap['route'] : false; + $sitemap['route'] = isset($sitemap['route']) ? $sitemap['route'] : false; $sitemap['parameters'] = isset($sitemap['parameters']) ? $sitemap['parameters'] : false; - $sitemap['query'] = isset($sitemap['query']) ? $sitemap['query'] : false; + $sitemap['query'] = isset($sitemap['query']) ? $sitemap['query'] : false; if ($sitemap['route'] === false) { throw new \RuntimeException('Route cannot be empty, please review the sonata_seo.sitemap configuration'); @@ -149,7 +171,7 @@ protected function fixConfiguration(array $config) $sitemap = array( 'group' => false, 'types' => array(), - 'id' => $sitemap, + 'id' => $sitemap, ); } else { $sitemap['group'] = isset($sitemap['group']) ? $sitemap['group'] : false; @@ -165,17 +187,4 @@ protected function fixConfiguration(array $config) return $config; } - - /** - * Add class to compile. - */ - public function configureClassesToCompile() - { - $this->addClassesToCompile(array( - 'Sonata\\SeoBundle\\Seo\\SeoPage', - 'Sonata\\SeoBundle\\Seo\\SeoPageInterface', - 'Sonata\\SeoBundle\\Sitemap\\SourceManager', - 'Sonata\\SeoBundle\\Twig\\Extension\\SeoExtension', - )); - } } diff --git a/Event/BreadcrumbListener.php b/Event/BreadcrumbListener.php index 3c09eeca..9789daeb 100644 --- a/Event/BreadcrumbListener.php +++ b/Event/BreadcrumbListener.php @@ -1,7 +1,7 @@ * diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..1b646e0f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2010-2016 Thomas Rabaix + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Makefile b/Makefile index 2a2dd2a5..0394dd00 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,14 @@ -cs: - php-cs-fixer fix --verbose +# DO NOT EDIT THIS FILE! +# +# It's auto-generated by sonata-project/dev-kit package. -cs_dry_run: - php-cs-fixer fix --verbose --dry-run +.PHONY: test docs + +all: + @echo "Please choose a task." test: - phpunit + phpunit -c phpunit.xml.dist docs: cd Resources/doc && sphinx-build -W -b html -d _build/doctrees . _build/html diff --git a/README.md b/README.md index c0694d8f..32a5aadb 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,28 @@ -Sonata SEO Bundle -================= +# Sonata Seo Bundle -[![Build Status](https://secure.travis-ci.org/sonata-project/SonataSeoBundle.png)](https://secure.travis-ci.org/#!/sonata-project/SonataSeoBundle) +Symfony SonataSeoBundle -This bundle provides a Site and Page management through container and block services +[![Latest Stable Version](https://poser.pugx.org/sonata-project/seo-bundle/v/stable)](https://packagist.org/packages/sonata-project/seo-bundle) +[![Latest Unstable Version](https://poser.pugx.org/sonata-project/seo-bundle/v/unstable)](https://packagist.org/packages/sonata-project/seo-bundle) +[![License](https://poser.pugx.org/sonata-project/seo-bundle/license)](https://packagist.org/packages/sonata-project/seo-bundle) -Check out the documentation on [https://sonata-project.org/bundles/seo/master/doc/index.html](https://sonata-project.org/bundles/seo/master/doc/index.html) +[![Total Downloads](https://poser.pugx.org/sonata-project/seo-bundle/downloads)](https://packagist.org/packages/sonata-project/seo-bundle) +[![Monthly Downloads](https://poser.pugx.org/sonata-project/seo-bundle/d/monthly)](https://packagist.org/packages/sonata-project/seo-bundle) +[![Daily Downloads](https://poser.pugx.org/sonata-project/seo-bundle/d/daily)](https://packagist.org/packages/sonata-project/seo-bundle) -**Google Groups**: For questions and proposals you can post on this google groups +[![Build Status](https://travis-ci.org/sonata-project/SonataSeoBundle.svg?branch=2.x)](https://travis-ci.org/sonata-project/SonataSeoBundle) -* [Sonata Users](https://groups.google.com/group/sonata-users): Only for user questions -* [Sonata Devs](https://groups.google.com/group/sonata-devs): Only for devs +## Documentation -License -------- +Check out the documentation on the [official website](https://sonata-project.org/bundles/seo). -This bundle is available under the [MIT license](Resources/meta/LICENSE). +## Support + +For general support and questions, please use [StackOverflow](http://stackoverflow.com/questions/tagged/sonata). + +If you think you find a bug or you have a feature idea to propose, feel free to open a issue +**after looking** at the [contributing guide](CONTRIBUTING.md). + +## License + +This package is available under the [MIT license](LICENSE). diff --git a/Seo/SeoPage.php b/Seo/SeoPage.php index 788bcdeb..4d9c7875 100644 --- a/Seo/SeoPage.php +++ b/Seo/SeoPage.php @@ -1,7 +1,7 @@ * @@ -61,13 +61,13 @@ class SeoPage implements SeoPageInterface */ public function __construct($title = '') { - $this->title = $title; - $this->metas = array( + $this->title = $title; + $this->metas = array( 'http-equiv' => array(), - 'name' => array(), - 'schema' => array(), - 'charset' => array(), - 'property' => array(), + 'name' => array(), + 'schema' => array(), + 'charset' => array(), + 'property' => array(), ); $this->headAttributes = array(); @@ -173,20 +173,6 @@ public function setMetas(array $metadatas) return $this; } - /** - * @param mixed $meta - * - * @return array - */ - private function normalize($meta) - { - if (is_string($meta)) { - return array($meta, array()); - } - - return $meta; - } - /** * {@inheritdoc} */ @@ -398,4 +384,18 @@ public function getOEmbedLinks() { return $this->oembedLinks; } + + /** + * @param mixed $meta + * + * @return array + */ + private function normalize($meta) + { + if (is_string($meta)) { + return array($meta, array()); + } + + return $meta; + } } diff --git a/Seo/SeoPageInterface.php b/Seo/SeoPageInterface.php index 00a8ff78..e7391dc6 100644 --- a/Seo/SeoPageInterface.php +++ b/Seo/SeoPageInterface.php @@ -1,7 +1,7 @@ * diff --git a/Sitemap/SourceManager.php b/Sitemap/SourceManager.php index 77336ec5..0c831dbe 100644 --- a/Sitemap/SourceManager.php +++ b/Sitemap/SourceManager.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\SeoBundle\Sitemap; use Exporter\Source\ChainSourceIterator; @@ -38,7 +47,7 @@ public function addSource($group, SourceIteratorInterface $source, array $types $this->sources[$group] = new \stdClass(); $this->sources[$group]->sources = new ChainSourceIterator(); - $this->sources[$group]->types = array(); + $this->sources[$group]->types = array(); } $this->sources[$group]->sources->addSource($source); diff --git a/SonataSeoBundle.php b/SonataSeoBundle.php index 9118adcd..f9b2b02f 100644 --- a/SonataSeoBundle.php +++ b/SonataSeoBundle.php @@ -1,7 +1,7 @@ * diff --git a/Tests/Block/BaseBlockTest.php b/Tests/Block/BaseBlockTest.php index c5367978..4ca973e7 100644 --- a/Tests/Block/BaseBlockTest.php +++ b/Tests/Block/BaseBlockTest.php @@ -1,7 +1,7 @@ * diff --git a/Tests/Block/Breadcrumb/BreadcrumbTest.php b/Tests/Block/Breadcrumb/BreadcrumbTest.php index 15bc5f8b..8a0a9a5b 100644 --- a/Tests/Block/Breadcrumb/BreadcrumbTest.php +++ b/Tests/Block/Breadcrumb/BreadcrumbTest.php @@ -1,7 +1,7 @@ * diff --git a/Tests/Block/Social/FacebookLikeBoxBlockServiceTest.php b/Tests/Block/Social/FacebookLikeBoxBlockServiceTest.php index e1614efd..ba4e6f63 100644 --- a/Tests/Block/Social/FacebookLikeBoxBlockServiceTest.php +++ b/Tests/Block/Social/FacebookLikeBoxBlockServiceTest.php @@ -1,7 +1,7 @@ * @@ -29,18 +29,18 @@ public function testService() } $templating = new FakeTemplating(); - $service = new FacebookLikeBoxBlockService('sonata.block.service.facebook.like_box', $templating); + $service = new FacebookLikeBoxBlockService('sonata.block.service.facebook.like_box', $templating); $block = new Block(); $block->setType('core.text'); $block->setSettings(array( - 'url' => 'url_setting', - 'width' => 'width_setting', - 'height' => 'height_setting', + 'url' => 'url_setting', + 'width' => 'width_setting', + 'height' => 'height_setting', 'colorscheme' => 'colorscheme_setting', - 'show_faces' => 'show_faces_setting', + 'show_faces' => 'show_faces_setting', 'show_header' => 'show_header_setting', - 'show_posts' => 'show_posts_setting', + 'show_posts' => 'show_posts_setting', 'show_border' => 'show_border_setting', )); @@ -57,13 +57,13 @@ public function testService() $service->execute($blockContext); - $this->assertEquals('url_setting', $templating->parameters['settings']['url']); - $this->assertEquals('width_setting', $templating->parameters['settings']['width']); - $this->assertEquals('height_setting', $templating->parameters['settings']['height']); + $this->assertEquals('url_setting', $templating->parameters['settings']['url']); + $this->assertEquals('width_setting', $templating->parameters['settings']['width']); + $this->assertEquals('height_setting', $templating->parameters['settings']['height']); $this->assertEquals('colorscheme_setting', $templating->parameters['settings']['colorscheme']); - $this->assertEquals('show_faces_setting', $templating->parameters['settings']['show_faces']); + $this->assertEquals('show_faces_setting', $templating->parameters['settings']['show_faces']); $this->assertEquals('show_header_setting', $templating->parameters['settings']['show_header']); - $this->assertEquals('show_posts_setting', $templating->parameters['settings']['show_posts']); + $this->assertEquals('show_posts_setting', $templating->parameters['settings']['show_posts']); $this->assertEquals('show_border_setting', $templating->parameters['settings']['show_border']); } } diff --git a/Tests/Block/Social/FacebookLikeButtonBlockServiceTest.php b/Tests/Block/Social/FacebookLikeButtonBlockServiceTest.php index 7dd1a4ad..746e5e56 100644 --- a/Tests/Block/Social/FacebookLikeButtonBlockServiceTest.php +++ b/Tests/Block/Social/FacebookLikeButtonBlockServiceTest.php @@ -1,7 +1,7 @@ * @@ -29,18 +29,18 @@ public function testService() } $templating = new FakeTemplating(); - $service = new FacebookLikeButtonBlockService('sonata.block.service.facebook.like_button', $templating); + $service = new FacebookLikeButtonBlockService('sonata.block.service.facebook.like_button', $templating); $block = new Block(); $block->setType('core.text'); $block->setSettings(array( - 'url' => 'url_setting', - 'width' => 'width_setting', - 'show_faces' => 'show_faces_setting', - 'share' => 'share_setting', - 'layout' => 'layout_setting', + 'url' => 'url_setting', + 'width' => 'width_setting', + 'show_faces' => 'show_faces_setting', + 'share' => 'share_setting', + 'layout' => 'layout_setting', 'colorscheme' => 'colorscheme_setting', - 'action' => 'action_setting', + 'action' => 'action_setting', )); $optionResolver = new OptionsResolver(); @@ -56,12 +56,12 @@ public function testService() $service->execute($blockContext); - $this->assertEquals('url_setting', $templating->parameters['settings']['url']); - $this->assertEquals('width_setting', $templating->parameters['settings']['width']); - $this->assertEquals('show_faces_setting', $templating->parameters['settings']['show_faces']); - $this->assertEquals('share_setting', $templating->parameters['settings']['share']); - $this->assertEquals('layout_setting', $templating->parameters['settings']['layout']); + $this->assertEquals('url_setting', $templating->parameters['settings']['url']); + $this->assertEquals('width_setting', $templating->parameters['settings']['width']); + $this->assertEquals('show_faces_setting', $templating->parameters['settings']['show_faces']); + $this->assertEquals('share_setting', $templating->parameters['settings']['share']); + $this->assertEquals('layout_setting', $templating->parameters['settings']['layout']); $this->assertEquals('colorscheme_setting', $templating->parameters['settings']['colorscheme']); - $this->assertEquals('action_setting', $templating->parameters['settings']['action']); + $this->assertEquals('action_setting', $templating->parameters['settings']['action']); } } diff --git a/Tests/Block/Social/FacebookSendButtonBlockServiceTest.php b/Tests/Block/Social/FacebookSendButtonBlockServiceTest.php index b5d895bc..754d1021 100644 --- a/Tests/Block/Social/FacebookSendButtonBlockServiceTest.php +++ b/Tests/Block/Social/FacebookSendButtonBlockServiceTest.php @@ -1,7 +1,7 @@ * @@ -29,14 +29,14 @@ public function testService() } $templating = new FakeTemplating(); - $service = new FacebookSendButtonBlockService('sonata.block.service.facebook.send_button', $templating); + $service = new FacebookSendButtonBlockService('sonata.block.service.facebook.send_button', $templating); $block = new Block(); $block->setType('core.text'); $block->setSettings(array( - 'url' => 'url_setting', - 'width' => 'width_setting', - 'height' => 'height_setting', + 'url' => 'url_setting', + 'width' => 'width_setting', + 'height' => 'height_setting', 'colorscheme' => 'colorscheme_setting', )); @@ -53,9 +53,9 @@ public function testService() $service->execute($blockContext); - $this->assertEquals('url_setting', $templating->parameters['settings']['url']); - $this->assertEquals('width_setting', $templating->parameters['settings']['width']); - $this->assertEquals('height_setting', $templating->parameters['settings']['height']); + $this->assertEquals('url_setting', $templating->parameters['settings']['url']); + $this->assertEquals('width_setting', $templating->parameters['settings']['width']); + $this->assertEquals('height_setting', $templating->parameters['settings']['height']); $this->assertEquals('colorscheme_setting', $templating->parameters['settings']['colorscheme']); } } diff --git a/Tests/Block/Social/FacebookShareButtonBlockServiceTest.php b/Tests/Block/Social/FacebookShareButtonBlockServiceTest.php index 091d5c92..f2d0a2e8 100644 --- a/Tests/Block/Social/FacebookShareButtonBlockServiceTest.php +++ b/Tests/Block/Social/FacebookShareButtonBlockServiceTest.php @@ -1,7 +1,7 @@ * @@ -29,13 +29,13 @@ public function testService() } $templating = new FakeTemplating(); - $service = new FacebookShareButtonBlockService('sonata.block.service.facebook.share_button', $templating); + $service = new FacebookShareButtonBlockService('sonata.block.service.facebook.share_button', $templating); $block = new Block(); $block->setType('core.text'); $block->setSettings(array( - 'url' => 'url_setting', - 'width' => 'width_setting', + 'url' => 'url_setting', + 'width' => 'width_setting', 'layout' => 'layout_setting', )); @@ -52,8 +52,8 @@ public function testService() $service->execute($blockContext); - $this->assertEquals('url_setting', $templating->parameters['settings']['url']); - $this->assertEquals('width_setting', $templating->parameters['settings']['width']); + $this->assertEquals('url_setting', $templating->parameters['settings']['url']); + $this->assertEquals('width_setting', $templating->parameters['settings']['width']); $this->assertEquals('layout_setting', $templating->parameters['settings']['layout']); } } diff --git a/Tests/Block/Social/TwitterEmbedTweetBlockServiceTest.php b/Tests/Block/Social/TwitterEmbedTweetBlockServiceTest.php index 2ce48245..604850cb 100644 --- a/Tests/Block/Social/TwitterEmbedTweetBlockServiceTest.php +++ b/Tests/Block/Social/TwitterEmbedTweetBlockServiceTest.php @@ -1,7 +1,7 @@ * @@ -33,7 +33,7 @@ public function testBuildUri() { $settings = array( 'tweet' => 'tweeeeeeeet', - 'foo' => 'bar', + 'foo' => 'bar', 'align' => 'bar', ); diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index 17c35038..44727b8e 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\SeoBundle\Tests\DependencyInjection; use Sonata\SeoBundle\DependencyInjection\Configuration; @@ -8,32 +17,6 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase { - private function getDefaultConfiguration() - { - return array( - 'encoding' => 'UTF-8', - 'page' => array( - 'default' => 'sonata.seo.page.default', - 'head' => array(), - 'metas' => array(), - 'separator' => ' - ', - 'title' => 'Sonata Project', - ), - 'sitemap' => array( - 'doctrine_orm' => array(), - 'services' => array(), - ), - ); - } - - private function processConfiguration(array $configs) - { - $configuration = new Configuration(); - $processor = new Processor(); - - return $processor->processConfiguration($configuration, $configs); - } - public function testDefaultConfiguration() { $config = $this->processConfiguration(array(array())); @@ -47,7 +30,7 @@ public function testKeysAreNotNormalized() { $values = array( 'page' => array( - 'head' => array('data-example' => 'abc-123'), + 'head' => array('data-example' => 'abc-123'), 'metas' => array( 'http-equiv' => array( 'Content-Type' => 'text/html; charset=utf-8', @@ -81,4 +64,30 @@ public function testWithYamlConfig() $this->assertEquals('website', $config['page']['metas']['property']['og:type']); } + + private function getDefaultConfiguration() + { + return array( + 'encoding' => 'UTF-8', + 'page' => array( + 'default' => 'sonata.seo.page.default', + 'head' => array(), + 'metas' => array(), + 'separator' => ' - ', + 'title' => 'Sonata Project', + ), + 'sitemap' => array( + 'doctrine_orm' => array(), + 'services' => array(), + ), + ); + } + + private function processConfiguration(array $configs) + { + $configuration = new Configuration(); + $processor = new Processor(); + + return $processor->processConfiguration($configuration, $configs); + } } diff --git a/Tests/DependencyInjection/SonataSeoExtensionTest.php b/Tests/DependencyInjection/SonataSeoExtensionTest.php index 542306c2..6e31bb68 100644 --- a/Tests/DependencyInjection/SonataSeoExtensionTest.php +++ b/Tests/DependencyInjection/SonataSeoExtensionTest.php @@ -1,7 +1,7 @@ * @@ -29,7 +29,7 @@ public function testBlocksLoading() $container = new ContainerBuilder(); $container->setParameter('kernel.bundles', array( 'SonataBlockBundle' => 'Sonata\BlockBundle\SonataBlockBundle', - 'KnpMenuBundle' => 'Knp\Bundle\MenuBundle\KnpMenuBundle', + 'KnpMenuBundle' => 'Knp\Bundle\MenuBundle\KnpMenuBundle', )); $extension = new SonataSeoExtension(); diff --git a/Tests/Seo/SeoPageTest.php b/Tests/Seo/SeoPageTest.php index ebc0e4f0..3010aad8 100644 --- a/Tests/Seo/SeoPageTest.php +++ b/Tests/Seo/SeoPageTest.php @@ -1,7 +1,7 @@ * @@ -22,10 +22,10 @@ public function testAddMeta() $expected = array( 'http-equiv' => array(), - 'name' => array(), - 'schema' => array(), - 'charset' => array(), - 'property' => array('foo' => array('bar', array())), + 'name' => array(), + 'schema' => array(), + 'charset' => array(), + 'property' => array('foo' => array('bar', array())), ); $this->assertEquals($expected, $page->getMetas()); @@ -37,7 +37,7 @@ public function testOverrideMetas() $page->setMetas(array('property' => array('foo' => 'bar', 'foo2' => array('bar2', array())))); $expected = array( - 'property' => array('foo' => array('bar', array()), 'foo2' => array('bar2', array())), + 'property' => array('foo' => array('bar', array()), 'foo2' => array('bar2', array())), ); $this->assertEquals($expected, $page->getMetas()); @@ -135,7 +135,7 @@ public function testLangAlternates() $page->addLangAlternate('http://example.com/en-us', 'en-us'); $expected = array( - 'http://example.com/' => 'x-default', + 'http://example.com/' => 'x-default', 'http://example.com/en-us' => 'en-us', ); diff --git a/Tests/Twig/Extension/SeoExtensionTest.php b/Tests/Twig/Extension/SeoExtensionTest.php index 9e6a6871..cdc8b74e 100644 --- a/Tests/Twig/Extension/SeoExtensionTest.php +++ b/Tests/Twig/Extension/SeoExtensionTest.php @@ -1,7 +1,7 @@ * @@ -19,7 +19,7 @@ public function testHtmlAttributes() { $page = $this->getMock('Sonata\SeoBundle\Seo\SeoPageInterface'); $page->expects($this->once())->method('getHtmlAttributes')->will($this->returnValue(array( - 'xmlns' => 'http://www.w3.org/1999/xhtml', + 'xmlns' => 'http://www.w3.org/1999/xhtml', 'xmlns:og' => 'http://opengraphprotocol.org/schema/', ))); @@ -54,10 +54,10 @@ public function testEncoding() $page->expects($this->once())->method('getTitle')->will($this->returnValue('pięć głów zatkniętych na pal')); $page->expects($this->once())->method('getMetas')->will($this->returnValue(array( 'http-equiv' => array(), - 'name' => array('foo' => array('pięć głów zatkniętych na pal', array())), - 'schema' => array(), - 'charset' => array(), - 'property' => array(), + 'name' => array('foo' => array('pięć głów zatkniętych na pal', array())), + 'schema' => array(), + 'charset' => array(), + 'property' => array(), ))); $extension = new SeoExtension($page, 'UTF-8'); @@ -72,10 +72,10 @@ public function testMetadatas() $page = $this->getMock('Sonata\SeoBundle\Seo\SeoPageInterface'); $page->expects($this->once())->method('getMetas')->will($this->returnValue(array( 'http-equiv' => array(), - 'name' => array('foo' => array('bar "\'"', array())), - 'schema' => array(), - 'charset' => array('UTF-8' => array('', array())), - 'property' => array(), + 'name' => array('foo' => array('bar "\'"', array())), + 'schema' => array(), + 'charset' => array('UTF-8' => array('', array())), + 'property' => array(), ))); $extension = new SeoExtension($page, 'UTF-8'); diff --git a/Tests/tests/bootstrap.php b/Tests/tests/bootstrap.php index 3d7191de..202644fc 100644 --- a/Tests/tests/bootstrap.php +++ b/Tests/tests/bootstrap.php @@ -1,11 +1,11 @@ + * (c) Thomas Rabaix * - * for the full copyright and license information, please view the LICENSE + * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ diff --git a/Twig/Extension/SeoExtension.php b/Twig/Extension/SeoExtension.php index ffe7e787..e072a539 100644 --- a/Twig/Extension/SeoExtension.php +++ b/Twig/Extension/SeoExtension.php @@ -1,9 +1,9 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code.