/** * 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_var('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_var_update(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(); }
<?php global $pods_init; $monday_mode = pods_var('monday_mode', 'get', 0, null, true); if (1 == date_i18n('N') && (int) date_i18n('G') < 15) { $monday_mode = 1; } if (isset($_POST['cleanup_1x'])) { pods_upgrade('2.0.0')->cleanup(); pods_redirect(pods_var_update(array('pods_cleanup_1x' => 1), array('page', 'tab'))); } elseif (isset($_POST['reset'])) { $pods_init->reset(); $pods_init->setup(); pods_redirect(pods_var_update(array('pods_reset' => 1), array('page', 'tab'))); } elseif (isset($_POST['reset_deactivate'])) { $pods_init->reset(); deactivate_plugins(PODS_DIR . 'init.php'); pods_redirect('index.php'); } elseif (1 == pods_var('pods_reset')) { pods_message('Pods 2.x settings and data have been reset.'); } elseif (1 == pods_var('pods_cleanup_1x')) { pods_message('Pods 1.x data has been deleted.'); } elseif (pods_var('reset_weekend', 'post', pods_var('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'); } }
/** * @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\">{$option}</span>"; } else { echo ' <a href="' . pods_var_update(array('limit' => $option), array('orderby' . $this->num, 'orderby_dir' . $this->num, 'search' . $this->num, 'filter_*', 'page' . $this->num), $this->exclusion()) . '">' . $option . '</a>'; } } }
?> <a class="previous-item" href="<?php echo pods_var_update(array('id' => $prev), null, 'do'); ?> "> <span>«</span> <?php echo sprintf(__('Previous %s', 'pods'), $singular_label); ?> </a> <?php } if (0 < $next) { ?> <a class="next-item" href="<?php echo pods_var_update(array('id' => $next), null, 'do'); ?> "> <?php echo sprintf(__('Next %s', 'pods'), $singular_label); ?> <span>»</span> </a> <?php } ?> <div class="clear"></div> </div> <!-- /#navigation-actions --> </div>
/** * 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_var_update(array('success*' => null, $success => 1)); if (1 == pods_var($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()); }
<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>
<?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_var_update(array('pods_clearcache' => 1), array('page', 'tab'))); } } elseif (1 == pods_var('pods_clearcache')) { pods_message('Pods transients and cache have been cleared.'); } if (PODS_GITHUB_UPDATE) { ?> <h3><?php _e('Force an update of this beta from GitHub', 'pods'); ?> </h3> <p><?php _e('This tool lets you update your Pods installation to the latest alpha/beta/release candidate, usually only when you\'ve been instructed to do so.', 'pods'); ?> </p> <?php $update = admin_url('update-core.php?pods_force_refresh=1'); if (is_multisite()) { $update = network_admin_url('update-core.php?pods_force_refresh=1');
<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 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_var_update(array('page' => 'pods', 'action' . $obj->num => 'manage')); ?> <a href="<?php echo $link; ?> " class="add-new-h2">« <?php _e('Back to Manage', 'pods'); ?> </a> <?php } ?> </h2> <img src="<?php echo PODS_URL;
</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>
<a href="<?php echo pods_var_update(array($params->page_var => $params->page + 1)); ?> " class="pods-pagination-number pods-pagination-next <?php echo $params->link_class; ?> "><?php echo $params->next_text; ?> </a> <?php if (1 === $params->first_last) { ?> <a href="<?php echo pods_var_update(array($params->page_var => $params->total)); ?> " class="pods-pagination-number pods-pagination-last <?php echo $params->link_class; ?> "><?php echo $params->last_text; ?> </a> <?php } ?> <?php } ?>
<div id="icon-pods" class="icon32"><br /></div> <?php $default = 'tools'; $tabs = array('tools' => __('Tools', 'pods'), 'reset' => __('Cleanup & Reset', 'pods')); ?> <h2 class="nav-tab-wrapper"> <?php foreach ($tabs as $tab => $label) { $class = ''; if ($tab == pods_var('tab', 'get', $default)) { $class = ' nav-tab-active'; $label = 'Pods ' . $label; } $url = pods_var_update(array('tab' => $tab), array('page')); ?> <a href="<?php echo $url; ?> " class="nav-tab<?php echo $class; ?> "> <?php echo $label; ?> </a> <?php } ?>
$( 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 addslashes(pods_var_update(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;
</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 addslashes(pods_var_update(array('do' => $do))); ?> '; } </script>