1 | <?php |
||
20 | trait CKEditorTrait |
||
21 | { |
||
22 | /** |
||
23 | * @var string the toolbar preset. It can be any of the following: |
||
24 | * |
||
25 | * - basic: will load the configuration on presets/basic.php |
||
26 | * - full: will load the configuration on presets/full.php |
||
27 | * - standard: will load the configuration on presets/standard.php |
||
28 | * - custom: configuration will be based on [[clientOptions]]. |
||
29 | * |
||
30 | * Defaults to 'standard'. It is important to note that any configuration item of the loaded presets can be |
||
31 | * overrided by [[clientOptions]] |
||
32 | */ |
||
33 | public $preset = 'standard'; |
||
34 | |||
35 | /** |
||
36 | * Enable or disable kcfinder |
||
37 | * @link https://kcfinder.sunhater.com |
||
38 | * @var boolean |
||
39 | */ |
||
40 | public $kcfinder = false; |
||
41 | |||
42 | /** |
||
43 | * KCFinder dynamic settings (using session) |
||
44 | * @link http://kcfinder.sunhater.com/install#dynamic |
||
45 | * @var array |
||
46 | */ |
||
47 | public $kcfOptions = []; |
||
48 | |||
49 | /** |
||
50 | * KCFinder default dynamic settings |
||
51 | * @link http://kcfinder.sunhater.com/install#dynamic |
||
52 | * @var array |
||
53 | */ |
||
54 | public static $kcfDefaultOptions = [ |
||
55 | 'disabled' => false, |
||
56 | 'uploadURL' => '@web/upload', |
||
57 | 'uploadDir' => '@webroot/upload', |
||
58 | 'denyZipDownload' => true, |
||
59 | 'denyUpdateCheck' => true, |
||
60 | 'denyExtensionRename' => true, |
||
61 | 'theme' => 'default', |
||
62 | 'access' => [ // @link http://kcfinder.sunhater.com/install#_access |
||
63 | 'files' => [ |
||
64 | 'upload' => true, |
||
65 | 'delete' => true, |
||
66 | 'copy' => true, |
||
67 | 'move' => true, |
||
68 | 'rename' => true, |
||
69 | ], |
||
70 | 'dirs' => [ |
||
71 | 'create' => true, |
||
72 | 'delete' => true, |
||
73 | 'rename' => true, |
||
74 | ], |
||
75 | ], |
||
76 | 'types' => [ // @link http://kcfinder.sunhater.com/install#_types |
||
77 | 'files' => [ |
||
78 | 'type' => '', |
||
79 | ], |
||
80 | ], |
||
81 | 'thumbsDir' => '.thumbs', |
||
82 | 'thumbWidth' => 100, |
||
83 | 'thumbHeight' => 100, |
||
84 | ]; |
||
85 | |||
86 | /** |
||
87 | * @var array the options for the CKEditor 4 JS plugin. |
||
88 | * Please refer to the CKEditor 4 plugin Web page for possible options. |
||
89 | * @see http://docs.ckeditor.com/#!/guide/dev_installation |
||
90 | */ |
||
91 | public $clientOptions = []; |
||
92 | |||
93 | /** |
||
94 | * Initializes the widget options. |
||
95 | * This method sets the default values for various options. |
||
96 | */ |
||
97 | 9 | protected function initOptions() |
|
121 | |||
122 | /** |
||
123 | * Registers KCFinder (@link https://kcfinder.sunhater.com) |
||
124 | * @author Nabi KaramAliZadeh <[email protected] |
||
125 | * @link http://www.nabi.ir |
||
126 | */ |
||
127 | protected function registerKCFinder() |
||
146 | } |
||
147 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: