Code Duplication    Length = 18-18 lines in 4 locations

classes/fields/paragraph.php 1 location

@@ 234-251 (lines=18) @@
231
     *
232
     * @since 2.0
233
     */
234
    public function input ( $name, $value = null, $options = null, $pod = null, $id = null ) {
235
        $options = (array) $options;
236
        $form_field_type = PodsForm::$field_type;
237
238
        if ( is_array( $value ) )
239
            $value = implode( "\n", $value );
240
241
        if ( isset( $options[ 'name' ] ) && false === PodsForm::permission( self::$type, $options[ 'name' ], $options, null, $pod, $id ) ) {
242
            if ( pods_var( 'read_only', $options, false ) )
243
                $options[ 'readonly' ] = true;
244
            else
245
                return;
246
        }
247
        elseif ( !pods_has_permissions( $options ) && pods_var( 'read_only', $options, false ) )
248
            $options[ 'readonly' ] = true;
249
250
        pods_view( PODS_DIR . 'ui/fields/textarea.php', compact( array_keys( get_defined_vars() ) ) );
251
    }
252
253
    /**
254
     * Change the value or perform actions after validation but before saving to the DB

classes/fields/password.php 1 location

@@ 109-126 (lines=18) @@
106
     *
107
     * @since 2.0
108
     */
109
    public function input ( $name, $value = null, $options = null, $pod = null, $id = null ) {
110
        $options = (array) $options;
111
        $form_field_type = PodsForm::$field_type;
112
113
        if ( is_array( $value ) )
114
            $value = implode( ' ', $value );
115
116
        if ( isset( $options[ 'name' ] ) && false === PodsForm::permission( self::$type, $options[ 'name' ], $options, null, $pod, $id ) ) {
117
            if ( pods_var( 'read_only', $options, false ) )
118
                $options[ 'readonly' ] = true;
119
            else
120
                return;
121
        }
122
        elseif ( !pods_has_permissions( $options ) && pods_var( 'read_only', $options, false ) )
123
            $options[ 'readonly' ] = true;
124
125
        pods_view( PODS_DIR . 'ui/fields/password.php', compact( array_keys( get_defined_vars() ) ) );
126
    }
127
128
    /**
129
     * Validate a value before it's saved

classes/fields/text.php 1 location

@@ 161-178 (lines=18) @@
158
     *
159
     * @since 2.0
160
     */
161
    public function input ( $name, $value = null, $options = null, $pod = null, $id = null ) {
162
        $options = (array) $options;
163
        $form_field_type = PodsForm::$field_type;
164
165
        if ( is_array( $value ) )
166
            $value = implode( ' ', $value );
167
168
        if ( isset( $options[ 'name' ] ) && false === PodsForm::permission( self::$type, $options[ 'name' ], $options, null, $pod, $id ) ) {
169
            if ( pods_var( 'read_only', $options, false ) )
170
                $options[ 'readonly' ] = true;
171
            else
172
                return;
173
        }
174
        elseif ( !pods_has_permissions( $options ) && pods_var( 'read_only', $options, false ) )
175
            $options[ 'readonly' ] = true;
176
177
        pods_view( PODS_DIR . 'ui/fields/text.php', compact( array_keys( get_defined_vars() ) ) );
178
    }
179
180
    /**
181
     * Validate a value before it's saved

classes/fields/oembed.php 1 location

@@ 228-245 (lines=18) @@
225
	 *
226
	 * @since 2.0
227
	 */
228
	public function input ( $name, $value = null, $options = null, $pod = null, $id = null ) {
229
		$options = (array) $options;
230
		$form_field_type = PodsForm::$field_type;
231
232
		if ( is_array( $value ) )
233
			$value = implode( ' ', $value );
234
235
		if ( isset( $options[ 'name' ] ) && false === PodsForm::permission( self::$type, $options[ 'name' ], $options, null, $pod, $id ) ) {
236
			if ( pods_var( 'read_only', $options, false ) )
237
				$options[ 'readonly' ] = true;
238
			else
239
				return;
240
		}
241
		elseif ( !pods_has_permissions( $options ) && pods_var( 'read_only', $options, false ) )
242
			$options[ 'readonly' ] = true;
243
244
		pods_view( PODS_DIR . 'ui/fields/oembed.php', compact( array_keys( get_defined_vars() ) ) );
245
	}
246
247
	/**
248
	 * Validate a value before it's saved