Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MODX3 support (dont break in MODX2) #39

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
32ca633
MODX3 support (dont break in MODX2)
dimasites Mar 30, 2022
7e75586
Update readme.md
dimasites Feb 27, 2023
24fa812
Развернул оригинальные min-файлы
Apr 17, 2023
f1130cd
Добавлен поиск по modx-ресурсам в диалог link
Apr 17, 2023
d069d6d
Добавлена локализация поиска по modx-ресурсам
Apr 17, 2023
4a89b7f
Исправлена верстка TAB-ов диалога link
Apr 18, 2023
6c7b812
Merge 'feature/link-modx-res-search'
Apr 22, 2023
efbf960
Partial code update for 1.4.5 version
dimasites Apr 22, 2023
6933aa0
move files
dimasites Apr 22, 2023
8014f0e
Fix builder paths and minor refactoring
dimasites Apr 22, 2023
3a1014d
fix readme, this is install instuction only now
dimasites Apr 22, 2023
7828bb5
update path in builder
dimasites Apr 22, 2023
46151cf
Add resolver
dimasites Apr 22, 2023
33560f3
add resolver runner
dimasites Apr 22, 2023
0caac6e
Merge branches
dimasites Apr 22, 2023
9653cd7
Merge branches
dimasites Apr 22, 2023
fd37872
Add missed code of prevous version
dimasites Apr 22, 2023
e06075a
Удалил лишние строки в билдере
denius-dev Apr 22, 2023
e72cb68
Merge pull request #2 from denius-dev/develop
dimasites Apr 22, 2023
e159384
Update builder for better DX
dimasites Apr 28, 2023
d3a79d4
update build env version
dimasites Apr 28, 2023
cdd5f96
CKEditor 1.4.6 (2024.07.03)
dimasites Jul 3, 2024
c71f1c7
Replace дв style tags to actual
dimasites Jul 5, 2024
71069dd
Обновленный appstat resolver под MODX3
dimasites Nov 3, 2024
03f27b0
Update build env GUI
dimasites Nov 3, 2024
fbfcd50
CKEditor 1.4.7 (draft)
dimasites Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
_build/build.config.php
# These are some examples of commonly ignored file patterns.
# You should customize this list as applicable to your project.
# Learn more about .gitignore:
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore

# Node artifact files
node_modules/
dist/

# Compiled Java class files
*.class

# Compiled Python bytecode
*.py[cod]

# Log files
*.log

# Package files
*.jar

# Maven
target/
dist/

# JetBrains IDE
.idea/

# Unit test reports
TEST*.xml

# Generated by MacOS
.DS_Store

# Generated by Windows
Thumbs.db

# Applications
*.app
*.exe
*.war

# Large media files
*.mp4
*.tiff
*.avi
*.flv
*.mov
*.wmv

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "_build/env"]
path = _build/env
url = https://github.com/dimasites/modx-build-environment-gui
13 changes: 0 additions & 13 deletions _build/build.config.sample.php

This file was deleted.

28 changes: 28 additions & 0 deletions _build/ckeditor/build.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/* define version */
define('PKG_NAME','CKEditor');
define('PKG_NAME_LOWER', strtolower(PKG_NAME));

define('PKG_NAMESPACE','ckeditor');
define('PKG_VERSION','1.4.7');
//TODO remove system settings when package removed or ask user for full replace
//TODO check b and em tag replacement!
define('PKG_RELEASE','dev16');
if (isset($_SERVER['MODX_BASE_PATH'])) {
define('MODX_BASE_PATH', $_SERVER['MODX_BASE_PATH']);
} elseif (file_exists(dirname(__FILE__ ,3) . '/core')) {
define('MODX_BASE_PATH', dirname(__FILE__,3) . '/');
} else {
define('MODX_BASE_PATH', dirname(__FILE__,4) . '/');
}
define('MODX_CORE_PATH', MODX_BASE_PATH . 'core/');
define('MODX_MANAGER_PATH', MODX_BASE_PATH . 'manager/');
define('MODX_CONNECTORS_PATH', MODX_BASE_PATH . 'connectors/');
define('MODX_ASSETS_PATH', MODX_BASE_PATH . 'assets/');

// define urls
define('MODX_BASE_URL', '/');
define('MODX_CORE_URL', MODX_BASE_URL . 'core/');
define('MODX_MANAGER_URL', MODX_BASE_URL . 'manager/');
define('MODX_CONNECTORS_URL', MODX_BASE_URL . 'connectors/');
define('MODX_ASSETS_URL', MODX_BASE_URL . 'assets/');
67 changes: 52 additions & 15 deletions _build/build.transport.php → _build/ckeditor/build.transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@
$tstart = microtime(true);
set_time_limit(0);

/* define version */
define('PKG_NAME','CKEditor');
define('PKG_NAMESPACE','ckeditor');
define('PKG_VERSION','1.4.0');
define('PKG_RELEASE','pl');

require_once dirname(__FILE__) . '/build.config.php';
/* define sources */
$root = dirname(dirname(__FILE__)).'/';
$root = dirname(__FILE__,3).'/';
$sources = array(
'root' => $root,
'build' => $root . '_build/',
'data' => $root . '_build/data/',
'build' => $root . '_build/'. PKG_NAME_LOWER .'/',
'data' => $root . '_build/'. PKG_NAME_LOWER .'/data/other/',
'resolvers' => $root . '_build/'. PKG_NAME_LOWER .'/data/resolvers/',
'processors' => $root . '_build/'. PKG_NAME_LOWER .'/data/processors/resource/',//last folder from here will be created in file structure, cant target to root ./processors/ dir. TODO find reason and fix it.
'lexicon' => $root . 'core/components/'.PKG_NAMESPACE.'/lexicon/',
'documents' => $root.'core/components/'.PKG_NAMESPACE.'/documents/',
'elements' => $root.'core/components/'.PKG_NAMESPACE.'/elements/',
Expand All @@ -30,13 +27,19 @@
unset($root);

/* load modx */
require_once dirname(__FILE__) . '/build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';

$modx= new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML'); flush();

$modx_version = $modx->getVersionData();
$modx3 = false;
if ($modx_version['version'] == 3) {
$modx3 = true;
}

$modx->loadClass('transport.modPackageBuilder','',false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAMESPACE,PKG_VERSION,PKG_RELEASE);
Expand All @@ -46,7 +49,7 @@
$plugin= $modx->newObject('modPlugin');
$plugin->set('id',1);
$plugin->set('name', PKG_NAME);
$plugin->set('description', 'CKEditor WYSIWYG editor plugin for MODx Revolution');
$plugin->set('description', 'CKEditor WYSIWYG editor plugin for MODX2 and MODX3');
$plugin->set('static', true);
$plugin->set('static_file', PKG_NAMESPACE.'/elements/plugins/'.PKG_NAMESPACE.'.plugin.php');
$plugin->set('category', 0);
Expand Down Expand Up @@ -86,19 +89,34 @@
'source' => $sources['source_manager_assets'],
'target' => "return MODX_MANAGER_PATH . 'assets/components/';",
));

if (!$modx3){
$vehicle->resolve('file',array(
'source' => $sources['processors'],
'target' => "return MODX_CORE_PATH . 'model/modx/processors/ckeditor/';",
));
//TODO clean folder model/modx/processors/ckeditor/ on MODX3 because wrong installer in 1.4.6 and prev versions.
//May be needed only when uninstall or update package...
}

$vehicle->resolve('file',array(
'source' => $sources['source_core'],
'target' => "return MODX_CORE_PATH . 'components/';",
));
$vehicle->resolve('php',array(
'source' => $sources['data'].'transport.resolver.php',
'source' => $sources['resolvers'].'transport.resolver.php',
'name' => 'resolve',
'type' => 'php'
));
$vehicle->resolve('php',array(
'source' => $sources['resolvers'].'modappstat.resolver.php',
'name' => 'modappstat',
'type' => 'php'
));
$builder->putVehicle($vehicle);

/* load system settings */
$settings = include $sources['data'].'transport.settings.php';
$settings = include $sources['data'].'transport.settings_install.php';
if (is_array($settings) && !empty($settings)) {
$attributes= array(
xPDOTransport::UNIQUE_KEY => 'key',
Expand All @@ -113,7 +131,23 @@
} else {
$modx->log(xPDO::LOG_LEVEL_ERROR,'Could not package System Settings.');
}
unset($settings,$setting);
unset($settings, $setting, $attributes);
$su = include $sources['data'] . 'transport.settings_update.php';
if (!is_array($su)) {
$modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in settings for update.');
} else {
$attributes_u = array(
xPDOTransport::UNIQUE_KEY => 'key',
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => true,
);
foreach ($su as $setting_u) {
$vehicle = $builder->createVehicle($setting_u, $attributes_u);
$builder->putVehicle($vehicle);
}
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . count($su) . ' System Settings for update its values.');
}
unset($su, $setting_u, $attributes_u);


$modx->log(modX::LOG_LEVEL_INFO,'Adding package attributes and setup options...');
Expand All @@ -136,4 +170,7 @@

$modx->log(modX::LOG_LEVEL_INFO,"Package built in {$totalTime}\n");

exit ();
$download_url = '/_build/env/index.php?getpackage='.PKG_NAME_LOWER.'-'.PKG_VERSION.'-'.PKG_RELEASE;
$modx->log(modX::LOG_LEVEL_INFO,"\n<br /><a target='_blank' href='{$download_url}'>[DOWNLOAD PACKAGE]</a><br />\n");

exit ();
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'key' => 'ckeditor.ui_color',
'xtype' => 'textfield',
'value' => '#DDDDDD',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

Expand All @@ -15,7 +15,7 @@
'key' => 'ckeditor.toolbar',
'xtype' => 'textarea',
'value' => '',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

Expand All @@ -24,7 +24,7 @@
'key' => 'ckeditor.toolbar_groups',
'xtype' => 'textarea',
'value' => '[{"name":"document","groups":["mode","document","doctools"]},{"name":"clipboard","groups":["clipboard","undo"]},{"name":"editing","groups":["find","selection","spellchecker"]},{"name":"links"},{"name":"insert"},{"name":"forms"},"/",{"name":"basicstyles","groups":["basicstyles","cleanup"]},{"name":"paragraph","groups":["list","indent","blocks","align","bidi"]},{"name":"styles"},{"name":"colors"},{"name":"tools"},{"name":"others"},{"name":"about"}]',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

Expand All @@ -33,7 +33,7 @@
'key' => 'ckeditor.format_tags',
'xtype' => 'textfield',
'value' => 'p;h1;h2;h3;h4;h5;h6;pre;address;div',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

Expand All @@ -42,16 +42,16 @@
'key' => 'ckeditor.skin',
'xtype' => 'textfield',
'value' => 'moono-lisa',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

$settings['extra_plugins']= $modx->newObject('modSystemSetting');
$settings['extra_plugins']->fromArray(array(
'key' => 'ckeditor.extra_plugins',
'xtype' => 'textfield',
'value' => '',
'namespace' => 'ckeditor',
'value' => 'html5video',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

Expand All @@ -60,7 +60,7 @@
'key' => 'ckeditor.object_resizing',
'xtype' => 'combo-boolean',
'value' => '0',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

Expand All @@ -69,7 +69,7 @@
'key' => 'ckeditor.autocorrect_dash',
'xtype' => 'textfield',
'value' => '—',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

Expand All @@ -78,7 +78,7 @@
'key' => 'ckeditor.autocorrect_double_quotes',
'xtype' => 'textfield',
'value' => '«»',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

Expand All @@ -87,7 +87,7 @@
'key' => 'ckeditor.autocorrect_single_quotes',
'xtype' => 'textfield',
'value' => '„“',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

Expand All @@ -96,16 +96,16 @@
'key' => 'ckeditor.styles_set',
'xtype' => 'textarea',
'value' => 'default',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

$settings['remove_plugins']= $modx->newObject('modSystemSetting');
$settings['remove_plugins']->fromArray(array(
'key' => 'ckeditor.remove_plugins',
'xtype' => 'textfield',
'value' => 'forms,smiley,autogrow,liststyle,justify,pagebreak,colorbutton,indentblock,font,newpage,print,save,language,bidi,selectall,preview',
'namespace' => 'ckeditor',
'value' => 'forms,smiley,liststyle,justify,pagebreak,colorbutton,indentblock,font,newpage,print,save,language,bidi,selectall,preview,flash',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

Expand All @@ -114,7 +114,7 @@
'key' => 'ckeditor.native_spellchecker',
'xtype' => 'combo-boolean',
'value' => '1',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

Expand All @@ -123,8 +123,8 @@
'key' => 'ckeditor.resource_editor_height',
'xtype' => 'textfield',
'value' => '600',
'namespace' => 'ckeditor',
'namespace' => PKG_NAME_LOWER,
'area' => 'general'
),'',true,true);

return $settings;
return $settings;
Loading