diff --git a/admin/controllers/configure-plugin.php b/admin/controllers/configure-plugin.php index c4f6b6ee..d1c1c9f4 100644 --- a/admin/controllers/configure-plugin.php +++ b/admin/controllers/configure-plugin.php @@ -17,10 +17,11 @@ if($Login->role()!=='admin') { // Main before POST // ============================================================================ $_Plugin = false; +$pluginClassName = $layout['parameters']; foreach($plugins['all'] as $P) { - if($P->className()==$layout['parameters']) { + if($P->className()==$pluginClassName) { $_Plugin = $P; } } @@ -30,7 +31,7 @@ if($_Plugin===false) { Redirect::page('admin', 'plugins'); } -// Check if the plugin has the method form. +// Check if the plugin has the method form() if($_Plugin->form()===false) { Redirect::page('admin', 'plugins'); } diff --git a/admin/controllers/install-plugin.php b/admin/controllers/install-plugin.php index 6b615e82..80659233 100644 --- a/admin/controllers/install-plugin.php +++ b/admin/controllers/install-plugin.php @@ -22,7 +22,11 @@ if($Login->role()!=='admin') { // ============================================================================ $pluginClassName = $layout['parameters']; -$Plugin = new $pluginClassName; -$Plugin->install(); +foreach($plugins['all'] as $P) +{ + if($P->className()==$pluginClassName) { + $P->install(); + } +} Redirect::page('admin', 'plugins'); \ No newline at end of file diff --git a/admin/controllers/themes.php b/admin/controllers/themes.php new file mode 100644 index 00000000..c8d2a7de --- /dev/null +++ b/admin/controllers/themes.php @@ -0,0 +1,30 @@ +role()!=='admin') { + Alert::set($Language->g('you-do-not-have-sufficient-permissions')); + Redirect::page('admin', 'dashboard'); +} + +// ============================================================================ +// POST Method +// ============================================================================ + +if( $_SERVER['REQUEST_METHOD'] == 'POST' ) +{ + $Site->set($_POST); +} + +// ============================================================================ +// Main +// ============================================================================ + +$themes = Filesystem::listDirectories(PATH_THEMES); + +// Load each plugin clasess +foreach($themes as $themePath) { +// include($themePath.DS.'plugin.php'); +} \ No newline at end of file diff --git a/admin/themes/default/css/default.css b/admin/themes/default/css/default.css index fcff5495..bef79c3f 100644 --- a/admin/themes/default/css/default.css +++ b/admin/themes/default/css/default.css @@ -12,6 +12,10 @@ body { background-color: #f9f9f9; } +div.unit-80 { + margin-left: 1% !important; +} + /* ----------- FONTS AWESOME ----------- */ .fa-right { margin-right: 5px; @@ -63,7 +67,7 @@ body { } #sidebar li { - + } /* ----------- ALERT ----------- */ @@ -151,7 +155,32 @@ div.dashboardBox h2 { padding: 10px 20px; } +div.dashboardBox ul.menu { + list-style-type: none; + margin: 0; + padding: 0; + text-align: center; +} +div.dashboardBox ul.menu a { + color: #2672ec; +} + +div.dashboardBox ul.menu li.title { + +} + +div.dashboardBox ul.menu li.description { + border-bottom: 1px dashed #ddd; + margin-bottom: 10px; + padding-bottom: 10px; + color: #555; +} + +div.dashboardBox ul.menu li.description:last-child { + border-bottom: 0 !important; + margin-bottom: 0 !important; +} /* ----------- FORMS ----------- */ @@ -214,6 +243,44 @@ a.btn-red:hover { margin-left: 10px; } +/* ----------- THEMES ----------- */ + +div.themeBox { + box-shadow: 0 1px 2px rgba(0,0,0,.26); + background-color: #fff; + border-radius: 2px; + box-sizing: border-box; + padding: 15px 20px; + width: 70%; + margin-bottom: 20px; +} + +div.themeBox p { + margin-bottom: 6px; +} + +div.themeBox p.name { + border-bottom: 1px dashed #ccc; +} + +div.themeBox a.btn-smaller { + padding: 4px 10px; + margin-right: 10px; +} + +div.themeBox span.author { + color: #777; + margin-left: 10px; + float: right; + font-size: 0.9em; +} + +div.themeBox span.version { + color: #777; + margin-left: 10px; + float: right; + font-size: 0.9em; +} /* ----------- PLUGINS ----------- */ div.pluginBox { @@ -221,18 +288,36 @@ div.pluginBox { background-color: #fff; border-radius: 2px; box-sizing: border-box; - padding: 20px; + padding: 15px 20px; width: 70%; margin-bottom: 20px; } div.pluginBox p { - margin-bottom: 10px; + margin-bottom: 6px; +} + +div.pluginBox p.name { + border-bottom: 1px dashed #ccc; +} + +div.pluginBox a.btn-smaller { + padding: 4px 10px; + margin-right: 10px; +} + +div.pluginBox span.author { + color: #777; + margin-left: 10px; + float: right; + font-size: 0.9em; } div.pluginBox span.version { - color: #ccc; + color: #777; margin-left: 10px; + float: right; + font-size: 0.9em; } /* ----------- PLUGINS FORM ----------- */ diff --git a/admin/themes/default/index.php b/admin/themes/default/index.php index 85316ab8..1383815d 100644 --- a/admin/themes/default/index.php +++ b/admin/themes/default/index.php @@ -7,9 +7,9 @@ <?php echo $layout['title'] ?> - - - + + + diff --git a/admin/views/dashboard.php b/admin/views/dashboard.php index d764f9aa..f96240a9 100644 --- a/admin/views/dashboard.php +++ b/admin/views/dashboard.php @@ -2,7 +2,36 @@
-
+
+ +
+

p('Start here') ?>

+
+ +
+
+ +
+ +
+ +
+
+
p('database-regenerated') ?>
+
p('new-posts-and-pages-synchronized') ?>
+ +
+
+
@@ -20,18 +49,6 @@
-
- -
- -
-
-
p('database-regenerated') ?>
-
p('new-posts-and-pages-synchronized') ?>
- -
-
-

Drafts

diff --git a/admin/views/edit-page.php b/admin/views/edit-page.php index e4872589..2e08e672 100644 --- a/admin/views/edit-page.php +++ b/admin/views/edit-page.php @@ -6,12 +6,12 @@ p('Title') ?> - + p('Title') ?> - + p('Title') ?> - + '; - echo '

'.$Plugin->name().' '.$Language->g('Version').': '.$Plugin->version().'

'; + echo '

'.$Plugin->name().'

'; echo '

'.$Plugin->description().'

'; + echo ''.$Language->g('Version').': '.$Plugin->version().''.$Language->g('author').': '.$Plugin->author().''; if($Plugin->installed()) { - echo ''.$Language->g('Uninstall plugin').''; if($Plugin->form()) { - echo ''.$Language->g('Configure plugin').''; + echo ''.$Language->g('Configure plugin').''; } + echo ''.$Language->g('Uninstall plugin').''; } else { - echo ''.$Language->g('Install plugin').''; + echo ''.$Language->g('Install plugin').''; } echo '
'; diff --git a/admin/views/themes.php b/admin/views/themes.php index 6e521df3..cd99ad29 100644 --- a/admin/views/themes.php +++ b/admin/views/themes.php @@ -1,2 +1,2 @@ -

Themes

-

Not implemented...

+

p('Themes') ?>

+ diff --git a/kernel/abstract/plugin.class.php b/kernel/abstract/plugin.class.php index bebd3c84..5e437e27 100644 --- a/kernel/abstract/plugin.class.php +++ b/kernel/abstract/plugin.class.php @@ -2,7 +2,7 @@ class Plugin { - // (string) Plugin's directory + // (string) Plugin's directory name public $directoryName; // (string) Database path and filename @@ -31,13 +31,13 @@ class Plugin { 'version'=>'', 'releaseDate'=>'' ); - + $this->dbFields = array(); $reflector = new ReflectionClass(get_class($this)); // Directory name - $this->directoryName = basename(dirname($reflector->getFileName())).DS; + $this->directoryName = basename(dirname($reflector->getFileName())); // Class Name $this->className = $reflector->getName(); @@ -48,7 +48,7 @@ class Plugin { // Init empty database $this->db = $this->dbFields; - $this->filenameDb = PATH_PLUGINS_DATABASES.$this->directoryName.'db.php'; + $this->filenameDb = PATH_PLUGINS_DATABASES.$this->directoryName.DS.'db.php'; // If the plugin installed then get the database. if($this->installed()) @@ -58,6 +58,11 @@ class Plugin { } } + public function htmlPath() + { + return HTML_PATH_PLUGINS.$this->directoryName.'/'; + } + // Returns the item from plugin-data. public function getData($key) { @@ -65,7 +70,7 @@ class Plugin { return $this->data[$key]; } - return ''; + return ''; } public function setData($array) @@ -73,10 +78,18 @@ class Plugin { $this->data = $array; } - public function getDbField($key) + public function getDbField($key, $html=true) { if(isset($this->db[$key])) { - return $this->db[$key]; + + if($html) { + // All fields from DBField are sanitized. + return $this->db[$key]; + } + else { + // Decode HTML tags, this action unsanitized the variable. + return Sanitize::htmlDecode($this->db[$key]); + } } return ''; @@ -145,7 +158,7 @@ class Plugin { } // Return TRUE if the installation success, otherwise FALSE. - public function install() + public function install($position=0) { if($this->installed()) { return false; @@ -155,10 +168,8 @@ class Plugin { mkdir(PATH_PLUGINS_DATABASES.$this->directoryName, 0755, true); // Create database - $Tmp = new dbJSON($this->filenameDb); - $Tmp->db = $this->dbFields; - $Tmp->db['position'] = 0; - $Tmp->save(); + $this->dbFields['position'] = $position; + $this->setDb($this->dbFields); return true; } diff --git a/kernel/boot/admin.php b/kernel/boot/admin.php index f4b9e937..1c6e42fb 100644 --- a/kernel/boot/admin.php +++ b/kernel/boot/admin.php @@ -43,6 +43,7 @@ else include(PATH_RULES.'80.plugins.php'); include(PATH_RULES.'99.header.php'); include(PATH_RULES.'99.paginator.php'); + include(PATH_RULES.'99.themes.php'); if($Url->notFound() || !$Login->isLogged() || ($Url->slug()==='login') ) { diff --git a/kernel/boot/init.php b/kernel/boot/init.php index 4bcb4818..112d8550 100644 --- a/kernel/boot/init.php +++ b/kernel/boot/init.php @@ -143,6 +143,10 @@ define('HTML_PATH_THEME_JS', HTML_PATH_THEME.'js/'); define('HTML_PATH_ADMIN_THEME', HTML_PATH_ROOT.'admin/themes/'.$Site->adminTheme().'/'); define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.'admin/'); define('HTML_PATH_UPLOADS', HTML_PATH_ROOT.'content/uploads/'); +define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'plugins/'); + +// PHP PATHs with dependency +define('PATH_THEME', PATH_ROOT.'themes/'.$Site->theme().'/'); // Objects with dependency $Language = new dbLanguage( $Site->locale() ); diff --git a/kernel/boot/rules/80.plugins.php b/kernel/boot/rules/80.plugins.php index 873c317a..4eadd9a0 100644 --- a/kernel/boot/rules/80.plugins.php +++ b/kernel/boot/rules/80.plugins.php @@ -55,14 +55,14 @@ function build_plugins() $Plugin = new $pluginClass; // Set Plugin data - $languageFilename = PATH_PLUGINS.$Plugin->directoryName().'language'.DS.$Site->locale().'.json'; + $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'language'.DS.$Site->locale().'.json'; if( Sanitize::pathFile($languageFilename) ) { $database = new dbJSON($languageFilename, false); } else { - $languageFilename = PATH_PLUGINS.$Plugin->directoryName().'language'.DS.'en_US.json'; + $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'language'.DS.'en_US.json'; $database = new dbJSON($languageFilename, false); } diff --git a/kernel/boot/rules/99.themes.php b/kernel/boot/rules/99.themes.php new file mode 100644 index 00000000..ee1fb042 --- /dev/null +++ b/kernel/boot/rules/99.themes.php @@ -0,0 +1,50 @@ +'', + 'description'=>'', + 'author'=>'', + 'email'=>'', + 'website'=>'', + 'version'=>'', + 'releaseDate'=>'' +); + +// ============================================================================ +// Functions +// ============================================================================ + +// ============================================================================ +// Main +// ============================================================================ + +$langLocaleFile = PATH_THEME.'language'.DS.$Site->locale().'.json'; +$langDefaultFile = PATH_THEME.'language'.DS.'en_US.json'; +$database = false; + +// Check if exists locale language +if( Sanitize::pathFile($langLocaleFile) ) { + $database = new dbJSON($langLocaleFile, false); +} +// Check if exists default language +elseif( Sanitize::pathFile($langDefaultFile) ) { + $database = new dbJSON($langDefaultFile, false); +} + +if($database!==false) +{ + $databaseArray = $database->db; + + // Theme data + $theme = $databaseArray['theme-data']; + + // Remove theme data + unset($databaseArray['theme-data']); + + // Add new words from language theme + $Language->add($databaseArray); +} \ No newline at end of file diff --git a/kernel/boot/site.php b/kernel/boot/site.php index f426611b..19c99ed0 100644 --- a/kernel/boot/site.php +++ b/kernel/boot/site.php @@ -6,6 +6,7 @@ include(PATH_RULES.'70.build_pages.php'); include(PATH_RULES.'80.plugins.php'); include(PATH_RULES.'99.header.php'); include(PATH_RULES.'99.paginator.php'); +include(PATH_RULES.'99.themes.php'); // Plugins before site loaded Theme::plugins('beforeSiteLoad'); diff --git a/kernel/dbsite.class.php b/kernel/dbsite.class.php index 217e5911..c71602f7 100644 --- a/kernel/dbsite.class.php +++ b/kernel/dbsite.class.php @@ -166,6 +166,16 @@ class dbSite extends dbJSON return $this->db['locale']; } + // Returns the current language in short format. + public function shortLanguage() + { + $locale = $this->locale(); + $explode = explode('_', $locale); + $short = array_shift($explode); + + return $short; + } + // Returns the current homepage. public function homepage() { diff --git a/languages/en_US.json b/languages/en_US.json index 5ed0bc5c..7dc87845 100644 --- a/languages/en_US.json +++ b/languages/en_US.json @@ -130,5 +130,12 @@ "show-blog": "Show blog", "default-home-page": "Default home page", "version": "Version", - "there-are-no-drafts": "There are no drafts." + "there-are-no-drafts": "There are no drafts.", + "create-a-new-article-for-your-blog":"Create a new article for your blog.", + "create-a-new-page-for-your-website":"Create a new page for your website.", + "invite-a-friend-to-collaborate-on-your-website":"Invite a friend to collaborate on your website.", + "change-your-language-and-region-settings":"Change your language and region settings.", + "language-and-timezone":"Language and timezone", + "author": "Author", + "start-here": "Start here" } \ No newline at end of file diff --git a/languages/es_VE.json b/languages/es_VE.json new file mode 100644 index 00000000..948dc7ef --- /dev/null +++ b/languages/es_VE.json @@ -0,0 +1,130 @@ +{ + "language-data": + { + "native": "Español (Venezuela)", + "english-name": "Spanish", + "last-update": "2015-07-27", + "author": "c-sanchez", + "email": "", + "website": "" + }, + + "username": "Usuario", + "password": "Contraseña", + "confirm-password": "Confirmar contraseña", + "editor": "Editor", + "dashboard": "Tablero", + "role": "Papel", + "post": "Mensaje", + "posts": "Entrada", + "users": "Usuarios", + "administrator": "Administrador", + "add": "Agregar", + "cancel": "Cancelar", + "content": "Contenido", + "title": "Título", + "no-parent": "Ningún padre", + "edit-page": "Editar página", + "edit-post": "Editar entrada", + "add-a-new-user": "Agregar un nuevo usuario", + "parent": "Padre", + "friendly-url": "URL amigable", + "description": "Descripción", + "posted-by": "Publicado por", + "tags": "Etiquetas", + "position": "Posición", + "save": "Guardar", + "draft": "Borrador", + "delete": "Eliminar", + "registered": "Registrado", + "Notifications": "Notificaciones", + "profile": "Perfil", + "email": "Email", + "settings": "Ajustes", + "general": "General", + "advanced": "Avanzado", + "regional": "Regional", + "about": "Acerca de...", + "login": "Ingresar", + "logout": "Salir", + "dasbhoard": "Dasbhoard", + "manage": "Administrar", + "themes": "Temas", + "prev-page": "Página Anterior", + "next-page": "Siguiente página", + "configure-plugin": "Configurar complemento", + "confirm-delete-this-action-cannot-be-undone": "Confirmar eliminar, esta acción no se puede deshacer.", + "site-title": "Título del sitio", + "site-slogan": "Lema del sitio", + "site-description": "Descripción del sitio", + "footer-text": "Texto de pie de página", + "posts-per-page": "Entradas por página", + "site-url": "URL del sitio", + "writting-settings": "Ajustes de redacción", + "url-filters": "Filtros de URL", + "page": "Página", + "pages": "Páginas", + "home": "Página de inicio", + "welcome-back": "Bienvenido", + "language": "Idioma", + "website": "Sitio web", + "timezone": "Zona Horaria", + "locale": "Localización", + "notifications": "Notificaciones", + "new-post": "Nueva entrada", + "html-and-markdown-code-supported": "Código HTML y Markdown soportado", + "new-page": "Nueva página", + "manage-posts": "Administrar mensajes", + "published-date": "Fecha de publicación", + "modified-date": "Fecha de modificación", + "empty-title": "Título vacío", + "plugins": "Complementos", + "install-plugin": "Instalar complemento", + "uninstall-plugin": "Desinstalar complemento", + "new-password": "Nueva contraseña", + "edit-user": "Editar usuario", + "publish-now": "Publicar ahora", + "first-name": "Nombre", + "last-name": "Apellido", + "bludit-version": "Versión de Bludit", + "powered-by": "Impulsado por", + "recent-posts": "Mensajes recientes", + "manage-pages": "Administrar páginas", + "advanced-options": "Opciones avanzadas", + "user-deleted": "Usuario eliminado", + "page-added-successfully": "Página agregada correctamente", + "post-added-successfully": "Mensaje agregado correctamente", + "the-post-has-been-deleted-successfully": "El mensaje ha sido eliminado correctamente", + "the-page-has-been-deleted-successfully": "La página ha sido eliminado correctamente", + "username-or-password-incorrect": "Usuario o contraseña incorrecto", + "database-regenerated": "Base de datos regenerada", + "the-changes-have-been-saved": "Los cambios han sido guardados", + "html-markdown-code-supported": "Código HTML y Markdown soportado.", + "enable-more-features-at": "Activar más funciones en", + "username-already-exists": "Ya existe nombre de usuario", + "username-field-is-empty": "Está vacío el campo de nombre de usuario ", + "the-password-and-confirmation-password-do-not-match":"La contraseña y la contraseña de confirmación no coinciden", + "user-has-been-added-successfully": "El usuario se ha agregado correctamente", + "you-do-not-have-sufficient-permissions": "No tienes permisos suficientes para acceder a esta página, póngase en contacto con el administrador.", + "settings-advanced-writting-settings": "Ajustes->Avanzado->Ajustes de redacción", + "new-posts-and-pages-synchronized": "Nuevos mensajes y páginas sincronizadas.", + "you-can-choose-the-users-privilege": "Usted puede elegir los privilegios del usuario. El papel del editor sólo puede escribir páginas y mensajes.", + "email-will-not-be-publicly-displayed": "El correo electrónico no se mostrará públicamente. Recomendado para notificaciones y recuperación contraseña.", + "use-this-field-to-name-your-site": "Use este campo para el nombre de su sitio, aparecerá en la parte superior de cada página de su sitio.", + "use-this-field-to-add-a-catchy-prhase": "Use este campo para agregar una frase pegadiza en su sitio.", + "you-can-add-a-site-description-to-provide": "Puede agregar una descripción del sitio para proporcionar una breve biografía o descripción de su sitio.", + "you-can-add-a-small-text-on-the-bottom": "Puede añadir un pequeño texto en la parte inferior de cada página. por ejemplo: derechos de autor, propietario, fechas, etc.", + "number-of-posts-to-show-per-page": "Número de mensajes a mostrar por página.", + "the-url-of-your-site": "La URL de su sitio.", + "add-or-edit-description-tags-or": "Agregar o editar la descripción, etiquetas o modificar la URL amigable.", + "select-your-sites-language": "Seleccionar el idioma de su sitio.", + "select-a-timezone-for-a-correct": "Seleccione una zona horaria para mostrar correctamente la fecha y hora en su sitio.", + "you-can-use-this-field-to-define-a-set-of": "Puede usar este campo para definir un conjunto de parámetros relacionados con la languege, el país y preferencias especiales.", + "you-can-modify-the-url-which-identifies":"You can modify the URL which identifies a page or post using human-readable keywords. No more than 150 characters.", + "this-field-can-help-describe-the-content": "Este campo puede ayudar a describir el contenido en pocas palabras. No más de 150 caracteres.", + "write-the-tags-separeted-by-comma": "Escribir las etiquetas separadas por comas. por ejemplo: etiqueta1, etiqueta2, etiqueta3", + "delete": "Delete", + "delete-the-user-and-all-its-posts":"Eliminar el usuario y todos sus mensajes", + "delete-the-user-and-associate-its-posts-to-admin-user": "Eliminar el usuario y asociar sus mensajes al usuario administrador", + "read-more": "Leer más" +} \ No newline at end of file diff --git a/plugins/opengraph/language/en_US.json b/plugins/opengraph/language/en_US.json index e5ed10b7..c9d8afe3 100644 --- a/plugins/opengraph/language/en_US.json +++ b/plugins/opengraph/language/en_US.json @@ -3,13 +3,10 @@ { "name": "Open Graph", "description": "The Open Graph protocol enables any web page to become a rich object in a social graph.", - "author": "Diego", + "author": "Bludit", "email": "", - "website": "", + "website": "http://www.bludit.com", "version": "0.1", - "releaseDate": "" - }, - - "name": "Name", - "first-name": "First Name" + "releaseDate": "2015-08-02" + } } \ No newline at end of file diff --git a/plugins/pages/language/en_US.json b/plugins/pages/language/en_US.json index 3ea163e7..fc5f93ba 100755 --- a/plugins/pages/language/en_US.json +++ b/plugins/pages/language/en_US.json @@ -2,16 +2,14 @@ "plugin-data": { "name": "Page list", - "description": "List of pages", - "author": "Diego", + "description": "Shows the list of pages in order.", + "author": "Bludit", "email": "", - "website": "", + "website": "http://www.bludit.com", "version": "0.1", - "releaseDate": "" + "releaseDate": "2015-08-02" }, - "pages": "Pages", "home": "Home", - "show-home-link": "Show home link", - "label-text-to-display": "Label text to display" + "show-home-link": "Show home link" } \ No newline at end of file diff --git a/plugins/pages/language/fr_FR.json b/plugins/pages/language/fr_FR.json index 82c6e5a4..2091b2ae 100755 --- a/plugins/pages/language/fr_FR.json +++ b/plugins/pages/language/fr_FR.json @@ -3,15 +3,13 @@ { "name": "Page navigation", "description": "Constitue un menu avec les liens des pages dans la colonne du thème.", - "author": "Diego", + "author": "Bludit", "email": "", - "website": "", + "website": "http://www.bludit.com", "version": "0.1", - "releaseDate": "" + "releaseDate": "2015-08-02" }, - "pages": "Pages", "home": "Accueil", - "show-home-link": "Afficher le lien de la page d’accueil", - "label-text-to-display": "Texte à afficher" + "show-home-link": "Afficher le lien de la page d’accueil" } \ No newline at end of file diff --git a/plugins/pages/plugin.php b/plugins/pages/plugin.php index fc0379bf..0b364e29 100755 --- a/plugins/pages/plugin.php +++ b/plugins/pages/plugin.php @@ -6,7 +6,7 @@ class pluginPages extends Plugin { { $this->dbFields = array( 'homeLink'=>true, - 'label'=> 'Pages' + 'label'=>'Pages' ); } @@ -15,14 +15,14 @@ class pluginPages extends Plugin { global $Language; $html = '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; $html .= 'getDbField('homeLink')?'checked':'').'>'; $html .= ''; $html .= '
'; - $html .= '
'; - $html .= ''; - $html .= '
'; return $html; } @@ -63,12 +63,9 @@ class pluginPages extends Plugin { } $html .= ''; } - - } $html .= ''; - $html .= '
'; $html .= '
'; diff --git a/plugins/tinymce/css/editor.css b/plugins/tinymce/css/editor.css new file mode 100644 index 00000000..f44cdb18 --- /dev/null +++ b/plugins/tinymce/css/editor.css @@ -0,0 +1,7 @@ +body { + font-size: 0.9em; +} + +*:first-child { + margin-top: 0; +} \ No newline at end of file diff --git a/plugins/tinymce/language/en_US.json b/plugins/tinymce/language/en_US.json new file mode 100755 index 00000000..b8d0da7d --- /dev/null +++ b/plugins/tinymce/language/en_US.json @@ -0,0 +1,12 @@ +{ + "plugin-data": + { + "name": "Tinymce", + "description": "Tinymce is an easy HTML editor, with many plugins and very customizable.", + "author": "Bludit", + "email": "", + "website": "http://www.bludit.com", + "version": "0.1", + "releaseDate": "2015-08-02" + } +} \ No newline at end of file diff --git a/plugins/tinymce/plugin.php b/plugins/tinymce/plugin.php new file mode 100755 index 00000000..aa647d99 --- /dev/null +++ b/plugins/tinymce/plugin.php @@ -0,0 +1,93 @@ +dbFields = array( + 'plugins'=>'autoresize, fullscreen, pagebreak, link, textcolor, code', + 'toolbar'=>'bold italic underline strikethrough | alignleft aligncenter alignright | bullist numlist | styleselect | link forecolor backcolor removeformat | pagebreak code fullscreen' + ); + } + + public function form() + { + global $Language; + + $html = '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + return $html; + } + + public function onAdminHead() + { + global $Language; + global $Site; + global $layout; + + $html = ''; + + // Load CSS and JS only on Controllers in array. + if(in_array($layout['controller'], $this->loadWhenController)) + { + $language = $Site->shortLanguage(); + $pluginPath = $this->htmlPath(); + + $html = ''; + $html .= ''; + } + + return $html; + } + + public function onAdminBodyEnd() + { + global $Language; + global $Site; + global $layout; + + $html = ''; + + // Load CSS and JS only on Controllers in array. + if(in_array($layout['controller'], $this->loadWhenController)) + { + $language = $Site->shortLanguage(); + $pluginPath = $this->htmlPath(); + + $html = ''; + } + + return $html; + } +} diff --git a/plugins/tinymce/tinymce/jquery.tinymce.min.js b/plugins/tinymce/tinymce/jquery.tinymce.min.js new file mode 100755 index 00000000..15919f37 --- /dev/null +++ b/plugins/tinymce/tinymce/jquery.tinymce.min.js @@ -0,0 +1 @@ +!function(a){function b(){function b(a){"remove"===a&&this.each(function(a,b){var c=e(b);c&&c.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(a,b){var c=tinymce.get(b.id.replace(/_parent$/,""));c&&c.remove()})}function d(a){var c,d=this;if(null!=a)b.call(d),d.each(function(b,c){var d;(d=tinymce.get(c.id))&&d.setContent(a)});else if(d.length>0&&(c=tinymce.get(d[0].id)))return c.getContent()}function e(a){var b=null;return a&&a.id&&g.tinymce&&(b=tinymce.get(a.id)),b}function f(a){return!!(a&&a.length&&g.tinymce&&a.is(":tinymce"))}var h={};a.each(["text","html","val"],function(b,g){var i=h[g]=a.fn[g],j="text"===g;a.fn[g]=function(b){var g=this;if(!f(g))return i.apply(g,arguments);if(b!==c)return d.call(g.filter(":tinymce"),b),i.apply(g.not(":tinymce"),arguments),g;var h="",k=arguments;return(j?g:g.eq(0)).each(function(b,c){var d=e(c);h+=d?j?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent({save:!0}):i.apply(a(c),k)}),h}}),a.each(["append","prepend"],function(b,d){var g=h[d]=a.fn[d],i="prepend"===d;a.fn[d]=function(a){var b=this;return f(b)?a!==c?("string"==typeof a&&b.filter(":tinymce").each(function(b,c){var d=e(c);d&&d.setContent(i?a+d.getContent():d.getContent()+a)}),g.apply(b.not(":tinymce"),arguments),b):void 0:g.apply(b,arguments)}}),a.each(["remove","replaceWith","replaceAll","empty"],function(c,d){var e=h[d]=a.fn[d];a.fn[d]=function(){return b.call(this,d),e.apply(this,arguments)}}),h.attr=a.fn.attr,a.fn.attr=function(b,g){var i=this,j=arguments;if(!b||"value"!==b||!f(i))return g!==c?h.attr.apply(i,j):h.attr.apply(i,j);if(g!==c)return d.call(i.filter(":tinymce"),g),h.attr.apply(i.not(":tinymce"),j),i;var k=i[0],l=e(k);return l?l.getContent({save:!0}):h.attr.apply(a(k),j)}}var c,d,e,f=[],g=window;a.fn.tinymce=function(c){function h(){var d=[],f=0;e||(b(),e=!0),l.each(function(a,b){var e,g=b.id,h=c.oninit;g||(b.id=g=tinymce.DOM.uniqueId()),tinymce.get(g)||(e=new tinymce.Editor(g,c,tinymce.EditorManager),d.push(e),e.on("init",function(){var a,b=h;l.css("visibility",""),h&&++f==d.length&&("string"==typeof b&&(a=-1===b.indexOf(".")?null:tinymce.resolve(b.replace(/\.\w+$/,"")),b=tinymce.resolve(b)),b.apply(a||tinymce,d))}))}),a.each(d,function(a,b){b.render()})}var i,j,k,l=this,m="";if(!l.length)return l;if(!c)return window.tinymce?tinymce.get(l[0].id):null;if(l.css("visibility","hidden"),g.tinymce||d||!(i=c.script_url))1===d?f.push(h):h();else{d=1,j=i.substring(0,i.lastIndexOf("/")),-1!=i.indexOf(".min")&&(m=".min"),g.tinymce=g.tinyMCEPreInit||{base:j,suffix:m},-1!=i.indexOf("gzip")&&(k=c.language||"en",i=i+(/\?/.test(i)?"&":"?")+"js=true&core=true&suffix="+escape(m)+"&themes="+escape(c.theme||"modern")+"&plugins="+escape(c.plugins||"")+"&languages="+(k||""),g.tinyMCE_GZ||(g.tinyMCE_GZ={start:function(){function b(a){tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(a))}b("langs/"+k+".js"),b("themes/"+c.theme+"/theme"+m+".js"),b("themes/"+c.theme+"/langs/"+k+".js"),a.each(c.plugins.split(","),function(a,c){c&&(b("plugins/"+c+"/plugin"+m+".js"),b("plugins/"+c+"/langs/"+k+".js"))})},end:function(){}}));var n=document.createElement("script");n.type="text/javascript",n.onload=n.onreadystatechange=function(b){b=b||window.event,2===d||"load"!=b.type&&!/complete|loaded/.test(n.readyState)||(tinymce.dom.Event.domLoaded=1,d=2,c.script_loaded&&c.script_loaded(),h(),a.each(f,function(a,b){b()}))},n.src=i,document.body.appendChild(n)}return l},a.extend(a.expr[":"],{tinymce:function(a){var b;return a.id&&"tinymce"in window&&(b=tinymce.get(a.id),b&&b.editorManager===tinymce)?!0:!1}})}(jQuery); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/langs/readme.md b/plugins/tinymce/tinymce/langs/readme.md new file mode 100755 index 00000000..a52bf03f --- /dev/null +++ b/plugins/tinymce/tinymce/langs/readme.md @@ -0,0 +1,3 @@ +This is where language files should be placed. + +Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/ diff --git a/plugins/tinymce/tinymce/plugins/advlist/plugin.min.js b/plugins/tinymce/tinymce/plugins/advlist/plugin.min.js new file mode 100755 index 00000000..1e1c6680 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/advlist/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("advlist",function(a){function b(a,b){var c=[];return tinymce.each(b.split(/[ ,]/),function(a){c.push({text:a.replace(/\-/g," ").replace(/\b\w/g,function(a){return a.toUpperCase()}),data:"default"==a?"":a})}),c}function c(b,c){a.undoManager.transact(function(){var d,e=a.dom,f=a.selection;d=e.getParent(f.getNode(),"ol,ul"),d&&d.nodeName==b&&c!==!1||a.execCommand("UL"==b?"InsertUnorderedList":"InsertOrderedList"),c=c===!1?g[b]:c,g[b]=c,d=e.getParent(f.getNode(),"ol,ul"),d&&(e.setStyle(d,"listStyleType",c?c:null),d.removeAttribute("data-mce-style")),a.focus()})}function d(b){var c=a.dom.getStyle(a.dom.getParent(a.selection.getNode(),"ol,ul"),"listStyleType")||"";b.control.items().each(function(a){a.active(a.settings.data===c)})}var e,f,g={};e=b("OL",a.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman")),f=b("UL",a.getParam("advlist_bullet_styles","default,circle,disc,square")),a.addButton("numlist",{type:"splitbutton",tooltip:"Numbered list",menu:e,onshow:d,onselect:function(a){c("OL",a.control.settings.data)},onclick:function(){c("OL",!1)}}),a.addButton("bullist",{type:"splitbutton",tooltip:"Bullet list",menu:f,onshow:d,onselect:function(a){c("UL",a.control.settings.data)},onclick:function(){c("UL",!1)}})}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/anchor/plugin.min.js b/plugins/tinymce/tinymce/plugins/anchor/plugin.min.js new file mode 100755 index 00000000..26500e7d --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/anchor/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("anchor",function(a){function b(){var b=a.selection.getNode(),c="";"A"==b.tagName&&(c=b.name||b.id||""),a.windowManager.open({title:"Anchor",body:{type:"textbox",name:"name",size:40,label:"Name",value:c},onsubmit:function(b){a.execCommand("mceInsertContent",!1,a.dom.createHTML("a",{id:b.data.name}))}})}a.addButton("anchor",{icon:"anchor",tooltip:"Anchor",onclick:b,stateSelector:"a:not([href])"}),a.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",onclick:b})}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/autolink/plugin.min.js b/plugins/tinymce/tinymce/plugins/autolink/plugin.min.js new file mode 100755 index 00000000..8a4b89e9 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/autolink/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("autolink",function(a){function b(a){e(a,-1,"(",!0)}function c(a){e(a,0,"",!0)}function d(a){e(a,-1,"",!1)}function e(a,b,c){function d(a,b){if(0>b&&(b=0),3==a.nodeType){var c=a.data.length;b>c&&(b=c)}return b}function e(a,b){1!=a.nodeType||a.hasChildNodes()?g.setStart(a,d(a,b)):g.setStartBefore(a)}function f(a,b){1!=a.nodeType||a.hasChildNodes()?g.setEnd(a,d(a,b)):g.setEndAfter(a)}var g,h,i,j,k,l,m,n,o,p;if(g=a.selection.getRng(!0).cloneRange(),g.startOffset<5){if(n=g.endContainer.previousSibling,!n){if(!g.endContainer.firstChild||!g.endContainer.firstChild.nextSibling)return;n=g.endContainer.firstChild.nextSibling}if(o=n.length,e(n,o),f(n,o),g.endOffset<5)return;h=g.endOffset,j=n}else{if(j=g.endContainer,3!=j.nodeType&&j.firstChild){for(;3!=j.nodeType&&j.firstChild;)j=j.firstChild;3==j.nodeType&&(e(j,0),f(j,j.nodeValue.length))}h=1==g.endOffset?2:g.endOffset-1-b}i=h;do e(j,h>=2?h-2:0),f(j,h>=1?h-1:0),h-=1,p=g.toString();while(" "!=p&&""!==p&&160!=p.charCodeAt(0)&&h-2>=0&&p!=c);g.toString()==c||160==g.toString().charCodeAt(0)?(e(j,h),f(j,i),h+=1):0===g.startOffset?(e(j,0),f(j,i)):(e(j,h),f(j,i)),l=g.toString(),"."==l.charAt(l.length-1)&&f(j,i-1),l=g.toString(),m=l.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i),m&&("www."==m[1]?m[1]="http://www.":/@$/.test(m[1])&&!/^mailto:/.test(m[1])&&(m[1]="mailto:"+m[1]),k=a.selection.getBookmark(),a.selection.setRng(g),a.execCommand("createlink",!1,m[1]+m[2]),a.selection.moveToBookmark(k),a.nodeChanged())}var f;return a.on("keydown",function(b){return 13==b.keyCode?d(a):void 0}),tinymce.Env.ie?void a.on("focus",function(){if(!f){f=!0;try{a.execCommand("AutoUrlDetect",!1,!0)}catch(b){}}}):(a.on("keypress",function(c){return 41==c.keyCode?b(a):void 0}),void a.on("keyup",function(b){return 32==b.keyCode?c(a):void 0}))}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/autoresize/plugin.min.js b/plugins/tinymce/tinymce/plugins/autoresize/plugin.min.js new file mode 100755 index 00000000..80d84311 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/autoresize/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("autoresize",function(a){function b(){return a.plugins.fullscreen&&a.plugins.fullscreen.isFullscreen()}function c(d){var g,h,i,j,k,l,m,n,o,p,q,r,s=tinymce.DOM;if(h=a.getDoc()){if(i=h.body,j=h.documentElement,k=e.autoresize_min_height,!i||d&&"setcontent"===d.type&&d.initial||b())return void(i&&j&&(i.style.overflowY="auto",j.style.overflowY="auto"));m=a.dom.getStyle(i,"margin-top",!0),n=a.dom.getStyle(i,"margin-bottom",!0),o=a.dom.getStyle(i,"padding-top",!0),p=a.dom.getStyle(i,"padding-bottom",!0),q=a.dom.getStyle(i,"border-top-width",!0),r=a.dom.getStyle(i,"border-bottom-width",!0),l=i.offsetHeight+parseInt(m,10)+parseInt(n,10)+parseInt(o,10)+parseInt(p,10)+parseInt(q,10)+parseInt(r,10),(isNaN(l)||0>=l)&&(l=tinymce.Env.ie?i.scrollHeight:tinymce.Env.webkit&&0===i.clientHeight?0:i.offsetHeight),l>e.autoresize_min_height&&(k=l),e.autoresize_max_height&&l>e.autoresize_max_height?(k=e.autoresize_max_height,i.style.overflowY="auto",j.style.overflowY="auto"):(i.style.overflowY="hidden",j.style.overflowY="hidden",i.scrollTop=0),k!==f&&(g=k-f,s.setStyle(a.iframeElement,"height",k+"px"),f=k,tinymce.isWebKit&&0>g&&c(d))}}function d(a,b,e){setTimeout(function(){c({}),a--?d(a,b,e):e&&e()},b)}var e=a.settings,f=0;a.settings.inline||(e.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight),10),e.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0),10),a.on("init",function(){var b,c;b=a.getParam("autoresize_overflow_padding",1),c=a.getParam("autoresize_bottom_margin",50),b!==!1&&a.dom.setStyles(a.getBody(),{paddingLeft:b,paddingRight:b}),c!==!1&&a.dom.setStyles(a.getBody(),{paddingBottom:c})}),a.on("nodechange setcontent keyup FullscreenStateChanged",c),a.getParam("autoresize_on_init",!0)&&a.on("init",function(){d(20,100,function(){d(5,1e3)})}),a.addCommand("mceAutoResize",c))}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/autosave/plugin.min.js b/plugins/tinymce/tinymce/plugins/autosave/plugin.min.js new file mode 100755 index 00000000..11de44d9 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/autosave/plugin.min.js @@ -0,0 +1 @@ +tinymce._beforeUnloadHandler=function(){var a;return tinymce.each(tinymce.editors,function(b){b.plugins.autosave&&b.plugins.autosave.storeDraft(),!a&&b.isDirty()&&b.getParam("autosave_ask_before_unload",!0)&&(a=b.translate("You have unsaved changes are you sure you want to navigate away?"))}),a},tinymce.PluginManager.add("autosave",function(a){function b(a,b){var c={s:1e3,m:6e4};return a=/^(\d+)([ms]?)$/.exec(""+(a||b)),(a[2]?c[a[2]]:1)*parseInt(a,10)}function c(){var a=parseInt(n.getItem(k+"time"),10)||0;return(new Date).getTime()-a>m.autosave_retention?(d(!1),!1):!0}function d(b){n.removeItem(k+"draft"),n.removeItem(k+"time"),b!==!1&&a.fire("RemoveDraft")}function e(){!j()&&a.isDirty()&&(n.setItem(k+"draft",a.getContent({format:"raw",no_events:!0})),n.setItem(k+"time",(new Date).getTime()),a.fire("StoreDraft"))}function f(){c()&&(a.setContent(n.getItem(k+"draft"),{format:"raw"}),a.fire("RestoreDraft"))}function g(){l||(setInterval(function(){a.removed||e()},m.autosave_interval),l=!0)}function h(){var b=this;b.disabled(!c()),a.on("StoreDraft RestoreDraft RemoveDraft",function(){b.disabled(!c())}),g()}function i(){a.undoManager.beforeChange(),f(),d(),a.undoManager.add()}function j(b){var c=a.settings.forced_root_block;return b=tinymce.trim("undefined"==typeof b?a.getBody().innerHTML:b),""===b||new RegExp("^<"+c+"[^>]*>((\xa0| |[ ]|]*>)+?|)|
$","i").test(b)}var k,l,m=a.settings,n=tinymce.util.LocalStorage;k=m.autosave_prefix||"tinymce-autosave-{path}{query}-{id}-",k=k.replace(/\{path\}/g,document.location.pathname),k=k.replace(/\{query\}/g,document.location.search),k=k.replace(/\{id\}/g,a.id),m.autosave_interval=b(m.autosave_interval,"30s"),m.autosave_retention=b(m.autosave_retention,"20m"),a.addButton("restoredraft",{title:"Restore last draft",onclick:i,onPostRender:h}),a.addMenuItem("restoredraft",{text:"Restore last draft",onclick:i,onPostRender:h,context:"file"}),a.settings.autosave_restore_when_empty!==!1&&(a.on("init",function(){c()&&j()&&f()}),a.on("saveContent",function(){d()})),window.onbeforeunload=tinymce._beforeUnloadHandler,this.hasDraft=c,this.storeDraft=e,this.restoreDraft=f,this.removeDraft=d,this.isEmpty=j}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/bbcode/plugin.min.js b/plugins/tinymce/tinymce/plugins/bbcode/plugin.min.js new file mode 100755 index 00000000..4548e5e6 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/bbcode/plugin.min.js @@ -0,0 +1 @@ +!function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(a){var b=this,c=a.getParam("bbcode_dialect","punbb").toLowerCase();a.on("beforeSetContent",function(a){a.content=b["_"+c+"_bbcode2html"](a.content)}),a.on("postProcess",function(a){a.set&&(a.content=b["_"+c+"_bbcode2html"](a.content)),a.get&&(a.content=b["_"+c+"_html2bbcode"](a.content))})},getInfo:function(){return{longname:"BBCode Plugin",author:"Ephox Corp",authorurl:"http://www.tinymce.com",infourl:"http://www.tinymce.com/wiki.php/Plugin:bbcode"}},_punbb_html2bbcode:function(a){function b(b,c){a=a.replace(b,c)}return a=tinymce.trim(a),b(/(.*?)<\/a>/gi,"[url=$1]$2[/url]"),b(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),b(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),b(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),b(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),b(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"),b(/(.*?)<\/font>/gi,"[color=$1]$2[/color]"),b(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"),b(/(.*?)<\/font>/gi,"$1"),b(//gi,"[img]$1[/img]"),b(/(.*?)<\/span>/gi,"[code]$1[/code]"),b(/(.*?)<\/span>/gi,"[quote]$1[/quote]"),b(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),b(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),b(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),b(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),b(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),b(/(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),b(/<\/(strong|b)>/gi,"[/b]"),b(/<(strong|b)>/gi,"[b]"),b(/<\/(em|i)>/gi,"[/i]"),b(/<(em|i)>/gi,"[i]"),b(/<\/u>/gi,"[/u]"),b(/(.*?)<\/span>/gi,"[u]$1[/u]"),b(//gi,"[u]"),b(/]*>/gi,"[quote]"),b(/<\/blockquote>/gi,"[/quote]"),b(/
/gi,"\n"),b(//gi,"\n"),b(/
/gi,"\n"),b(/

/gi,""),b(/<\/p>/gi,"\n"),b(/ |\u00a0/gi," "),b(/"/gi,'"'),b(/</gi,"<"),b(/>/gi,">"),b(/&/gi,"&"),a},_punbb_bbcode2html:function(a){function b(b,c){a=a.replace(b,c)}return a=tinymce.trim(a),b(/\n/gi,"
"),b(/\[b\]/gi,""),b(/\[\/b\]/gi,""),b(/\[i\]/gi,""),b(/\[\/i\]/gi,""),b(/\[u\]/gi,""),b(/\[\/u\]/gi,""),b(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2'),b(/\[url\](.*?)\[\/url\]/gi,'$1'),b(/\[img\](.*?)\[\/img\]/gi,''),b(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2'),b(/\[code\](.*?)\[\/code\]/gi,'$1 '),b(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 '),a}}),tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)}(); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/charmap/plugin.min.js b/plugins/tinymce/tinymce/plugins/charmap/plugin.min.js new file mode 100755 index 00000000..3f414ad5 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/charmap/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("charmap",function(a){function b(){function b(a){for(;a;){if("TD"==a.nodeName)return a;a=a.parentNode}}var d,e,f,g;d='';var h=25,i=Math.ceil(c.length/h);for(f=0;i>f;f++){for(d+="",e=0;h>e;e++){var j=f*h+e;if(j
'+(k?String.fromCharCode(parseInt(k[0],10)):" ")+"
"}else d+="
"}d+="";var l={type:"container",html:d,onclick:function(c){var d=c.target;/^(TD|DIV)$/.test(d.nodeName)&&b(d).firstChild&&(a.execCommand("mceInsertContent",!1,tinymce.trim(d.innerText||d.textContent)),c.ctrlKey||g.close())},onmouseover:function(a){var c=b(a.target);c&&c.firstChild?(g.find("#preview").text(c.firstChild.firstChild.data),g.find("#previewTitle").text(c.title)):(g.find("#preview").text(" "),g.find("#previewTitle").text(" "))}};g=a.windowManager.open({title:"Special character",spacing:10,padding:10,items:[l,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"label",name:"previewTitle",text:" ",style:"text-align: center",border:1,minWidth:140,minHeight:80}]}],buttons:[{text:"Close",onclick:function(){g.close()}}]})}var c=[["160","no-break space"],["173","soft hyphen"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["221","Y - acute"],["376","Y - diaeresis"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"]];a.addButton("charmap",{icon:"charmap",tooltip:"Special character",onclick:b}),a.addMenuItem("charmap",{icon:"charmap",text:"Special character",onclick:b,context:"insert"})}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/code/plugin.min.js b/plugins/tinymce/tinymce/plugins/code/plugin.min.js new file mode 100755 index 00000000..d6331f87 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/code/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("code",function(a){function b(){var b=a.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:a.getParam("code_dialog_width",600),minHeight:a.getParam("code_dialog_height",Math.min(tinymce.DOM.getViewPort().h-200,500)),spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(b){a.focus(),a.undoManager.transact(function(){a.setContent(b.data.code)}),a.selection.setCursorLocation(),a.nodeChanged()}});b.find("#code").value(a.getContent({source_view:!0}))}a.addCommand("mceCodeEditor",b),a.addButton("code",{icon:"code",tooltip:"Source code",onclick:b}),a.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:b})}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/colorpicker/plugin.min.js b/plugins/tinymce/tinymce/plugins/colorpicker/plugin.min.js new file mode 100755 index 00000000..66ea69c2 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/colorpicker/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("colorpicker",function(a){function b(b,c){function d(a){var b=new tinymce.util.Color(a),c=b.toRgb();f.fromJSON({r:c.r,g:c.g,b:c.b,hex:b.toHex().substr(1)}),e(b.toHex())}function e(a){f.find("#preview")[0].getEl().style.background=a}var f=a.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:c,onchange:function(){var a=this.rgb();f&&(f.find("#r").value(a.r),f.find("#g").value(a.g),f.find("#b").value(a.b),f.find("#hex").value(this.value().substr(1)),e(this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox",size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var a,b,c=f.find("colorpicker")[0];return a=this.name(),b=this.value(),"hex"==a?(b="#"+b,d(b),void c.value(b)):(b={r:f.find("#r").value(),g:f.find("#g").value(),b:f.find("#b").value()},c.value(b),void d(b))}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){b("#"+this.toJSON().hex)}});d(c)}a.settings.color_picker_callback||(a.settings.color_picker_callback=b)}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/contextmenu/plugin.min.js b/plugins/tinymce/tinymce/plugins/contextmenu/plugin.min.js new file mode 100755 index 00000000..20274a68 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/contextmenu/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("contextmenu",function(a){var b,c=a.settings.contextmenu_never_use_native;a.on("contextmenu",function(d){var e,f=a.getDoc();if(!d.ctrlKey||c){if(d.preventDefault(),tinymce.Env.mac&&tinymce.Env.webkit&&2==d.button&&f.caretRangeFromPoint&&a.selection.setRng(f.caretRangeFromPoint(d.x,d.y)),e=a.settings.contextmenu||"link image inserttable | cell row column deletetable",b)b.show();else{var g=[];tinymce.each(e.split(/[ ,]/),function(b){var c=a.menuItems[b];"|"==b&&(c={text:b}),c&&(c.shortcut="",g.push(c))});for(var h=0;h'}),a+=""}),a+=""}var d=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]];a.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:c,onclick:function(b){var c=a.dom.getParent(b.target,"a");c&&(a.insertContent(''+c.getAttribute('),this.hide())}},tooltip:"Emoticons"})}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/example/dialog.html b/plugins/tinymce/tinymce/plugins/example/dialog.html new file mode 100755 index 00000000..565f06f5 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/example/dialog.html @@ -0,0 +1,8 @@ + + + +

Custom dialog

+ Input some text: + + + \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/example/plugin.min.js b/plugins/tinymce/tinymce/plugins/example/plugin.min.js new file mode 100755 index 00000000..88687c7d --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/example/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("example",function(a,b){a.addButton("example",{text:"My button",icon:!1,onclick:function(){a.windowManager.open({title:"Example plugin",body:[{type:"textbox",name:"title",label:"Title"}],onsubmit:function(b){a.insertContent("Title: "+b.data.title)}})}}),a.addMenuItem("example",{text:"Example plugin",context:"tools",onclick:function(){a.windowManager.open({title:"TinyMCE site",url:b+"/dialog.html",width:600,height:400,buttons:[{text:"Insert",onclick:function(){var b=a.windowManager.getWindows()[0];a.insertContent(b.getContentWindow().document.getElementById("content").value),b.close()}},{text:"Close",onclick:"close"}]})}})}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/example_dependency/plugin.min.js b/plugins/tinymce/tinymce/plugins/example_dependency/plugin.min.js new file mode 100755 index 00000000..e61bf473 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/example_dependency/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("example_dependency",function(){},["example"]); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/fullpage/plugin.min.js b/plugins/tinymce/tinymce/plugins/fullpage/plugin.min.js new file mode 100755 index 00000000..1ea5c360 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/fullpage/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("fullpage",function(a){function b(){var b=c();a.windowManager.open({title:"Document properties",data:b,defaults:{type:"textbox",size:40},body:[{name:"title",label:"Title"},{name:"keywords",label:"Keywords"},{name:"description",label:"Description"},{name:"robots",label:"Robots"},{name:"author",label:"Author"},{name:"docencoding",label:"Encoding"}],onSubmit:function(a){d(tinymce.extend(b,a.data))}})}function c(){function b(a,b){var c=a.attr(b);return c||""}var c,d,f=e(),g={};return g.fontface=a.getParam("fullpage_default_fontface",""),g.fontsize=a.getParam("fullpage_default_fontsize",""),c=f.firstChild,7==c.type&&(g.xml_pi=!0,d=/encoding="([^"]+)"/.exec(c.value),d&&(g.docencoding=d[1])),c=f.getAll("#doctype")[0],c&&(g.doctype=""),c=f.getAll("title")[0],c&&c.firstChild&&(g.title=c.firstChild.value),k(f.getAll("meta"),function(a){var b,c=a.attr("name"),d=a.attr("http-equiv");c?g[c.toLowerCase()]=a.attr("content"):"Content-Type"==d&&(b=/charset\s*=\s*(.*)\s*/gi.exec(a.attr("content")),b&&(g.docencoding=b[1]))}),c=f.getAll("html")[0],c&&(g.langcode=b(c,"lang")||b(c,"xml:lang")),g.stylesheets=[],tinymce.each(f.getAll("link"),function(a){"stylesheet"==a.attr("rel")&&g.stylesheets.push(a.attr("href"))}),c=f.getAll("body")[0],c&&(g.langdir=b(c,"dir"),g.style=b(c,"style"),g.visited_color=b(c,"vlink"),g.link_color=b(c,"link"),g.active_color=b(c,"alink")),g}function d(b){function c(a,b,c){a.attr(b,c?c:void 0)}function d(a){g.firstChild?g.insert(a,g.firstChild):g.append(a)}var f,g,h,j,m,n=a.dom;f=e(),g=f.getAll("head")[0],g||(j=f.getAll("html")[0],g=new l("head",1),j.firstChild?j.insert(g,j.firstChild,!0):j.append(g)),j=f.firstChild,b.xml_pi?(m='version="1.0"',b.docencoding&&(m+=' encoding="'+b.docencoding+'"'),7!=j.type&&(j=new l("xml",7),f.insert(j,f.firstChild,!0)),j.value=m):j&&7==j.type&&j.remove(),j=f.getAll("#doctype")[0],b.doctype?(j||(j=new l("#doctype",10),b.xml_pi?f.insert(j,f.firstChild):d(j)),j.value=b.doctype.substring(9,b.doctype.length-1)):j&&j.remove(),j=null,k(f.getAll("meta"),function(a){"Content-Type"==a.attr("http-equiv")&&(j=a)}),b.docencoding?(j||(j=new l("meta",1),j.attr("http-equiv","Content-Type"),j.shortEnded=!0,d(j)),j.attr("content","text/html; charset="+b.docencoding)):j&&j.remove(),j=f.getAll("title")[0],b.title?(j?j.empty():(j=new l("title",1),d(j)),j.append(new l("#text",3)).value=b.title):j&&j.remove(),k("keywords,description,author,copyright,robots".split(","),function(a){var c,e,g=f.getAll("meta"),h=b[a];for(c=0;c"))}function e(){return new tinymce.html.DomParser({validate:!1,root_name:"#document"}).parse(i)}function f(b){function c(a){return a.replace(/<\/?[A-Z]+/g,function(a){return a.toLowerCase()})}var d,f,h,l,m=b.content,n="",o=a.dom;if(!b.selection&&!("raw"==b.format&&i||b.source_view&&a.getParam("fullpage_hide_in_source_view"))){0!==m.length||b.source_view||(m=tinymce.trim(i)+"\n"+tinymce.trim(m)+"\n"+tinymce.trim(j)),m=m.replace(/<(\/?)BODY/gi,"<$1body"),d=m.indexOf("",d),i=c(m.substring(0,d+1)),f=m.indexOf("\n"),h=e(),k(h.getAll("style"),function(a){a.firstChild&&(n+=a.firstChild.value)}),l=h.getAll("body")[0],l&&o.setAttribs(a.getBody(),{style:l.attr("style")||"",dir:l.attr("dir")||"",vLink:l.attr("vlink")||"",link:l.attr("link")||"",aLink:l.attr("alink")||""}),o.remove("fullpage_styles");var p=a.getDoc().getElementsByTagName("head")[0];n&&(o.add(p,"style",{id:"fullpage_styles"},n),l=o.get("fullpage_styles"),l.styleSheet&&(l.styleSheet.cssText=n));var q={};tinymce.each(p.getElementsByTagName("link"),function(a){"stylesheet"==a.rel&&a.getAttribute("data-mce-fullpage")&&(q[a.href]=a)}),tinymce.each(h.getAll("link"),function(a){var b=a.attr("href");q[b]||"stylesheet"!=a.attr("rel")||o.add(p,"link",{rel:"stylesheet",text:"text/css",href:b,"data-mce-fullpage":"1"}),delete q[b]}),tinymce.each(q,function(a){a.parentNode.removeChild(a)})}}function g(){var b,c="",d="";return a.getParam("fullpage_default_xml_pi")&&(c+='\n'),c+=a.getParam("fullpage_default_doctype",""),c+="\n\n\n",(b=a.getParam("fullpage_default_title"))&&(c+=""+b+"\n"),(b=a.getParam("fullpage_default_encoding"))&&(c+='\n'),(b=a.getParam("fullpage_default_font_family"))&&(d+="font-family: "+b+";"),(b=a.getParam("fullpage_default_font_size"))&&(d+="font-size: "+b+";"),(b=a.getParam("fullpage_default_text_color"))&&(d+="color: "+b+";"),c+="\n\n"}function h(b){b.selection||b.source_view&&a.getParam("fullpage_hide_in_source_view")||(b.content=tinymce.trim(i)+"\n"+tinymce.trim(b.content)+"\n"+tinymce.trim(j))}var i,j,k=tinymce.each,l=tinymce.html.Node;a.addCommand("mceFullPageProperties",b),a.addButton("fullpage",{title:"Document properties",cmd:"mceFullPageProperties"}),a.addMenuItem("fullpage",{text:"Document properties",cmd:"mceFullPageProperties",context:"file"}),a.on("BeforeSetContent",f),a.on("GetContent",h)}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/fullscreen/plugin.min.js b/plugins/tinymce/tinymce/plugins/fullscreen/plugin.min.js new file mode 100755 index 00000000..d275e059 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/fullscreen/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("fullscreen",function(a){function b(){var a,b,c=window,d=document,e=d.body;return e.offsetWidth&&(a=e.offsetWidth,b=e.offsetHeight),c.innerWidth&&c.innerHeight&&(a=c.innerWidth,b=c.innerHeight),{w:a,h:b}}function c(){function c(){j.setStyle(m,"height",b().h-(l.clientHeight-m.clientHeight))}var k,l,m,n,o=document.body,p=document.documentElement;i=!i,l=a.getContainer(),k=l.style,m=a.getContentAreaContainer().firstChild,n=m.style,i?(d=n.width,e=n.height,n.width=n.height="100%",g=k.width,h=k.height,k.width=k.height="",j.addClass(o,"mce-fullscreen"),j.addClass(p,"mce-fullscreen"),j.addClass(l,"mce-fullscreen"),j.bind(window,"resize",c),c(),f=c):(n.width=d,n.height=e,g&&(k.width=g),h&&(k.height=h),j.removeClass(o,"mce-fullscreen"),j.removeClass(p,"mce-fullscreen"),j.removeClass(l,"mce-fullscreen"),j.unbind(window,"resize",f)),a.fire("FullscreenStateChanged",{state:i})}var d,e,f,g,h,i=!1,j=tinymce.DOM;return a.settings.inline?void 0:(a.on("init",function(){a.addShortcut("Meta+Alt+F","",c)}),a.on("remove",function(){f&&j.unbind(window,"resize",f)}),a.addCommand("mceFullScreen",c),a.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Meta+Alt+F",selectable:!0,onClick:c,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})},context:"view"}),a.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Meta+Alt+F",onClick:c,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})}}),{isFullscreen:function(){return i}})}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/hr/plugin.min.js b/plugins/tinymce/tinymce/plugins/hr/plugin.min.js new file mode 100755 index 00000000..25abb0c1 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/hr/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("hr",function(a){a.addCommand("InsertHorizontalRule",function(){a.execCommand("mceInsertContent",!1,"
")}),a.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),a.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/image/plugin.min.js b/plugins/tinymce/tinymce/plugins/image/plugin.min.js new file mode 100755 index 00000000..665df5a3 --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/image/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("image",function(a){function b(a,b){function c(a,c){d.parentNode&&d.parentNode.removeChild(d),b({width:a,height:c})}var d=document.createElement("img");d.onload=function(){c(Math.max(d.width,d.clientWidth),Math.max(d.height,d.clientHeight))},d.onerror=function(){c()};var e=d.style;e.visibility="hidden",e.position="fixed",e.bottom=e.left=0,e.width=e.height="auto",document.body.appendChild(d),d.src=a}function c(a,b,c){function d(a,c){return c=c||[],tinymce.each(a,function(a){var e={text:a.text||a.title};a.menu?e.menu=d(a.menu):(e.value=a.value,b(e)),c.push(e)}),c}return d(a,c||[])}function d(b){return function(){var c=a.settings.image_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):"function"==typeof c?c(b):b(c)}}function e(d){function e(){var a,b,c,d;a=l.find("#width")[0],b=l.find("#height")[0],a&&b&&(c=a.value(),d=b.value(),l.find("#constrain")[0].checked()&&m&&n&&c&&d&&(m!=c?(d=Math.round(c/m*d),isNaN(d)||b.value(d)):(c=Math.round(d/n*c),isNaN(c)||a.value(c))),m=c,n=d)}function f(){function b(b){function c(){b.onload=b.onerror=null,a.selection&&(a.selection.select(b),a.nodeChanged())}b.onload=function(){q.width||q.height||!t||r.setAttribs(b,{width:b.clientWidth,height:b.clientHeight}),c()},b.onerror=c}j(),e(),q=tinymce.extend(q,l.toJSON()),q.alt||(q.alt=""),q.title||(q.title=""),""===q.width&&(q.width=null),""===q.height&&(q.height=null),q.style||(q.style=null),q={src:q.src,alt:q.alt,title:q.title,width:q.width,height:q.height,style:q.style,"class":q["class"]},a.undoManager.transact(function(){return q.src?(""===q.title&&(q.title=null),s?r.setAttribs(s,q):(q.id="__mcenew",a.focus(),a.selection.setContent(r.createHTML("img",q)),s=r.get("__mcenew"),r.setAttrib(s,"id",null)),void b(s)):void(s&&(r.remove(s),a.focus(),a.nodeChanged()))})}function g(a){return a&&(a=a.replace(/px$/,"")),a}function h(c){var d,e,f,g=c.meta||{};o&&o.value(a.convertURL(this.value(),"src")),tinymce.each(g,function(a,b){l.find("#"+b).value(a)}),g.width||g.height||(d=a.convertURL(this.value(),"src"),e=a.settings.image_prepend_url,f=new RegExp("^(?:[a-z]+:)?//","i"),e&&!f.test(d)&&d.substring(0,e.length)!==e&&(d=e+d),this.value(d),b(a.documentBaseURI.toAbsolute(this.value()),function(a){a.width&&a.height&&t&&(m=a.width,n=a.height,l.find("#width").value(m),l.find("#height").value(n))}))}function i(a){if(a.margin){var b=a.margin.split(" ");switch(b.length){case 1:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[0],a["margin-bottom"]=a["margin-bottom"]||b[0],a["margin-left"]=a["margin-left"]||b[0];break;case 2:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[0],a["margin-left"]=a["margin-left"]||b[1];break;case 3:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[2],a["margin-left"]=a["margin-left"]||b[1];break;case 4:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[2],a["margin-left"]=a["margin-left"]||b[3]}delete a.margin}return a}function j(){function b(a){return a.length>0&&/^[0-9]+$/.test(a)&&(a+="px"),a}if(a.settings.image_advtab){var c=l.toJSON(),d=r.parseStyle(c.style);d=i(d),c.vspace&&(d["margin-top"]=d["margin-bottom"]=b(c.vspace)),c.hspace&&(d["margin-left"]=d["margin-right"]=b(c.hspace)),c.border&&(d["border-width"]=b(c.border)),l.find("#style").value(r.serializeStyle(r.parseStyle(r.serializeStyle(d))))}}function k(){if(a.settings.image_advtab){var b=l.toJSON(),c=r.parseStyle(b.style);l.find("#vspace").value(""),l.find("#hspace").value(""),c=i(c),(c["margin-top"]&&c["margin-bottom"]||c["margin-right"]&&c["margin-left"])&&(l.find("#vspace").value(c["margin-top"]===c["margin-bottom"]?g(c["margin-top"]):""),l.find("#hspace").value(c["margin-right"]===c["margin-left"]?g(c["margin-right"]):"")),c["border-width"]&&l.find("#border").value(g(c["border-width"])),l.find("#style").value(r.serializeStyle(r.parseStyle(r.serializeStyle(c))))}}var l,m,n,o,p,q={},r=a.dom,s=a.selection.getNode(),t=a.settings.image_dimensions!==!1;m=r.getAttrib(s,"width"),n=r.getAttrib(s,"height"),"IMG"!=s.nodeName||s.getAttribute("data-mce-object")||s.getAttribute("data-mce-placeholder")?s=null:q={src:r.getAttrib(s,"src"),alt:r.getAttrib(s,"alt"),title:r.getAttrib(s,"title"),"class":r.getAttrib(s,"class"),width:m,height:n},d&&(o={type:"listbox",label:"Image list",values:c(d,function(b){b.value=a.convertURL(b.value||b.url,"src")},[{text:"None",value:""}]),value:q.src&&a.convertURL(q.src,"src"),onselect:function(a){var b=l.find("#alt");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),l.find("#src").value(a.control.value()).fire("change")},onPostRender:function(){o=this}}),a.settings.image_class_list&&(p={name:"class",type:"listbox",label:"Class",values:c(a.settings.image_class_list,function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"img",classes:[b.value]})})})});var u=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:h},o];a.settings.image_description!==!1&&u.push({name:"alt",type:"textbox",label:"Image description"}),a.settings.image_title&&u.push({name:"title",type:"textbox",label:"Image Title"}),t&&u.push({type:"container",label:"Dimensions",layout:"flex",direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}),u.push(p),a.settings.image_advtab?(s&&(s.style.marginLeft&&s.style.marginRight&&s.style.marginLeft===s.style.marginRight&&(q.hspace=g(s.style.marginLeft)),s.style.marginTop&&s.style.marginBottom&&s.style.marginTop===s.style.marginBottom&&(q.vspace=g(s.style.marginTop)),s.style.borderWidth&&(q.border=g(s.style.borderWidth)),q.style=a.dom.serializeStyle(a.dom.parseStyle(a.dom.getAttrib(s,"style")))),l=a.windowManager.open({title:"Insert/edit image",data:q,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox",onchange:k},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:j},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]}],onSubmit:f})):l=a.windowManager.open({title:"Insert/edit image",data:q,body:u,onSubmit:f})}a.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:d(e),stateSelector:"img:not([data-mce-object],[data-mce-placeholder])"}),a.addMenuItem("image",{icon:"image",text:"Insert/edit image",onclick:d(e),context:"insert",prependToContext:!0}),a.addCommand("mceImage",d(e))}); \ No newline at end of file diff --git a/plugins/tinymce/tinymce/plugins/imagetools/plugin.min.js b/plugins/tinymce/tinymce/plugins/imagetools/plugin.min.js new file mode 100755 index 00000000..da08eeef --- /dev/null +++ b/plugins/tinymce/tinymce/plugins/imagetools/plugin.min.js @@ -0,0 +1 @@ +!function(a,b){"use strict";function c(a,b){for(var c,d=[],f=0;fe?360+e:e,(90==e||270==e)&&b.resize(g,g.height,g.width),(90==e||180==e)&&(j=g.width),(270==e||180==e)&&(k=g.height),i.translate(j,k),i.rotate(e*Math.PI/180),i.drawImage(f,0,0),h(f),a.canvasToBlob(g,d.type)})}function e(d,e){return a.blobToImage(d).then(function(d){var f=b.create(c.getWidth(d),c.getHeight(d)),g=b.get2dContext(f);return"v"==e?(g.scale(1,-1),g.drawImage(d,0,-f.height)):(g.scale(-1,1),g.drawImage(d,-f.width,0)),h(d),a.canvasToBlob(f)})}function f(c,d,e,f,g){return a.blobToImage(c).then(function(c){var i=b.create(f,g),j=b.get2dContext(i);return j.drawImage(c,-d,-e),h(c),a.canvasToBlob(i)})}function g(c,d,e){return a.blobToImage(c).then(function(f){var g=b.create(d,e),i=b.get2dContext(g);return i.drawImage(f,0,0,d,e),h(f),a.canvasToBlob(g,c.type)})}var h=a.revokeImageUrl;return{rotate:d,flip:e,crop:f,resize:g}}),d("tinymce/imagetoolsplugin/CropRect",["tinymce/dom/DomQuery","tinymce/ui/DragHelper","tinymce/ui/Rect","tinymce/util/Tools","tinymce/util/Observable"],function(a,b,c,d,e){var f=0;return function(g,h,i,j){function k(a,b){return{x:b.x+a.x,y:b.y+a.y,w:b.w,h:b.h}}function l(a,b){return{x:b.x-a.x,y:b.y-a.y,w:b.w,h:b.h}}function m(){return l(i,g)}function n(){function e(a){var d;return new b(A,{document:j.ownerDocument,handle:A+"-"+a.name,start:function(){d=g},drag:function(b){var e,f,h,j,k;e=d.x,f=d.y,h=d.w,j=d.h,e+=b.deltaX*a.deltaX,f+=b.deltaY*a.deltaY,h+=b.deltaX*a.deltaW,j+=b.deltaY*a.deltaH,20>h&&(h=20),20>j&&(j=20),k=g=c.clamp({x:e,y:f,w:h,h:j},i,"move"==a.name),k=l(i,k),v.fire("updateRect",{rect:k}),s(k)}})}a('
').appendTo(j),d.each(y,function(b){a("#"+A,j).append('