Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Commit

Permalink
Closes #56 - Update to Symfony 2.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Mar 13, 2013
1 parent e65f47b commit d8bf06a
Show file tree
Hide file tree
Showing 417 changed files with 8,805 additions and 0 deletions.
12 changes: 12 additions & 0 deletions vendor/egeloen/ckeditor-bundle/Ivory/CKEditorBundle/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Composer
/installer
/composer.phar
/composer.lock
/vendor

# PHPUnit
/phpunit.xml
/report

# ApiGen
/api
20 changes: 20 additions & 0 deletions vendor/egeloen/ckeditor-bundle/Ivory/CKEditorBundle/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: php

php:
- 5.3.3
- 5.3
- 5.4
- 5.5

env:
- SYMFONY_VERSION="2.1.*"
- SYMFONY_VERSION="dev-master"

before_script:
- composer require symfony/framework-bundle:${SYMFONY_VERSION}
- composer install --dev

script: phpunit

notifications:
email: [email protected]
21 changes: 21 additions & 0 deletions vendor/egeloen/ckeditor-bundle/Ivory/CKEditorBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# CHANGELOG

### 1.1.2 - 2.1.2 (2013-02-19)

* a6b1556 - Add plugins support
* c796be2 - Normalize line endings
* d078d28 - Handle filebrowser URL generation

### 1.1.1 - 2.1.1 (2013-01-27)

* e0b086a - Allow to configure ckeditor form type through configuration
* 038d7c1 - Upgrade CKEditor to 4.0.1
* b90ea78 - Fix assets_version support
* 4be2e56 - Add support for assets_version
* e787087 - [Widget] Remove autoescape js

### 1.1.0 - 2.1.0 (2013-01-12)

* fd79848 - [Form][Type] Allow to set all config options.

### 1.0.0 - 2.0.0 (2013-01-12)
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

/*
* This file is part of the Ivory CKEditor package.
*
* (c) Eric GELOEN <[email protected]>
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/

namespace Ivory\CKEditorBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder,
Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* Ivory CKEditor configuration.
*
* @author GeLo <[email protected]>
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$node = $treeBuilder->root('ivory_ck_editor');

$node
->children()
->arrayNode('configs')
->useAttributeAsKey('name')
->prototype('array')
->useAttributeAsKey('name')
->prototype('variable')->end()
->end()
->end()
->arrayNode('plugins')
->useAttributeAsKey('name')
->prototype('array')
->children()
->scalarNode('path')->end()
->scalarNode('filename')->end()
->end()
->end()
->end()
->arrayNode('toolbars')
->addDefaultsIfNotSet()
->children()
->arrayNode('configs')
->useAttributeAsKey('name')
->prototype('array')
->prototype('variable')->end()
->end()
->end()
->arrayNode('items')
->useAttributeAsKey('name')
->prototype('array')
->prototype('variable')->end()
->end()
->end()
->end()
->end()
->end();

return $treeBuilder;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?php

/*
* This file is part of the Ivory CKEditor package.
*
* (c) Eric GELOEN <[email protected]>
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/

namespace Ivory\CKEditorBundle\DependencyInjection;

use Ivory\CKEditorBundle\Exception\DependencyInjectionException,
Symfony\Component\Config\Definition\Processor,
Symfony\Component\Config\FileLocator,
Symfony\Component\DependencyInjection\ContainerBuilder,
Symfony\Component\DependencyInjection\Loader\XmlFileLoader,
Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* Ivory CKEditor extension.
*
* @author GeLo <[email protected]>
*/
class IvoryCKEditorExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$processor = new Processor();
$config = $processor->processConfiguration(new Configuration(), $configs);

$this->register($config, $container);
}

/**
* Registers the CKEditor configuration.
*
* @param array $config The CKEditor configuration
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
*/
protected function register(array $config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

foreach (array('form', 'twig') as $service) {
$loader->load($service.'.xml');
}

$container->setParameter('twig.form.resources', array_merge(
$container->getParameter('twig.form.resources'),
array('IvoryCKEditorBundle:Form:ckeditor_widget.html.twig')
));

if (!empty($config['configs'])) {
$this->registerConfigs($config, $container);
}

if (!empty($config['plugins'])) {
$this->registerPlugins($config, $container);
}
}

/**
* Register the CKEditor configurations.
*
* @param array $config The CKEditor configuration.
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
*/
protected function registerConfigs(array $config, ContainerBuilder $container)
{
$config = $this->mergeToolbars($config);

$definition = $container->getDefinition('ivory_ck_editor.config_manager');
foreach ($config['configs'] as $name => $configuration) {
$definition->addMethodCall('setConfig', array($name, $configuration));
}
}

/**
* Registers the CKEditor plugins.
*
* @param array $config The CKEditor configuration.
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
*/
protected function registerPlugins(array $config, ContainerBuilder $container)
{
$definition = $container->getDefinition('ivory_ck_editor.plugin_manager');

foreach ($config['plugins'] as $name => $plugin) {
$definition->addMethodCall('setPlugin', array($name, $plugin));
}
}

/**
* Merges the toolbars into the CKEditor configurations.
*
* @param array $config The CKEditor configuration.
*
* @return array The CKEditor configuration with merged toolbars.
*/
protected function mergeToolbars(array $config)
{
$toolbars = array();
foreach ($config['toolbars']['configs'] as $name => $toolbar) {
$toolbars[$name] = array();

foreach ($toolbar as $item) {
if (is_string($item) && ($item[0] === '@')) {
$itemName = substr($item, 1);

if (!isset($config['toolbars']['items'][$itemName])) {
throw DependencyInjectionException::invalidToolbarItem($itemName);
}

$item = $config['toolbars']['items'][$itemName];
}

$toolbars[$name][] = $item;
}
}

foreach ($config['configs'] as $name => $configuration) {
if (isset($configuration['toolbar']) && is_string($configuration['toolbar'])) {
if (!isset($toolbars[$configuration['toolbar']])) {
throw DependencyInjectionException::invalidToolbar($configuration['toolbar']);
}

$config['configs'][$name]['toolbar'] = $toolbars[$configuration['toolbar']];
}
}

unset($config['toolbars']);

return $config;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/*
* This file is part of the Ivory CKEditor package.
*
* (c) Eric GELOEN <[email protected]>
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/

namespace Ivory\CKEditorBundle\Exception;

/**
* Config manager exception.
*
* @author GeLo <[email protected]>
*/
class ConfigManagerException extends Exception
{
/**
* Gets the "CONFIG DOES NOT EXIST" exception.
*
* @param string $name The invalid CKEditor config name.
*
* @return \Ivory\CKEditorBundle\Exception\ConfigManagerException The "CONFIG DOES NOT EXIST" exception.
*/
static public function configDoesNotExist($name)
{
return new static(sprintf('The CKEditor config "%s" does not exist.', $name));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/*
* This file is part of the Ivory CKEditor package.
*
* (c) Eric GELOEN <[email protected]>
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/

namespace Ivory\CKEditorBundle\Exception;

/**
* Depencency injection exception.
*
* @author GeLo <[email protected]>
*/
class DependencyInjectionException extends Exception
{
/**
* Gets the "INVALID TOOLBAR ITEM" exception.
*
* @param string $item The invalid toolbar item.
*
* @return \Ivory\CKEditorBundle\Exception\DependencyInjectionException The "INVALID TOOLBAR ITEM" exception.
*/
static public function invalidToolbarItem($item)
{
return new static(sprintf('The toolbar item "%s" does not exist.', $item));
}

/**
* Getsthe "INVALID TOOLBAR" exception.
*
* @param string $toolbar The invalid toolbar.
*
* @return \Ivory\CKEditorBundle\Exception\DependencyInjectionException The "INVALID TOOLBAR" exception.
*/
static public function invalidToolbar($toolbar)
{
return new static(sprintf('The toolbar "%s" does not exist.', $toolbar));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/*
* This file is part of the Ivory CKEditor package.
*
* (c) Eric GELOEN <[email protected]>
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/

namespace Ivory\CKEditorBundle\Exception;

use \Exception as BaseException;

/**
* Ivory CKEditor exception.
*
* All exceptions must extend this class.
*
* @author GeLo <[email protected]>
*/
class Exception extends BaseException
{

}
Loading

0 comments on commit d8bf06a

Please sign in to comment.