/** * Show the Admin */ public function admin($options, $component) { $post_types = (array) $this->post_types; $taxonomies = (array) $this->taxonomies; $method = 'migrate'; // ajax_migrate pods_view(PODS_DIR . 'components/Migrate-CPTUI/ui/wizard.php', compact(array_keys(get_defined_vars()))); }
function admin_edit($duplicate, $obj) { global $wp_roles; $id = $obj->id; $capabilities = $this->get_capabilities(); $role_name = $role_label = $role_capabilities = null; foreach ($wp_roles->role_objects as $key => $role) { if ($key != $id) { continue; } $role_name = $key; $role_label = $wp_roles->role_names[$key]; $role_capabilities = $role->capabilities; } if (empty($role)) { return $obj->error(__('Role not found, cannot edit it.', 'pods')); } $component = $obj->x['component']; $method = 'edit'; // ajax_edit pods_view(PODS_DIR . 'components/Roles/ui/edit.php', compact(array_keys(get_defined_vars()))); }
/** * Output a row (label, field, and comment) * * @param string $name Field name * @param mixed $value Field value * @param string $type Field type * @param array $options Field options * @param array $pod Pod data * @param int $id Item ID * * @return string Row HTML * * @since 2.0 */ public static function row($name, $value, $type = 'text', $options = null, $pod = null, $id = null) { $options = self::options(null, $options); ob_start(); pods_view(PODS_DIR . 'ui/fields/_row.php', compact(array_keys(get_defined_vars()))); $output = ob_get_clean(); return apply_filters('pods_form_ui_field_row', $output, $name, $value, $options, $pod, $id); }
/** * Shortcode support for use anywhere that support WP Shortcodes * * @param array $tags An associative array of shortcode properties * @param string $content A string that represents a template override * * @return string * @since 1.6.7 */ function pods_shortcode($tags, $content = null) { $defaults = array('name' => null, 'id' => null, 'slug' => null, 'select' => null, 'order' => null, 'orderby' => null, 'limit' => null, 'where' => null, 'having' => null, 'groupby' => null, 'search' => true, 'pagination' => false, 'page' => null, 'filters' => false, 'filters_label' => 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); if (!empty($tags)) { $tags = array_merge($defaults, $tags); } else { $tags = $defaults; } $tags = apply_filters('pods_shortcode', $tags); if (empty($content)) { $content = null; } if (0 < strlen($tags['view'])) { $return = pods_view($tags['view'], null, (int) $tags['expires'], $tags['cache_mode']); if ($tags['shortcodes']) { $return = do_shortcode($return); } return $return; } if (empty($tags['name'])) { if (in_the_loop() || is_singular()) { $pod = pods(get_post_type(), get_the_ID(), false); if (!empty($pod)) { $tags['name'] = get_post_type(); $id = $tags['id'] = get_the_ID(); } } if (empty($tags['name'])) { return '<p>Please provide a Pod name</p>'; } } if (!empty($tags['col'])) { $tags['field'] = $tags['col']; unset($tags['col']); } if (!empty($tags['order'])) { $tags['orderby'] = $tags['order']; unset($tags['order']); } if (empty($content) && empty($tags['pods_page']) && empty($tags['template']) && empty($tags['field']) && empty($tags['form'])) { return '<p>Please provide either a template or field name</p>'; } if (!isset($id)) { // id > slug (if both exist) $id = empty($tags['slug']) ? null : pods_evaluate_tags($tags['slug']); if (!empty($tags['id'])) { $id = $tags['id']; if (is_numeric($id)) { $id = absint($id); } } } if (!isset($pod)) { $pod = pods($tags['name'], $id); } if (empty($pod)) { return '<p>Pod not found</p>'; } $found = 0; if (!empty($tags['form'])) { return $pod->form($tags['fields'], $tags['label'], $tags['thank_you']); } elseif (empty($id)) { $params = array(); if (0 < strlen($tags['orderby'])) { $params['orderby'] = $tags['orderby']; } if (!empty($tags['limit'])) { $params['limit'] = $tags['limit']; } if (0 < strlen($tags['where'])) { $params['where'] = pods_evaluate_tags($tags['where']); } if (0 < strlen($tags['having'])) { $params['having'] = pods_evaluate_tags($tags['having']); } if (0 < strlen($tags['groupby'])) { $params['groupby'] = $tags['groupby']; } if (0 < strlen($tags['select'])) { $params['select'] = $tags['select']; } if (empty($tags['search'])) { $params['search'] = false; } if (0 < absint($tags['page'])) { $params['page'] = absint($tags['page']); } if (empty($tags['pagination'])) { $params['pagination'] = false; } if (!empty($tags['cache_mode']) && 'none' != $tags['cache_mode']) { $params['cache_mode'] = $tags['cache_mode']; $params['expires'] = (int) $tags['expires']; } $params = apply_filters('pods_shortcode_findrecords_params', $params); $pod->find($params); $found = $pod->total(); } elseif (!empty($tags['field'])) { if (empty($tags['helper'])) { $return = $pod->display($tags['field']); } else { $return = $pod->helper($tags['helper'], $pod->field($tags['field']), $tags['field']); } if ($tags['shortcodes']) { $return = do_shortcode($return); } return $return; } elseif (!empty($tags['pods_page']) && class_exists('Pods_Pages')) { $pods_page = Pods_Pages::exists($tags['pods_page']); if (empty($pods_page)) { return '<p>Pods Page not found</p>'; } $return = Pods_Pages::content(true, $pods_page); if ($tags['shortcodes']) { $return = do_shortcode($return); } return $return; } ob_start(); if (empty($id) && false !== $tags['filters'] && 'before' == $tags['filters_location']) { echo $pod->filters($tags['filters'], $tags['filters_label']); } if (empty($id) && 0 < $found && false !== $tags['pagination'] && in_array($tags['pagination_location'], array('before', 'both'))) { echo $pod->pagination($tags['pagination_label']); } echo $pod->template($tags['template'], $content); if (empty($id) && 0 < $found && false !== $tags['pagination'] && in_array($tags['pagination_location'], array('after', 'both'))) { echo $pod->pagination($tags['pagination_label']); } if (empty($id) && false !== $tags['filters'] && 'after' == $tags['filters_location']) { echo $pod->filters($tags['filters'], $tags['filters_label']); } $return = ob_get_clean(); if ($tags['shortcodes']) { $return = do_shortcode($return); } return $return; }
/** * @return bool|mixed * @since 2.3.10 */ public function view() { if (false !== $this->callback_action('view')) { return null; } if (empty($this->row)) { $this->get_row(); } if (empty($this->row)) { return $this->error(sprintf(__('<strong>Error:</strong> %s not found.', 'pods'), $this->item)); } $pod =& $this->pod; $obj =& $this; $fields = array(); if (isset($this->fields[$this->action])) { $fields = $this->fields[$this->action]; } if (is_object($this->pod)) { $object_fields = (array) pods_var_raw('object_fields', $this->pod->pod_data, array(), null, true); $object_field_objects = array('post_type', 'taxonomy', 'media', 'user', 'comment'); if (empty($object_fields) && in_array($this->pod->pod_data['type'], $object_field_objects)) { $object_fields = $this->pod->api->get_wp_object_fields($this->pod->pod_data['type'], $this->pod->pod_data); } if (empty($fields)) { // Add core object fields if $fields is empty $fields = array_merge($object_fields, $this->pod->fields); } } $view_fields = $fields; // Temporary $fields = array(); foreach ($view_fields as $k => $field) { $name = $k; $defaults = array('name' => $name, 'type' => 'text', 'options' => 'text'); if (!is_array($field)) { $name = $field; $field = array('name' => $name); } $field = array_merge($defaults, $field); $field['name'] = trim($field['name']); $value = pods_var_raw('default', $field); if (empty($field['name'])) { $field['name'] = trim($name); } if (isset($object_fields[$field['name']])) { $field = array_merge($field, $object_fields[$field['name']]); } elseif (isset($this->pod->fields[$field['name']])) { $field = array_merge($this->pod->fields[$field['name']], $field); } if (pods_v('hidden', $field, false, null, true) || 'hidden' == $field['type']) { continue; } elseif (!PodsForm::permission($field['type'], $field['name'], $field['options'], $fields, $pod, $pod->id())) { continue; } $fields[$field['name']] = $field; if (empty($this->id) && null !== $value) { $this->pod->row_override[$field['name']] = $value; } } unset($view_fields); // Cleanup ?> <div class="wrap 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 echo $this->do_template($this->header['view']); 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->heading['add']; ?> </a> <?php } elseif (!in_array('manage', $this->actions_disabled) && !in_array('manage', $this->actions_hidden)) { $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']; } ?> <a href="<?php echo esc_url($link); ?> " class="add-new-h2">« <?php echo sprintf(__('Back to %s', 'pods'), $this->heading['manage']); ?> </a> <?php } pods_view(PODS_DIR . 'ui/admin/view.php', compact(array_keys(get_defined_vars()))); ?> </h2> </div> <?php }
/** * Customize output of the form field * * @param string $name * @param mixed $value * @param array $options * @param array $pod * @param int $id * * @since 2.0 */ public function input($name, $value = null, $options = null, $pod = null, $id = null) { $options = (array) $options; $form_field_type = PodsForm::$field_type; if (is_array($value)) { $value = implode("\n", $value); } $field_type = 'codemirror'; do_action('pods_form_ui_field_code_' . $field_type, $name, $value, $options, $pod, $id); do_action('pods_form_ui_field_code', $field_type, $name, $value, $options, $pod, $id); pods_view(PODS_DIR . 'ui/fields/' . $field_type . '.php', compact(array_keys(get_defined_vars()))); }
/** * Customize output of the form field * * @param string $name * @param mixed $value * @param array $options * @param array $pod * @param int $id * * @since 2.0 */ public function input($name, $value = null, $options = null, $pod = null, $id = null) { global $wpdb; $options = (array) $options; $form_field_type = PodsForm::$field_type; $options['grouped'] = 1; $options['table_info'] = array(); $custom = pods_var_raw(self::$type . '_custom', $options, false); $custom = apply_filters('pods_form_ui_field_pick_custom_values', $custom, $name, $value, $options, $pod, $id); $ajax = false; if (('custom-simple' != pods_var(self::$type . '_object', $options) || empty($custom)) && '' != pods_var(self::$type . '_object', $options, '', null, true)) { $ajax = true; } if (!empty(self::$field_data) && self::$field_data['id'] == $options['id']) { $ajax = (bool) self::$field_data['autocomplete']; } $ajax = apply_filters('pods_form_ui_field_pick_ajax', $ajax, $name, $value, $options, $pod, $id); if (0 == pods_var(self::$type . '_ajax', $options, 1)) { $ajax = false; } if ('single' == pods_var(self::$type . '_format_type', $options, 'single')) { if ('dropdown' == pods_var(self::$type . '_format_single', $options, 'dropdown')) { $field_type = 'select'; } elseif ('radio' == pods_var(self::$type . '_format_single', $options, 'dropdown')) { $field_type = 'radio'; } elseif ('autocomplete' == pods_var(self::$type . '_format_single', $options, 'dropdown')) { $field_type = 'select2'; } else { // Support custom integration do_action('pods_form_ui_field_pick_input_' . pods_var(self::$type . '_format_type', $options, 'single') . '_' . pods_var(self::$type . '_format_single', $options, 'dropdown'), $name, $value, $options, $pod, $id); do_action('pods_form_ui_field_pick_input', pods_var(self::$type . '_format_type', $options, 'single'), $name, $value, $options, $pod, $id); return; } } elseif ('multi' == pods_var(self::$type . '_format_type', $options, 'single')) { if (!empty($value) && !is_array($value)) { $value = explode(',', $value); } if ('checkbox' == pods_var(self::$type . '_format_multi', $options, 'checkbox')) { $field_type = 'checkbox'; } elseif ('multiselect' == pods_var(self::$type . '_format_multi', $options, 'checkbox')) { $field_type = 'select'; } elseif ('autocomplete' == pods_var(self::$type . '_format_multi', $options, 'checkbox')) { $field_type = 'select2'; } else { // Support custom integration do_action('pods_form_ui_field_pick_input_' . pods_var(self::$type . '_format_type', $options, 'single') . '_' . pods_var(self::$type . '_format_multi', $options, 'checkbox'), $name, $value, $options, $pod, $id); do_action('pods_form_ui_field_pick_input', pods_var(self::$type . '_format_type', $options, 'single'), $name, $value, $options, $pod, $id); return; } } else { // Support custom integration do_action('pods_form_ui_field_pick_input', pods_var(self::$type . '_format_type', $options, 'single'), $name, $value, $options, $pod, $id); return; } pods_view(PODS_DIR . 'ui/fields/' . $field_type . '.php', compact(array_keys(get_defined_vars()))); }
/** * Build admin area * * @param $options * * @since 2.0 */ public function admin($options, $component) { $method = 'import_export'; // ajax_import pods_view(PODS_DIR . 'components/Migrate-Packages/ui/wizard.php', compact(array_keys(get_defined_vars()))); }
} include $view; } else { echo $view; } } } } app_starter_paging_nav(); } else { get_template_part('content', 'none'); } } else { if (is_file($alt_view) && file_exists($alt_view)) { if (function_exists('pods_view')) { pods_view($alt_view, null, app_starter_cache_expires(), app_starter_cache_mode()); } else { include $alt_view; } } else { if (is_string($alt_view)) { echo $alt_view; } } } ?> </main><!-- #main --> <?php app_starter_sidebar(); ?>
/** * @param bool $create * @param bool $duplicate * * @return bool|mixed */ public function form($create = false, $duplicate = false) { if (in_array('duplicate', $this->actions_disabled)) { $duplicate = false; } $this->do_hook('form'); if (isset($this->actions_custom['form']) && is_callable($this->actions_custom['form'])) { return call_user_func_array($this->actions_custom['form'], array(&$this)); } $label = $this->label['add']; $id = null; $vars = array('action' . $this->num => $this->action_after['add'], 'do' . $this->num => 'create', 'id' . $this->num => 'X_ID_X'); $alt_vars = $vars; $alt_vars['action'] = 'manage'; unset($alt_vars['id']); if (false === $create) { if (empty($this->row)) { $this->get_row(); } if (empty($this->row) && (!is_object($this->pod) || 'settings' != $this->pod->pod_data['type'])) { return $this->error(sprintf(__('<strong>Error:</strong> %s not found.', 'pods'), $this->item)); } if ($this->restricted($this->action, $this->row)) { return $this->error(sprintf(__('<strong>Error:</strong> You do not have access to this %s.', 'pods'), $this->item)); } $label = $this->label['edit']; $id = $this->row[$this->sql['field_id']]; $vars = array('action' . $this->num => $this->action_after['edit'], 'do' . $this->num => 'save', 'id' . $this->num => $id); $alt_vars = $vars; $alt_vars['action'] = 'manage'; unset($alt_vars['id']); if ($duplicate) { $label = $this->label['duplicate']; $id = null; $vars = array('action' . $this->num => $this->action_after['duplicate'], 'do' . $this->num => 'create', 'id' . $this->num => 'X_ID_X'); $alt_vars = $vars; $alt_vars['action'] = 'manage'; unset($alt_vars['id']); } } if (isset($this->fields[$this->action])) { $fields = $this->fields[$this->action]; } if (is_object($this->pod)) { $object_fields = (array) pods_var_raw('object_fields', $this->pod->pod_data, array(), null, true); if (empty($object_fields) && in_array($this->pod->pod_data['type'], array('post_type', 'taxonomy', 'media', 'user', 'comment'))) { $object_fields = $this->pod->api->get_wp_object_fields($this->pod->pod_data['type'], $this->pod->pod_data); } if (empty($fields)) { // Add core object fields if $fields is empty $fields = array_merge($object_fields, $this->pod->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']); $value = pods_var_raw('default', $field); if (empty($field['name'])) { $field['name'] = trim($name); } if (pods_var_raw('hidden', $field, false, null, true)) { $field['type'] = 'hidden'; } elseif (isset($object_fields[$field['name']])) { $fields[$field['name']] = array_merge($field, $object_fields[$field['name']]); } elseif (isset($this->pod->fields[$field['name']])) { $fields[$field['name']] = array_merge($this->pod->fields[$field['name']], $field); } if (empty($this->id) && null !== $value) { $this->pod->row_override[$field['name']] = $value; } } unset($form_fields); // Cleanup $fields = $this->do_hook('form_fields', $fields, $this->pod); $pod =& $this->pod; $thank_you = pods_var_update($vars, self::$allowed, $this->exclusion()); $thank_you_alt = pods_var_update($alt_vars, self::$allowed, $this->exclusion()); $obj =& $this; $singular_label = $this->item; $plural_label = $this->items; if (is_object($this->pod) && 'settings' == $this->pod->pod_data['type'] && 'settings' == $this->style) { pods_view(PODS_DIR . 'ui/admin/form-settings.php', compact(array_keys(get_defined_vars()))); } else { pods_view(PODS_DIR . 'ui/admin/form.php', compact(array_keys(get_defined_vars()))); } }
$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 } ?> </h2> <img src="<?php echo PODS_URL; ?> ui/images/pods-logo-notext-rgb-transparent.png" class="pods-leaf-watermark-right" /> <?php $tab = pods_v('tab', 'get', $default); $tab = sanitize_title($tab); $data = compact(array('keys', 'public_local', 'private_local', 'public_remote', 'private_remote', 'deploy_active', 'key_gen_submit', 'key_gen_header', 'form_fields')); echo pods_view(PODS_DEPLOY_DIR . 'ui/' . $tab . '.php', $data); ?> </form> </div>
/** * Include Main Page view * * @return string */ public function main_page() { return pods_view($this->template_path() . 'main-page.php'); }
/** * Customize output of the form field * * @param string $name * @param mixed $value * @param array $options * @param array $pod * @param int $id * * @since 2.0 */ public function input($name, $value = null, $options = null, $pod = null, $id = null) { $options = (array) $options; $form_field_type = PodsForm::$field_type; if (is_array($value)) { $value = !empty($value); } $field_type = 'checkbox'; if ('radio' == pods_var(self::$type . '_format_type', $options)) { $field_type = 'radio'; } elseif ('dropdown' == pods_var(self::$type . '_format_type', $options)) { $field_type = 'select'; } pods_view(PODS_DIR . 'ui/fields/' . $field_type . '.php', compact(array_keys(get_defined_vars()))); }
<?php /** * pods_view() has built-in output buffering. */ /** WITHOUT pods_view */ // Get file.php content ob_start(); get_template_part('file'); $content = ob_get_clean(); // Apply a filter $content = apply_filters('filter_name', $content); // Do shortcodes $content = do_shortcode($content); // Replace a custom tag like {MY_TAG} with something dynamic, great for things specific to the current user or other cases $content = str_replace('{MY_TAG}', 'Cool content', $content); // Output the content echo $content; /** WITH pods_view */ // Get file.php and cache it $content = pods_view('file.php', null, HOUR_IN_SECONDS, 'cache', true); // Apply a filter $content = apply_filters('filter_name', $content); // Do shortcodes $content = do_shortcode($content); // Replace a custom tag like {MY_TAG} with something dynamic, great for things specific to the current user or other cases $content = str_replace('{MY_TAG}', 'Cool content', $content); // Output the content echo $content;
/** * Customize output of the form field * * @param string $name * @param mixed $value * @param array $options * @param array $pod * @param int $id * * @since 2.0 */ public function input($name, $value = null, $options = null, $pod = null, $id = null) { $options = (array) $options; $form_field_type = PodsForm::$field_type; if (is_array($value)) { $value = implode("\n", $value); } if (isset($options['name']) && false === PodsForm::permission(self::$type, $options['name'], $options, null, $pod, $id)) { if (pods_var('read_only', $options, false)) { $options['readonly'] = true; $field_type = 'textarea'; } else { return; } } elseif (!pods_has_permissions($options) && pods_var('read_only', $options, false)) { $options['readonly'] = true; $field_type = 'textarea'; } elseif ('tinymce' == pods_var(self::$type . '_editor', $options)) { $field_type = 'tinymce'; } elseif ('cleditor' == pods_var(self::$type . '_editor', $options)) { $field_type = 'cleditor'; } else { // Support custom WYSIWYG integration do_action('pods_form_ui_field_wysiwyg_' . pods_var(self::$type . '_editor', $options), $name, $value, $options, $pod, $id); do_action('pods_form_ui_field_wysiwyg', pods_var(self::$type . '_editor', $options), $name, $value, $options, $pod, $id); return; } pods_view(PODS_DIR . 'ui/fields/' . $field_type . '.php', compact(array_keys(get_defined_vars()))); }
<h2> <?php _e('Deploy To Remote Site', 'pods-deploy'); ?> </h2> <div class="keys-and-url stuffbox"> <?php $form = Pods_Form(); $fields[] = $form::field('_wpnonce', wp_create_nonce('pods-deploy'), 'hidden'); foreach ($form_fields as $name => $field) { $fields[] = '<li>'; $fields[] = $form::label($name, pods_v('label', $field, ''), pods_v('help', $field, '')); $fields[] = $form::field($name, pods_v('value', $field), pods_v('type', $field, 'text'), pods_v('options', $field)); $fields[] = '</li>'; } echo sprintf('<ul>%1s</ul>', implode($fields)); ?> </div> <div class="clearfix"></div> <?php pods_view(PODS_DEPLOY_DIR . 'ui/pods-wizard.php'); ?> <p class="submit"> <input type="submit" class="button button-primary" name="pods-deploy-submit" value="Deploy"> </p> </form> </div>
/** * Customize output of the form field * * @param string $name * @param mixed $value * @param array $options * @param array $pod * @param int $id * * @since 2.0 */ public function input($name, $value = null, $options = null, $pod = null, $id = null) { $options = (array) $options; $form_field_type = PodsForm::$field_type; if (is_array($value)) { $value = implode(' ', $value); } pods_view(PODS_DIR . 'ui/fields/email.php', compact(array_keys(get_defined_vars()))); }
/** * Customize output of the form field * * @param string $name * @param mixed $value * @param array $options * @param array $pod * @param int $id * * @since 2.0 */ public function input($name, $value = null, $options = null, $pod = null, $id = null) { $options = (array) $options; $form_field_type = PodsForm::$field_type; if (is_array($value)) { $value = implode('', $value); } if ('slider' == pods_var(self::$type . '_format_type', $options, 'number')) { $field_type = 'slider'; } else { $field_type = 'number'; } pods_view(PODS_DIR . 'ui/fields/' . $field_type . '.php', compact(array_keys(get_defined_vars()))); }
/** * Customize output of the form field * * @param string $name * @param mixed $value * @param array $options * @param array $pod * @param int $id * * @since 2.0 */ public function input($name, $value = null, $options = null, $pod = null, $id = null) { $options = (array) $options; $form_field_type = PodsForm::$field_type; if (is_array($value)) { $value = implode(' ', $value); } // Farbtastic for below 3.5 if (pods_version_check('wp', '3.5', '>')) { pods_view(PODS_DIR . 'ui/fields/farbtastic.php', compact(array_keys(get_defined_vars()))); } else { pods_view(PODS_DIR . 'ui/fields/color.php', compact(array_keys(get_defined_vars()))); } }
/** * Include main UI view and add scope data into it. * * @since 0.4.0 * * @return bool|string */ function include_view() { $keys = Pods_Deploy_Auth::get_keys(true); $public_remote = pods_v_sanitized('public', $keys, ''); $private_remote = pods_v_sanitized('private', $keys, ''); $deploy_active = Pods_Deploy_Auth::deploy_active(); wp_enqueue_style('pods-wizard'); if ($deploy_active) { $key_gen_submit = __('Disable Deployments', 'pods-deploy'); $key_gen_header = __('Click to revoke keys and prevent deployments to this site.', 'pods-deploy'); } else { $key_gen_submit = __('Allow Deployments', 'pods-deploy'); $key_gen_header = __('Click to generate new keys and allow deployments to this site', 'pods-deploy'); } $form_fields = $this->form_fields(); $data = compact(array('keys', 'public_local', 'private_local', 'public_remote', 'private_remote', 'deploy_active', 'key_gen_submit', 'key_gen_header', 'form_fields')); return pods_view(PODS_DEPLOY_DIR . 'ui/main.php', $data); }
/** * Customize output of the form field * * @param string $name * @param mixed $value * @param array $options * @param array $pod * @param int $id * * @since 2.0 */ public function input($name, $value = null, $options = null, $pod = null, $id = null) { $options = (array) $options; $form_field_type = PodsForm::$field_type; if (is_array($value)) { $value = implode(' ', $value); } // Format Value $value = $this->display($value, $name, $options, null, $pod, $id); pods_view(PODS_DIR . 'ui/fields/datetime.php', compact(array_keys(get_defined_vars()))); }
<?php // Include with Cache Key using Current URL // Loop content on a page cached based on Current URL pods_view('loop-content.php?url=' . pods_current_url(), null, DAY_IN_SECONDS); // Include with Cache Key using User Role // Restricted content cached based on current role of User global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); pods_view('restricted-content.php?role=' . $user_role, null, DAY_IN_SECONDS); // Include with Cache Key using Special Magic Tag // See: http://pods.io/docs/build/special-magic-tags/ // Show related posts cached based on current post ID pods_view('related-posts.php?ID={globals.post_ID}', null, DAY_IN_SECONDS);
/** * Get the admin help page */ public function admin_help() { pods_view(PODS_DIR . 'ui/admin/help.php', compact(array_keys(get_defined_vars()))); }
/** * @param array $fields (optional) Fields to show in the view, defaults to all fields * * @return mixed * @since 2.3.10 */ public function view($fields = null) { $pod =& $this; // Convert comma separated list of fields to an array if (null !== $fields && !is_array($fields) && 0 < strlen($fields)) { $fields = explode(',', $fields); } $object_fields = (array) pods_v('object_fields', $this->pod_data, array(), true); if (empty($fields)) { // Add core object fields if $fields is empty $fields = array_merge($object_fields, $this->fields); } $view_fields = $fields; // Temporary $fields = array(); foreach ($view_fields as $name => $field) { $defaults = array('name' => $name); if (!is_array($field)) { $name = $field; $field = array('name' => $name); } $field = array_merge($defaults, $field); $field['name'] = trim($field['name']); if (empty($field['name'])) { $field['name'] = trim($name); } if (isset($object_fields[$field['name']])) { $field = array_merge($field, $object_fields[$field['name']]); } elseif (isset($this->fields[$field['name']])) { $field = array_merge($this->fields[$field['name']], $field); } if (pods_v('hidden', $field, false, null, true) || 'hidden' == $field['type']) { continue; } elseif (!PodsForm::permission($field['type'], $field['name'], $field['options'], $fields, $pod, $pod->id())) { continue; } $fields[$field['name']] = $field; } unset($view_fields); // Cleanup $output = pods_view(PODS_DIR . 'ui/front/view.php', compact(array_keys(get_defined_vars())), false, 'cache', true); return $this->do_hook('view', $output, $fields, $this->id()); }
/** * Shortcode support for use anywhere that support WP Shortcodes * * @param array $tags An associative array of shortcode properties * @param string $content A string that represents a template override * * @return string * @since 1.6.7 */ function pods_shortcode($tags, $content = null) { if (defined('PODS_DISABLE_SHORTCODE') && PODS_DISABLE_SHORTCODE) { return ''; } // For enforcing pagination parameters when not displaying pagination $page = 1; $offset = 0; if (isset($tags['page'])) { $page = (int) $tags['page']; $page = max($page, 1); } if (isset($tags['offset'])) { $offset = (int) $tags['offset']; $offset = max($offset, 0); } $defaults = array('use_current' => false, 'name' => null, 'id' => null, 'slug' => null, 'select' => null, 'join' => null, 'order' => null, 'orderby' => null, 'limit' => null, 'where' => null, 'having' => null, 'groupby' => null, 'search' => true, 'pagination' => false, 'page' => null, 'offset' => null, 'filters' => false, 'filters_label' => 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); if (!empty($tags)) { $tags = array_merge($defaults, $tags); } else { $tags = $defaults; } $tags = apply_filters('pods_shortcode', $tags); $tags['pagination'] = filter_var($tags['pagination'], FILTER_VALIDATE_BOOLEAN); $tags['search'] = filter_var($tags['pagination'], FILTER_VALIDATE_BOOLEAN); $tags['use_current'] = filter_var($tags['use_current'], FILTER_VALIDATE_BOOLEAN); if (empty($content)) { $content = null; } // Allow views only if not targeting a file path (must be within theme) if (0 < strlen($tags['view'])) { $return = ''; if (!file_exists($tags['view'])) { $return = pods_view($tags['view'], null, (int) $tags['expires'], $tags['cache_mode']); if ($tags['shortcodes'] && defined('PODS_SHORTCODE_ALLOW_SUB_SHORTCODES') && PODS_SHORTCODE_ALLOW_SUB_SHORTCODES) { $return = do_shortcode($return); } } return $return; } if (!$tags['use_current'] && empty($tags['name'])) { if (in_the_loop() || is_singular()) { $pod = pods(get_post_type(), get_the_ID(), false); if (!empty($pod)) { $tags['name'] = get_post_type(); $id = $tags['id'] = get_the_ID(); } } if (empty($tags['name'])) { return '<p>Please provide a Pod name</p>'; } } if (!empty($tags['col'])) { $tags['field'] = $tags['col']; unset($tags['col']); } if (!empty($tags['order'])) { $tags['orderby'] = $tags['order']; unset($tags['order']); } if (empty($content) && empty($tags['pods_page']) && empty($tags['template']) && empty($tags['field']) && empty($tags['form'])) { return '<p>Please provide either a template or field name</p>'; } if (!$tags['use_current'] && !isset($id)) { // id > slug (if both exist) $id = 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 (!empty($tags['id'])) { $id = $tags['id']; if (defined('PODS_SHORTCODE_ALLOW_EVALUATE_TAGS') && PODS_SHORTCODE_ALLOW_EVALUATE_TAGS) { $id = pods_evaluate_tags($id); } if (is_numeric($id)) { $id = absint($id); } } } if (!isset($pod)) { if (!$tags['use_current']) { $pod = pods($tags['name'], $id); } else { $pod = pods(); $id = $pod->id(); } } if (empty($pod) || !$pod->valid()) { return '<p>Pod not found</p>'; } $found = 0; $is_singular = !empty($id) || $tags['use_current']; if (!$is_singular) { $params = array(); if (!defined('PODS_DISABLE_SHORTCODE_SQL') || !PODS_DISABLE_SHORTCODE_SQL) { if (0 < strlen($tags['orderby'])) { $params['orderby'] = $tags['orderby']; } 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($params['where']); } } 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($id); } } if (0 < strlen($tags['groupby'])) { $params['groupby'] = $tags['groupby']; } if (0 < strlen($tags['select'])) { $params['select'] = $tags['select']; } if (0 < strlen($tags['join'])) { $params['join'] = $tags['join']; } } // Forms require params set if (!empty($params) || empty($tags['form'])) { if (!empty($tags['limit'])) { $params['limit'] = (int) $tags['limit']; } $params['search'] = $tags['search']; $params['pagination'] = $tags['pagination']; // If we aren't displaying pagination, we need to enforce page/offset if (!$params['pagination']) { $params['page'] = $page; $params['offset'] = $offset; // Force pagination on, we need it and we're enforcing page/offset $params['pagination'] = true; } else { // If we are displaying pagination, allow page/offset override only if *set* if (isset($tags['page'])) { $params['page'] = (int) $tags['page']; $params['page'] = max($params['page'], 1); } if (isset($tags['offset'])) { $params['offset'] = (int) $tags['offset']; $params['offset'] = max($params['offset'], 0); } } if (!empty($tags['cache_mode']) && 'none' != $tags['cache_mode']) { $params['cache_mode'] = $tags['cache_mode']; $params['expires'] = (int) $tags['expires']; } $params = apply_filters('pods_shortcode_findrecords_params', $params, $pod, $tags); $pod->find($params); $found = $pod->total(); } } if (!empty($tags['form'])) { if ('user' == $pod->pod) { // Further hardening of User-based forms if (false !== strpos($tags['fields'], '_capabilities') || false !== strpos($tags['fields'], '_user_level')) { return ''; } elseif ($is_singular && (!defined('PODS_SHORTCODE_ALLOW_USER_EDIT') || !PODS_SHORTCODE_ALLOW_USER_EDIT)) { return ''; } } return $pod->form($tags['fields'], $tags['label'], $tags['thank_you']); } elseif (!empty($tags['field'])) { if (empty($tags['helper'])) { $return = $pod->display($tags['field']); } else { $return = $pod->helper($tags['helper'], $pod->field($tags['field']), $tags['field']); } if ($tags['shortcodes'] && defined('PODS_SHORTCODE_ALLOW_SUB_SHORTCODES') && PODS_SHORTCODE_ALLOW_SUB_SHORTCODES) { $return = do_shortcode($return); } return $return; } elseif (!empty($tags['pods_page']) && class_exists('Pods_Pages')) { $pods_page = Pods_Pages::exists($tags['pods_page']); if (empty($pods_page)) { return '<p>Pods Page not found</p>'; } $return = Pods_Pages::content(true, $pods_page); if ($tags['shortcodes'] && defined('PODS_SHORTCODE_ALLOW_SUB_SHORTCODES') && PODS_SHORTCODE_ALLOW_SUB_SHORTCODES) { $return = do_shortcode($return); } return $return; } ob_start(); if (!$is_singular && false !== $tags['filters'] && 'before' == $tags['filters_location']) { echo $pod->filters($tags['filters'], $tags['filters_label']); } if (!$is_singular && 0 < $found && true === $tags['pagination'] && in_array($tags['pagination_location'], array('before', 'both'))) { echo $pod->pagination($tags['pagination_label']); } echo $pod->template($tags['template'], $content); if (!$is_singular && 0 < $found && true === $tags['pagination'] && in_array($tags['pagination_location'], array('after', 'both'))) { echo $pod->pagination($tags['pagination_label']); } if (!$is_singular && false !== $tags['filters'] && 'after' == $tags['filters_location']) { echo $pod->filters($tags['filters'], $tags['filters_label']); } $return = ob_get_clean(); if ($tags['shortcodes'] && defined('PODS_SHORTCODE_ALLOW_SUB_SHORTCODES') && PODS_SHORTCODE_ALLOW_SUB_SHORTCODES) { $return = do_shortcode($return); } return $return; }
/** * Customize output of the form field * * @param string $name * @param mixed $value * @param array $options * @param array $pod * @param int $id * * @since 2.0 */ public function input($name, $value = null, $options = null, $pod = null, $id = null) { $options = (array) $options; $form_field_type = PodsForm::$field_type; if (!is_admin()) { include_once ABSPATH . '/wp-admin/includes/template.php'; if (is_multisite()) { include_once ABSPATH . '/wp-admin/includes/ms.php'; } } if ((defined('PODS_DISABLE_FILE_UPLOAD') && true === PODS_DISABLE_FILE_UPLOAD || defined('PODS_UPLOAD_REQUIRE_LOGIN') && is_bool(PODS_UPLOAD_REQUIRE_LOGIN) && true === PODS_UPLOAD_REQUIRE_LOGIN && !is_user_logged_in() || defined('PODS_UPLOAD_REQUIRE_LOGIN') && !is_bool(PODS_UPLOAD_REQUIRE_LOGIN) && (!is_user_logged_in() || !current_user_can(PODS_UPLOAD_REQUIRE_LOGIN))) && (defined('PODS_DISABLE_FILE_BROWSER') && true === PODS_DISABLE_FILE_BROWSER || defined('PODS_FILES_REQUIRE_LOGIN') && is_bool(PODS_FILES_REQUIRE_LOGIN) && true === PODS_FILES_REQUIRE_LOGIN && !is_user_logged_in() || defined('PODS_FILES_REQUIRE_LOGIN') && !is_bool(PODS_FILES_REQUIRE_LOGIN) && (!is_user_logged_in() || !current_user_can(PODS_FILES_REQUIRE_LOGIN)))) { ?> <p>You do not have access to upload / browse files. Contact your website admin to resolve.</p> <?php return; } // Use plupload if attachment isn't available if ('attachment' == pods_var(self::$type . '_uploader', $options) && (!is_user_logged_in() || !current_user_can('upload_files') && !current_user_can('edit_files'))) { $field_type = 'plupload'; } elseif ('plupload' == pods_var(self::$type . '_uploader', $options)) { $field_type = 'plupload'; } elseif ('attachment' == pods_var(self::$type . '_uploader', $options)) { if (!pods_version_check('wp', '3.5') || !is_admin()) { // @todo test frontend media modal $field_type = 'attachment'; } else { $field_type = 'media'; } } else { // Support custom File Uploader integration do_action('pods_form_ui_field_file_uploader_' . pods_var(self::$type . '_uploader', $options), $name, $value, $options, $pod, $id); do_action('pods_form_ui_field_file_uploader', pods_var(self::$type . '_uploader', $options), $name, $value, $options, $pod, $id); return; } pods_view(PODS_DIR . 'ui/fields/' . $field_type . '.php', compact(array_keys(get_defined_vars()))); }
/** * Customize output of the form field * * @param string $name * @param mixed $value * @param array $options * @param array $pod * @param int $id * * @since 2.0 */ public function input($name, $value = null, $options = null, $pod = null, $id = null) { $options = (array) $options; $form_field_type = PodsForm::$field_type; if (is_array($value)) { $value = !empty($value); } $field_type = 'checkbox'; if ('radio' == pods_v(self::$type . '_format_type', $options)) { $field_type = 'radio'; } elseif ('dropdown' == pods_v(self::$type . '_format_type', $options)) { $field_type = 'select'; } if (isset($options['name']) && false === PodsForm::permission(self::$type, $options['name'], $options, null, $pod, $id)) { if (pods_v('read_only', $options, false)) { $options['readonly'] = true; } else { return; } } elseif (!pods_has_permissions($options) && pods_v('read_only', $options, false)) { $options['readonly'] = true; } if (1 === $value || '1' === $value || true === $value) { $value = 1; } else { $value = 0; } pods_view(PODS_DIR . 'ui/fields/' . $field_type . '.php', compact(array_keys(get_defined_vars()))); }
/** * Better footer function * * @param string $name Name of footer. * * @returns string The footer. * * @since 0.0.2 */ function app_starter_footer($name = null) { /** * Override which footer is returned; * * @param string $name Name of footer. * * @since 0.0.2 */ $name = apply_filters('app_starter_footer', $name); if (function_exists('pods_view')) { $name = 'footer.php'; if (!is_null($name) && file_exists('footer-' . $name . '.php')) { $name = 'footer-' . $name . '.php'; } pods_view($name, null, app_starter_cache_expires(), app_starter_cache_mode()); } else { get_header($name); } }
/** * Customize output of the form field * * @param string $name * @param mixed $value * @param array $options * @param array $pod * @param int $id * * @since 2.0 */ public function input($name, $value = null, $options = null, $pod = null, $id = null) { $options = (array) $options; $form_field_type = PodsForm::$field_type; if (is_array($value)) { $value = implode(' ', $value); } $field_type = 'email'; if (isset($options['name']) && false === PodsForm::permission(self::$type, $options['name'], $options, null, $pod, $id)) { if (pods_var('read_only', $options, false)) { $options['readonly'] = true; $field_type = 'text'; } else { return; } } elseif (!pods_has_permissions($options) && pods_var('read_only', $options, false)) { $options['readonly'] = true; $field_type = 'text'; } pods_view(PODS_DIR . 'ui/fields/' . $field_type . '.php', compact(array_keys(get_defined_vars()))); }
$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 } ?> </h2> <img src="<?php echo PODS_URL; ?> ui/images/pods-logo-notext-rgb-transparent.png" class="pods-leaf-watermark-right" /> <?php wp_nonce_field('pods-settings'); $tab = pods_var('tab', 'get', $default); $tab = sanitize_title($tab); echo pods_view(PODS_DIR . 'ui/admin/settings-' . $tab . '.php'); ?> </form> </div>