Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
tools.php
1<?
9
11
12Loc::loadMessages(__FILE__);
13
14class Tools
15{
19 public static function getControlInput()
20 {
21 return '<input type="text" data-bx-editor-tool-input="item" value="">';
22 }
23
27 public static function getControlSelect(array $optionList, $haveDefault = true)
28 {
29 if($haveDefault)
30 {
31 $optionList = array('' => Loc::getMessage('BLOCK_EDITOR_TOOLS_DEFAULT')) + $optionList;
32 }
33
34 $options = '';
35 foreach($optionList as $value => $name)
36 {
37 $value = htmlspecialcharsbx($value);
38 $name = htmlspecialcharsbx($name);
39 $options .= '<option value="' . $value . '">' . $name . '</option>';
40 }
41 return '<select data-bx-editor-tool-input="item">' .$options . '</select>';
42 }
43
47 public static function getControlColor()
48 {
49 return '<input type="hidden" data-bx-editor-tool-input="item" class="bx-editor-color-picker">' .
50 '<span class="bx-editor-color-picker-view"></span>' .
51 '<span class="bx-editor-color-picker-text">' . Loc::getMessage('BLOCK_EDITOR_TOOLS_COLOR') .'</span>';
52 }
53
57 public static function getControlPaddingBottoms()
58 {
59 $options = array(0, 5, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 100, 120, 140, 160);
60
61 $optionList = array();
62 foreach($options as $v)
63 {
64 $v .= 'px';
65 $optionList[$v] = $v;
66 }
67
68 return static::getControlSelect($optionList);
69 }
70
74 public static function getControlBorderRadius()
75 {
76 $optionList = array(
77 '' => Loc::getMessage('BLOCK_EDITOR_CTRL_BORDER_RADIUS_SQUARE'),
78 '4px' => Loc::getMessage('BLOCK_EDITOR_CTRL_BORDER_RADIUS_ROUND1'),
79 '7px' => Loc::getMessage('BLOCK_EDITOR_CTRL_BORDER_RADIUS_ROUND2'),
80 '10px' => Loc::getMessage('BLOCK_EDITOR_CTRL_BORDER_RADIUS_ROUND3'),
81 '15px' => Loc::getMessage('BLOCK_EDITOR_CTRL_BORDER_RADIUS_ROUND4'),
82 );
83 return static::getControlSelect($optionList, false);
84 }
85
89 public static function getControlTextDecoration()
90 {
91 $optionList = array(
92 'none' => Loc::getMessage('BLOCK_EDITOR_COMMON_NO'),
93 'underline' => Loc::getMessage('BLOCK_EDITOR_CTRL_TEXT_DECORATION_UNDERLINE'),
94 'overline' => Loc::getMessage('BLOCK_EDITOR_CTRL_TEXT_DECORATION_OVERLINE'),
95 'line-through' => Loc::getMessage('BLOCK_EDITOR_CTRL_TEXT_DECORATION_THROUGH'),
96 );
97 return static::getControlSelect($optionList);
98 }
99
103 public static function getControlTextAlign()
104 {
105 $optionList = array(
106 'left' => Loc::getMessage('BLOCK_EDITOR_CTRL_TEXT_ALIGN_LEFT'),
107 'center' => Loc::getMessage('BLOCK_EDITOR_CTRL_TEXT_ALIGN_CENTER'),
108 'right' => Loc::getMessage('BLOCK_EDITOR_CTRL_TEXT_ALIGN_RIGHT'),
109 );
110 return static::getControlSelect($optionList, false);
111 }
112
116 public static function getControlAlign()
117 {
118 $optionList = array(
119 'left' => Loc::getMessage('BLOCK_EDITOR_CTRL_ALIGN_LEFT'),
120 'top' => Loc::getMessage('BLOCK_EDITOR_CTRL_ALIGN_TOP'),
121 'right' => Loc::getMessage('BLOCK_EDITOR_CTRL_ALIGN_RIGHT'),
122 'bottom' => Loc::getMessage('BLOCK_EDITOR_CTRL_ALIGN_BOTTOM'),
123 );
124 return static::getControlSelect($optionList, false);
125 }
126
130 public static function getControlFontFamily()
131 {
132 $optionList = array(
133 '\'Times New Roman\', Times' => 'Times New Roman',
134 '\'Courier New\'' => 'Courier New',
135 'Arial, Helvetica' => 'Arial / Helvetica',
136 '\'Arial Black\', Gadget' => 'Arial Black',
137 'Tahoma, Geneva' => 'Tahoma / Geneva',
138 'Verdana' => 'Verdana',
139 'Georgia, serif' => 'Georgia',
140 'monospace' => 'monospace',
141 );
142 return static::getControlSelect($optionList, false);
143 }
144
148 public static function getControlLineHeight()
149 {
150 $options = array(5, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 35, 40, 45, 50);
151
152 $optionList = array();
153 foreach($options as $v)
154 {
155 $v .= 'px';
156 $optionList[$v] = $v;
157 }
158
159 return static::getControlSelect($optionList);
160 }
161
165 public static function getControlFontWeight()
166 {
167 $optionList = array(
168 'normal' => Loc::getMessage('BLOCK_EDITOR_CTRL_FONT_WEIGHT_NORMAL'),
169 'bold' => Loc::getMessage('BLOCK_EDITOR_CTRL_FONT_WEIGHT_BOLD'),
170 '100' => '100',
171 '200' => '200',
172 '300' => '300',
173 '400' => '400',
174 '500' => '500',
175 '600' => '600',
176 '700' => '700',
177 '800' => '800',
178 '900' => '900',
179 );
180 return static::getControlSelect($optionList);
181 }
182
186 public static function getControlFontSize()
187 {
188 $options = array(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 26, 28, 30, 35, 40, 45, 50);
189
190 $optionList = array();
191 foreach($options as $v)
192 {
193 $v .= 'px';
194 $optionList[$v] = $v;
195 }
196 return static::getControlSelect($optionList);
197 }
198}
static getControlTextDecoration()
Definition tools.php:89
static getControlLineHeight()
Definition tools.php:148
static getControlSelect(array $optionList, $haveDefault=true)
Definition tools.php:27
static getControlPaddingBottoms()
Definition tools.php:57
static getControlFontWeight()
Definition tools.php:165
static getControlBorderRadius()
Definition tools.php:74
static getControlFontFamily()
Definition tools.php:130
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29