-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a862be9
commit 4618290
Showing
122 changed files
with
19,541 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
# froala-wysiwyg-cakephp | ||
# Froala plugin for CakePHP | ||
|
||
## Installation | ||
|
||
You can install this plugin into your CakePHP application using [composer](http://getcomposer.org). | ||
|
||
The recommended way to install composer packages is: | ||
|
||
``` | ||
composer require your-name-here/Froala | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "wysiwyg/Froala", | ||
"description": "A beautiful jQuery WYSIWYG text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.", | ||
"type": "cakephp-plugin", | ||
"keywords": [ | ||
"froala", | ||
"froala cake php 3", | ||
"html", | ||
"text", | ||
"editor", | ||
"wysiwyg", | ||
"jquery-plugin", | ||
"rich editor", | ||
"rich text editor", | ||
"rte", | ||
"javascript", | ||
"jquery" | ||
], | ||
"homepage": "https://www.froala.com/wysiwyg-editor", | ||
"license": [ | ||
"One Website", | ||
"Advanced", | ||
"OEM" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Froala Labs", | ||
"role": "Maintainer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.5.9", | ||
"cakephp/cakephp": ">=3.3.2 <4.0.0", | ||
"fontawsome/font-awesome": ">=4.4.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Froala\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Froala\\Test\\": "tests", | ||
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests" | ||
} | ||
}, | ||
"support": { | ||
"issues": "-", | ||
"source": "https://www.froala.com/wysiwyg-editor" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
use Cake\Routing\RouteBuilder; | ||
use Cake\Routing\Router; | ||
use Cake\Routing\Route\DashedRoute; | ||
|
||
Router::plugin( | ||
'Froala', | ||
['path' => '/froala'], | ||
function (RouteBuilder $routes) { | ||
$routes->fallbacks(DashedRoute::class); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
colors="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
bootstrap="./tests/bootstrap.php" | ||
> | ||
<php> | ||
<ini name="memory_limit" value="-1"/> | ||
<ini name="apc.enable_cli" value="1"/> | ||
</php> | ||
|
||
<!-- Add any additional test suites you want to run here --> | ||
<testsuites> | ||
<testsuite name="Froala Test Suite"> | ||
<directory>./tests/TestCase</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<!-- Setup a listener for fixtures --> | ||
<listeners> | ||
<listener | ||
class="\Cake\TestSuite\Fixture\FixtureInjector" | ||
file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php"> | ||
<arguments> | ||
<object class="\Cake\TestSuite\Fixture\FixtureManager" /> | ||
</arguments> | ||
</listener> | ||
</listeners> | ||
|
||
<!-- Prevent coverage reports from looking in tests and vendors --> | ||
<filter> | ||
<blacklist> | ||
<directory suffix=".php">./vendor/</directory> | ||
<directory suffix=".ctp">./vendor/</directory> | ||
|
||
<directory suffix=".php">./tests/</directory> | ||
<directory suffix=".ctp">./tests/</directory> | ||
</blacklist> | ||
</filter> | ||
|
||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Froala\Controller; | ||
|
||
use App\Controller\AppController as BaseController; | ||
|
||
class AppController extends BaseController | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?php | ||
namespace Froala\View\Helper; | ||
|
||
use Cake\View\Helper; | ||
use Cake\Core\Configure; | ||
|
||
/** | ||
* Froala helper | ||
*/ | ||
class FroalaHelper extends Helper | ||
{ | ||
|
||
/** | ||
* Default configuration. | ||
* | ||
* @var array | ||
*/ | ||
protected $_defaultConfig = []; | ||
public $helpers = array('Html'); | ||
|
||
|
||
public function initialize(array $config) {} | ||
|
||
/** | ||
* Adds a new editor to the script block on the page | ||
* | ||
* @see http://editor.froala.com/docs/options for a list of keys | ||
* @param mixed | ||
* @return void | ||
*/ | ||
public function editor($selector = null, $options = null) { | ||
|
||
$configs = Configure::read('Froala.editorOptions'); | ||
if (!empty($configs) && is_array($configs)) { | ||
$this->_defaultConfig = $configs; | ||
} | ||
|
||
if (is_object($options)){ | ||
$options = json_encode($options); | ||
} else if (is_array($options)) { | ||
$options = json_encode(array_merge($this->_defaultConfig, $options)); | ||
|
||
} | ||
else { | ||
$options = '{}'; | ||
} | ||
|
||
echo $this->Html->scriptBlock('$(function() {$("' . $selector . '").froalaEditor(' . "\n" . $options . "\n" . ');})' . "\n"); | ||
} | ||
|
||
|
||
/** | ||
* Loads up all the plugins and css for plugins upon calling. | ||
* | ||
*/ | ||
public function plugin() { | ||
|
||
echo $this->Html->script(array( | ||
'/Froala/js/froala_editor.min.js', | ||
'/Froala/js/plugins/align.min.js', | ||
'/Froala/js/plugins/char_counter.min.js', | ||
'/Froala/js/plugins/code_beautifier.min.js', | ||
'/Froala/js/plugins/code_view.min.js', | ||
'/Froala/js/plugins/colors.min.js', | ||
'/Froala/js/plugins/draggable.min.js', | ||
'/Froala/js/plugins/emoticons.min.js', | ||
'/Froala/js/plugins/entities.min.js', | ||
'/Froala/js/plugins/file.min.js', | ||
'/Froala/js/plugins/font_family.min.js', | ||
'/Froala/js/plugins/font_size.min.js', | ||
'/Froala/js/plugins/fullscreen.min.js', | ||
'/Froala/js/plugins/help.min.js', | ||
'/Froala/js/plugins/image.min.js', | ||
'/Froala/js/plugins/image_manager.min.js', | ||
'/Froala/js/plugins/inline_style.min.js', | ||
'/Froala/js/plugins/line_breaker.min.js', | ||
'/Froala/js/plugins/link.min.js', | ||
'/Froala/js/plugins/lists.min.js', | ||
'/Froala/js/plugins/paragraph_format.min.js', | ||
'/Froala/js/plugins/paragraph_style.min.js', | ||
'/Froala/js/plugins/print.min.js', | ||
'/Froala/js/plugins/quick_insert.min.js', | ||
'/Froala/js/plugins/quote.min.js', | ||
'/Froala/js/plugins/special_characters.min.js', | ||
'/Froala/js/plugins/save.min.js', | ||
'/Froala/js/plugins/table.min.js', | ||
'/Froala/js/plugins/url.min.js', | ||
'/Froala/js/plugins/video.min.js', | ||
'/Froala/js/plugins/word_paste.min.js' | ||
), array('toolbarInline' => false)); | ||
echo $this->Html->css(array( | ||
'/Froala/css/froala_editor.min.css', | ||
'/Froala/css/froala_style.min.css', | ||
'/Froala/css/plugins/char_counter.min.css', | ||
'/Froala/css/plugins/code_view.min.css', | ||
'/Froala/css/plugins/colors.min.css', | ||
'/Froala/css/plugins/draggable.min.css', | ||
'/Froala/css/plugins/emoticons.min.css', | ||
'/Froala/css/plugins/file.min.css', | ||
'/Froala/css/plugins/fullscreen.min.css', | ||
'/Froala/css/plugins/help.min.css', | ||
'/Froala/css/plugins/image_manager.min.css', | ||
'/Froala/css/plugins/image.min.css', | ||
'/Froala/css/plugins/line_breaker.min.css', | ||
'/Froala/css/plugins/quick_insert.min.css', | ||
'/Froala/css/plugins/special_characters.min.css', | ||
'/Froala/css/plugins/table.min.css', | ||
'/Froala/css/plugins/video.min.css', | ||
'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' | ||
) | ||
); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
namespace Froala\Test\TestCase\View\Helper; | ||
|
||
use Cake\TestSuite\TestCase; | ||
use Cake\View\View; | ||
use Froala\View\Helper\FroalaHelper; | ||
|
||
/** | ||
* Froala\View\Helper\FroalaHelper Test Case | ||
*/ | ||
class FroalaHelperTest extends TestCase | ||
{ | ||
|
||
/** | ||
* Test subject | ||
* | ||
* @var \Froala\View\Helper\FroalaHelper | ||
*/ | ||
public $Froala; | ||
|
||
/** | ||
* setUp method | ||
* | ||
* @return void | ||
*/ | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
$view = new View(); | ||
$this->Froala = new FroalaHelper($view); | ||
} | ||
|
||
/** | ||
* tearDown method | ||
* | ||
* @return void | ||
*/ | ||
public function tearDown() | ||
{ | ||
unset($this->Froala); | ||
|
||
parent::tearDown(); | ||
} | ||
|
||
/** | ||
* Test initial setup | ||
* | ||
* @return void | ||
*/ | ||
public function testInitialization() | ||
{ | ||
$this->markTestIncomplete('Not implemented yet.'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* Test suite bootstrap for Froala. | ||
* | ||
* This function is used to find the location of CakePHP whether CakePHP | ||
* has been installed as a dependency of the plugin, or the plugin is itself | ||
* installed as a dependency of an application. | ||
*/ | ||
$findRoot = function ($root) { | ||
do { | ||
$lastRoot = $root; | ||
$root = dirname($root); | ||
if (is_dir($root . '/vendor/cakephp/cakephp')) { | ||
return $root; | ||
} | ||
} while ($root !== $lastRoot); | ||
|
||
throw new Exception("Cannot find the root of the application, unable to run tests"); | ||
}; | ||
$root = $findRoot(__FILE__); | ||
unset($findRoot); | ||
|
||
chdir($root); | ||
require $root . '/config/bootstrap.php'; |
Oops, something went wrong.