$( 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;
<?php

if (!empty($_POST)) {
    if (isset($_POST['clearcache'])) {
        $api = pods_api();
        $api->cache_flush_pods();
        if (defined('PODS_PRELOAD_CONFIG_AFTER_FLUSH') && PODS_PRELOAD_CONFIG_AFTER_FLUSH) {
            $api->load_pods();
        }
        pods_redirect(pods_query_arg(array('pods_clearcache' => 1), array('page', 'tab')));
    }
} elseif (1 == pods_var('pods_clearcache')) {
    pods_message('Pods transients and cache have been cleared.');
}
?>

<h3><?php 
_e('Clear Pods Cache', 'pods');
?>
</h3>

<p><?php 
_e('This tool will clear all of the transients/cache that are used by Pods. ', 'pods');
?>
</p>

<p class="submit">
    <input type="submit" class="button button-primary" name="clearcache" value="<?php 
esc_attr_e('Clear Pods Cache', 'pods');
?>
" />
 /**
  * @param bool $options
  *
  * @return mixed
  */
 public function limit($options = false)
 {
     if (false !== $this->callback('limit', $options)) {
         return null;
     }
     if (false === $options || !is_array($options) || empty($options)) {
         $options = array(10, 25, 50, 100, 200);
     }
     if (!in_array($this->limit, $options) && -1 != $this->limit) {
         $this->limit = $options[1];
     }
     foreach ($options as $option) {
         if ($option == $this->limit) {
             echo ' <span class="page-numbers current">' . esc_html($option) . '</span>';
         } else {
             echo ' <a href="' . esc_url(pods_query_arg(array('limit' => $option), array('orderby' . $this->num, 'orderby_dir' . $this->num, 'search' . $this->num, 'filter_*', 'page' . $this->num), $this->exclusion())) . '">' . esc_html($option) . '</a>';
         }
     }
 }
Example #4
0
    <form action="" method="post" class="pods-submittable">
        <div class="pods-submittable-fields">
            <input type="hidden" name="action" value="pods_admin" />
            <input type="hidden" name="method" value="add_pod" />
            <input type="hidden" name="_wpnonce" value="<?php 
echo esc_attr(wp_create_nonce('pods-add_pod'));
?>
" />
            <input type="hidden" name="create_extend" id="pods_create_extend" value="create" />

            <h2 class="italicized">
                <?php 
_e('Add New Pod', 'pods');
$all_pods = pods_api()->load_pods(array('key_names' => true));
if (!empty($all_pods)) {
    $link = pods_query_arg(array('page' => 'pods', 'action' . $obj->num => 'manage'));
    ?>
                    <a href="<?php 
    echo esc_url($link);
    ?>
" class="add-new-h2">&laquo; <?php 
    _e('Back to Manage', 'pods');
    ?>
</a>
                <?php 
}
?>
            </h2>

            <img src="<?php 
echo esc_url(PODS_URL);
Example #5
0
    /**
     * @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 (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 $this->icon;
            ?>
);"<?php 
        }
        ?>
><br /></div>
        <h2>
            <?php 
        if (true === $reorder) {
            echo $this->header['reorder'];
            $link = pods_var_update(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 $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_var_update(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 $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_var_update(array('action' . $this->num => 'reorder'), self::$allowed, $this->exclusion());
            if (!empty($this->action_links['reorder'])) {
                $link = $this->action_links['reorder'];
            }
            ?>
                <a href="<?php 
            echo $link;
            ?>
" class="add-new-h2"><?php 
            echo $this->label['reorder'];
            ?>
</a>
                <?php 
        }
        ?>
        </h2>
        <?php 
        if (true !== $reorder) {
            ?>
            <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);
            $filters = $this->filters;
            foreach ($filters as $k => $filter) {
                if (isset($this->pod->fields[$filter]) && in_array($this->pod->fields[$filter]['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) {
                    // use PodsFormUI fields
                    if (!isset($this->pod->fields[$filter])) {
                        continue;
                    }
                    if (in_array($this->pod->fields[$filter]['type'], array('date', 'datetime', 'time'))) {
                        $start = pods_var_raw('filter_' . $filter . '_start', 'get', pods_var_raw('filter_default', $this->pod->fields[$filter], '', null, true), null, true);
                        $end = pods_var_raw('filter_' . $filter . '_end', 'get', pods_var_raw('filter_ongoing_default', $this->pod->fields[$filter], '', null, true), null, true);
                        // override default value
                        $this->pod->fields[$filter]['options']['default_value'] = '';
                        $this->pod->fields[$filter]['options'][$this->pod->fields[$filter]['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($this->pod->fields[$filter]['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($this->pod->fields[$filter]['type'], 'convert_date', $end, 'n/j/Y');
                        }
                        ?>
                        <label for="pods-form-ui-filter-<?php 
                        echo $filter;
                        ?>
_start">
                            <?php 
                        echo $this->pod->fields[$filter]['label'];
                        ?>
                        </label>
                        <?php 
                        echo PodsForm::field('filter_' . $filter . '_start', $start, $this->pod->fields[$filter]['type'], $this->pod->fields[$filter]);
                        ?>

                        <label for="pods-form-ui-filter-<?php 
                        echo $filter;
                        ?>
_end">
                            to
                        </label>
                    <?php 
                        echo PodsForm::field('filter_' . $filter . '_end', $end, $this->pod->fields[$filter]['type'], $this->pod->fields[$filter]);
                    } elseif ('pick' == $this->pod->fields[$filter]['type']) {
                        $value = pods_var_raw('filter_' . $filter, 'get');
                        if (strlen($value) < 1) {
                            $value = pods_var_raw('filter_default', $this->pod->fields[$filter]);
                        }
                        // override default value
                        $this->pod->fields[$filter]['options']['default_value'] = '';
                        $this->pod->fields[$filter]['options']['pick_format_type'] = 'single';
                        $this->pod->fields[$filter]['options']['pick_format_single'] = 'dropdown';
                        $this->pod->fields[$filter]['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);
                        $this->pod->fields[$filter]['options']['input_helper'] = pods_var_raw('ui_input_helper', $this->pod->fields[$filter]['options'], $this->pod->fields[$filter]['options']['input_helper'], null, true);
                        $options = array_merge($this->pod->fields[$filter], $this->pod->fields[$filter]['options']);
                        ?>
                        <label for="pods-form-ui-filter-<?php 
                        echo $filter;
                        ?>
">
                            <?php 
                        echo $this->pod->fields[$filter]['label'];
                        ?>
                        </label>
                    <?php 
                        echo PodsForm::field('filter_' . $filter, $value, 'pick', $options);
                    } elseif ('boolean' == $this->pod->fields[$filter]['type']) {
                        $value = pods_var_raw('filter_' . $filter, 'get', '');
                        if (strlen($value) < 1) {
                            $value = pods_var_raw('filter_default', $this->pod->fields[$filter]);
                        }
                        // override default value
                        $this->pod->fields[$filter]['options']['default_value'] = '';
                        $this->pod->fields[$filter]['options']['pick_format_type'] = 'single';
                        $this->pod->fields[$filter]['options']['pick_format_single'] = 'dropdown';
                        $this->pod->fields[$filter]['options']['pick_object'] = 'custom-simple';
                        $this->pod->fields[$filter]['options']['pick_custom'] = array('1' => pods_var_raw('boolean_yes_label', $this->pod->fields[$filter]['options'], __('Yes', 'pods'), null, true), '0' => pods_var_raw('boolean_no_label', $this->pod->fields[$filter]['options'], __('No', 'pods'), null, true));
                        $this->pod->fields[$filter]['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);
                        $this->pod->fields[$filter]['options']['input_helper'] = pods_var_raw('ui_input_helper', $this->pod->fields[$filter]['options'], $this->pod->fields[$filter]['options']['input_helper'], null, true);
                        $options = array_merge($this->pod->fields[$filter], $this->pod->fields[$filter]['options']);
                        ?>
                        <label for="pods-form-ui-filter-<?php 
                        echo $filter;
                        ?>
">
                            <?php 
                        echo $this->pod->fields[$filter]['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', $this->pod->fields[$filter]);
                        }
                        // override default value
                        $this->pod->fields[$filter]['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 $filter;
                        ?>
">
                            <?php 
                        echo $this->pod->fields[$filter]['label'];
                        ?>
                        </label>
                    <?php 
                        echo PodsForm::field('filter_' . $filter, $value, 'text', $options);
                    }
                }
                ?>
                    &nbsp;&nbsp; <label<?php 
                echo empty($this->filters) ? ' class="screen-reader-text"' : '';
                ?>
 for="page-search-input"><?php 
                _e('Search', 'pods');
                ?>
:</label>
                    <?php 
                echo PodsForm::field('search' . $this->num, $this->search, 'text', array('attributes' => array('id' => 'page-search-input')));
                ?>
                    <input type="submit" value="<?php 
                esc_attr_e('Search', 'pods');
                echo ' ' . esc_attr($this->items);
                ?>
" class="button" />
                    <?php 
                if (0 < strlen($this->search)) {
                    $clear_filters = array();
                    foreach ($this->filters as $filter) {
                        $clear_filters['filter_' . $filter . '_start'] = '';
                        $clear_filters['filter_' . $filter . '_end'] = '';
                        $clear_filters['filter_' . $filter] = '';
                    }
                    ?>
                        <br class="clear" />
                        <small>[<a href="<?php 
                    echo pods_var_update($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">
                        <select name="action_bulk<?php 
                echo $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 $this->num;
                ?>
" class="button-secondary action" value="<?php 
                _e('Apply', 'pods');
                ?>
">
                    </div>
                <?php 
            }
            if (true !== $reorder && (false !== $this->pagination_total || false !== $this->pagination)) {
                ?>
                        <div class="tablenav-pages<?php 
                echo $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 
                _e('Update Order', 'pods');
                ?>
" class="button" onclick="jQuery('form.admin_ui_reorder_form').submit();" />
                        <input type="button" value="<?php 
                _e('Cancel', 'pods');
                ?>
" class="button" onclick="document.location='<?php 
                echo esc_attr($link);
                ?>
';" />
                        <?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 strtoupper($format);
                    ?>
 " class="button" onclick="document.location='<?php 
                    echo pods_var_update(array('action' . $this->num => 'export', 'export_type' . $this->num => $format), 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 $this->limit < $this->total_found || 1 < $this->page ? '' : ' one-page';
                ?>
">
                            <?php 
                $this->pagination(0);
                ?>
                            <br class="clear" />
                        </div>
                    </div>
                    <?php 
            }
        }
        if (true !== $reorder) {
            ?>
        </form>
        <?php 
        }
        ?>
    </div>
    <?php 
        if ($this->filters_enhanced) {
            $this->filters_popup();
        }
    }
Example #6
0
 /**
  * Toggle a component on or off
  *
  * @param PodsUI $ui
  *
  * @return bool
  */
 public function admin_components_toggle(PodsUI $ui)
 {
     $component = $_GET['id'];
     if (!empty(PodsInit::$components->components[$component]['PluginDependency'])) {
         $dependency = explode('|', PodsInit::$components->components[$component]['PluginDependency']);
         if (!pods_is_plugin_active($dependency[1])) {
             $website = 'http://wordpress.org/extend/plugins/' . dirname($dependency[1]) . '/';
             if (isset($dependency[2])) {
                 $website = $dependency[2];
             }
             if (!empty($website)) {
                 $website = ' ' . sprintf(__('You can find it at %s', 'pods'), '<a href="' . $website . '" target="_blank">' . $website . '</a>');
             }
             $message = sprintf(__('The %s component requires that you have the <strong>%s</strong> plugin installed and activated.', 'pods'), PodsInit::$components->components[$component]['Name'], $dependency[0]) . $website;
             $ui->error($message);
             $ui->manage();
             return;
         }
     }
     if (!empty(PodsInit::$components->components[$component]['ThemeDependency'])) {
         $dependency = explode('|', PodsInit::$components->components[$component]['ThemeDependency']);
         if (strtolower($dependency[1]) != strtolower(get_template()) && strtolower($dependency[1]) != strtolower(get_stylesheet())) {
             $website = '';
             if (isset($dependency[2])) {
                 $website = ' ' . sprintf(__('You can find it at %s', 'pods'), '<a href="' . $dependency[2] . '" target="_blank">' . $dependency[2] . '</a>');
             }
             $message = sprintf(__('The %s component requires that you have the <strong>%s</strong> theme installed and activated.', 'pods'), PodsInit::$components->components[$component]['Name'], $dependency[0]) . $website;
             $ui->error($message);
             $ui->manage();
             return;
         }
     }
     if (!empty(PodsInit::$components->components[$component]['MustUse'])) {
         $message = sprintf(__('The %s component can not be disabled from here. You must deactivate the plugin or theme that added it.', 'pods'), PodsInit::$components->components[$component]['Name']);
         $ui->error($message);
         $ui->manage();
         return;
     }
     if ('1' == pods_v('toggled')) {
         $toggle = PodsInit::$components->toggle($component);
         if (true === $toggle) {
             $ui->message(PodsInit::$components->components[$component]['Name'] . ' ' . __('Component enabled', 'pods'));
         } elseif (false === $toggle) {
             $ui->message(PodsInit::$components->components[$component]['Name'] . ' ' . __('Component disabled', 'pods'));
         }
         $components = PodsInit::$components->components;
         foreach ($components as $component => &$component_data) {
             $toggle = 0;
             if (isset(PodsInit::$components->settings['components'][$component_data['ID']])) {
                 if (0 != PodsInit::$components->settings['components'][$component_data['ID']]) {
                     $toggle = 1;
                 }
             }
             if (true === $component_data['DeveloperMode']) {
                 if (!pods_developer()) {
                     unset($components[$component]);
                     continue;
                 }
             }
             $component_data = array('id' => $component_data['ID'], 'name' => $component_data['Name'], 'description' => make_clickable($component_data['Description']), 'version' => $component_data['Version'], 'author' => $component_data['Author'], 'toggle' => $toggle);
         }
         $ui->data = $components;
         pods_transient_clear('pods_components');
         $url = pods_query_arg(array('toggled' => null));
         pods_redirect($url);
     } elseif (1 == pods_var('toggle')) {
         $ui->message(PodsInit::$components->components[$component]['Name'] . ' ' . __('Component enabled', 'pods'));
     } else {
         $ui->message(PodsInit::$components->components[$component]['Name'] . ' ' . __('Component disabled', 'pods'));
     }
     $ui->manage();
 }
            ?>
                                        <a class="previous-item" href="<?php 
            echo esc_url(pods_query_arg(array('id' => $prev), null, 'do'));
            ?>
">
                                            <span>&laquo;</span>
                                            <?php 
            echo sprintf(__('Previous %s', 'pods'), $singular_label);
            ?>
                                        </a>
                                    <?php 
        }
        if (0 < $next) {
            ?>
                                        <a class="next-item" href="<?php 
            echo esc_url(pods_query_arg(array('id' => $next), null, 'do'));
            ?>
">
                                            <?php 
            echo sprintf(__('Next %s', 'pods'), $singular_label);
            ?>
                                            <span>&raquo;</span>
                                        </a>
                                    <?php 
        }
        ?>

                                    <div class="clear"></div>
                                </div>
                                <!-- /#navigation-actions -->
                            </div>
/**
 * Create a new URL off of the current one, with updated parameters
 *
 * @param array $array Parameters to be set (empty will remove it)
 * @param array $allowed Parameters to keep (if empty, all are kept)
 * @param array $excluded Parameters to always remove
 * @param string $url URL to base update off of
 *
 * @return mixed
 *
 * @since 2.0
 *
 * @deprecated 2.4 Use pods_query_arg() instead.
 * @see pods_query_arg
 */
function pods_var_update($array = null, $allowed = null, $excluded = null, $url = null)
{
    return pods_query_arg($array, $allowed, $excluded, $url);
}
<?php

global $pods_init;
if (isset($_POST['_wpnonce']) && false !== wp_verify_nonce($_POST['_wpnonce'], 'pods-settings')) {
    if (isset($_POST['pods_cleanup_1x'])) {
        pods_upgrade('2.0.0')->cleanup();
        pods_redirect(pods_query_arg(array('pods_cleanup_1x_success' => 1), array('page', 'tab')));
    } elseif (isset($_POST['pods_reset'])) {
        $pods_init->reset();
        $pods_init->setup();
        pods_redirect(pods_query_arg(array('pods_reset_success' => 1), array('page', 'tab')));
    } elseif (isset($_POST['pods_reset_deactivate'])) {
        $pods_init->reset();
        deactivate_plugins(PODS_DIR . 'init.php');
        pods_redirect('index.php');
    } elseif (1 == pods_v('pods_reset_success')) {
        pods_message('Pods 2.x settings and data have been reset.');
    } elseif (1 == pods_v('pods_cleanup_1x_success')) {
        pods_message('Pods 1.x data has been deleted.');
    }
}
// Monday Mode
$monday_mode = pods_v('pods_monday_mode', 'get', 0, true);
if (pods_var('pods_reset_weekend', 'post', pods_var('pods_reset_weekend', 'get', 0, null, true), null, true)) {
    if ($monday_mode) {
        $html = '<br /><br /><iframe width="480" height="360" src="http://www.youtube-nocookie.com/embed/QH2-TGUlwu4?autoplay=1" frameborder="0" allowfullscreen></iframe>';
        pods_message('The weekend has been reset and you have been sent back to Friday night. Unfortunately due to a tear in the fabric of time, you slipped back to Monday. We took video of the whole process and you can see it below..' . $html);
    } else {
        $html = '<br /><br /><iframe width="480" height="360" src="http://www.youtube-nocookie.com/embed/xhrBDcQq2DM?autoplay=1" frameborder="0" allowfullscreen></iframe>';
        pods_message('Oops, sorry! You can only reset the weekend on a Monday before the end of the work day. Somebody call the Waaambulance!' . $html, 'error');
    }
        ?>
" class="pods-pagination-number pods-pagination-next <?php 
        echo esc_attr($params->link_class);
        ?>
"><?php 
        echo $params->next_text;
        ?>
</a>
            <?php 
    }
    ?>
        <?php 
    if ($params->first_last) {
        ?>
            <a href="<?php 
        echo esc_url(pods_query_arg(array($params->page_var => $params->total)));
        ?>
" class="pods-pagination-number pods-pagination-last <?php 
        echo esc_attr($params->link_class);
        ?>
"><?php 
        echo $params->last_text;
        ?>
</a>
            <?php 
    }
    ?>
        <?php 
}
?>
									<a class="submitdelete deletion" href="<?php 
    echo pods_query_arg(array('action' => 'delete'));
    ?>
" onclick="return confirm('You are about to permanently delete this item\n Choose \'Cancel\' to stop, \'OK\' to delete.');"><?php 
    _e('Delete', 'pods');
    ?>
</a>
								</div>
								<!-- /#delete-action -->
							<?php 
}
if (pods_is_admin(array('pods')) && !in_array('process_job', $obj->actions_disabled) && !in_array('process_job', $obj->actions_hidden) && 'queued' == $item['status']) {
    ?>
								<div id="preview-action">
									<a class="preview button" href="<?php 
    echo pods_query_arg(array('action' => 'process_job'));
    ?>
"><?php 
    _e('Process Job', 'pods-jobs-queue');
    ?>
</a>
								</div>
								<!-- /#delete-action -->
							<?php 
}
?>

							<div class="clear"></div>
						</div>
						<!-- /#major-publishing-actions -->
					</div>
Example #12
0
            ?>
								<a class="previous-item" href="<?php 
            echo pods_query_arg(array('id' => $prev), null, 'do');
            ?>
">
									<span>&laquo;</span>
									<?php 
            echo sprintf(__('Previous %s', 'pods'), $singular_label);
            ?>
								</a>
							<?php 
        }
        if (0 < $next) {
            ?>
								<a class="next-item" href="<?php 
            echo pods_query_arg(array('id' => $next), null, 'do');
            ?>
">
									<?php 
            echo sprintf(__('Next %s', 'pods'), $singular_label);
            ?>
									<span>&raquo;</span>
								</a>
							<?php 
        }
        ?>

							<div class="clear"></div>
						</div>
						<!-- /#navigation-actions -->
					</div>
Example #13
0
 /**
  * Embed a form to add / edit a pod item from within your theme. Provide an array of $fields to include
  * and override options where needed. For WP object based Pods, you can pass through the WP object
  * field names too, such as "post_title" or "post_content" for example.
  *
  * @param array $params (optional) Fields to show on the form, defaults to all fields
  * @param string $label (optional) Save button label, defaults to "Save Changes"
  * @param string $thank_you (optional) Thank you URL to send to upon success
  *
  * @return bool|mixed
  * @since 2.0
  * @link http://pods.io/docs/form/
  */
 public function form($params = null, $label = null, $thank_you = null)
 {
     $defaults = array('fields' => $params, 'label' => $label, 'thank_you' => $thank_you, 'fields_only' => false);
     if (is_array($params)) {
         $params = array_merge($defaults, $params);
     } else {
         $params = $defaults;
     }
     $pod =& $this;
     $params = $this->do_hook('form_params', $params);
     $fields = $params['fields'];
     if (null !== $fields && !is_array($fields) && 0 < strlen($fields)) {
         $fields = explode(',', $fields);
     }
     $object_fields = (array) pods_var_raw('object_fields', $this->pod_data, array(), null, true);
     if (empty($fields)) {
         // Add core object fields if $fields is empty
         $fields = array_merge($object_fields, $this->fields);
     }
     $form_fields = $fields;
     // Temporary
     $fields = array();
     foreach ($form_fields as $k => $field) {
         $name = $k;
         $defaults = array('name' => $name);
         if (!is_array($field)) {
             $name = $field;
             $field = array('name' => $name);
         }
         $field = array_merge($defaults, $field);
         $field['name'] = trim($field['name']);
         $default_value = pods_var_raw('default', $field);
         $value = pods_var_raw('value', $field);
         if (empty($field['name'])) {
             $field['name'] = trim($name);
         }
         if (isset($object_fields[$field['name']])) {
             $field = array_merge($object_fields[$field['name']], $field);
         } elseif (isset($this->fields[$field['name']])) {
             $field = array_merge($this->fields[$field['name']], $field);
         }
         if (pods_var_raw('hidden', $field, false, null, true)) {
             $field['type'] = 'hidden';
         }
         $fields[$field['name']] = $field;
         if (empty($this->id) && null !== $default_value) {
             $this->row_override[$field['name']] = $default_value;
         } elseif (!empty($this->id) && null !== $value) {
             $this->row[$field['name']] = $value;
         }
     }
     unset($form_fields);
     // Cleanup
     $fields = $this->do_hook('form_fields', $fields, $params);
     $label = $params['label'];
     if (empty($label)) {
         $label = __('Save Changes', 'pods');
     }
     $thank_you = $params['thank_you'];
     $fields_only = $params['fields_only'];
     PodsForm::$form_counter++;
     ob_start();
     if (empty($thank_you)) {
         $success = 'success';
         if (1 < PodsForm::$form_counter) {
             $success .= PodsForm::$form_counter;
         }
         $thank_you = pods_query_arg(array('success*' => null, $success => 1));
         if (1 == pods_v($success, 'get', 0)) {
             $message = __('Form submitted successfully', 'pods');
             /**
              * Change the text of the message that appears on succesful form submission.
              *
              * @param string $message
              *
              * @returns string the message
              *
              * @since 3.0.0
              */
             $message = apply_filters('pods_pod_form_success_message', $message);
             echo '<div id="message" class="pods-form-front-success">' . $message . '</div>';
         }
     }
     pods_view(PODS_DIR . 'ui/front/form.php', compact(array_keys(get_defined_vars())));
     $output = ob_get_clean();
     if (empty($this->id)) {
         $this->row_override = array();
     }
     return $this->do_hook('form', $output, $fields, $label, $thank_you, $this, $this->id());
 }
Example #14
0
		<div id="icon-pods" class="icon32"><br /></div>

		<?php 
$default = 'deploy';
$tabs = array('deploy' => __('Deploy From This Site', 'pods-deploy'), 'key-gen' => __('Allow Deploying To This Site', 'pods-deploy'));
?>

		<h2 class="nav-tab-wrapper">
			<?php 
foreach ($tabs as $tab => $label) {
    $class = '';
    if ($tab == pods_v('tab', 'get', $default)) {
        $class = ' nav-tab-active';
        $label = $label;
    }
    $url = pods_query_arg(array('tab' => $tab), array('page'));
    ?>
				<a href="<?php 
    echo $url;
    ?>
" class="nav-tab<?php 
    echo $class;
    ?>
">
					<?php 
    echo $label;
    ?>
				</a>
			<?php 
}
?>
Example #15
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>