本文整理汇总了PHP中pods_v函数的典型用法代码示例。如果您正苦于以下问题:PHP pods_v函数的具体用法?PHP pods_v怎么用?PHP pods_v使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pods_v函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: admin_page
/**
* Output admin page
*/
public static function admin_page()
{
include_once 'Pods_Jobs_Queue_API.php';
/**
* @var $wpdb wpdb
*/
global $wpdb;
$table = Pods_Jobs_Queue_API::table();
Pods_Jobs_Queue_API::install();
$ui = array('item' => __('Job', 'pods-jobs-queue'), 'items' => __('Jobs', 'pods-jobs-queue'), 'header' => array('view' => __('View Job Info', 'pods-jobs-queue')), 'sql' => array('table' => $table, 'field_id' => 'id', 'field_index' => 'callback'), 'orderby' => '( `t`.`status` = "queued" ) DESC, ( `t`.`status` = "completed" ) DESC, `t`.`date_queued` DESC, `t`.`date_completed` DESC', 'fields' => array('manage' => array('callback' => array('name' => 'callback', 'label' => 'Callback', 'type' => 'text'), 'group' => array('name' => 'group', 'label' => 'Group', 'type' => 'text'), 'memo' => array('name' => 'memo', 'label' => 'Memo', 'type' => 'text'), 'status' => array('name' => 'status', 'label' => 'Status', 'type' => 'pick', 'pick_object' => 'custom-simple', 'data' => array('queued' => __('Queued', 'pods-jobs-queue'), 'processing' => __('Processing', 'pods-jobs-queue'), 'completed' => __('Completed', 'pods-jobs-queue'), 'failed' => __('Failed', 'pods-jobs-queue'))), 'date_queued' => array('name' => 'date_queued', 'label' => 'Time Queued', 'type' => 'datetime', 'options' => array('datetime_allow_empty' => 1)), 'date_started' => array('name' => 'date_started', 'label' => 'Time Started', 'type' => 'datetime', 'options' => array('datetime_allow_empty' => 1)), 'date_completed' => array('name' => 'date_completed', 'label' => 'Time Completed', 'type' => 'datetime', 'options' => array('datetime_allow_empty' => 1))), 'search' => array()), 'filters' => array('callback', 'memo', 'group', 'status', 'date_queued', 'date_started', 'date_completed'), 'filters_enhanced' => true, 'actions_disabled' => array('add', 'edit', 'duplicate', 'export'), 'actions_custom' => array('process_job' => array('callback' => array(__CLASS__, 'admin_page_process_job')), 'view' => array('callback' => array(__CLASS__, 'admin_page_view_job')), 'delete' => array('callback' => array(__CLASS__, 'admin_page_delete_job'))), 'actions_bulk' => array('delete' => array('label' => __('Delete', 'pods')), 'process_jobs' => array('callback' => array(__CLASS__, 'admin_page_process_jobs'))));
$ui['fields']['search']['callback'] = $ui['fields']['manage']['callback'];
$ui['fields']['search']['memo'] = $ui['fields']['manage']['memo'];
$ui['fields']['search']['group'] = $ui['fields']['manage']['group'];
$ui['fields']['search']['status'] = $ui['fields']['manage']['status'];
$ui['fields']['search']['date_queued'] = $ui['fields']['manage']['date_queued'];
$ui['fields']['search']['date_started'] = $ui['fields']['manage']['date_started'];
$ui['fields']['search']['date_completed'] = $ui['fields']['manage']['date_completed'];
$ui['fields']['view'] = $ui['fields']['manage'];
unset($ui['fields']['view']['callback']);
$ui['fields']['view']['arguments'] = array('name' => 'arguments', 'label' => 'Callback Arguments', 'type' => 'paragraph');
$ui['fields']['view']['log'] = array('name' => 'log', 'label' => 'Callback Log', 'type' => 'text');
$ui['fields']['view']['blog_id'] = array('name' => 'blog_id', 'label' => 'Blog ID', 'type' => 'number', 'options' => array('number_format_type' => '9999.99', 'number_decimals' => 0), 'width' => '5%');
if (!defined('PODS_JOBS_QUEUE_GROUPS') || !PODS_JOBS_QUEUE_GROUPS) {
unset($ui['fields']['manage']['group']);
unset($ui['fields']['manage']['search']);
unset($ui['fields']['manage']['view']);
unset($ui['filters'][array_search('group', $ui['filters'])]);
}
if (1 == pods_v('deleted_bulk')) {
unset($ui['actions_custom']['delete']);
}
pods_ui($ui);
}
开发者ID:KevinFairbanks,项目名称:pods-jobs-queue,代码行数:36,代码来源:Pods_Jobs_Queue_Admin.php
示例2: SLUG_new_salad_redirect
function SLUG_new_salad_redirect()
{
//check if new_salad GET variable isset, act only if it is
if (false !== ($new_salad_id = pods_v('new_salad', 'get', false, true))) {
//use the value to get the link to the item and then redirect to it.
//get peramlink only works for post types.
///Use get_term_link for taxonomies or build link manually for advanced content types
pods_redirect(get_permalink($new_salad_id));
}
}
开发者ID:logoscreative,项目名称:pods-code-library,代码行数:10,代码来源:redirect-to-new-item.php
示例3: get_pod_id_shortcode
/**
* Note: This is needed due to a bug issued here https://github.com/pods-framework/pods/issues/2284
* The forum thread is: http://pods.io/forums/topic/some-lesson-learned/#post-185783
*
* Add Shortcode to generate a pods (template or form) that support a id passed vía GET (this is generic)
* If we need to work with a related var (sub collection) you can indicate the "related pod" and a "where"
* clause will be generated
*
* @params
* id_get_var is the id var passed via get that holds the id (i.e: give me a concrete author by its id
* related_pod optional. If exists there's a related field to a one to many relation and is used in combination with id_get_var
* this is used to get a collection where subrelated field is equal to the id provided (i.e: all books from and author)
* @usage
* [podsid name="author" form="1" id_get_var="author_id" fields="post_title, type_author" label="Save Author"/]
* [podsid name="books" id_get_var="author_id" related_pod="author" template="Books View" limit="10" pagination="1"/]
*/
function get_pod_id_shortcode($atts, $content = "")
{
// get the pods form user attributes
extract(shortcode_atts(array('id_get_var' => 'id', 'related_pod' => '', 'name' => '', 'fields' => '', 'form' => '0', 'template' => '', 'limit' => '', 'pagination' => '', 'label' => ''), $atts, 'podsid'));
// get the id
$id = pods_v($id_get_var, 'get', null, true);
// where
if ($related_pod == '') {
$where = $id > 0 ? 't.ID = ' . $id : '';
} else {
$where = $id > 0 ? $related_pod . '.id = ' . $id : '';
}
$params = array('limit' => $limit, 'where' => $where);
$_pod = pods($name, $params);
if ($form == 1) {
return $_pod->form($fields, $label);
} else {
return $_pod->template($template, $content);
}
}
开发者ID:logoscreative,项目名称:pods-code-library,代码行数:36,代码来源:pods-by-id-shortcode.php
示例4: data
/**
* Get the data from the field
*
* @param string $name The name of the field
* @param string|array $value The value of the field
* @param array $options
* @param array $pod
* @param int $id
* @param boolean $in_form
*
* @return array Array of possible field data
*
* @since 2.0
*/
public function data($name, $value = null, $options = null, $pod = null, $id = null, $in_form = true)
{
if ('checkbox' != pods_v(self::$type . '_format_type', $options)) {
$data = array(1 => pods_var_raw(self::$type . '_yes_label', $options), 0 => pods_var_raw(self::$type . '_no_label', $options));
} else {
$data = array(1 => pods_var_raw(self::$type . '_yes_label', $options));
}
return $data;
}
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:23,代码来源:boolean.php
示例5: esc_attr_e
var select_container = default_select.match( /<select[^<]*>/g );
$el.find( '.pods-sister-field' ).html( select_container + '<option value=""><?php
esc_attr_e('Loading available fields..', 'pods');
?>
</option></select>' );
postdata = {
action : 'pods_admin',
method : 'load_sister_fields',
_wpnonce : '<?php
echo esc_js(wp_create_nonce('pods-load_sister_fields'));
?>
',
pod : '<?php
echo esc_js(pods_v('name', $pod));
?>
',
related_pod : related_pod_name
};
jQuery.ajax( {
type : 'POST',
dataType : 'html',
url : ajaxurl + '?pods_ajax=1',
cache : false,
data : postdata,
success : function ( d ) {
if ( -1 == d.indexOf( '<e>' ) && -1 == d.indexOf('</e>') && -1 != d && '[]' != d ) {
var json = d.match( /{.*}$/ );
开发者ID:jeremybradbury,项目名称:wp-ninja-kit,代码行数:30,代码来源:setup-edit.php
示例6: get_table_info_load
/**
*
* Load the information about an objects MySQL table
*
* @param $object_type
* @param string $object The object to look for
* @param null $name (optional) Name of the pod to load
* @param array $pod (optional) Array with pod information
*
* @return array
*
* @since 2.5
*/
public function get_table_info_load($object_type, $object, $name = null, $pod = null)
{
$info = array();
if ('pod' == $object_type && null === $pod) {
if (empty($name)) {
$prefix = 'pod-';
// Make sure we actually have the prefix before trying anything with the name
if (0 === strpos($object_type, $prefix)) {
$name = substr($object_type, strlen($prefix), strlen($object_type));
}
}
if (empty($name) && !empty($object)) {
$name = $object;
}
$pod = $this->load_pod(array('name' => $name, 'table_info' => false), false);
if (!empty($pod)) {
$object_type = $pod['type'];
$name = $pod['name'];
$object = $pod['object'];
$info['pod'] = $pod;
}
} elseif (null === $pod) {
if (empty($name)) {
$prefix = $object_type . '-';
// Make sure we actually have the prefix before trying anything with the name
if (0 === strpos($object_type, $prefix)) {
$name = substr($object_type, strlen($prefix), strlen($object_type));
}
}
if (empty($name) && !empty($object)) {
$name = $object;
}
if (!empty($name)) {
$pod = $this->load_pod(array('name' => $name, 'table_info' => false), false);
if (!empty($pod) && (null === $object_type || $object_type == $pod['type'])) {
$object_type = $pod['type'];
$name = $pod['name'];
$object = $pod['object'];
$info['pod'] = $pod;
}
}
} elseif (!empty($pod)) {
$info['pod'] = $pod;
}
if (0 === strpos($object_type, 'pod')) {
if (empty($name)) {
$prefix = 'pod-';
// Make sure we actually have the prefix before trying anything with the name
if (0 === strpos($object_type, $prefix)) {
$name = substr($object_type, strlen($prefix), strlen($object_type));
}
}
$info['type'] = 'pod';
global $wpdb;
$info['table'] = $info['meta_table'] = $wpdb->prefix . 'pods_' . (empty($object) ? $name : $object);
if (is_array($info['pod']) && 'pod' == pods_v('type', $info['pod'])) {
$info['pod_field_index'] = $info['field_index'] = $info['meta_field_index'] = $info['meta_field_value'] = pods_v('pod_index', $info['pod']['options'], 'id', true);
$slug_field = get_posts(array('post_type' => '_pods_field', 'posts_per_page' => 1, 'nopaging' => true, 'post_parent' => $info['pod']['id'], 'orderby' => 'menu_order', 'order' => 'ASC', 'meta_query' => array(array('key' => 'type', 'value' => 'slug'))));
if (!empty($slug_field)) {
$slug_field = $slug_field[0];
$info['field_slug'] = $info['pod_field_slug'] = $slug_field->post_name;
}
if (1 == pods_v('hierarchical', $info['pod']['options'], 0)) {
$parent_field = pods_v('pod_parent', $info['pod']['options'], 'id', true);
if (!empty($parent_field) && isset($info['pod']['fields'][$parent_field])) {
$info['object_hierarchical'] = true;
$info['pod_field_parent'] = $info['field_parent'] = $parent_field . '_select';
$info['field_parent_select'] = '`' . $parent_field . '`.`id` AS `' . $info['field_parent'] . '`';
}
}
}
}
return $info;
}
开发者ID:satokora,项目名称:IT354Project,代码行数:87,代码来源:PodsAPI.php
示例7: __
//meta title
$pods->meta['title'] = __('Your Meta Title Here', 'text-domain');
//meta descrioption
$pods->meta['description'] = __('Your Meta Description Here', 'text-domain');
/**
* SEO Fields for Pods advanced content types. Using dynamically generated content.
*
* Goes in Pods Page precode field.
*
* Be sure to note inline comments about fields that are presumed to exist that DO NOT exist by default.
*/
/**Setup Pods Object**/
//get current url
$slug = pods_v('last', 'url');
//get pod name
$pod_name = pods_v(0, 'url');
//get pods object for current item
$pods = pods($pod_name, $slug);
/*title field*/
//assumes field name of meta_title exists
$pods->meta['title'] = __($pods->field('meta_title'), 'translation-domain') . ' | ';
/*meta description*/
//presumes field name of 'meta_desc' exists
$pods->meta['description'] = __($pods->field('meta_desc'), 'translation-domain');
$pods->meta_properties['og:description'] = __($pods->field('meta_desc', 'translation-domain'));
/**Google+ Profile Link**/
//Presumes users is extended with a field called 'google_plus'
//Also presumes ACT has a field called page_author, related to Users
$author = $pods->field('page_author');
echo '<link rel="author" href="' . esc_url(get_the_author_meta('google_plus', $author['ID'])) . ' "/>';
/*OpenGrpah Image*/
开发者ID:logoscreative,项目名称:pods-code-library,代码行数:31,代码来源:act-seo.php
示例8: esc_js
return {
// Simply use the new tag term as the id
//we might want to append 'new' to all newly created term IDs for processing in PodsAPI.php
id: term.trim(),
text: term.trim()
};
}
},
<?php
}
?>
width : 'resolve',
<?php
if (1 == (int) pods_v($form_field_type . '_allow_html', $options)) {
?>
escapeMarkup : function (m) { return m; },
<?php
}
?>
initSelection : function ( element, callback ) {
var data = [];
jQuery( element.val().split( "," ) ).each( function () {
if ( 'undefined' != typeof <?php
echo esc_js(pods_js_name($attributes['id']));
?>
_data[ this ] ) {
data.push( {
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:31,代码来源:select2.php
示例9: view
/**
* @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;
$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 $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 $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
//.........这里部分代码省略.........
开发者ID:Ingenex,项目名称:redesign,代码行数:101,代码来源:PodsUI.php
示例10: traverse_recurse
//.........这里部分代码省略.........
$traverse['table_info'] = $this->api->get_table_info('post_type', 'attachment');
} elseif (!in_array($traverse['type'], $tableless_field_types)) {
$traverse['table_info'] = $this->api->get_table_info($pod_data['type'], $pod_data['name'], $pod_data['name'], $pod_data);
} elseif (empty($traverse['table_info']) || in_array($traverse['pick_object'], $simple_tableless_objects) && !empty($traverse_recurse['last_table_info'])) {
if (in_array($traverse['pick_object'], $simple_tableless_objects) && !empty($traverse_recurse['last_table_info'])) {
$traverse['table_info'] = $traverse_recurse['last_table_info'];
if (!empty($traverse['table_info']['meta_table'])) {
$meta_data_table = true;
}
} elseif (!in_array($traverse['type'], $tableless_field_types) && !empty($traverse_recurse['last_table_info']) && 0 == $traverse_recurse['depth']) {
$traverse['table_info'] = $traverse_recurse['last_table_info'];
} else {
if (!isset($traverse['pod'])) {
$traverse['pod'] = null;
}
$traverse['table_info'] = $this->api->get_table_info($traverse['pick_object'], $traverse['pick_val'], null, $traverse['pod'], $traverse);
}
}
if (isset($this->traversal[$traverse_recurse['pod']][$traverse['name']])) {
$traverse = array_merge($traverse, (array) $this->traversal[$traverse_recurse['pod']][$traverse['name']]);
}
$traverse = apply_filters('pods_data_traverse', $traverse, compact('pod', 'fields', 'joined', 'depth', 'joined_id', 'params'), $this);
if (empty($traverse)) {
return $joins;
}
$traverse['id'] = (int) $traverse['id'];
if (empty($traverse['id'])) {
$traverse['id'] = $field;
}
$table_info = $traverse['table_info'];
$this->traversal[$traverse_recurse['pod']][$field] = $traverse;
$field_joined = $field;
if (0 < $traverse_recurse['depth'] && 't' != $traverse_recurse['joined']) {
if ($meta_data_table && ('pick' != $traverse['type'] || !in_array(pods_var('pick_object', $traverse), $simple_tableless_objects))) {
$field_joined = $traverse_recurse['joined'] . '_d';
} else {
$field_joined = $traverse_recurse['joined'] . '_' . $field;
}
}
$rel_alias = 'rel_' . $field_joined;
if (pods_v('search', $traverse_recurse['params'], false) && empty($traverse_recurse['params']->filters)) {
if (0 < strlen(pods_var('filter_' . $field_joined, 'get'))) {
$val = absint(pods_var('filter_' . $field_joined, 'get'));
$search = "`{$field_joined}`.`{$table_info['field_id']}` = {$val}";
if ('text' == $this->search_mode) {
$val = pods_var('filter_' . $field_joined, 'get');
$search = "`{$field_joined}`.`{$traverse['name']}` = '{$val}'";
} elseif ('text_like' == $this->search_mode) {
$val = pods_sanitize(pods_sanitize_like(pods_var_raw('filter_' . $field_joined)));
$search = "`{$field_joined}`.`{$traverse['name']}` LIKE '%{$val}%'";
}
$this->search_where[] = " {$search} ";
}
}
$the_join = null;
$joined_id = $table_info['field_id'];
$joined_index = $table_info['field_index'];
if ('taxonomy' == $traverse['type']) {
$rel_tt_alias = 'rel_tt_' . $field_joined;
if ($meta_data_table) {
$the_join = "\n LEFT JOIN `{$table_info['pod_table']}` AS `{$field_joined}` ON\n `{$field_joined}`.`{$table_info['pod_field_id']}` = `{$traverse_recurse['rel_alias']}`.`{$traverse_recurse['joined_id']}`\n ";
} else {
$the_join = "\n LEFT JOIN `{$wpdb->term_relationships}` AS `{$rel_alias}` ON\n `{$rel_alias}`.`object_id` = `{$traverse_recurse['joined']}`.`ID`\n\n LEFT JOIN `{$wpdb->term_taxonomy}` AS `{$rel_tt_alias}` ON\n `{$rel_tt_alias}`.`taxonomy` = '{$traverse['name']}'\n AND `{$rel_tt_alias}`.`term_taxonomy_id` = `{$rel_alias}`.`term_taxonomy_id`\n\n LEFT JOIN `{$table_info['table']}` AS `{$field_joined}` ON\n `{$field_joined}`.`{$table_info['field_id']}` = `{$rel_tt_alias}`.`{$table_info['field_id']}`\n ";
// Override $rel_alias
$rel_alias = $field_joined;
$joined_id = $table_info['field_id'];
开发者ID:ngdinhbinh,项目名称:fine-interior,代码行数:67,代码来源:PodsData.php
示例11: archive_warning
/**
* Throw admin warnings for post types that have archive templates set, but don't support archives
*
* @since 2.4.5
*/
function archive_warning()
{
//create $page variable to check if we are on pods admin page
$page = pods_v('page', 'get', false, true);
//check if we are on Pods Admin page
if ($page === 'pods') {
$archive_test = $this->archive_test();
if (is_array($archive_test)) {
foreach ($archive_test as $label => $test) {
if ($test === 'fail') {
echo sprintf('<div id="message" class="error"><p>%s</p></div>', sprintf(__('The Pods post type %1$s has an archive template set to be displayed using Pods auto template, but the Pod does not have an archive. You can enable post type archives in the "Advanced Options" tab.', 'pfat'), $label));
}
}
}
}
}
开发者ID:benbrandt,项目名称:pods,代码行数:21,代码来源:Pods_Templates_Auto_Template_Settings.php
示例12: pods_video
/**
* Output a video field as a video player.
*
* @uses wp_video_shortcode()
*
* @since 2.5
*
* @param string|array $url Can be a URL of the source file, or a Pods video field.
* @param bool|array $args Optional. Additional arguments to pass to wp_video_shortcode()
*
* @return string
*/
function pods_video($url, $args = false)
{
if (is_array($url)) {
if (!is_null(pods_v('ID', $url))) {
$id = pods_v('ID', $url);
$url = wp_get_attachment_url($id);
} else {
return;
}
}
$video_args = array('src' => $url);
if (is_array($args)) {
$video_args = array_merge($video_args, $args);
}
return wp_video_shortcode($video_args);
}
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:28,代码来源:media.php
示例13: pods_s_get_header
* @package pods_s
*/
pods_s_get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
if (have_posts()) {
//Build pods object for current item or return false if no Pod for this content type
$pods = pods(null, get_the_ID(), true);
//get name of pod
if ($pods) {
$pod_name = pods_s_get_content_type(true);
$pod_name = pods_v('specific_type', $pod_name, false, true);
}
while (have_posts()) {
the_post();
//test if we have a valid Pods object.
if ($pods and $pod_name) {
//Output template of the same name as Pod, if such a template exists.
//if it doesn't output template part
$temp = $pods->template($pod_name);
if (isset($temp)) {
echo $temp;
} else {
pods_s_get_template_part('content', pods_s_part_by_post_type(), compact(array('pods')));
}
} else {
pods_s_get_template_part('content', pods_s_part_by_post_type());
开发者ID:logoscreative,项目名称:pods-code-library,代码行数:31,代码来源:single.php
示例14: prepare_data
/**
* Prepare data to be saved
*
* @param array $data
*/
protected function prepare_data($data)
{
$details = pods_v_sanitized('details', $data, [], true);
$this->data = ['datetime' => current_time('mysql'), 'license' => $this->get_license_id($data['license']), 'url' => pods_v_sanitized('url', $data, null), 'wp_ver' => pods_v_sanitized('wp_version', $details, 0), 'ingot_ver' => pods_v_sanitized('ingot_version', $details, 0), 'php_ver' => pods_v_sanitized('php_version', $details, 0), 'vertical' => pods_v_sanitized('ing_vertical', $details, 0), 'trial' => boolval(pods_v('trial', $data, false, true))];
}
开发者ID:Ingothq,项目名称:ingSL,代码行数:10,代码来源:checkin.php
示例15: pods_var
}
$more = true;
$extra = '';
$max_length = (int) pods_var('maxlength', $field['options'], pods_var($field['type'] . '_max_length', $field['options'], 0), null, true);
if (0 < $max_length) {
$extra .= ' maxlength="' . esc_attr($max_length) . '"';
}
/**
* Filter that lets you make the title field readonly
*
* @param Pods $pod Current Pods object.
* @param PodsUI $obj Current PodsUI object.
*
* @since 2.5
*/
if (pods_v('readonly', $field['options'], pods_v('readonly', $field, false)) || apply_filters('pods_ui_form_title_readonly', false, $pod, $obj)) {
?>
<div id="titlediv">
<div id="titlewrap">
<h3><?php
echo esc_html($pod->index());
?>
</h3>
<input type="hidden" name="pods_field_<?php
echo esc_attr($pod->pod_data['field_index']);
?>
" data-name-clean="pods-field-<?php
echo esc_attr($pod->pod_data['field_index']);
?>
" id="title" size="30" tabindex="1" value="<?php
echo esc_attr(htmlspecialchars($pod->index()));
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:31,代码来源:form.php
示例16: pods_has_permissions
/**
* Check if permissions are restricted
*
* @param array $options
*
* @return bool Whether the permissions are restricted
*
* @since 2.3.4
*/
function pods_has_permissions($options)
{
$permission = false;
if (isset($options['options'])) {
$options = $options['options'];
}
if (1 == pods_v('restrict_role', $options, 0) || 1 == pods_v('restrict_capability', $options, 0) || 1 == pods_v('admin_only', $options, 0)) {
return true;
}
return false;
}
开发者ID:jeremybradbury,项目名称:wp-ninja-kit,代码行数:20,代码来源:general.php
示例17: wp_get_attachment_url
$attachment['thumbnail'] = $thumb[0];
$attachment['link'] = '';
if ($linked) {
$attachment['link'] = wp_get_attachment_url($attachment['ID']);
}
$attachment = apply_filters('pods_media_attachment', $attachment);
echo $field_file->markup($attributes, $file_limit, $title_editable, $attachment['ID'], $attachment['thumbnail'], $attachment['post_title']);
}
?>
</ul>
<a class="button pods-file-add pods-media-add" href="<?php
echo esc_url(admin_url('media-upload.php?inlineId=pods_media_attachment' . $the_post_id . '&tab=' . $tab . '&TB_iframe=1&width=640&height=1500&pods_pod=' . $pod->pod . '&pods_pod_id=' . $pod->pod . '&pods_field=' . $options['name'] . '&pods_field_id=' . $options['id'] . '&pods_uri_hash=' . $uri_hash . '&pods_field_nonce=' . $field_nonce));
?>
"><?php
echo pods_v($form_field_type . '_add_button', $options, __('Add File', 'pods'));
?>
</a>
</div>
<script type="text/x-handlebars" id="<?php
echo $css_id;
?>
-handlebars">
<?php
echo $field_file->markup($attributes, $file_limit, $title_editable);
?>
</script>
<script type="text/javascript">
jQuery( function ( $ ) {
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:31,代码来源:attachment.php
示例18: add_rest_support
/**
* Add REST API support to post type and taxonomy objects.
*
* @uses "init"
*
* @since 2.5.6
*/
public function add_rest_support()
{
static $rest_support_added;
if (!function_exists('register_rest_field')) {
return;
}
include_once PODS_DIR . 'classes/PodsRESTFields.php';
include_once PODS_DIR . 'classes/PodsRESTHandlers.php';
$rest_bases = pods_transient_get('pods_rest_bases');
if (empty($rest_bases)) {
$pods = pods_api()->load_pods();
$rest_bases = array();
if (!empty($pods) && is_array($pods)) {
foreach ($pods as $pod) {
$type = $pod['type'];
if (in_array($type, array('post_type', 'taxonomy'))) {
if ($pod && PodsRESTHandlers::pod_extends_core_route($pod)) {
$rest_bases[$pod['name']] = array('type' => $type, 'base' => sanitize_title(pods_v('rest_base', $pod['options'], $pod['name'])));
}
}
}
}
if (empty($rest_bases)) {
$rest_bases = 'none';
}
pods_transient_set('pods_rest_bases', $rest_bases);
}
if (empty($rest_support_added) && !empty($rest_bases) && 'none' !== $rest_bases) {
foreach ($rest_bases as $pod_name => $pod_info) {
$pod_type = $pod_info['type'];
$rest_base = $pod_info['base'];
if ('post_type' == $pod_type) {
PodsRESTHandlers::post_type_rest_support($pod_name, $rest_base);
} elseif ('taxonomy' == $pod_type) {
PodsRESTHandlers::taxonomy_rest_support($pod_name, $rest_base);
}
new PodsRESTFields($pod_name);
}
$rest_support_added = true;
}
}
开发者ID:benbrandt,项目名称:pods,代码行数:48,代码来源:PodsInit.php
示例19: pods_v
<?php
/**
* Get diffrent URL segment if in a local environment with a diffrent directory structure.
*
* In local wp-config set: define( 'LOCAL_ENV', true );
*/
$pod_name = pods_v(0, 'url');
$slug = pods_v(1, 'url');
if (defined('LOCAL_ENV') && LOCAL_ENV) {
$pod_name = pods_v(1, 'url');
$slug = pods_v(2, 'url');
}
$pods = pods($pod_name, $slug);
开发者ID:logoscreative,项目名称:pods-code-library,代码行数:14,代码来源:diffrent-setttings-based-on-environment.php
示例20: auto_pods
/**
* Get all Pods with auto template enable and its settings
*
* @return array With info about auto template settings per post type
*
* @since 2.4.5
*/
function auto_pods()
{
/**
* Filter to override all settings for which templates are used.
*
* Note: If this filter does not return null, all back-end settings are ignored. To add to settings with a filter, use 'pods_pfat_auto_pods';
*
* @param array $auto_pods Array of parameters to use instead of those from settings.
*
* @return array Settings arrays for each post type.
*
* @since 2.4.5
*/
$auto_pods = apply_filters('pods_pfat_auto_pods_override', null);
if (!is_null($auto_pods)) {
return $auto_pods;
}
//try to get cached results of this method
$key = '_pods_pfat_auto_pods';
$auto_pods = pods_transient_get($key);
//check if we already have the results cached & use it if we can.
if ($auto_pods === false) {
//get possible pods
$the_pods = $this->the_pods();
//start output array empty
$auto_pods = array();
//get pods api class
$api = pods_api();
//loop through each to see if auto templates is enabled
foreach ($the_pods as $the_pod => $the_pod_label) {
//get this Pods' data.
$pod_data = $api->load_pod(array('name' => $the_pod));
//if auto template is enabled add info about Pod to array
if (1 == pods_v('pfat_enable', $pod_data['options'])) {
//check if pfat_single and pfat_archive are set
$single = pods_v('pfat_single', $pod_data['options'], false, true);
$archive = pods_v('pfat_archive', $pod_data['options'], false, true);
$single_append = pods_v('pfat_append_single', $pod_data['options'], true, true);
$archive_append = pods_v('pfat_append_archive', $pod_data['options'], true, true);
$single_filter = pods_v('pfat_filter_single', $pod_data['options'], 'the_content', true);
$archive_filter = pods_v('pfat_filter_archive', $pod_data['options'], 'the_content', true);
$type = pods_v('type', $pod_data, false, true);
//check if it's a post type that has an arhive
if ($type === 'post_type' && $the_pod !== 'post' || $the_pod !== 'page') {
$has_archive = pods_v('has_archive', $pod_data['options'], false, true);
} else {
$has_archive = true;
}
if (empty($single_filter)) {
$single_filter = 'the_content';
}
if (empty($archive_filter)) {
$archive_filter = 'the_content';
}
//build output array
$auto_pods[$the_pod] = array('name' => $the_pod, 'label' => $the_pod_label, 'single' => $single, 'archive' => $archive, 'single_append' => $single_append, 'archive_append' => $archive_append, 'has_archive' => $has_archive, 'single_filter' => $single_filter, 'archive_filter' => $archive_filter, 'type' => $type);
}
}
//endforeach
//cache the results
pods_transient_set($key, $auto_pods);
}
/**
* Add to or change settings.
*
* Use this filter to change or add to the settings set in the back-end for this plugin. Has no effect if 'pods_pfat_auto_pods_override' filter is being used.
*
* @param array $auto_pods Array of parameters to use instead of those from settings.
*
* @return arr
|
请发表评论