Example #1
0
 /**
  * Save a comment and it's meta
  *
  * @param array $comment_data All comment data to be saved (using wp_insert_comment / wp_update_comment)
  * @param array $comment_meta (optional) All meta to be saved (set value to null to delete)
  * @param bool $strict (optional) Whether to delete previously saved meta not in $comment_meta
  * @param bool $sanitized (optional) Will unsanitize the data, should be passed if the data is sanitized before sending.
  * @param array $fields (optional) The array of fields and their options, for further processing with
  *
  * @return int Comment ID
  *
  * @since 2.0
  */
 public function save_comment($comment_data, $comment_meta = null, $strict = false, $sanitized = false, $fields = array())
 {
     if (!is_array($comment_data) || empty($comment_data)) {
         return pods_error(__('Comment data is required but is either invalid or empty', 'pods'), $this);
     }
     $conflicted = pods_no_conflict_check('comment');
     if (!$conflicted) {
         pods_no_conflict_on('comment');
     }
     if (!is_array($comment_meta)) {
         $comment_meta = array();
     }
     if ($sanitized) {
         $comment_data = pods_unsanitize($comment_data);
         $comment_meta = pods_unsanitize($comment_meta);
     }
     if (!isset($comment_data['comment_ID']) || empty($comment_data['comment_ID'])) {
         $comment_data['comment_ID'] = wp_insert_comment(pods_slash($comment_data));
     } elseif (1 < count($comment_data)) {
         wp_update_comment($comment_data);
     }
     if (is_wp_error($comment_data['comment_ID'])) {
         if (!$conflicted) {
             pods_no_conflict_off('comment');
         }
         /**
          * @var $comment_error WP_Error
          */
         $comment_error = $comment_data['comment_ID'];
         return pods_error($comment_error->get_error_message(), $this);
     }
     $this->save_comment_meta($comment_data['comment_ID'], $comment_meta, $strict, $fields);
     if (!$conflicted) {
         pods_no_conflict_off('comment');
     }
     return $comment_data['comment_ID'];
 }
        $( document ).Pods( 'sluggable' );
        $( document ).Pods( 'sortable' );
        $( document ).Pods( 'collapsible', $( 'tbody.pods-manage-list tr.flexible-row div.pods-manage-field' ) );
        $( document ).Pods( 'toggled' );
        $( document ).Pods( 'tabbed' );
        $( document ).Pods( 'nav_tabbed' );
        $( document ).Pods( 'dependency' );
        $( document ).Pods( 'flexible', $( 'tbody.pods-manage-list tr.flexible-row' ) );
        $( document ).Pods( 'confirm' );
        $( document ).Pods( 'exit_confirm' );
    } );

    var pods_admin_submit_callback = function ( id ) {
        id = parseInt( id );
        var thank_you = '<?php 
echo pods_slash(pods_query_arg(array('do' => 'save')));
?>
';

        document.location = thank_you.replace( 'X_ID_X', id );
    }

    var pods_sister_field_going = {

    };

    var pods_sister_field = function ( $el ) {
        var id = $el.closest( 'tr.pods-manage-row' ).data( 'row' );

        if ( 'undefined' != typeof pods_sister_field_going[ id + '_' + $el.prop( 'id' ) ] && true == pods_sister_field_going[ id + '_' + $el.prop( 'id' ) ] )
            return;
Example #3
0
        var ajaxurl = '<?php 
echo admin_url('admin-ajax.php');
?>
';
    }

    jQuery( function ( $ ) {
        $( document ).Pods( 'validate' );
        $( document ).Pods( 'submit' );
        $( document ).Pods( 'dependency' );
        $( document ).Pods( 'confirm' );
        $( document ).Pods( 'exit_confirm' );
    } );

    var pods_admin_submit_callback = function ( id ) {
        id = parseInt( id );
        var thank_you = '<?php 
echo pods_slash($thank_you);
?>
';
        var thank_you_alt = '<?php 
echo pods_slash($thank_you_alt);
?>
';

        if ( 'NaN' == id )
            document.location = thank_you_alt.replace( 'X_ID_X', 0 );
        else
            document.location = thank_you.replace( 'X_ID_X', id );
    }
</script>
    /**
     * @param bool $reorder
     *
     * @return mixed|null
     */
    public function manage($reorder = false)
    {
        if (false !== $this->callback_action('manage', $reorder)) {
            return null;
        }
        if (!empty($this->action_bulk) && !empty($this->actions_bulk) && isset($this->actions_bulk[$this->action_bulk]) && !in_array($this->action_bulk, $this->actions_disabled) && !empty($this->bulk)) {
            if (empty($_REQUEST['_wpnonce' . $this->num]) || false === wp_verify_nonce($_REQUEST['_wpnonce' . $this->num], 'pods-ui-action-bulk')) {
                pods_message(__('Invalid bulk request, please try again.', 'pods'));
            } elseif (false !== $this->callback_bulk($this->action_bulk, $this->bulk)) {
                return null;
            } elseif ('delete' == $this->action_bulk) {
                return $this->delete_bulk();
            }
        }
        $this->screen_meta();
        if (true === $reorder) {
            wp_enqueue_script('jquery-ui-sortable');
        }
        ?>
    <div class="wrap pods-admin pods-ui">
        <div id="icon-edit-pages" class="icon32"<?php 
        if (false !== $this->icon) {
            ?>
 style="background-position:0 0;background-size:100%;background-image:url(<?php 
            echo esc_url($this->icon);
            ?>
);"<?php 
        }
        ?>
><br /></div>
        <h2>
            <?php 
        if (true === $reorder) {
            echo $this->header['reorder'];
            $link = pods_query_arg(array('action' . $this->num => 'manage', 'id' . $this->num => ''), self::$allowed, $this->exclusion());
            if (!empty($this->action_links['manage'])) {
                $link = $this->action_links['manage'];
            }
            ?>
                <small>(<a href="<?php 
            echo esc_url($link);
            ?>
">&laquo; <?php 
            echo sprintf(__('Back to %s', 'pods'), $this->heading['manage']);
            ?>
</a>)</small>
                <?php 
        } else {
            echo $this->header['manage'];
        }
        if (!in_array('add', $this->actions_disabled) && !in_array('add', $this->actions_hidden)) {
            $link = pods_query_arg(array('action' . $this->num => 'add', 'id' . $this->num => '', 'do' . $this->num => ''), self::$allowed, $this->exclusion());
            if (!empty($this->action_links['add'])) {
                $link = $this->action_links['add'];
            }
            ?>
                <a href="<?php 
            echo esc_url($link);
            ?>
" class="add-new-h2"><?php 
            echo $this->label['add_new'];
            ?>
</a>
                <?php 
        }
        if (!in_array('reorder', $this->actions_disabled) && !in_array('reorder', $this->actions_hidden) && false !== $this->reorder['on']) {
            $link = pods_query_arg(array('action' . $this->num => 'reorder'), self::$allowed, $this->exclusion());
            if (!empty($this->action_links['reorder'])) {
                $link = $this->action_links['reorder'];
            }
            ?>
                <a href="<?php 
            echo esc_url($link);
            ?>
" class="add-new-h2"><?php 
            echo $this->label['reorder'];
            ?>
</a>
                <?php 
        }
        ?>
        </h2>

		<form id="posts-filter" action="" method="get">
        	<?php 
        $excluded_filters = array('search' . $this->num, 'pg' . $this->num, 'action' . $this->num, 'action_bulk' . $this->num, 'action_bulk_ids' . $this->num, '_wpnonce' . $this->num);
        $filters = $this->filters;
        foreach ($filters as $k => $filter) {
            if (isset($this->pod->fields[$filter])) {
                $filter_field = $this->pod->fields[$filter];
            } elseif (isset($this->fields['manage'][$filter])) {
                $filter_field = $this->fields['manage'][$filter];
            } else {
                unset($filters[$k]);
                continue;
            }
            if (in_array($filter_field['type'], array('date', 'datetime', 'time'))) {
                if ('' == pods_var_raw('filter_' . $filter . '_start', 'get', '', null, true) && '' == pods_var_raw('filter_' . $filter . '_end', 'get', '', null, true)) {
                    unset($filters[$k]);
                    continue;
                }
            } elseif ('' === pods_var_raw('filter_' . $filter, 'get', '')) {
                unset($filters[$k]);
                continue;
            }
            $excluded_filters[] = 'filter_' . $filter . '_start';
            $excluded_filters[] = 'filter_' . $filter . '_end';
            $excluded_filters[] = 'filter_' . $filter;
        }
        $get = $_GET;
        foreach ($get as $k => $v) {
            if (is_array($v) || in_array($k, $excluded_filters) || strlen($v) < 1) {
                continue;
            }
            ?>
				<input type="hidden" name="<?php 
            echo esc_attr($k);
            ?>
" value="<?php 
            echo esc_attr($v);
            ?>
" />
			<?php 
        }
        if (false !== $this->callback('header', $reorder)) {
            return null;
        }
        if (false === $this->data) {
            $this->get_data();
        } elseif ($this->sortable) {
            // we have the data already as an array
            $this->sort_data();
        }
        if (!in_array('export', $this->actions_disabled) && 'export' == $this->action) {
            $this->export();
        }
        if ((!empty($this->data) || false !== $this->search || $this->filters_enhanced && !empty($this->views)) && ($this->filters_enhanced && !empty($this->views) || false !== $this->searchable)) {
            if ($this->filters_enhanced) {
                $this->filters();
            } else {
                ?>
                <p class="search-box" align="right">
                    <?php 
                $excluded_filters = array('search' . $this->num, 'pg' . $this->num);
                foreach ($this->filters as $filter) {
                    $excluded_filters[] = 'filter_' . $filter . '_start';
                    $excluded_filters[] = 'filter_' . $filter . '_end';
                    $excluded_filters[] = 'filter_' . $filter;
                }
                $this->hidden_vars($excluded_filters);
                foreach ($this->filters as $filter) {
                    if (isset($this->pod->fields[$filter])) {
                        $filter_field = $this->pod->fields[$filter];
                    } elseif (isset($this->fields['manage'][$filter])) {
                        $filter_field = $this->fields['manage'][$filter];
                    } else {
                        continue;
                    }
                    if (in_array($filter_field['type'], array('date', 'datetime', 'time'))) {
                        $start = pods_var_raw('filter_' . $filter . '_start', 'get', pods_var_raw('filter_default', $filter_field, '', null, true), null, true);
                        $end = pods_var_raw('filter_' . $filter . '_end', 'get', pods_var_raw('filter_ongoing_default', $filter_field, '', null, true), null, true);
                        // override default value
                        $filter_field['options']['default_value'] = '';
                        $filter_field['options'][$filter_field['type'] . '_allow_empty'] = 1;
                        if (!empty($start) && !in_array($start, array('0000-00-00', '0000-00-00 00:00:00', '00:00:00'))) {
                            $start = PodsForm::field_method($filter_field['type'], 'convert_date', $start, 'n/j/Y');
                        }
                        if (!empty($end) && !in_array($end, array('0000-00-00', '0000-00-00 00:00:00', '00:00:00'))) {
                            $end = PodsForm::field_method($filter_field['type'], 'convert_date', $end, 'n/j/Y');
                        }
                        ?>
                        <label for="pods-form-ui-filter-<?php 
                        echo esc_attr($filter);
                        ?>
_start">
                            <?php 
                        echo $filter_field['label'];
                        ?>
                        </label>
                        <?php 
                        echo PodsForm::field('filter_' . $filter . '_start', $start, $filter_field['type'], $filter_field);
                        ?>

                        <label for="pods-form-ui-filter-<?php 
                        echo esc_attr($filter);
                        ?>
_end">
                            to
                        </label>
                    <?php 
                        echo PodsForm::field('filter_' . $filter . '_end', $end, $filter_field['type'], $filter_field);
                    } elseif ('pick' == $filter_field['type']) {
                        $value = pods_var_raw('filter_' . $filter, 'get');
                        if (strlen($value) < 1) {
                            $value = pods_var_raw('filter_default', $filter_field);
                        }
                        // override default value
                        $filter_field['options']['default_value'] = '';
                        $filter_field['options']['pick_format_type'] = 'single';
                        $filter_field['options']['pick_format_single'] = 'dropdown';
                        $filter_field['options']['input_helper'] = pods_var_raw('ui_input_helper', pods_var_raw('options', pods_var_raw($filter, $this->fields['search'], array(), null, true), array(), null, true), '', null, true);
                        $filter_field['options']['input_helper'] = pods_var_raw('ui_input_helper', $filter_field['options'], $filter_field['options']['input_helper'], null, true);
                        $options = array_merge($filter_field, $filter_field['options']);
                        ?>
                        <label for="pods-form-ui-filter-<?php 
                        echo esc_attr($filter);
                        ?>
">
                            <?php 
                        echo $filter_field['label'];
                        ?>
                        </label>
                    <?php 
                        echo PodsForm::field('filter_' . $filter, $value, 'pick', $options);
                    } elseif ('boolean' == $filter_field['type']) {
                        $value = pods_var_raw('filter_' . $filter, 'get', '');
                        if (strlen($value) < 1) {
                            $value = pods_var_raw('filter_default', $filter_field);
                        }
                        // override default value
                        $filter_field['options']['default_value'] = '';
                        $filter_field['options']['pick_format_type'] = 'single';
                        $filter_field['options']['pick_format_single'] = 'dropdown';
                        $filter_field['options']['pick_object'] = 'custom-simple';
                        $filter_field['options']['pick_custom'] = array('1' => pods_var_raw('boolean_yes_label', $filter_field['options'], __('Yes', 'pods'), null, true), '0' => pods_var_raw('boolean_no_label', $filter_field['options'], __('No', 'pods'), null, true));
                        $filter_field['options']['input_helper'] = pods_var_raw('ui_input_helper', pods_var_raw('options', pods_var_raw($filter, $this->fields['search'], array(), null, true), array(), null, true), '', null, true);
                        $filter_field['options']['input_helper'] = pods_var_raw('ui_input_helper', $filter_field['options'], $filter_field['options']['input_helper'], null, true);
                        $options = array_merge($filter_field, $filter_field['options']);
                        ?>
                        <label for="pods-form-ui-filter-<?php 
                        echo esc_attr($filter);
                        ?>
">
                            <?php 
                        echo $filter_field['label'];
                        ?>
                        </label>
                    <?php 
                        echo PodsForm::field('filter_' . $filter, $value, 'pick', $options);
                    } else {
                        $value = pods_var_raw('filter_' . $filter, 'get');
                        if (strlen($value) < 1) {
                            $value = pods_var_raw('filter_default', $filter_field);
                        }
                        // override default value
                        $filter_field['options']['default_value'] = '';
                        $options = array();
                        $options['input_helper'] = pods_var_raw('ui_input_helper', pods_var_raw('options', pods_var_raw($filter, $this->fields['search'], array(), null, true), array(), null, true), '', null, true);
                        $options['input_helper'] = pods_var_raw('ui_input_helper', $options, $options['input_helper'], null, true);
                        ?>
                        <label for="pods-form-ui-filter-<?php 
                        echo esc_attr($filter);
                        ?>
">
                            <?php 
                        echo $filter_field['label'];
                        ?>
                        </label>
                    <?php 
                        echo PodsForm::field('filter_' . $filter, $value, 'text', $options);
                    }
                }
                if (false !== $this->do_hook('filters_show_search', true)) {
                    ?>
						&nbsp;&nbsp; <label<?php 
                    echo empty($this->filters) ? ' class="screen-reader-text"' : '';
                    ?>
 for="page-search<?php 
                    echo esc_attr($this->num);
                    ?>
-input"><?php 
                    _e('Search', 'pods');
                    ?>
:</label>
						<?php 
                    echo PodsForm::field('search' . $this->num, $this->search, 'text', array('attributes' => array('id' => 'page-search' . $this->num . '-input')));
                    ?>
					<?php 
                } else {
                    echo PodsForm::field('search' . $this->num, '', 'hidden');
                }
                ?>
                    <?php 
                echo PodsForm::submit_button($this->header['search'], 'button', false, false, array('id' => 'search' . $this->num . '-submit'));
                ?>
                    <?php 
                if (0 < strlen($this->search)) {
                    $clear_filters = array('search' . $this->num => false);
                    foreach ($this->filters as $filter) {
                        $clear_filters['filter_' . $filter . '_start'] = false;
                        $clear_filters['filter_' . $filter . '_end'] = false;
                        $clear_filters['filter_' . $filter] = false;
                    }
                    ?>
                        <br class="clear" />
                        <small>[<a href="<?php 
                    echo esc_url(pods_query_arg($clear_filters, array('orderby' . $this->num, 'orderby_dir' . $this->num, 'limit' . $this->num, 'page'), $this->exclusion()));
                    ?>
"><?php 
                    _e('Reset Filters', 'pods');
                    ?>
</a>]</small>
                        <br class="clear" />
                        <?php 
                }
                ?>
                </p>
                <?php 
            }
        } else {
            ?>
                <br class="clear" />
                <?php 
        }
        if (!empty($this->data) && (false !== $this->pagination_total || false !== $this->pagination || true === $reorder) || !in_array('export', $this->actions_disabled) && !in_array('export', $this->actions_hidden) || !empty($this->actions_disabled)) {
            ?>
                <div class="tablenav">
                    <?php 
            if (!empty($this->data) && !empty($this->actions_bulk)) {
                ?>
                    <div class="alignleft actions">
	                    <?php 
                wp_nonce_field('pods-ui-action-bulk', '_wpnonce' . $this->num, false);
                ?>

                        <select name="action_bulk<?php 
                echo esc_attr($this->num);
                ?>
">
                            <option value="-1" selected="selected"><?php 
                _e('Bulk Actions', 'pods');
                ?>
</option>

                            <?php 
                foreach ($this->actions_bulk as $action => $action_data) {
                    if (in_array($action, $this->actions_hidden) || in_array($action, $this->actions_hidden)) {
                        continue;
                    }
                    if (!isset($action_data['label'])) {
                        $action_data['label'] = ucwords(str_replace('_', ' ', $action));
                    }
                    ?>
                                <option value="<?php 
                    echo esc_attr($action);
                    ?>
"><?php 
                    echo esc_html($action_data['label']);
                    ?>
</option>
                            <?php 
                }
                ?>
                        </select>

                        <input type="submit" id="doaction_bulk<?php 
                echo esc_attr($this->num);
                ?>
" class="button-secondary action" value="<?php 
                esc_attr_e('Apply', 'pods');
                ?>
">
                    </div>
                <?php 
            }
            if (true !== $reorder && (false !== $this->pagination_total || false !== $this->pagination)) {
                ?>
                        <div class="tablenav-pages<?php 
                echo esc_attr($this->limit < $this->total_found || 1 < $this->page ? '' : ' one-page');
                ?>
">
                            <?php 
                $this->pagination(1);
                ?>
                        </div>
                        <?php 
            }
            if (true === $reorder) {
                $link = pods_query_arg(array('action' . $this->num => 'manage', 'id' . $this->num => ''), self::$allowed, $this->exclusion());
                if (!empty($this->action_links['manage'])) {
                    $link = $this->action_links['manage'];
                }
                ?>
                        <input type="button" value="<?php 
                esc_attr_e('Update Order', 'pods');
                ?>
" class="button" onclick="jQuery('form.admin_ui_reorder_form').submit();" />
                        <input type="button" value="<?php 
                esc_attr_e('Cancel', 'pods');
                ?>
" class="button" onclick="document.location='<?php 
                echo esc_js($link);
                ?>
';" />
                    </form>
				<?php 
            } elseif (!in_array('export', $this->actions_disabled) && !in_array('export', $this->actions_hidden)) {
                ?>
                        <div class="alignleft actions">
                            <strong><?php 
                _e('Export', 'pods');
                ?>
:</strong>
                            <?php 
                foreach ($this->export['formats'] as $format => $separator) {
                    ?>
                                <input type="button" value=" <?php 
                    echo esc_attr(strtoupper($format));
                    ?>
 " class="button" onclick="document.location='<?php 
                    echo pods_slash(pods_query_arg(array('action' . $this->num => 'export', 'export_type' . $this->num => $format, '_wpnonce' => wp_create_nonce('pods-ui-action-export')), self::$allowed, $this->exclusion()));
                    ?>
';" />
                                <?php 
                }
                ?>
                        </div>
                        <?php 
            }
            ?>
                    <br class="clear" />
                </div>
                <?php 
        } else {
            ?>
                <br class="clear" />
                <?php 
        }
        ?>
            <div class="clear"></div>
            <?php 
        if (empty($this->data) && false !== $this->default_none && false === $this->search) {
            ?>
                <p><?php 
            _e('Please use the search filter(s) above to display data', 'pods');
            if ($this->export) {
                ?>
, <?php 
                _e('or click on an Export to download a full copy of the data', 'pods');
            }
            ?>
.</p>
                <?php 
        } else {
            $this->table($reorder);
        }
        if (!empty($this->data)) {
            if (true !== $reorder && (false !== $this->pagination_total || false !== $this->pagination)) {
                ?>
                    <div class="tablenav">
                        <div class="tablenav-pages<?php 
                echo esc_attr($this->limit < $this->total_found || 1 < $this->page ? '' : ' one-page');
                ?>
">
                            <?php 
                $this->pagination(0);
                ?>
                            <br class="clear" />
                        </div>
                    </div>
                    <?php 
            }
        }
        ?>
        </form>
    </div>
    <?php 
        if ($this->filters_enhanced) {
            $this->filters_popup();
        }
    }
/**
 * Filter input and return slashed output
 *
 * @param mixed $input The string, array, or object to sanitize
 * @param array $params Additional options
 *
 * @return array|mixed|object|string|void
 *
 * @since 2.3.9
 *
 * @see wp_slash
 */
function pods_slash($input, $params = array())
{
    if ('' === $input || is_int($input) || is_float($input) || empty($input)) {
        return $input;
    }
    $output = array();
    $defaults = array('type' => null);
    if (!is_array($params)) {
        $defaults['type'] = $params;
        $params = $defaults;
    } else {
        $params = array_merge($defaults, (array) $params);
    }
    if (empty($input)) {
        $output = $input;
    } elseif (is_object($input)) {
        $input = get_object_vars($input);
        foreach ($input as $key => $val) {
            $output[$key] = pods_slash($val, $params);
        }
        $output = (object) $output;
    } elseif (is_array($input)) {
        foreach ($input as $key => $val) {
            $output[$key] = pods_slash($val, $params);
        }
    } elseif (!empty($params['type']) && false !== strpos($params['type'], '%')) {
        /**
         * @var $wpdb wpdb
         */
        global $wpdb;
        $output = $wpdb->prepare($params['type'], $output);
    } elseif (function_exists('wp_slash')) {
        $output = wp_slash($input);
    } else {
        $output = addslashes($input);
    }
    return $output;
}
    wp_enqueue_script('jquery-ui-sortable');
}
$options['data'] = (array) pods_var_raw('data', $options, array(), null, true);
?>
<div class="pods-select2">
    <input<?php 
PodsForm::attributes($attributes, $name, $form_field_type, $options);
?>
 />
</div>

<script type="text/javascript">
    jQuery( function ( $ ) {
        if ( 'undefined' == typeof ajaxurl ) {
            var ajaxurl = '<?php 
echo pods_slash(admin_url('admin-ajax.php'));
?>
';
        }

        function <?php 
echo esc_js(pods_js_name($attributes['id']));
?>
_podsFormatResult ( item ) {
            return item.text;
        }

        function <?php 
echo esc_js(pods_js_name($attributes['id']));
?>
_podsFormatSelection ( item ) {
            <p class="submit">
                <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php 
esc_attr_e('Save Changes', 'pods');
?>
">
                <img class="waiting" src="<?php 
echo esc_url(admin_url('images/wpspin_light.gif'));
?>
" alt="" />
            </p>
        </div>
    </form>
</div>

<script type="text/javascript">
    jQuery( function ( $ ) {
        $( document ).Pods( 'validate' );
        $( document ).Pods( 'submit' );
        $( document ).Pods( 'dependency' );
        $( document ).Pods( 'confirm' );
        $( document ).Pods( 'exit_confirm' );
    } );

    var pods_admin_submit_callback = function ( id ) {
        document.location = '<?php 
echo pods_slash(pods_var_update(array('do' => 'save')));
?>
';
    }
</script>
Example #8
0
    }

    var pods_sister_field_going = {

    };

    var pods_sister_field = function ( $el ) {
        var id = $el.closest( 'tr.pods-manage-row' ).data( 'row' );

        if ( 'undefined' != typeof pods_sister_field_going[ id + '_' + $el.prop( 'id' ) ] && true == pods_sister_field_going[ id + '_' + $el.prop( 'id' ) ] )
            return;

        pods_sister_field_going[ id + '_' + $el.prop( 'id' ) ] = true;

        var default_select = '<?php 
echo pods_slash(str_replace(array("\n", "\r"), ' ', PodsForm::field('field_data[--1][sister_id]', '', 'pick', array('data' => pods_var_raw('sister_id', $field_settings)))));
?>
';
        default_select = default_select.replace( /\-\-1/g, id );

        var related_pod_name = jQuery( '#pods-form-ui-field-data-' + id + '-pick-object' ).val();

        if ( 0 != related_pod_name.indexOf( 'pod-' ) && 0 != related_pod_name.indexOf( 'post_type-' ) && 0 != related_pod_name.indexOf( 'taxonomy-' ) && 0 != related_pod_name.indexOf( 'user' ) && 0 != related_pod_name.indexOf( 'media' ) && 0 != related_pod_name.indexOf( 'comment' ) ) {
            pods_sister_field_going[ id + '_' + $el.prop( 'id' ) ] = false;

            return;
        }

        var selected_value = jQuery( '#pods-form-ui-field-data-' + id + '-sister-id' ).val();

        var select_container = default_select.match( /<select[^<]*>/g );
Example #9
0
        </table>

        <p class="submit">
            <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php 
echo esc_attr($obj->label['edit']);
?>
">
            <img class="waiting" src="<?php 
echo esc_url(admin_url('images/wpspin_light.gif'));
?>
" alt="" />
        </p>
    </div>
</form>

<script type="text/javascript">
    jQuery( function ( $ ) {
        $( document ).Pods( 'validate' );
        $( document ).Pods( 'submit' );
        $( document ).Pods( 'dependency' );
        $( document ).Pods( 'confirm' );
        $( document ).Pods( 'exit_confirm' );
    } );

    var pods_admin_submit_callback = function ( id ) {
        document.location = '<?php 
echo pods_slash(pods_var_update(array('do' => $do)));
?>
';
    }
</script>
Example #10
0
                        // only thumbnails have sizes which is what we're on the hunt for
                        if ( 'undefined' != typeof attachment.attributes.sizes ) {
                            // Get thumbnail if it exists
                            if ( 'undefined' != typeof attachment.attributes.sizes.thumbnail && 'undefined' != typeof attachment.attributes.sizes.thumbnail.url )
                                attachment_thumbnail = attachment.attributes.sizes.thumbnail.url;
                            // If thumbnail doesn't exist, get full because this is a small image
                            else if ( 'undefined' != typeof attachment.attributes.sizes.full && 'undefined' != typeof attachment.attributes.sizes.full.url )
                                attachment_thumbnail = attachment.attributes.sizes.full.url;
                        }

                        <?php 
if (!empty($limit_types)) {
    ?>
                            if ( '<?php 
    echo implode('\' != attachment.attributes.type && \'', explode(',', pods_slash($limit_types)));
    ?>
' != attachment.attributes.type )
                                return;
                        <?php 
}
?>

                        // set our object properties
                        var binding = {
                            id: attachment.id,
                            icon: attachment_thumbnail,
                            name: attachment.attributes.title,
                            filename: attachment.filename,
                            link: attachment.attributes.url
                        };
Example #11
0
        </table>

        <p class="submit">
            <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php 
echo esc_attr($obj->label['edit']);
?>
">
            <img class="waiting" src="<?php 
echo esc_url(admin_url('images/wpspin_light.gif'));
?>
" alt="" />
        </p>
    </div>
</form>

<script type="text/javascript">
    jQuery( function ( $ ) {
        $( document ).Pods( 'validate' );
        $( document ).Pods( 'submit' );
        $( document ).Pods( 'dependency' );
        $( document ).Pods( 'confirm' );
        $( document ).Pods( 'exit_confirm' );
    } );

    var pods_admin_submit_callback = function ( id ) {
        document.location = '<?php 
echo pods_slash(pods_query_arg(array('do' => $do)));
?>
';
    }
</script>