本文整理汇总了PHP中pods_view函数的典型用法代码示例。如果您正苦于以下问题:PHP pods_view函数的具体用法?PHP pods_view怎么用?PHP pods_view使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pods_view函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin
/**
* 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())));
}
示例2: admin_edit
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())));
}
示例3: row
/**
* 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);
}
示例4: pods_shortcode
/**
* 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']) {
//.........这里部分代码省略.........
示例5: view
//.........这里部分代码省略.........
$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
}
示例6: input
/**
* 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())));
}
示例7: input
/**
* 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())));
}
示例8: admin
/**
* 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())));
}
示例9: app_starter_paging_nav
}
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();
?>
示例10: form
/**
* @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())));
}
//.........这里部分代码省略.........
示例11: pods_query_arg
$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>
示例12: main_page
/**
* Include Main Page view
*
* @return string
*/
public function main_page()
{
return pods_view($this->template_path() . 'main-page.php');
}
示例13: input
/**
* 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())));
}
示例14: ob_start
<?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;
示例15: input
/**
* 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())));
}