Skip to content

Commit

Permalink
snapshot; enlighterjs 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AndiDittrich committed Jul 21, 2019
1 parent 0a0c3b3 commit 3ddb0a5
Show file tree
Hide file tree
Showing 30 changed files with 131 additions and 162 deletions.
1 change: 1 addition & 0 deletions Enlighter.php
Expand Up @@ -62,6 +62,7 @@ function Enlighter_PhpEnvironmentError(){
require_once(ENLIGHTER_PLUGIN_PATH.'/modules/core/ResourceLoader.php');
require_once(ENLIGHTER_PLUGIN_PATH.'/modules/core/ThemeManager.php');
require_once(ENLIGHTER_PLUGIN_PATH.'/modules/core/Versions.php');
require_once(ENLIGHTER_PLUGIN_PATH.'/modules/customizer/Fonts.php');
require_once(ENLIGHTER_PLUGIN_PATH.'/modules/customizer/ThemeCustomizer.php');
require_once(ENLIGHTER_PLUGIN_PATH.'/modules/customizer/Toolbar.php');
require_once(ENLIGHTER_PLUGIN_PATH.'/modules/editor/EditorConfig.php');
Expand Down
79 changes: 25 additions & 54 deletions build.xml
Expand Up @@ -5,7 +5,7 @@
<!-- ANT-contrib !-->
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>

<target name="full" depends="potgen, readme, changelog, webfonts, themes, languages, devcopy, dist"/>
<target name="full" depends="dist"/>

<!-- "Compile" po language support files !-->
<target name="languages">
Expand All @@ -19,69 +19,38 @@
</target>

<!-- Plugin Test - DEVELOPMENT ONLY -->
<target name="devcopy">
<target name="devcopy" depends="dist">
<!-- Credentials, Host Settings !-->
<loadproperties srcFile=".credentials/account.conf" prefix="dev"/>

<!-- cleanup old plugin files !-->
<echo message="Removing old plugin files [Single Site]"/>
<sshexec host="${dev.host}" trust="true"
username="${dev.user}"
keyfile="${user.home}/${dev.keyfile}"
port="${dev.port}"
command="rm -rf ${dev.path}/*"
/>

<!-- transfer deploy plugin !-->
<echo message="Uploading files [Single Site]"/>
<scp todir="${dev.user}@${dev.host}:${dev.path}" trust="true" port="${dev.port}"
keyfile="${user.home}/${dev.keyfile}">
<fileset dir="."/>
</scp>

<echo message="Uploading files [MU Site]"/>
<scp todir="${dev.user}@${dev.host}:${dev.mupath}" trust="true" port="${dev.port}"
<scp todir="${dev.user}@${dev.host}:${dev.path}" trust="true" port="${dev.port}" sftp="true"
keyfile="${user.home}/${dev.keyfile}">
<fileset dir="."/>
<fileset dir="dist"/>
</scp>
</target>

<!-- GitHub readme + changes => WordPress transformation !-->
<target name="readme">
<!-- merge readme + changes !-->
<concat destfile="readme.txt" append="false">
<concat destfile="dist/readme.txt" append="false">
<filelist files="README.md, FAQ.md, CHANGES.md"/>
</concat>

<!-- replace headings !-->
<replaceregexp file="readme.txt" match="^###(.*)###" replace="=\1=" byline="true"/>
<replaceregexp file="readme.txt" match="^##(.*)##" replace="==\1==" byline="true"/>
<replaceregexp file="readme.txt" match="^#(.*)#" replace="===\1===" byline="true"/>
</target>

<!-- POT file generation !-->
<target name="potgen">
<exec executable="php">
<arg value="util/GeneratePOT.php"/>
</exec>
</target>

<!-- Webfonts code generation !-->
<target name="webfonts">
<exec executable="php">
<arg value="util/WebfontsGenerator.php"/>
</exec>
</target>

<!-- Changelog html generation !-->
<target name="changelog">
<exec executable="php">
<arg value="util/extract-changes.php"/>
</exec>
</target>

<!-- Theme Fetching !-->
<target name="themes">
<!-- Cleanup Dir -->
<delete dir="views/themes"/>
<mkdir dir="views/themes"/>

<!-- Run Theme Fetcher !-->
<exec executable="php">
<arg value="util/ThemeFetcher.php"/>
<arg value="views/themes"/>
</exec>
<replaceregexp file="dist/readme.txt" match="^###(.*)###" replace="=\1=" byline="true"/>
<replaceregexp file="dist/readme.txt" match="^##(.*)##" replace="==\1==" byline="true"/>
<replaceregexp file="dist/readme.txt" match="^#(.*)#" replace="===\1===" byline="true"/>
</target>

<!-- Static Code Check !-->
Expand Down Expand Up @@ -109,24 +78,26 @@
</exec>
</target>

<!-- Create Dist copy !-->
<target name="dist">
<!-- Dist clean !-->
<target name="dist-cleanup">
<!-- cleanup !-->
<delete dir="dist"/>
<mkdir dir="dist"/>
</target>

<!-- Create Dist copy !-->
<target name="dist" depends="dist-cleanup, readme">

<!-- Copy Plugin !-->
<copy todir="dist">
<fileset dir=".">
<include name="cache/**" />
<include name="class/**" />
<include name="docs/**" />
<include name="modules/**" />
<include name="lang/**" />
<include name="resources/**" />
<include name="views/**" />
<include name="Enlighter.php" />
<include name="readme.txt" />
<include name="LICENSE" />
<include name="LICENSE.txt" />
</fileset>
</copy>
</target>
Expand Down
8 changes: 5 additions & 3 deletions modules/core/EnlighterJS.php
Expand Up @@ -3,6 +3,7 @@
namespace Enlighter;

use Enlighter\skltn\ResourceManager;
use Enlighter\skltn\CacheManager;

class EnlighterJS{

Expand All @@ -21,7 +22,8 @@ public function getConfig(){
'rawcodeDbclick' => $this->_config['enlighterjs-rawcodedbclick'],
'textOverflow' => $this->_config['enlighterjs-textoverflow'],
'linenumbers' => $this->_config['enlighterjs-linenumbers'],
'theme' => $this->_config['enlighterjs-theme']
'theme' => $this->_config['enlighterjs-theme'],
'retainCssClasses' => $this->_config['enlighterjs-retaincss']
);
}

Expand All @@ -45,8 +47,8 @@ public function enqueue(){

// add EnlighterJS themes ?
if ($this->_config['enlighterjs-assets-themes']){
// include local css file
ResourceManager::enqueueStyle('enlighterjs', 'cache/enlighterjs.min.css', array(), ENLIGHTER_VERSION);
// include local css file - use cache hash!
ResourceManager::enqueueStyle('enlighterjs', 'cache/enlighterjs.min.css', array(), CacheManager::getCacheHash());
}

// only include EnlighterJS js if enabled
Expand Down
5 changes: 5 additions & 0 deletions modules/core/EnvironmentCheck.php
Expand Up @@ -50,6 +50,11 @@ public function check(){
$errors[] = __('The plugin is located within an invalid path - the <code>enlighter/</code> directory name is <strong>mandatory</strong>', 'enlighter');
}

// Experimental Compat Plugin enabled ?
if (defined('ENLIGHTERJS3_COMPAT_VERSION')){
$errors[] = __('Plugin "EnlighterJS3 Compatibility" is enabled - please disable it to use Enlighter v4! ', 'enlighter');
}

return array(
'errors' => $errors,
'warnings' => $warnings
Expand Down
11 changes: 11 additions & 0 deletions modules/customizer/Fonts.php
@@ -0,0 +1,11 @@
<?php

namespace Enlighter\customizer;

class Fonts{

// font styles
public static function customize($config, $css){

}
}
4 changes: 2 additions & 2 deletions modules/editor/TinyMCE.php
Expand Up @@ -171,7 +171,7 @@ public function generateCSS(){
$builder = new CssBuilder();

// load base styles
$builder->addRaw(file_get_contents(ENLIGHTER_PLUGIN_PATH.'/resources/tinymce/enlighterjs.tinymce.min.css'));
$builder->addFile(ENLIGHTER_PLUGIN_PATH.'/resources/tinymce/enlighterjs.tinymce.min.css');

// add editor styles
$builder->add('code.EnlighterJSRAW, pre.EnlighterJSRAW', array(
Expand Down Expand Up @@ -210,7 +210,7 @@ public function generateCSS(){

public function loadEditorCSS($mce_css){
// add hash from last settings update to force a cache update
$url = ResourceManager::getResourceUrl('cache/' . $this->_cacheFilename, ENLIGHTER_VERSION);
$url = ResourceManager::getResourceUrl('cache/' . $this->_cacheFilename, true);

// other styles loaded ?
if (empty($mce_css)){
Expand Down
4 changes: 2 additions & 2 deletions modules/skltn/Plugin.php
Expand Up @@ -206,8 +206,8 @@ protected function getBackendMenu(){
}

// retrieve plugin config
protected function getPluginConfig(){
return $this->_settingsManager->getConfig();
public function getPluginConfig(){
return $this->_settingsManager->getOptions();
}

// links to the plugin website & author's twitter channel ()
Expand Down
2 changes: 2 additions & 0 deletions modules/skltn/PluginConfig.php
Expand Up @@ -34,6 +34,7 @@ class PluginConfig{
'enlighterjs-textoverflow' => 'break',
'enlighterjs-linenumbers' => true,
'enlighterjs-theme' => 'enlighter',
'enlighterjs-retaincss' => false,
'toolbar-visibility' => 'default',
'toolbar-button-raw' => true,
'toolbar-button-copy' => true,
Expand Down Expand Up @@ -106,6 +107,7 @@ class PluginConfig{
'enlighterjs-textoverflow' => 'string',
'enlighterjs-linenumbers' => 'boolean',
'enlighterjs-theme' => 'string',
'enlighterjs-retaincss' => 'boolean',
'toolbar-visibility' => 'string',
'toolbar-button-raw' => 'boolean',
'toolbar-button-copy' => 'boolean',
Expand Down
1 change: 1 addition & 0 deletions options.conf
Expand Up @@ -19,6 +19,7 @@ enlighterjs-rawcodedbclick = false
enlighterjs-textoverflow = break
enlighterjs-linenumbers = true
enlighterjs-theme = enlighter
enlighterjs-retaincss = false

# toolbar buttons
toolbar-visibility = default
Expand Down

0 comments on commit 3ddb0a5

Please sign in to comment.