Commit 69abaeb5 authored by Simonas's avatar Simonas

Header phone LT updated

parent 83e7d371
......@@ -1843,6 +1843,9 @@ class Pods implements Iterator {
if ( $last_options ) {
$last_field_data = $last_options;
} elseif ( isset( $related_obj, $related_obj->fields, $related_obj->fields[ $field ] ) ) {
// Save related field data for later to be used for display formatting
$last_field_data = $related_obj->fields[ $field ];
}
break;
......@@ -1870,7 +1873,6 @@ class Pods implements Iterator {
$field_data = $last_field_data;
}
// @todo Expand this into traversed fields too.
if ( ! empty( $field_data ) && ( $params->display || ! $params->raw ) && ! $params->in_form && ! $params->raw_display ) {
if ( $params->display || ( ( $params->get_meta || $params->deprecated ) && ! in_array( $field_data['type'], $tableless_field_types, true ) ) ) {
$field_data['options'] = pods_v( 'options', $field_data, array(), true );
......
......@@ -2890,7 +2890,7 @@ class PodsAPI {
if ( ( $field['type'] !== $old_type || $old_simple != $simple ) && empty( $definition ) ) {
pods_query( "ALTER TABLE `@wp_pods_{$params->pod}` DROP COLUMN `{$old_name}`", false );
} elseif ( 0 < strlen( $definition ) ) {
if ( $old_name !== $field['name'] || $old_simple != $simple ) {
if ( $old_name !== $field['name'] || $old_simple !== $simple || $old_definition !== $definition ) {
$test = false;
if ( 0 < strlen( $old_definition ) ) {
......@@ -3774,6 +3774,9 @@ class PodsAPI {
$custom = apply_filters( 'pods_form_ui_field_pick_custom_values', $custom, $field_data['name'], $value, array_merge( $field_data, $options ), $pod, $params->id );
// Input values are unslashed. Unslash database values as well to ensure correct comparison.
$custom = pods_unslash( $custom );
if ( empty( $value ) || empty( $custom ) ) {
$value = '';
} elseif ( ! empty( $custom ) ) {
......@@ -4891,13 +4894,13 @@ class PodsAPI {
$field = $pod->fields[ $field['name'] ];
$field['lookup_name'] = $field['name'];
if ( in_array( $field['type'], $tableless_field_types ) && ! in_array( pods_var( 'pick_object', $field ), $simple_tableless_objects ) ) {
if ( in_array( $field['type'], $tableless_field_types, true ) && ! in_array( pods_v( 'pick_object', $field ), $simple_tableless_objects, true ) ) {
if ( 'pick' === $field['type'] ) {
if ( empty( $field['table_info'] ) ) {
$field['table_info'] = $this->get_table_info( pods_var_raw( 'pick_object', $field ), pods_var_raw( 'pick_val', $field ), null, null, $field );
$field['table_info'] = $this->get_table_info( pods_v( 'pick_object', $field ), pods_v( 'pick_val', $field ), null, null, $field );
}
if ( ! empty( $field['table_info'] ) ) {
if ( ! empty( $field['table_info'] ) && 'table' !== $field['table_info']['object_type'] ) {
$field['lookup_name'] .= '.' . $field['table_info']['field_id'];
}
} elseif ( in_array( $field['type'], PodsForm::file_field_types() ) ) {
......@@ -6083,6 +6086,7 @@ class PodsAPI {
$pod = array(
'id' => 0,
'name' => $params->name,
'object' => $params->name,
'label' => __( 'Pods', 'pods' ),
'type' => 'post_type',
'storage' => 'meta',
......@@ -6095,6 +6099,7 @@ class PodsAPI {
$pod = array(
'id' => 0,
'name' => $params->name,
'object' => $params->name,
'label' => __( 'Pod Fields', 'pods' ),
'type' => 'post_type',
'storage' => 'meta',
......@@ -8696,12 +8701,23 @@ class PodsAPI {
$info['table'] = ( empty( $object ) ? $name : $object );
$info['pod_table'] = $wpdb->prefix . 'pods_' . $info['table'];
if ( ! empty( $field ) && is_array( $field ) ) {
$info['table'] = pods_var_raw( 'pick_table', pods_var_raw( 'options', $field, $field ) );
$info['field_id'] = pods_var_raw( 'pick_table_id', pods_var_raw( 'options', $field, $field ) );
$info['meta_field_value'] = pods_var_raw( 'pick_table_index', pods_var_raw( 'options', $field, $field ) );
$info['field_index'] = $info['meta_field_value'];
$info['meta_field_index'] = $info['meta_field_value'];
if ( ! empty( $field ) ) {
if ( ! is_array( $field ) ) {
if ( is_string( $pod ) ) {
$pod = pods( $pod );
}
if ( $pod && ! empty( $pod->fields[ $field ] ) ) {
$field = $pod->fields[ $field ];
}
}
if ( is_array( $field ) ) {
$info['table'] = pods_var_raw( 'pick_table', pods_var_raw( 'options', $field, $field ) );
$info['field_id'] = pods_var_raw( 'pick_table_id', pods_var_raw( 'options', $field, $field ) );
$info['meta_field_value'] = pods_var_raw( 'pick_table_index', pods_var_raw( 'options', $field, $field ) );
$info['field_index'] = $info['meta_field_value'];
$info['meta_field_index'] = $info['meta_field_value'];
}
}
}
......
......@@ -43,7 +43,7 @@ class PodsAdmin {
add_action( 'admin_init', array( $this, 'admin_init' ), 9 );
// Menus
add_action( 'admin_menu', array( $this, 'admin_menu' ), 99 );
add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 );
// AJAX for Admin
add_action( 'wp_ajax_pods_admin', array( $this, 'admin_ajax' ) );
......@@ -3641,106 +3641,110 @@ class PodsAdmin {
'label' => 'Pods',
'description' => __( 'Debug information for Pods installations.', 'pods' ),
'fields' => array(
'pods-server-software' => array(
'pods-server-software' => array(
'label' => __( 'Server Software', 'pods' ),
'value' => ! empty( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : 'N/A',
),
'pods-user-agent' => array(
'pods-user-agent' => array(
'label' => __( 'Your User Agent', 'pods' ),
'value' => ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : 'N/A',
),
'pods-session-save-path' => array(
'pods-session-save-path' => array(
'label' => __( 'Session Save Path', 'pods' ),
'value' => session_save_path(),
),
'pods-session-save-path-exists' => array(
'pods-session-save-path-exists' => array(
'label' => __( 'Session Save Path Exists', 'pods' ),
'value' => file_exists( session_save_path() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-session-save-path-writable' => array(
'pods-session-save-path-writable' => array(
'label' => __( 'Session Save Path Writeable', 'pods' ),
'value' => is_writable( session_save_path() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-session-max-lifetime' => array(
'pods-session-max-lifetime' => array(
'label' => __( 'Session Max Lifetime', 'pods' ),
'value' => ini_get( 'session.gc_maxlifetime' ),
),
'pods-opcode-cache-apc' => array(
'pods-opcode-cache-apc' => array(
'label' => __( 'Opcode Cache: Apc', 'pods' ),
'value' => function_exists( 'apc_cache_info' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-opcode-cache-memcached' => array(
'pods-opcode-cache-memcached' => array(
'label' => __( 'Opcode Cache: Memcached', 'pods' ),
'value' => class_exists( 'eaccelerator_put' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-opcode-cache-opcache' => array(
'pods-opcode-cache-opcache' => array(
'label' => __( 'Opcode Cache: OPcache', 'pods' ),
'value' => function_exists( 'opcache_get_status' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-opcode-cache-redis' => array(
'pods-opcode-cache-redis' => array(
'label' => __( 'Opcode Cache: Redis', 'pods' ),
'value' => class_exists( 'xcache_set' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-object-cache-apc' => array(
'pods-object-cache-apc' => array(
'label' => __( 'Object Cache: APC', 'pods' ),
'value' => function_exists( 'apc_cache_info' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-object-cache-apcu' => array(
'pods-object-cache-apcu' => array(
'label' => __( 'Object Cache: APCu', 'pods' ),
'value' => function_exists( 'apcu_cache_info' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-object-cache-memcache' => array(
'pods-object-cache-memcache' => array(
'label' => __( 'Object Cache: Memcache', 'pods' ),
'value' => class_exists( 'Memcache' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-object-cache-memcached' => array(
'pods-object-cache-memcached' => array(
'label' => __( 'Object Cache: Memcached', 'pods' ),
'value' => class_exists( 'Memcached' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-object-cache-redis' => array(
'pods-object-cache-redis' => array(
'label' => __( 'Object Cache: Redis', 'pods' ),
'value' => class_exists( 'Redis' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-memory-current-usage' => array(
'pods-memory-current-usage' => array(
'label' => __( 'Current Memory Usage', 'pods' ),
'value' => number_format_i18n( memory_get_usage() / 1024 / 1024, 3 ) . 'M',
),
'pods-memory-current-usage-real' => array(
'pods-memory-current-usage-real' => array(
'label' => __( 'Current Memory Usage (real)', 'pods' ),
'value' => number_format_i18n( memory_get_usage( true ) / 1024 / 1024, 3 ) . 'M',
),
'pods-network-wide' => array(
'pods-network-wide' => array(
'label' => __( 'Pods Network-Wide Activated', 'pods' ),
'value' => is_plugin_active_for_network( basename( PODS_DIR ) . '/init.php' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-install-location' => array(
'pods-install-location' => array(
'label' => __( 'Pods Install Location', 'pods' ),
'value' => PODS_DIR,
),
'pods-developer' => array(
'pods-developer' => array(
'label' => __( 'Pods Developer Activated' ),
'value' => ( pods_developer() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-tableless-mode' => array(
'pods-tableless-mode' => array(
'label' => __( 'Pods Tableless Mode Activated', 'pods' ),
'value' => ( pods_tableless() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-light-mode' => array(
'pods-light-mode' => array(
'label' => __( 'Pods Light Mode Activated', 'pods' ),
'value' => ( pods_light() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-strict' => array(
'pods-strict' => array(
'label' => __( 'Pods Strict Activated' ),
'value' => ( pods_strict() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-allow-deprecated' => array(
'pods-allow-deprecated' => array(
'label' => __( 'Pods Allow Deprecated' ),
'value' => ( pods_allow_deprecated() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-api-cache' => array(
'pods-api-cache' => array(
'label' => __( 'Pods API Cache Activated' ),
'value' => ( pods_api_cache() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
'pods-shortcode-allow-evaluate-tags' => array(
'label' => __( 'Pods Shortcode Allow Evaluate Tags' ),
'value' => ( pods_shortcode_allow_evaluate_tags() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
),
),
);
......
......@@ -344,8 +344,8 @@ class PodsInit {
// Check if Pod is a Modal Window
if ( pods_is_modal_window() ) {
add_filter( 'body_class', array( $this, 'add_classes_to_body_class' ) );
add_filter( 'admin_body_class', array( $this, 'add_classes_to_body_class' ) );
add_filter( 'body_class', array( $this, 'add_classes_to_modal_body' ) );
add_filter( 'admin_body_class', array( $this, 'add_classes_to_modal_body' ) );
}
// Deal with specifics on admin pages
......@@ -406,13 +406,17 @@ class PodsInit {
}
/**
* @param string $classes Body classes.
* @param string|array $classes Body classes.
*
* @return string
* @return string|array
*/
public function add_classes_to_body_class( $classes ) {
public function add_classes_to_modal_body( $classes ) {
$classes .= 'pods-modal-window';
if ( is_array( $classes ) ) {
$classes[] = 'pods-modal-window';
} else {
$classes .= ' pods-modal-window';
}
return $classes;
}
......@@ -1872,6 +1876,7 @@ class PodsInit {
$conditionals[] = 'pods_strict';
$conditionals[] = 'pods_allow_deprecated';
$conditionals[] = 'pods_api_cache';
$conditionals[] = 'pods_shortcode_allow_evaluate_tags';
return $conditionals;
}
}
......@@ -4634,6 +4634,9 @@ class PodsUI {
'filter_*',
'view' . $this->num,
'page' . $this->num,
'post_type',
'taxonomy',
'action' . $this->num,
), $this->exclusion()
);
......@@ -4653,9 +4656,21 @@ class PodsUI {
if ( false !== $this->pagination ) {
if ( 1 < $total_pages ) {
$first_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=1' );
$prev_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . max( $this->page - 1, 1 ) );
$next_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . min( $this->page + 1, $total_pages ) );
$last_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . $total_pages );
$classes = '';
if ( 1 >= $this->page ) {
$classes .= ' disabled';
}
if ( is_admin() ) {
$classes .= ' button';
}
?>
<a class="first-page<?php echo esc_attr( ( 1 < $this->page ) ? '' : ' disabled' ); ?>" title="<?php esc_attr_e( 'Go to the first page', 'pods' ); ?>" href="<?php echo esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=1' ); ?>">&laquo;</a>
<a class="prev-page<?php echo esc_attr( ( 1 < $this->page ) ? '' : ' disabled' ); ?>" title="<?php esc_attr_e( 'Go to the previous page', 'pods' ); ?>" href="<?php echo esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . max( $this->page - 1, 1 ) ); ?>">&lsaquo;</a>
<a class="first-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the first page', 'pods' ); ?>" href="<?php echo $first_link; ?>">&laquo;</a>
<a class="prev-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the previous page', 'pods' ); ?>" href="<?php echo $prev_link; ?>">&lsaquo;</a>
<?php
if ( true == $header ) {
?>
......@@ -4680,9 +4695,16 @@ class PodsUI {
<span class="total-pages"><?php echo number_format_i18n( $total_pages ); ?></span></span>
<?php
}//end if
$classes = '';
if ( $this->page >= $total_pages ) {
$classes .= ' disabled';
}
if ( is_admin() ) {
$classes .= ' button';
}
?>
<a class="next-page<?php echo esc_attr( ( $this->page < $total_pages ) ? '' : ' disabled' ); ?>" title="<?php esc_attr_e( 'Go to the next page', 'pods' ); ?>" href="<?php echo esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . min( $this->page + 1, $total_pages ) ); ?>">&rsaquo;</a>
<a class="last-page<?php echo esc_attr( ( $this->page < $total_pages ) ? '' : ' disabled' ); ?>" title="<?php esc_attr_e( 'Go to the last page', 'pods' ); ?>'" href="<?php echo esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . $total_pages ); ?>">&raquo;</a>
<a class="next-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the next page', 'pods' ); ?>" href="<?php echo $next_link; ?>">&rsaquo;</a>
<a class="last-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the last page', 'pods' ); ?>" href="<?php echo $last_link; ?>">&raquo</a>
<?php
}//end if
}//end if
......@@ -4914,8 +4936,7 @@ class PodsUI {
$author_restrict = false;
if ( ! empty( $this->restrict['author_restrict'] ) && $restrict === $this->restrict['author_restrict'] ) {
$restricted = false;
$restricted = false;
$author_restrict = true;
if ( is_object( $this->pod ) ) {
......@@ -4927,33 +4948,58 @@ class PodsUI {
if ( pods_is_admin( array( 'pods', 'pods_content' ) ) ) {
$restricted = false;
} elseif ( 'manage' === $action ) {
if ( ! in_array( 'edit', $this->actions_disabled ) && ( current_user_can( 'pods_edit_' . $this->pod->pod ) || current_user_can( 'pods_edit_others_' . $this->pod->pod ) ) ) {
$restricted = false;
} elseif ( ! in_array( 'delete', $this->actions_disabled ) && ( current_user_can( 'pods_delete_' . $this->pod->pod ) || current_user_can( 'pods_delete_others_' . $this->pod->pod ) ) ) {
$restricted = false;
} elseif ( current_user_can( 'pods_' . $action . '_' . $this->pod->pod ) || current_user_can( 'pods_' . $action . '_others_' . $this->pod->pod ) ) {
$restricted = false;
} else {
// Disable legacy check.
$author_restrict = false;
$pod = $this->pod;
if ( ! $pod->id() && $row ) {
$pod->fetch( $row );
}
// Check if the current user is the author of this item.
$author = $pod->field( 'author', true );
$is_author = false;
if ( $author && (int) wp_get_current_user()->ID === (int) pods_v( 'ID', $author, 0 ) ) {
$is_author = true;
}
$cap_actions = array( $action );
if ( 'manage' === $action || 'reorder' === $action ) {
if ( ! in_array( 'edit', $this->actions_disabled, true ) ) {
$cap_actions[] = 'edit';
}
if ( ! in_array( 'delete', $this->actions_disabled, true ) ) {
$cap_actions[] = 'delete';
}
}
foreach ( $cap_actions as $cap ) {
if ( $is_author ) {
// Only need regular capability.
if ( current_user_can( 'pods_' . $cap . '_' . $this->pod->pod ) ) {
$restricted = false;
break;
}
} else {
// This item is created by another user so the "others" capability is required as well.
if (
current_user_can( 'pods_' . $cap . '_' . $this->pod->pod ) &&
current_user_can( 'pods_' . $cap . '_others_' . $this->pod->pod )
) {
$restricted = false;
break;
}
}
}
} elseif ( current_user_can( 'pods_' . $action . '_' . $this->pod->pod ) || current_user_can( 'pods_' . $action . '_others_' . $this->pod->pod ) ) {
$restricted = false;
}
}//end if
/*
@todo determine proper logic for non-pods capabilities
else {
$restricted = true;
if ( pods_is_admin( array( 'pods', 'pods_content' ) ) )
$restricted = false;
elseif ( current_user_can( 'pods_' . $action . '_others_' . $_tbd ) )
$restricted = false;
}
*/
}//end if
if ( $restricted && ! empty( $restrict ) ) {
$relation = strtoupper( trim( pods_var( 'relation', $restrict, 'AND', null, true ) ) );
$relation = strtoupper( trim( pods_v( 'relation', $restrict, 'AND', null, true ) ) );
if ( 'AND' !== $relation ) {
$relation = 'OR';
......@@ -4969,7 +5015,7 @@ class PodsUI {
if ( is_array( $match ) ) {
$match_okay = true;
$match_relation = strtoupper( trim( pods_var( 'relation', $match, 'OR', null, true ) ) );
$match_relation = strtoupper( trim( pods_v( 'relation', $match, 'OR', null, true ) ) );
if ( 'AND' !== $match_relation ) {
$match_relation = 'OR';
......@@ -5088,42 +5134,28 @@ class PodsUI {
}//end if
}//end foreach
if ( ! empty( $author_restrict ) ) {
if ( is_object( $this->pod ) && 'manage' === $action ) {
if ( ! in_array( 'edit', $this->actions_disabled ) && ! current_user_can( 'pods_edit_' . $this->pod->pod ) && ! in_array( 'delete', $this->actions_disabled ) && ! current_user_can( 'pods_delete_' . $this->pod->pod ) ) {
$okay = false;
}
}
if ( is_object( $this->pod ) && ! current_user_can( 'pods_' . $action . '_' . $this->pod->pod ) ) {
$okay = false;
}
/*
@todo determine proper logic for non-pods capabilities
elseif ( !current_user_can( 'pods_' . $action . '_' . $_tbd ) )
$okay = false;
*/
if ( ! $okay && ! empty( $row ) ) {
foreach ( $this->restrict['author_restrict'] as $key => $val ) {
$author_restricted = $this->get_field( $key );
if ( ! empty( $author_restricted ) ) {
if ( ! is_array( $author_restricted ) ) {
$author_restricted = (array) $author_restricted;
}
// Legacy author restrict check.
if ( $author_restrict && ! $okay && ! empty( $row ) ) {
foreach ( $this->restrict['author_restrict'] as $key => $val ) {
$author_restricted = $this->get_field( $key );
if ( is_array( $val ) ) {
foreach ( $val as $v ) {
if ( in_array( $v, $author_restricted ) ) {
$okay = true;
}
if ( ! empty( $author_restricted ) ) {
if ( ! is_array( $author_restricted ) ) {
$author_restricted = (array) $author_restricted;
}
$author_restricted = array_map( 'intval', $author_restricted );
if ( is_array( $val ) ) {
foreach ( $val as $v ) {
if ( in_array( (int) $v, $author_restricted, true ) ) {
$restricted = false;
}
} elseif ( in_array( $val, $author_restricted ) ) {
$okay = true;
}
} elseif ( in_array( (int) $val, $author_restricted, true ) ) {
$restricted = false;
}
}
}//end if
}//end foreach
}//end if
if ( $okay ) {
......@@ -5131,7 +5163,10 @@ class PodsUI {
}
}//end if
if ( isset( $this->actions_custom[ $action ] ) && is_array( $this->actions_custom[ $action ] ) && isset( $this->actions_custom[ $action ]['restrict_callback'] ) && is_callable( $this->actions_custom[ $action ]['restrict_callback'] ) ) {
if (
isset( $this->actions_custom[ $action ]['restrict_callback'] )
&& is_callable( $this->actions_custom[ $action ]['restrict_callback'] )
) {
$restricted = call_user_func( $this->actions_custom[ $action ]['restrict_callback'], $restricted, $restrict, $action, $row, $this );
}
......
......@@ -169,6 +169,25 @@ class PodsField_Boolean extends PodsField {
return $data;
}
/**
* {@inheritdoc}
*/
public function validate( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) {
$errors = array();
$check = $this->pre_save( $value, $id, $name, $options, $fields, $pod, $params );
if ( 1 === (int) pods_v( 'required', $options ) && 0 === $check ) {
$errors[] = __( 'This field is required.', 'pods' );
}
if ( ! empty( $errors ) ) {
return $errors;
}
return true;
}
/**
* {@inheritdoc}
*/
......
......@@ -166,6 +166,19 @@ class PodsField_Date extends PodsField_DateTime {
return $schema;
}
/**
* {@inheritdoc}
*/
public function format_display( $options, $js = false ) {
if ( $js && 'custom' === pods_v( static::$type . '_type', $options, 'format' ) ) {
$format = $this->format_datetime( $options, $js );
return $this->convert_format( $format, array( 'source' => 'jquery_ui', 'type' => 'date' ) );
}
return parent::format_display( $options, $js );
}
/**
* {@inheritdoc}
*/
......
......@@ -281,8 +281,8 @@ class PodsField_DateTime extends PodsField {
$value = implode( ' ', $value );
}
// Format Value
$value = $this->format_value_display( $value, $options, true );
// @todo Remove? Format Value (done in field template).
//$value = $this->format_value_display( $value, $options, true );
$field_type = static::$type;
......@@ -321,11 +321,8 @@ class PodsField_DateTime extends PodsField {
$js = false;
}
$format = $this->format_datetime( $options, $js );
if ( $js ) {
$format = $this->convert_format( $format, array( 'source' => 'jquery_ui' ) );
}
// Value should always be passed as storage format since 2.7.15.
$format = static::$storage_format;
$check = $this->convert_date( $value, static::$storage_format, $format, true );
......@@ -345,14 +342,8 @@ class PodsField_DateTime extends PodsField {
*/
public function pre_save( $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) {
$js = true;
if ( 'custom' !== pods_v( static::$type . '_type', $options, 'format' ) ) {
$js = false;
}
$format = $this->format_datetime( $options, $js );
if ( $js ) {
$format = $this->convert_format( $format, array( 'source' => 'jquery_ui' ) );
}
// Value should always be passed as storage format since 2.7.15.
$format = static::$storage_format;
if ( ! empty( $value ) && ( 0 === (int) pods_v( static::$type . '_allow_empty', $options, 1 ) || ! in_array(
$value, array(
......@@ -446,12 +437,25 @@ class PodsField_DateTime extends PodsField {
*/
public function format_display( $options, $js = false ) {
if ( 'custom' !== pods_v( static::$type . '_type', $options, 'format' ) ) {
if ( 'custom' === pods_v( static::$type . '_type', $options, 'format' ) ) {
if ( $js ) {
// Gets format strings in jQuery UI format.
$date = $this->format_date( $options, $js );
$time = $this->format_time( $options, $js );
// Convert them to PHP date format.
$date = $this->convert_format( $date, array( 'source' => 'jquery_ui', 'type' => 'date' ) );
$time = $this->convert_format( $time, array( 'source' => 'jquery_ui', 'type' => 'time' ) );
return $date . ' ' . $time;
} else {
$format = $this->format_datetime( $options, $js );
}
} else {
$js = false;
}
$format = $this->format_datetime( $options, $js );
if ( $js ) {
$format = $this->convert_format( $format, array( 'source' => 'jquery_ui' ) );
$format = $this->format_datetime( $options, $js );
}
return $format;
......@@ -495,24 +499,33 @@ class PodsField_DateTime extends PodsField {
switch ( (string) pods_v( static::$type . '_type', $options, 'format', true ) ) {
case 'wp':
$format = get_option( 'date_format' );
if ( $js ) {
$format = $this->convert_format( $format, array( 'source' => 'php' ) );
$format = $this->convert_format( $format, array( 'source' => 'php', 'type' => 'date' ) );
}
break;
case 'custom':
if ( ! $js ) {
$format = pods_v( static::$type . '_format_custom', $options, '' );
} else {
$format = pods_v( static::$type . '_format_custom_js', $options, '' );
if ( empty( $format ) ) {
$format = pods_v( static::$type . '_format_custom', $options, '' );
$format = $this->convert_format( $format, array( 'source' => 'php' ) );
if ( $js ) {
$format = $this->convert_format( $format, array( 'source' => 'php', 'type' => 'date' ) );
}
}
}
break;
default:
$date_format = $this->get_date_formats( $js );
$format = $date_format[ pods_v( static::$type . '_format', $options, 'ymd_dash', true ) ];
break;
}//end switch
......@@ -549,10 +562,11 @@ class PodsField_DateTime extends PodsField {
$format = pods_v( static::$type . '_time_format_custom', $options, '' );
} else {
$format = pods_v( static::$type . '_time_format_custom_js', $options, '' );
$js = false; // Already in JS format.
if ( empty( $format ) ) {
$format = pods_v( static::$type . '_time_format_custom', $options, '' );
$format = $this->convert_format( $format, array( 'source' => 'php' ) );
$js = true;
}
}
......@@ -560,10 +574,6 @@ class PodsField_DateTime extends PodsField {
default:
$format = get_option( 'time_format' );
if ( $js ) {
$format = $this->convert_format( $format, array( 'source' => 'php' ) );
}
break;
}//end switch
......@@ -601,8 +611,9 @@ class PodsField_DateTime extends PodsField {
$filter = 'pods_form_ui_field_date_formats';
if ( $js ) {
// @todo Method parameters? (Not supported by array_map)
$date_format = array_map( array( $this, 'convert_format' ), $date_format );
foreach ( $date_format as $key => $value ) {
$date_format[ $key ] = $this->convert_format( $value, array( 'type' => 'date' ) );
}
$filter = 'pods_form_ui_field_date_js_formats';
}
......@@ -637,8 +648,9 @@ class PodsField_DateTime extends PodsField {
$filter = 'pods_form_ui_field_time_formats';
if ( $js ) {
// @todo Method parameters? (Not supported by array_map)
$time_format = array_map( array( $this, 'convert_format' ), $time_format );
foreach ( $time_format as $key => $value ) {
$time_format[ $key ] = $this->convert_format( $value, array( 'type' => 'time' ) );
}
$filter = 'pods_form_ui_field_time_js_formats';
}
......@@ -665,8 +677,9 @@ class PodsField_DateTime extends PodsField {
$filter = 'pods_form_ui_field_time_formats_24';
if ( $js ) {
// @todo Method parameters? (Not supported by array_map)
$time_format_24 = array_map( array( $this, 'convert_format' ), $time_format_24 );
foreach ( $time_format_24 as $key => $value ) {
$time_format_24[ $key ] = $this->convert_format( $value, array( 'type' => 'time' ) );
}
$filter = 'pods_form_ui_field_time_js_formats_24';
}
......@@ -784,55 +797,64 @@ class PodsField_DateTime extends PodsField {
$args = array_merge(
array(
'source' => 'php',
'type' => 'date',
// 'jquery_ui' for reverse.
), $args
);
// Keep keys and values sorted by string length.
$symbols = array(
// Day
'd' => 'dd',
'l' => 'DD',
'D' => 'D',
'j' => 'd',
'N' => '',
'S' => '',
'w' => '',
'z' => 'o',
// Week
'W' => '',
// Month
'F' => 'MM',
'm' => 'mm',
'M' => 'M',
'n' => 'm',
't' => '',
// Year
'L' => '',
'o' => '',
'Y' => 'yy',
'y' => 'y',
// AM/PM
'a' => 'tt',
'A' => 'TT',
// Swatch internet time (not supported)
'B' => '',
// Hour
'h' => 'hh',
'H' => 'HH',
'g' => 'h',
'G' => 'H',
// Minute
'i' => 'mm',
// Second
's' => 'ss',
// Microsecond
'u' => 'c',
);
if ( 'time' === $args['type'] || 'time' === static::$type ) {
$symbols = array(
// AM/PM.
'a' => 'tt',
'A' => 'TT',
// Swatch internet time (not supported).
'B' => '',
// Hour.
'h' => 'hh',
'H' => 'HH',
'g' => 'h',
'G' => 'H',
// Minute.
'i' => 'mm',
// Second.
's' => 'ss',
// Microsecond.
'u' => 'c',
);
if ( version_compare( PHP_VERSION, '7.0.0' ) >= 0 ) {
// Millisecond
$symbols['v'] = 'l';
if ( version_compare( PHP_VERSION, '7.0.0' ) >= 0 ) {
// Millisecond.
$symbols['v'] = 'l';
}
} else {
$symbols = array(
// Day.
'd' => 'dd',
'l' => 'DD',
'D' => 'D',
'j' => 'd',
'N' => '',
'S' => '',
'w' => '',
'z' => 'o',
// Week.
'W' => '',
// Month.
'F' => 'MM',
'm' => 'mm',
'M' => 'M',
'n' => 'm',
't' => '',
// Year.
'L' => '',
'o' => '',
'Y' => 'yy',
'y' => 'y',
);
}
if ( 'jquery_ui' === $args['source'] ) {
......
......@@ -169,6 +169,19 @@ class PodsField_Time extends PodsField_DateTime {
return empty( $value );
}
/**
* {@inheritdoc}
*/
public function format_display( $options, $js = false ) {
if ( $js && 'custom' === pods_v( static::$type . '_type', $options, 'format' ) ) {
$format = $this->format_datetime( $options, $js );
return $this->convert_format( $format, array( 'source' => 'jquery_ui', 'type' => 'time' ) );
}
return parent::format_display( $options, $js );
}
/**
* {@inheritdoc}
*/
......@@ -209,7 +222,10 @@ class PodsField_Time extends PodsField_DateTime {
if ( empty( $format ) ) {
$format = pods_v( static::$type . '_format_custom', $options, '' );
$format = $this->convert_format( $format, array( 'source' => 'php' ) );
if ( $js ) {
$format = $this->convert_format( $format, array( 'source' => 'php', 'type' => 'time' ) );
}
}
}
......@@ -218,7 +234,7 @@ class PodsField_Time extends PodsField_DateTime {
$format = get_option( 'time_format' );
if ( $js ) {
$format = $this->convert_format( $format, array( 'source' => 'php' ) );
$format = $this->convert_format( $format, array( 'source' => 'php', 'type' => 'time' ) );
}
break;
......
......@@ -374,6 +374,12 @@ class Pods_Migrate_Packages extends PodsComponent {
$pod = array_merge( $pod, $pod_data );
if ( in_array( $pod['name'], pods_reserved_keywords(), true ) ) {
// Extending objects when using reserved keywords.
// This will then accept `post`, `page` etc. as Pods object names.
$pod['create_extend'] = 'extend';
}
foreach ( $pod['fields'] as $k => $field ) {
if ( isset( $field['id'] ) && ! isset( $existing_fields[ $field['name'] ] ) ) {
unset( $pod['fields'][ $k ]['id'] );
......@@ -400,13 +406,14 @@ class Pods_Migrate_Packages extends PodsComponent {
}
}//end foreach
$api->save_pod( $pod );
if ( $api->save_pod( $pod ) ) {
if ( ! isset( $found['pods'] ) ) {
$found['pods'] = array();
}
if ( ! isset( $found['pods'] ) ) {
$found['pods'] = array();
$found['pods'][ $pod['name'] ] = $pod['label'];
}
$found['pods'][ $pod['name'] ] = $pod['label'];
}//end foreach
}//end if
......
......@@ -57,16 +57,6 @@ class Pods_Roles extends PodsComponent {
global $wp_roles;
// Hook into Gravity Forms roles (since it only adds filter if Members plugin itself is activated
if ( class_exists( 'RGForms' ) && ! has_filter(
'members_get_capabilities', array(
'RGForms',
'members_get_capabilities',
)
) ) {
add_filter( 'members_get_capabilities', array( 'RGForms', 'members_get_capabilities' ) );
}
$default_role = get_option( 'default_role' );
$roles = array();
......@@ -447,7 +437,12 @@ class Pods_Roles extends PodsComponent {
$capabilities = array_merge( $default_caps, $role_caps, $plugin_caps );
// To support Members filters
// Gravity Forms.
if ( is_callable( 'GFCommon::all_caps' ) ) {
$capabilities = array_merge( $capabilities, GFCommon::all_caps() );
}
// To support Members filters.
$capabilities = apply_filters( 'members_get_capabilities', $capabilities );
$capabilities = apply_filters( 'pods_roles_get_capabilities', $capabilities );
......
......@@ -1383,13 +1383,14 @@ function pods_absint( $maybeint, $strict = true, $allow_negative = false ) {
/**
* Functions like str_replace except it will restrict $occurrences
*
* @since 2.0
*
* @param mixed $find
* @param mixed $replace
* @param string $string
* @param int $occurrences (optional)
*
* @return mixed
* @version 2.0
*/
function pods_str_replace( $find, $replace, $string, $occurrences = - 1 ) {
......@@ -1416,8 +1417,12 @@ function pods_str_replace( $find, $replace, $string, $occurrences = - 1 ) {
} else {
$find = '/' . preg_quote( $find, '/' ) . '/';
}
return preg_replace( $find, $replace, $string, $occurrences );
if ( is_string( $string ) ) {
return preg_replace( $find, $replace, $string, $occurrences );
} else {
// Occasionally we will receive non string values (true, false, null). Allow those to pass through
return $string;
}
}
/**
......@@ -1462,82 +1467,82 @@ function pods_mb_substr( $string, $start, $length = null, $encoding = null ) {
}
/**
* Evaluate tags like magic tags but through pods_v
* Evaluate tags like magic tags but through pods_v.
*
* @param string|array|object $tags String to be evaluated
* @param bool $sanitize Whether to sanitize tags
* @since 2.1
*
* @return string
* @param string|array|object $tags String to be evaluated.
* @param bool $sanitize Whether to sanitize.
* @param null|mixed $fallback The fallback value to use if not set, should already be sanitized.
*
* @version 2.1
* @return string
*
* @see pods_evaluate_tag
* @see pods_evaluate_tag
*/
function pods_evaluate_tags( $tags, $sanitize = false ) {
function pods_evaluate_tags( $tags, $sanitize = false, $fallback = null ) {
if ( is_array( $tags ) ) {
foreach ( $tags as $k => $tag ) {
$tags[ $k ] = pods_evaluate_tags( $tag, $sanitize );
}
return $tags;
} elseif ( is_object( $tags ) ) {
$tags = get_object_vars( $tags );
}
foreach ( $tags as $k => $tag ) {
$tags[ $k ] = pods_evaluate_tags( $tag, $sanitize );
}
if ( is_object( $tags ) ) {
$tags = get_object_vars( $tags );
$tags = (object) $tags;
// Evaluate array and cast as object.
$tags = (object) pods_evaluate_tags( $tags );
return $tags;
}
$callback = 'pods_evaluate_tag';
if ( true === $sanitize ) {
$callback = 'pods_evaluate_tag_sanitized';
}
return preg_replace_callback( '/({@(.*?)})/m', $callback, (string) $tags );
return preg_replace_callback(
'/({@(.*?)})/m',
function ( $tag ) use ( $sanitize, $fallback ) {
return pods_evaluate_tag( $tag, $sanitize, $fallback );
},
(string) $tags
);
}
/**
* Evaluate tag like magic tag but mapped through pods_v_sanitized
* Evaluate tag like magic tag but mapped through pods_v_sanitized.
*
* @param string|array $tag
* @since 2.1
*
* @return string
* @param string|array $tag String to be evaluated.
*
* @version 2.1
* @return string Evaluated content.
*
* @see pods_evaluate_tag
* @see pods_evaluate_tag
*/
function pods_evaluate_tag_sanitized( $tag ) {
return pods_evaluate_tag( $tag, true );
}
/**
* Evaluate tag like magic tag but mapped through pods_v
* Evaluate tag like magic tag but mapped through pods_v.
*
* @param string|array $tag
* @param bool $sanitize Whether to sanitize tags
* @since 2.1
*
* @return string
* @param string|array $tag String to be evaluated.
* @param bool $sanitize Whether to sanitize tags.
* @param null|mixed $fallback The fallback value to use if not set, should already be sanitized.
*
* @version 2.1
* @return string Evaluated content.
*/
function pods_evaluate_tag( $tag, $sanitize = false ) {
function pods_evaluate_tag( $tag, $sanitize = false, $fallback = null ) {
global $wpdb;
// Handle pods_evaluate_tags
if ( is_array( $tag ) ) {
if ( ! isset( $tag[2] ) && strlen( trim( $tag[2] ) ) < 1 ) {
return '';
if ( ! isset( $tag[2] ) && '' === trim( $tag[2] ) ) {
if ( null === $fallback ) {
return '';
}
return $fallback;
}
$tag = $tag[2];
......@@ -1546,8 +1551,12 @@ function pods_evaluate_tag( $tag, $sanitize = false ) {
$tag = trim( $tag, ' {@}' );
$tag = explode( '.', $tag );
if ( empty( $tag ) || ! isset( $tag[0] ) || strlen( trim( $tag[0] ) ) < 1 ) {
return '';
if ( empty( $tag ) || ! isset( $tag[0] ) || '' === trim( $tag[0] ) ) {
if ( null === $fallback ) {
return '';
}
return $fallback;
}
// Fix formatting that may be after the first .
......@@ -1584,16 +1593,16 @@ function pods_evaluate_tag( $tag, $sanitize = false ) {
);
if ( in_array( $tag[0], $single_supported, true ) ) {
$value = pods_v( '', $tag[0], '', true );
} elseif ( 1 == count( $tag ) ) {
$value = pods_v( $tag[0], 'get', '', true );
} elseif ( 2 == count( $tag ) ) {
$value = pods_v( $tag[1], $tag[0], '', true );
$value = pods_v( '', $tag[0], null );
} elseif ( 1 === count( $tag ) ) {
$value = pods_v( $tag[0], 'get', null );
} elseif ( 2 === count( $tag ) ) {
$value = pods_v( $tag[1], $tag[0], null );
}
$value = apply_filters( 'pods_evaluate_tag', $value, $tag );
$value = apply_filters( 'pods_evaluate_tag', $value, $tag, $fallback );
if ( is_array( $value ) && 1 == count( $value ) ) {
if ( is_array( $value ) && 1 === count( $value ) ) {
$value = current( $value );
}
......@@ -1601,12 +1610,19 @@ function pods_evaluate_tag( $tag, $sanitize = false ) {
$value = pods_serial_comma( $value );
}
if ( null === $value ) {
$value = '';
}
if ( $sanitize ) {
$value = pods_sanitize( $value );
}
return $value;
if ( null !== $fallback && '' === $value ) {
$value = $fallback;
}
return $value;
}
/**
......
......@@ -459,6 +459,21 @@ function pods_api_cache() {
return true;
}
/**
* Determine if Pods shortcodes can evaluate magic tags.
*
* @since 2.7.16
*
* @return bool
*/
function pods_shortcode_allow_evaluate_tags() {
if ( defined( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS' ) && PODS_SHORTCODE_ALLOW_EVALUATE_TAGS ) {
return true;
}
return false;
}
/**
* Marks a function as deprecated and informs when it has been used.
*
......@@ -784,7 +799,8 @@ function pods_shortcode_run( $tags, $content = null ) {
$offset = max( $offset, 0 );
}
$defaults = array(
// Query related tags separated to use later.
$default_query_tags = array(
'use_current' => false,
'name' => null,
'id' => null,
......@@ -806,21 +822,26 @@ function pods_shortcode_run( $tags, $content = null ) {
'filters_location' => 'before',
'pagination_label' => null,
'pagination_location' => 'after',
'field' => null,
'col' => null,
'template' => null,
'pods_page' => null,
'helper' => null,
'form' => null,
'fields' => null,
'label' => null,
'thank_you' => null,
'view' => null,
'cache_mode' => 'none',
'expires' => 0,
'shortcodes' => false,
);
$default_other_tags = array(
'field' => null,
'col' => null,
'template' => null,
'pods_page' => null,
'helper' => null,
'form' => null,
'fields' => null,
'label' => null,
'thank_you' => null,
'view' => null,
'cache_mode' => 'none',
'expires' => 0,
'shortcodes' => false,
);
$defaults = array_merge( $default_other_tags, $default_query_tags );
if ( ! empty( $tags ) ) {
$tags = array_merge( $defaults, $tags );
} else {
......@@ -853,7 +874,9 @@ function pods_shortcode_run( $tags, $content = null ) {
}
if ( ! $tags['use_current'] && empty( $tags['name'] ) ) {
if ( in_the_loop() || is_singular() ) {
$has_query_tags = array_intersect_key( array_diff( $tags, $defaults ), $default_query_tags );
if ( ( in_the_loop() || is_singular() ) && ! $has_query_tags ) {
$pod = pods( get_post_type(), get_the_ID(), false );
if ( ! empty( $pod ) ) {
......@@ -891,16 +914,16 @@ function pods_shortcode_run( $tags, $content = null ) {
if ( ! empty( $tags['slug'] ) ) {
$id = $tags['slug'];
if ( defined( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS' ) && PODS_SHORTCODE_ALLOW_EVALUATE_TAGS ) {
$id = pods_evaluate_tags( $id );
if ( pods_shortcode_allow_evaluate_tags() ) {
$id = pods_evaluate_tags( $id, true );
}
}
if ( ! empty( $tags['id'] ) ) {
$id = $tags['id'];
if ( defined( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS' ) && PODS_SHORTCODE_ALLOW_EVALUATE_TAGS ) {
$id = pods_evaluate_tags( $id );
if ( pods_shortcode_allow_evaluate_tags() ) {
$id = pods_evaluate_tags( $id, true );
}
if ( is_numeric( $id ) ) {
......@@ -937,16 +960,16 @@ function pods_shortcode_run( $tags, $content = null ) {
if ( 0 < strlen( $tags['where'] ) ) {
$params['where'] = $tags['where'];
if ( defined( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS' ) && PODS_SHORTCODE_ALLOW_EVALUATE_TAGS ) {
$params['where'] = pods_evaluate_tags( html_entity_decode( $params['where'] ) );
if ( pods_shortcode_allow_evaluate_tags() ) {
$params['where'] = pods_evaluate_tags( html_entity_decode( $params['where'] ), true, '""' );
}
}
if ( 0 < strlen( $tags['having'] ) ) {
$params['having'] = $tags['having'];
if ( defined( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS' ) && PODS_SHORTCODE_ALLOW_EVALUATE_TAGS ) {
$params['having'] = pods_evaluate_tags( html_entity_decode( $params['having'] ) );
if ( pods_shortcode_allow_evaluate_tags() ) {
$params['having'] = pods_evaluate_tags( html_entity_decode( $params['having'] ), true, '""' );
}
}
......@@ -2154,7 +2177,7 @@ function pods_no_conflict_on( $object_type = 'post', $object = null ) {
$no_conflict['action'] = array(
array( 'transition_post_status', array( PodsInit::$meta, 'save_post_detect_new' ), 10, 3 ),
array( 'save_post', array( PodsInit::$meta, 'save_post' ), 10, 2 ),
array( 'save_post', array( PodsInit::$meta, 'save_post' ), 10, 3 ),
array( 'wp_insert_post_data', array( PodsInit::$meta, 'save_post_track_changed_fields' ), 10, 2 ),
);
} elseif ( 'taxonomy' === $object_type ) {
......
......@@ -3,7 +3,7 @@
Plugin Name: Pods - Custom Content Types and Fields
Plugin URI: https://pods.io/
Description: Pods is a framework for creating, managing, and deploying customized content types and fields
Version: 2.7.15
Version: 2.7.16.1
Author: Pods Framework Team
Author URI: https://pods.io/about/
Text Domain: pods
......@@ -36,7 +36,7 @@ if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) {
add_action( 'init', 'pods_deactivate_pods_ui' );
} else {
// Current version
define( 'PODS_VERSION', '2.7.15' );
define( 'PODS_VERSION', '2.7.16.1' );
// Version tracking between DB updates themselves
define( 'PODS_DB_VERSION', '2.3.5' );
......
......@@ -3,117 +3,130 @@ Contributors: sc0ttkclark, pglewis, jimtrue, keraweb, quasel, jamesgol, ramoonus
Donate link: https://pods.io/friends-of-pods/
Tags: pods, custom post types, custom taxonomies, content types, custom fields, cck, database, user fields, comment fields, media fields, relationships, drupal
Requires at least: 4.5
Tested up to: 5.2
Tested up to: 5.3
Requires PHP: 5.3
Stable tag: 2.7.15
Stable tag: 2.7.16.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Pods is a framework for creating, managing, and deploying customized content types and fields.
== Description ==
Manage all your custom content needs in ONE location with the Pods Framework. You can:
* Create and edit custom post types, taxonomy, fields and extend existing WordPress objects like users, media, posts and pages or extend other plugins' custom post types -- all from Pods.
* Easily display your custom content, whether you want to use shortcodes, widgets, the code-free Pods Template approach, or use standard PHP in WordPress Theme templates and functions.
* Create connections between any of your content to help organize it in logical and useful ways with relationship fields.
Manage all your custom content needs in one location with the Pods Framework.
Let Pods help you grow your development skills and manage content beyond the standard WordPress Posts & Pages. Check out [pods.io](https://pods.io/) for our User Guide, [Support Forum](https://pods.io/forums/), and our [Slack Chat](https://pods.io/chat/) to help you develop with Pods.
* **Create content types** including custom post types, custom taxonomies and advanced content types using custom tables (separate from WordPress)
* **Extend and customize content types** including posts, pages, categories, tags, users, and media
* **Create custom settings pages** easily within seconds
* **Add custom fields** to *any* content type or settings page
* **Show your fields** anywhere using our [shortcodes](https://docs.pods.io/displaying-pods/pods-shortcode/), [widgets](https://pods.io/2015/05/03/podscast-005-templates-shortcodes-widgets-displaying-data-in-pods-pt-3/), the code-free [Pods Template](https://pods.io/2015/05/03/podscast-005-templates-shortcodes-widgets-displaying-data-in-pods-pt-3/) approach, or our [automatic theme integration](https://docs.pods.io/displaying-pods/wordpress-theme-templates/)
* **Create connections** between any of your content with [relationship fields](https://docs.pods.io/fields/relationship-fields/) to keep your content organized
Let Pods help you grow your development skills and manage content beyond the standard WordPress Posts & Pages. Check out our [Documentation](https://docs.pods.io/), [Support Forums](https://wordpress.org/support/plugin/pods/), and our [Live Slack Chat](https://pods.io/chat/) to help you build your dream project with Pods.
= Introduction =
[youtube http://www.youtube.com/watch?v=bYEE2i3nPOM]
= Content types that evolve with your needs =
Create any type of content that you want -- small or large -- we've got you covered. Every content type created with Pods gets all the love it needs to grow up big and strong. You'll get an easy to use interface that lets you manage custom fields and how your content type will function.
We now give you the power you've never before had with a single plugin because we've re-imagined how to manage content types from the ground up.
Create any type of content that you want -- small or large -- we've got you covered. Every content type created with Pods gets all the love it needs to grow up big and strong. You'll get an easy to use interface that lets you manage custom fields and how your content type will look or function.
= Create new content types =
With Pods, you can create entirely new content types:
* Custom Post Types - Content types that look and function like Posts and Pages, but in their own separate areas
* Custom Taxonomies - Content types that look and function like Categories and Tags, but in their own separate areas
* Custom Settings Pages - Create custom admin forms under Settings to help organize your site's custom global settings
* Advanced Content Types - These are entirely separate from WordPress and function off their own database tables
= Extend existing content types =
Not satisfied? How about the power of being able to extend existing content types? We've got you covered with extending these major WordPress objects:
* Post Types - Create and manage fields for any existing Post Type (Posts, Pages, etc), even those created by plugins or themes
* Taxonomies - Create and manage fields for any existing Taxonomies (Categories, Tags, etc), even those created by plugins or themes
* Media - Create and manage fields for your media uploads, easily add additional information and context to any file you want
* Users - Create and manage fields for your user profiles, this is truly the bees knees!
* Comments - Create and manage fields for your visitor comments, easily add fields to fit the way you use comments as reviews and more
With Pods, you can create entirely new content types and settings pages.
= Use our field types, or make your own =
We have a lot of common field types available for you to use, or you can build your own with our extensible field type classes.
* **Custom Post Types** - Content types that look and function like Posts and Pages, but in their own separate sections of WordPress
* **Custom Taxonomies** - Content types that look and function like Categories and Tags, but in their own separate sections of WordPress
* **Custom Settings Pages** - Create custom settings under Settings menu to help organize your site's custom global settings
* **Advanced Content Types** - These are entirely separate from WordPress and function off their own database tables (much like the [Drupal CCK](https://www.drupal.org/project/cck))
Each of these field type have their own set of options, if those aren't enough they are also easily extended:
= Extend existing content types =
* Date / Time - Date, Time, or both
* Number - Plain Number or Currency
* Text - Plain Text, Website, Phone, E-mail, or Password
* Paragraph Text - Plain Paragraph, WYSIWYG (TinyMCE or CLEditor, or add your own), or Code (Syntax Highlighting)
* Color Picker - Choose colors, because colors are great
* Yes / No - You can't really go wrong with a checkbox, but we've added a few charms to make it stand out
* File / Image / Video - Upload new media or select from existing ones with our Media Library integration, or use a simple uploader, your choice
* Avatars - Upload new media or select from existing ones, automatically integrates with get_avatar calls for Users extended by Pods
* Relationships - Relate any item, to any item of any WP object type, another Pod, or a custom user-defined list -- with bidirectional relationships
Need to customize your existing content types in WordPress? We offer the ability to extend existing content types across all of WordPress:
* **Post Types** - Customize and create/manage fields for any existing post type -- Posts, Pages, and even those created by plugins or themes
* **Taxonomies** - Customize and create/manage fields for any existing taxonomy -- Categories, Tags, and even those created by plugins or themes
* **Media** - Create and manage fields for your media uploads to enable you to fill in additional information and context to any image/file you want
* **Users** - Create and manage fields for your user/author profiles
* **Comments** - Create and manage fields for your visitor comments, easily add fields to fit the way you use comments as reviews and more
= Field Types =
We have an extensive collection of fields that you can leverage to build the perfect content structure for your site. You can also build your own custom field types with our extensible field type classes.
* **Text**
* Plain Text
* Website
* Phone
* E-mail
* Password
* **Paragraph**
* Plain Paragraph Text
* WYSIWYG (Visual Editor)
* Code (Syntax Highlighting)
* **Date / Time**
* Date and Time
* Date
* Time
* **Number**
* Plain Number
* Currency (30+ international currencies)
* **Relationships / Media**
* File / Image / Video
* Avatar (for extended Users)
* oEmbed
* Relationship
* **Checkbox** (Yes / No)
* **Color Picker**
= Relationships to rule the world with =
* Custom defined list
* Post Types
* Taxonomies
* Users
* User Roles
* User Capabilities
* Media
* Comments
The power is in your hands with our comprehensive support to **relate your content to anything**.
And many other relationships are also available including:
* Image Sizes
* Navigation Menus
* Post Formats
* Post Status
* Sidebars
* Countries (predefined)
* US States (predefined)
* Days of Week (predefined)
* Months of Year (predefined)
= Easily display your content =
There are several ways to get Pods data to show up throughout your site, but with any WP object type you create or extend with Pods, you can use all of the functions and methods you're already used to with the core WordPress API / Loop -- out of the box!
* **Custom defined lists** of text options
* Relate to **Post Type** content
* Relate to **Taxonomy** content
* Relate to any **User** profile
* Relate to **User Roles**
* Relate to **User Capabilities**
* Relate to **Media** attachments
* Relate to any **Comment**
Additionally, we have a United Theming API that lets you theme your content types across every type of Pod, regardless if it's a post type or taxonomy or user, or.. you get the picture.
And many other relationships are also available including:
= Customized Management Panels =
Utilize Pods UI (included in Pods 1.10+) to build your own Custom Management panels for your Pods.
* **Image Sizes**
* **Navigation Menus**
* **Post Formats**
* **Post Status**
* Relate to content within **any Database Table**
* **Themes**
* **Page Templates**
* **Sidebars**
* **Post Type Objects** (choose the post type itself)
* **Taxonomy Objects** (choose the taxonomy itself)
* **Countries** (predefined)
* **US States** (predefined)
* **Canadian Provinces** (predefined)
* **Calendar - Days of Week** (predefined)
* **Calendar - Months of Year** (predefined)
= Optional Components to do even more =
You can enable some of our included components to extend your WordPress site even further:
* Roles and Capabilities - Create or edit Roles for your site, and customize their corresponding capabilities
* Pages - Create custom pages that function off of your site's path, with wildcard support, and choose the Page Template to use
* Templates - Use our template engine to create templates that can be handed off to clients for carefree management
* Helpers - Customize how Pods works right from the admin area with simple to advanced reusable code snippets
* Advanced Content Types - These types of content were built into Pods prior to 2.3, but are now optionally enabled
* Table Storage - Enable table-based storage for custom fields on Post Types, Media, Users, and Comments. Also adds the ability to add custom fields to Taxonomies
* Advanced Relationships - Add advanced relationship objects for relating to including Database Tables, Multisite Networks, Multisite Sites, Themes, Page Templates, Sidebars, Post Type Objects, and Taxonomy Objects
* Markdown Syntax - Parses Markdown Syntax for Paragraph Text / WYSIWYG fields
* Builder theme integration - Use our tightly integrated modules for Builder in your layouts
= Migrate to Pods, find out what you've been missing =
Using another solution? We've built additional components to help you transition:
* Import from Custom Post Type UI
* More imports coming soon including Importing from Custom Field Suite, Advanced Custom Fields, and Custom Tables
* **Roles and Capabilities** - Create or edit Roles for your site, and customize their corresponding capabilities
* **Templates** - Use our template engine to create templates that can be handed off to clients for care-free management
* **Advanced Relationships** - Add advanced relationship objects for relating to including Database Tables, Multisite Networks, Multisite Sites, Themes, Page Templates, Sidebars, Post Type Objects, and Taxonomy Objects
* **Advanced Content Types** - These types of content were built into Pods prior to 2.3, but are now optionally enabled
* **Table Storage** - Enable table-based storage for custom fields on Post Types, Media, Users, and Comments. Also adds the ability to add custom fields to Taxonomies
* **Markdown Syntax** - Parses Markdown Syntax for Paragraph Text / WYSIWYG fields
* **Pages** - Create custom pages that function off of your site's URL path, with wildcard support, and choose the Page Template to use
= Plays well with others =
We also do our best to integrate and play nicely with other projects:
* Plugins we've integrated with
* **Plugins we've integrated with**
* [Tabify Edit Screen](http://wordpress.org/plugins/tabify-edit-screen/)
* [Codepress Admin Columns](http://wordpress.org/plugins/codepress-admin-columns/)
* [Polylang](http://wordpress.org/plugins/polylang/)
......@@ -123,7 +136,7 @@ We also do our best to integrate and play nicely with other projects:
* [Timber](http://upstatement.com/timber/)
* [Gravity Forms](http://www.gravityforms.com/) Using the [Pods Gravity Forms Add-on](https://wordpress.org/plugins/pods-gravity-forms/)
* [Beaver Builder](https://www.wpbeaverbuilder.com/) and [Beaver Themer](https://www.wpbeaverbuilder.com/beaver-themer/) Using the [Pods Beaver Themer Add-On](https://wordpress.org/plugins/pods-beaver-builder-themer-add-on/)
* Themes we've integrated with
* **Themes we've integrated with**
* [Builder](http://www.ithemes.com/) (iThemes)
* [Genesis](http://www.studiopress.com/) (StudioPress)
......@@ -140,7 +153,7 @@ OR you can just install it with WordPress by going to Plugins >> Add New >> and
= Where do we go for Support on your plugin? =
Our primary Support is handled through our Support Forums at [https://pods.io/forums/](https://pods.io/forums/). For the fastest support, you can contact us on our Slack Chat at [https://pods.io/chat/](https://pods.io/chat/) in the #support channel. We do not staff our Slack channel 24 hours, but we do check any questions that come through daily and reply to any unanswered questions.
Our primary Support is handled through our [Support Forums](https://wordpress.org/support/plugin/pods/). For the fastest support, you can contact us on our [Live Slack Chat](https://pods.io/chat/) in the #support channel. We do not staff our Slack channel 24/7, but we do check any questions that come through daily and reply to any unanswered questions.
We do have a community of Pods users and developers that hang out on Slack so you're sure to get an answer quickly. We answer our Forum questions once a week with follow-up during the week as we're prioritizing resources towards restructuring and improving our documentation.
......@@ -150,7 +163,7 @@ If you’ve uncovered a Bug or have a Feature Request, we kindly request you to
= Will Pods work with my Theme? =
We don't provide any special CSS or display attributes with your custom content so as long as your theme works with WordPress standard functions and the [WordPress Template Hierarchy](https://wphierarchy.com), you should be fine. You may need to create special PHP WordPress Theme Templates for your content, or you can use our Pods Templates and the Auto Template option to display your 'template' containing your custom content where your theme normally outputs `the_content` filter.
Most likely the answer is yes. We don't require any special CSS or display attributes to use Pods with your theme so you should have little to no difficulty showing your content in your theme. If you encounter any issues, contact your theme developer and ask them about their support for the standard WordPress theming functions and how to use [WordPress Template Hierarchy](https://wphierarchy.com) with their theme.
== Screenshots ==
......@@ -165,20 +178,50 @@ We don't provide any special CSS or display attributes with your custom content
== Contributors ==
Pods really wouldn't be where it is without all of the contributions both financially and through code / time. Check out our GitHub for a list of contributors, or search our GitHub issues to see everyone involved in adding features, fixing bugs, or reporting issues/testing.
[github.com/pods-framework/pods/graphs/contributors](https://github.com/pods-framework/pods/graphs/contributors)
Pods really wouldn't be where it is without all of the contributions from our [donors](https://friends.pods.io) and [code/support contributors](https://github.com/pods-framework/pods/graphs/contributors).
== Translations ==
Many thanks go out to the fine folks who have helped us translate Pods into other languages other than English!
Many thanks go out to the fine folks who have helped us translate Pods into many other languages.
Join us in further translating the Pods interface at: [https://translate.wordpress.org/projects/wp-plugins/pods](https://translate.wordpress.org/projects/wp-plugins/pods)
We also have a dedicated [Slack Chat](https://pods.io/chat/) channel to help our translators get started and to support them on the process.
We are also available through our [Live Slack Chat](https://pods.io/chat/) to help our translators get started and to support them on the process.
== Changelog ==
= 2.7.16.1 - November 13th 2019 =
* Fixed: Reverted changes in #5289 to auto templates that introduced breaking changes. We will revisit this in a future maintenance release. #5531
= 2.7.16 - November 13th 2019 =
**Enhancements**
* Enhancement: CSS fixes for WP 5.3. #5501 (@JoryHogeveen)
* Enhancement: Format traversed fields properly. #4932 (@jamesgol)
* Enhancement: ACT list view pagination. #5510 (@JoryHogeveen)
* Enhancement: Add PODS_SHORTCODE_ALLOW_EVALUATE_TAGS to debug info. #5310 (@JoryHogeveen)
**Bug Fixes**
* Fixed: Avoid SQL errors when using special magic tags. #5310 (@sc0ttkclark)
* Fixed: Validate shortcode query tags before default to current object. #5520 (@JoryHogeveen)
* Fixed: Unslash simple relationship values to support saving quoted values. #5517 (@JoryHogeveen)
* Fixed: Add sanitize_title optional to sluggables instead of applying default. #5516 (@JoryHogeveen)
* Fixed: DateTime: Always parse any manual input data. Also fixes clearing values. #5488 (@JoryHogeveen)
* Fixed: DateTime: jQuery date & time picker overlapping formats. #5467 (@JoryHogeveen)
* Fixed: DateTime: Fix datetime-local HTML5 input format. #5460 (@JoryHogeveen)
* Fixed: Could not submit a form if required checkbox not ticked. #5481 (@Turkal)
* Fixed: Allow migrate packages to import pages. #5476 (@jamesgol)
* Fixed: Allow pods_str_replace() function to handle non-strings. #5254 (@jamesgol)
* Fixed: Refactor and fix issues with Advanced Content Types capabilities. #5504 (@JoryHogeveen)
* Fixed: Add `object` key to prevent undefined index notice. #5493 (@JoryHogeveen)
* Fixed: Make sure number of arguments passed to PodsMeta->save_post() is correct. #5512 (@jamesgol)
* Fixed: ACT pagination URL for child type. #5510 (@JoryHogeveen)
* Fixed: Custom table relationships SQL error. #5505 (@JoryHogeveen)
* Fixed: Allow Pods to ALTER table if the SQL field definition has changed. #5507 (@jamesgol)
* Fixed: Admin menu: set hook priority to 9 instead of 99 to fix CPT submenu placement. #5497 (@JoryHogeveen)
* Fixed: Make auto templates for a Taxonomy Pod behave sensibly. #5289 (@gwhitney, @sc0ttkclark, @JoryHogeveen)
= 2.7.15 - September 5th 2019 =
**Enhancements**
......
......@@ -80,7 +80,7 @@ $pick_object = trim( pods_v_sanitized( 'pick_object', $field ) . '-' . pods_v_sa
'maxlength' => 50,
'data-sluggable' => 'field_data[' . $pods_i . '][label]',
),
'class' => 'pods-validate pods-validate-required pods-slugged-lower',
'class' => 'pods-validate pods-validate-required pods-slugged-lower pods-slugged-sanitize-title',
)
);
?>
......
......@@ -45,7 +45,7 @@ $args = array(
if ( $use_date ) {
$args['dateFormat'] = PodsForm::field_method( $form_field_type, 'format_date', $options, true );
$args['altFormat'] = PodsForm::field_method( $form_field_type, 'convert_format', $mysql_date_format );
$args['altFormat'] = PodsForm::field_method( $form_field_type, 'convert_format', $mysql_date_format, array( 'type' => 'date' ) );
$args['changeMonth'] = true;
$args['changeYear'] = true;
$args['firstDay'] = (int) get_option( 'start_of_week', 0 );
......@@ -57,8 +57,9 @@ if ( $use_date ) {
}
if ( $use_time ) {
$args['timeFormat'] = PodsForm::field_method( $form_field_type, 'format_time', $options, true );
$args['altTimeFormat'] = PodsForm::field_method( $form_field_type, 'convert_format', $mysql_time_format );
$args['altTimeFormat'] = PodsForm::field_method( $form_field_type, 'convert_format', $mysql_time_format, array( 'type' => 'time' ) );
$args['ampm'] = ( false !== stripos( $args['timeFormat'], 'tt' ) );
$args['parse'] = 'loose';
}
$mysql_format = '';
......@@ -97,7 +98,7 @@ switch ( $form_field_type ) {
$date = PodsForm::field_method( $form_field_type, 'createFromFormat', $format, (string) $value );
$date_default = PodsForm::field_method( $form_field_type, 'createFromFormat', $mysql_format, (string) $value );
$formatted_value = $value;
$formatted_value = PodsForm::field_method( $form_field_type, 'format_value_display', $value, $options, true );
$mysql_value = $value;
$empty_values = array(
......@@ -126,8 +127,13 @@ if (
}
if ( $html5 ) {
// HTML5 uses mysql date format.
$value = $mysql_value;
/**
* HTML5 uses mysql date format separated with a T.
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
*/
$value = str_replace( ' ', 'T', $mysql_value );
} else {
$value = $formatted_value;
}
}
......@@ -146,15 +152,11 @@ $attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type,
<input<?php PodsForm::attributes( $attributes, $name, $form_field_type, $options ); ?> />
<script>
jQuery( function () {
var $container = jQuery( '<div>' ).appendTo( 'body' ).addClass( 'pods-compat-container' ),
$element = jQuery( 'input#<?php echo esc_js( $attributes['id'] ); ?>' ),
beforeShow = {
'beforeShow': function( textbox, instance) {
jQuery( '#ui-datepicker-div' ).appendTo( $container );
}
},
args = jQuery.extend( <?php echo json_encode( $args ); ?>, beforeShow );
jQuery( function ( $ ) {
var $container = $( '<div>' ).appendTo( 'body' ).addClass( 'pods-compat-container' ),
$element = $( 'input#<?php echo esc_js( $attributes['id'] ); ?>' ),
$alt = null,
args = <?php echo wp_json_encode( $args ); ?>;
<?php
if ( 'text' !== $type ) {
......@@ -165,38 +167,44 @@ $attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type,
input.setAttribute( 'type', '<?php echo $type; ?>' );
var notADateValue = 'not-a-date';
input.setAttribute('value', notADateValue);
input.setAttribute( 'value', notADateValue );
return (input.value !== notADateValue);
return ( input.value !== notADateValue );
}
if ( ! podsCheckHtml5() ) {
args = altField( args, $element );
$element.val( '<?php echo esc_js( $formatted_value ); ?>' );
$element.<?php echo esc_js( $method ); ?>( args );
jQueryField();
}
<?php
} else {
?>
args = altField( args, $element );
$element.<?php echo esc_js( $method ); ?>( args );
jQueryField();
<?php
}//end if
} //end if
?>
function altField( args, el ) {
var $el = $( el ),
$alt = $el.clone();
function jQueryField() {
// Create alt field.
$alt = $element.clone();
$alt.attr( 'type', 'hidden' );
$alt.val( '<?php echo esc_attr( $mysql_value ) ?>' );
$el.after( $alt );
$el.attr( 'name', $el.attr( 'name' ) + '__ui' );
$el.attr( 'id', $el.attr( 'id' ) + '__ui' );
$element.after( $alt );
$element.attr( 'name', $element.attr( 'name' ) + '__ui' );
$element.attr( 'id', $element.attr( 'id' ) + '__ui' );
// Add alt field option.
args.altField = 'input#' + $alt.attr( 'id' );
// Fix manual user input changes.
args.onClose = function() {
$element.<?php echo esc_js( $method ); ?>( 'setDate', $element.val() );
};
// Wrapper.
args.beforeShow = function( textbox, instance ) {
$( '#ui-datepicker-div' ).appendTo( $container );
};
return args;
};
$element.<?php echo esc_js( $method ); ?>( args );
}
} );
</script>
......@@ -513,40 +513,55 @@
sluggable_single : function ( sluggable ) {
var $slug = $( 'input[name="' + sluggable.replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]' );
if ( $slug[ 0 ] ) {
$( 'form' ).on( 'change', 'input[name="' + sluggable.replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]', function () {
if ( 0 < $( this ).val().length ) {
var slug = $( this ).val();
slug = slug.replace( /<( ?:. )*?>/g, '' ).replace( /([^0-9a-zA-Z\_\- ])/g, '' );
// update fields
$( 'input.pods-slugged[data-sluggable="' + $( this ).prop( 'name' ).replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]' ).each( function () {
if ( '' === $( this ).val() ) {
$( this ).val( slug.charAt( 0 ).toUpperCase() + slug.slice( 1 ) );
$( this ).trigger( 'change' );
}
} );
$( 'input.pods-slugged-lower[data-sluggable="' + $( this ).prop( 'name' ).replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]' ).each( function () {
if ( '' === $( this ).val() ) {
$( this ).val( slug.toLowerCase() );
$( this ).trigger( 'change' );
}
if ( $slug.length ) {
$slug.on( 'change', function () {
// Strip HTML/code.
var slug = $( this ).val().replace( /<( ?:. )*?>/g, '' ),
name = $( this ).prop( 'name' ).replace( '[', '\\[' ).replace( ']', '\\]' );
if ( slug.length ) {
var slug_lower = slug.toLowerCase(),
slug_sanitized = slug.replace( /([^0-9a-zA-Z\_\- ])/g, '' ),
slug_sanitized_lower = slug_sanitized.toLowerCase();
slug = slug.charAt( 0 ).toUpperCase() + slug.slice( 1 );
// Update elements and trigger change.
$( '.pods-slugged[data-sluggable="' + name + '"], .pods-slugged-lower[data-sluggable="' + name + '"]' ).each( function() {
var $this = $( this ),
lowercase = $this.hasClass( 'pods-slugged-lower' ),
sanitize_title = $this.hasClass( 'pods-slugged-sanitize-title' ),
val = slug;
if ( sanitize_title ) {
val = slug_sanitized;
if ( lowercase ) {
val = slug_sanitized_lower;
}
} else if ( lowercase ) {
val = slug_lower;
}
switch ( this.nodeName.toLowerCase() ) {
case 'input':
case 'textarea':
// Update fields.
if ( '' === $this.val() ) {
$this.val( val );
}
break;
default:
// Update html.
$this.html( val );
break;
}
$this.trigger( 'change' );
} );
// update elements and trigger change
$( '.pods-slugged-lower[data-sluggable="' + $( this ).prop( 'name' ).replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]:not(input )' )
.html( slug.toLowerCase() )
.trigger( 'change' );
// trigger change
$( '.pods-slugged[data-sluggable="' + $( this ).prop( 'name' ).replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]:not(input )' )
.html( slug.charAt( 0 ).toUpperCase() + slug.slice( 1 ) )
.trigger( 'change' );
}
} );
if ( 0 < $slug.val().length ) {
if ( $slug.val().length ) {
$slug.trigger( 'change' );
}
}
......
......@@ -28,9 +28,6 @@ export const IframeFrame = wp.media.view.Frame.extend( {
this.on( 'title:create:default', this.createTitle, this );
this.title.mode( 'default' );
this.on( 'title:render', function ( view ) {
view.$el.append( '<span class="dashicons dashicons-arrow-down"></span>' );
} );
},
initState: function () {
......
......@@ -77,10 +77,16 @@
</nav>
<?php
$blogID = get_current_blog_id();
$inEmployers = get_post_meta( $post->ID, 'section', true) == 'employers';
$phone = '+37064902392';
$phoneUI = '+370 649 02392';
if ($blogID == 1 && $inEmployers):
$phone = '+37065553216';
$phoneUI = '+370 655 53216';
endif;
if ($blogID == 2):
$phone = '+37166100328';
$phoneUI = '+371 661 00328';
......@@ -99,7 +105,7 @@
<?php
global $post;
if ( get_post_meta( $post->ID, 'section', true) == 'employers'):
if ( $inEmployers ):
$contactsPage = new WP_Query( array(
'numberposts' => 1,
'post_type' => 'page',
......
......@@ -14,7 +14,7 @@ wp core update-db --network;
wp plugin update loco-translate --version=2.3.1;
# wp plugin install pods --version=2.7.15 --activate-network;
wp plugin update pods --version=2.7.15;
wp plugin update pods --version=2.7.16.1;
# wp plugin install polylang --version=2.6.6 --activate-network;
wp plugin update polylang --version=2.6.6;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment