PluginProbe ʕ •ᴥ•ʔ
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF / trunk
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF vtrunk
2.0.5 trunk 1.3.7 1.4.0 1.4.1 1.4.2 1.4.6 1.5.0 1.5.3 1.5.6 1.5.8 1.6.5 1.6.6 1.6.9 1.7.0 1.7.4 1.8.1 1.8.2 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4
robin-image-optimizer / libs / factory / forms / controls / textarea.php
robin-image-optimizer / libs / factory / forms / controls Last commit date
customs 5 months ago holders 5 months ago checkbox.php 5 months ago color-and-opacity.php 5 months ago color.php 5 months ago datepicker-range.php 5 months ago dropdown-and-colors.php 5 months ago dropdown.php 5 months ago font.php 5 months ago google-font.php 5 months ago gradient.php 5 months ago hidden.php 5 months ago index.php 5 months ago integer.php 5 months ago list.php 5 months ago multiple-textbox.php 5 months ago paddings-editor.php 5 months ago pattern.php 5 months ago radio-colors.php 5 months ago radio.php 5 months ago textarea.php 5 months ago textbox.php 5 months ago url.php 5 months ago wp-editor.php 5 months ago
textarea.php
80 lines
1 <?php
2
3 /**
4 * Textarea Control
5 *
6 * Main options:
7 * name => a name of the control
8 * value => a value to show in the control
9 * default => a default value of the control if the "value" option is not specified
10 *
11 * @package factory-forms
12 * @since 1.0.0
13 */
14
15 // Exit if accessed directly
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19
20 if ( ! class_exists( 'Wbcr_FactoryForms600_TextareaControl' ) ) {
21
22 class Wbcr_FactoryForms600_TextareaControl extends Wbcr_FactoryForms600_Control {
23
24 public $type = 'textarea';
25
26 /**
27 * Returns a submit value of the control by a given name.
28 *
29 * @since 1.0.0
30 * @return mixed
31 */
32 public function getSubmitValue( $name, $subName ) {
33 $name_on_form = $this->getNameOnForm( $name );
34
35 $raw_value = isset( $_POST[ $name_on_form ] )
36 ? $_POST[ $name_on_form ]
37 : null;
38
39 $value = $raw_value;
40
41 if ( is_array( $value ) ) {
42 $value = array_map( 'sanitize_textarea_field', $value );
43 $value = implode( ',', $value );
44 } else {
45 $value = sanitize_textarea_field( $value );
46 }
47
48 return $this->filterValue( $value, $raw_value );
49 }
50
51 /**
52 * Preparing html attributes before rendering html of the control.
53 *
54 * @since 1.0.0
55 * @return void
56 */
57 protected function beforeHtml() {
58 $name_on_form = $this->getNameOnForm();
59 $height = (int) $this->getOption( 'height', 100 );
60
61 $this->addCssClass( 'form-control' );
62 $this->addHtmlAttr( 'name', $name_on_form );
63 $this->addHtmlAttr( 'id', $name_on_form );
64 $this->addHtmlAttr( 'style', 'min-height:' . $height . 'px' );
65 }
66
67 /**
68 * Shows the html markup of the control.
69 *
70 * @since 1.0.0
71 * @return void
72 */
73 public function html() {
74 ?>
75 <textarea <?php $this->attrs(); ?>><?php echo esc_textarea( strval( $this->getValue() ) ); ?></textarea>
76 <?php
77 }
78 }
79 }
80