Code Duplication    Length = 18-18 lines in 4 locations

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

classes/fields/paragraph.php 1 location

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

classes/fields/password.php 1 location

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

classes/fields/text.php 1 location

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