| Server IP : 78.24.162.143 / Your IP : 216.73.217.2 Web Server : Apache System : Linux hosting.cormo.systems 5.15.0-179-generic #189-Ubuntu SMP Tue May 5 18:20:56 UTC 2026 x86_64 User : web63 ( 5058) PHP Version : 7.4.33 Disable Function : create_functions,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/clients/client34/web63/web/wp-content/plugins/pods/classes/fields/ |
Upload File : |
<?php
/**
* @package Pods\Fields
*/
class PodsField_Slug extends PodsField {
/**
* {@inheritdoc}
*/
public static $type = 'slug';
/**
* {@inheritdoc}
*/
public static $label = 'Permalink (url-friendly)';
/**
* {@inheritdoc}
*/
public static $prepare = '%s';
/**
* {@inheritdoc}
*/
public static $pod_types = array(
'pod',
'table',
);
/**
* {@inheritdoc}
*/
public function setup() {
static::$label = __( 'Permalink (url-friendly)', 'pods' );
}
/**
* {@inheritdoc}
*/
public function options() {
$options = array(
static::$type . '_placeholder' => array(
'label' => __( 'HTML Placeholder', 'pods' ),
'default' => '',
'type' => 'text',
'help' => array(
__( 'Placeholders can provide instructions or an example of the required data format for a field. Please note: It is not a replacement for labels or description text, and it is less accessible for people using screen readers.', 'pods' ),
'https://www.w3.org/WAI/tutorials/forms/instructions/#placeholder-text',
),
),
);
return $options;
}
/**
* {@inheritdoc}
*/
public function schema( $options = null ) {
$schema = 'VARCHAR(200)';
return $schema;
}
/**
* {@inheritdoc}
*/
public function input( $name, $value = null, $options = null, $pod = null, $id = null ) {
$options = ( is_array( $options ) || is_object( $options ) ) ? $options : (array) $options;
$form_field_type = PodsForm::$field_type;
$value = $this->normalize_value_for_input( $value, $options, '-' );
$field_type = 'slug';
if ( isset( $options['name'] ) && ! pods_permission( $options ) ) {
if ( pods_v( 'read_only', $options, false ) ) {
$options['readonly'] = true;
$field_type = 'text';
} else {
return;
}
} elseif ( ! pods_has_permissions( $options ) && pods_v( 'read_only', $options, false ) ) {
$options['readonly'] = true;
$field_type = 'text';
}
if ( ! empty( $options['disable_dfv'] ) ) {
return pods_view( PODS_DIR . 'ui/fields/' . $field_type . '.php', compact( array_keys( get_defined_vars() ) ) );
}
$type = pods_v( 'type', $options, static::$type );
$args = compact( array_keys( get_defined_vars() ) );
$args = (object) $args;
$this->render_input_script( $args );
}
/**
* {@inheritdoc}
*/
public function pre_save( $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) {
$index = pods_v( 'pod_index', pods_v( 'options', $pod, $pod, true ), 'id', true );
if ( empty( $value ) && isset( $fields[ $index ] ) ) {
$value = $fields[ $index ]['value'];
}
$value = pods_unique_slug( $value, $name, $pod, 0, $params->id, null, false );
return $value;
}
}