Skip to content

Commit

Permalink
smarter import of TinyMceFileManager class
Browse files Browse the repository at this point in the history
  • Loading branch information
rob006 committed Jan 14, 2016
1 parent d3561ce commit 55a23ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions ElFinderHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,19 @@ public static function getAssetsDir() {
return self::$_assetsDir;
}

/**
* Try import TinyMceFileManager class.
*/
public static function importTinyMceFileManager() {
if (@class_exists('TinyMceFileManager')) {
// class already imported or declared
} elseif (Yii::getPathOfAlias('tinymce')) {
// try import by declared alias
Yii::import('tinymce.TinyMceFileManager');
} else {
// try import by default extension directory
Yii::import('ext.tinymce.TinyMceFileManager');
}
}

}
3 changes: 2 additions & 1 deletion TinyMceElFinder.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

Yii::import('ext.tinymce.TinyMceFileManager');
require_once dirname(__FILE__) . '/ElFinderHelper.php';
ElFinderHelper::importTinyMceFileManager();

/**
* elFnder file manager for TinyMCE
Expand Down

0 comments on commit 55a23ad

Please sign in to comment.