form_sanitizer($_POST['box_title'], '', 'box_title'), 'box_description' => form_sanitizer($_POST['box_description'], '', 'box_description'), 'box_class' => form_sanitizer($_POST['box_class'], '', 'box_class'), 'box_icon_type' => form_sanitizer($_POST['box_icon_type'], 0, 'box_icon_type'), 'box_icon_margin_top' => form_sanitizer($_POST['box_icon_margin_top'], '', 'box_icon_margin_top'), 'box_icon_margin_bottom' => form_sanitizer($_POST['box_icon_margin_bottom'], '', 'box_icon_margin_bottom'), 'box_padding' => form_sanitizer($_POST['box_padding'], '', 'box_padding'), 'box_link' => form_sanitizer($_POST['box_link'], '', 'box_link'), 'box_link_class' => form_sanitizer($_POST['box_link_class'], '', 'box_link_class'), 'box_link_margin_top' => form_sanitizer($_POST['box_link_margin_top'], '', 'box_link_margin_top'), 'box_link_margin_bottom' => form_sanitizer($_POST['box_link_margin_bottom'], '', 'box_link_margin_bottom'), 'box_icon_class' => '', 'box_icon_size' => '', 'box_icon_color' => '', 'box_stacked_icon_class' => '', 'box_stacked_icon_size' => '', 'box_stacked_icon_color' => '', 'box_icon_src' => '' ]; /** * Selector */ if (!self::$widget_data['box_icon_type']) { $icon_type_data = [ 'box_icon_class' => form_sanitizer($_POST['box_icon_class'], '', 'box_icon_class'), 'box_icon_size' => form_sanitizer($_POST['box_icon_size'], '0', 'box_icon_size'), 'box_icon_color' => form_sanitizer($_POST['box_icon_color'], '', 'box_icon_color'), 'box_stacked_icon_class' => form_sanitizer($_POST['box_stacked_icon_class'], '', 'box_stacked_icon_class'), 'box_stacked_icon_size' => form_sanitizer($_POST['box_stacked_icon_size'], '0', 'box_stacked_icon_size'), 'box_stacked_icon_color' => form_sanitizer($_POST['box_stacked_icon_color'], '', 'box_stacked_icon_color'), ]; self::$widget_data = array_merge(self::$widget_data, $icon_type_data); } else { // must have uploaded or selected something if (!empty($_FILES['box_icon_src']['tmp_name'])) { $upload = form_sanitizer($_FILES['box_icon_src'], '', 'box_icon_src'); if (empty($upload['error'])) { self::$widget_data['box_icon_src'] = $upload['image_name']; } } else { self::$widget_data['box_icon_src'] = form_sanitizer($_POST['box_icon_src-mediaSelector'], '', 'box_icon_src-mediaSelector'); } } if (\defender::safe()) { return \defender::serialize(self::$widget_data); } } public function validate_delete() { } public function display_form_input() { $lang = file_exists(WIDGETS."featurebox/locale/".LANGUAGE.".php") ? WIDGETS."featurebox/locale/".LANGUAGE.".php" : WIDGETS."featurebox/locale/English.php"; $widget_locale = fusion_get_locale('', $lang); self::$widget_data = [ 'box_title' => '', 'box_description' => '', 'box_class' => '', 'box_icon_class' => '', 'box_icon_type' => 0, 'box_icon_src' => '', 'box_icon_size' => '30', 'box_icon_color' => '', 'box_stacked_icon_class' => '', 'box_stacked_icon_size' => '60', 'box_stacked_icon_color' => '', 'box_icon_margin_top' => '15', 'box_icon_margin_bottom' => '15', 'box_padding' => '30', 'box_link' => '', 'box_link_class' => '', 'box_link_margin_top' => '15', 'box_link_margin_bottom' => '20', ]; if (!empty(self::$colData['page_content'])) { self::$widget_data = \defender::unserialize(self::$colData['page_content']); } echo form_text('box_title', $widget_locale['FBW_0200'], self::$widget_data['box_title'], ['inline' => TRUE]); echo form_textarea('box_description', $widget_locale['FBW_0201'], self::$widget_data['box_description'], ['inline' => TRUE]); echo form_text('box_class', $widget_locale['FBW_0230'], self::$widget_data['box_class'], ['inline' => TRUE]); echo form_select('box_icon_type', $widget_locale['FBW_0202'], self::$widget_data['box_icon_type'], [ 'options' => [ 0 => $widget_locale['FBW_0203'], 1 => $widget_locale['FBW_0204'] ], 'inline' => TRUE, ] ); add_to_jquery(" $('#box_icon_type').bind('change', function(e) { var icon_type = $(this).val(); if (icon_type == 0) { $('#featureboxImage').hide(); $('#featureboxIcon').slideDown(); } else { $('#featureboxIcon').hide(); $('#featureboxImage').slideDown(); } }); "); if (!file_exists(IMAGES.'featurebox')) { mkdir(IMAGES.'featurebox'); } echo "
\n"; echo " \n"; echo form_text('box_link', $widget_locale['FBW_0215'], self::$widget_data['box_link'], ['inline' => TRUE, 'type' => 'url']); echo form_text('box_link_class', $widget_locale['FBW_0216'], self::$widget_data['box_link_class'], ['inline' => TRUE]); ?>