| Server IP : 216.238.66.20 / Your IP : 216.73.216.149 Web Server : nginx/1.30.4 System : Linux woropds 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/sweetheart.mx/htdocs/wp-content/plugins/pods/classes/fields/ |
Upload File : |
<?php
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
/**
* @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 = [
'pod',
'table',
];
/**
* {@inheritdoc}
*/
public function setup() {
static::$label = __( 'Permalink (url-friendly)', 'pods' );
}
/**
* {@inheritdoc}
*/
public function options() {
$options = [
static::$type . '_placeholder' => [
'label' => __( 'HTML Placeholder', 'pods' ),
'default' => '',
'type' => 'text',
'help' => [
__( '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_bool( 'read_only_restricted', $options ) ) {
$options['readonly'] = true;
$field_type = 'text';
} else {
return;
}
} elseif ( ! pods_has_permissions( $options ) ) {
if ( pods_v_bool( 'read_only', $options ) ) {
$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;
}
}