本文整理汇总了PHP中pods_var函数的典型用法代码示例。如果您正苦于以下问题:PHP pods_var函数的具体用法?PHP pods_var怎么用?PHP pods_var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pods_var函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: pods_markdown_output
function pods_markdown_output($value, $name, $options, $pod, $id, $traverse)
{
if (1 == pods_var($options['type'] . '_allow_markdown', $options)) {
$value = Markdown($value);
}
return $value;
}
开发者ID:Ingenex,项目名称:redesign,代码行数:7,代码来源:Markdown.php
示例2: display
/**
* Change the way the value of the field is displayed with Pods::get
*
* @param mixed $value
* @param string $name
* @param array $options
* @param array $fields
* @param array $pod
* @param int $id
*
* @since 2.0
*/
public function display($value = null, $name = null, $options = null, $pod = null, $id = null)
{
if (1 == pods_var(self::$type . '_allow_shortcode', $options, 0)) {
$value = do_shortcode($value);
}
return $value;
}
开发者ID:centaurustech,项目名称:chipin,代码行数:19,代码来源:code.php
示例3: admin
/**
* Build admin area
*
* @param $options
* @param $component
*
* @return void
* @since 2.0
*/
public function admin($options, $component)
{
global $wp_roles;
// Hook into Gravity Forms roles (since it only adds filter if Members plugin itself is activated
if (class_exists('RGForms') && !has_filter('members_get_capabilities', array('RGForms', 'members_get_capabilities'))) {
add_filter('members_get_capabilities', array('RGForms', 'members_get_capabilities'));
}
$default_role = get_option('default_role');
$roles = array();
foreach ($wp_roles->role_objects as $key => $role) {
$count = $this->count_users($key);
$roles[$key] = array('id' => $key, 'label' => $wp_roles->role_names[$key], 'name' => $key, 'capabilities' => count((array) $role->capabilities), 'users' => sprintf(_n('%s User', '%s Users', $count, 'pods'), $count));
if ($default_role == $key) {
$roles[$key]['label'] .= ' (site default)';
}
if (0 < $count && pods_is_admin(array('list_users'))) {
$roles[$key]['users'] .= '<br /><a href="' . admin_url(esc_url('users.php?role=' . $key)) . '">' . __('View Users', 'pods') . '</a>';
}
}
$ui = array('component' => $component, 'data' => $roles, 'total' => count($roles), 'total_found' => count($roles), 'icon' => PODS_URL . 'ui/images/icon32.png', 'items' => 'Roles', 'item' => 'Role', 'fields' => array('manage' => array('label' => array('label' => __('Label', 'pods')), 'name' => array('label' => __('Name', 'pods')), 'capabilities' => array('label' => __('Capabilities', 'pods')), 'users' => array('label' => __('Users', 'pods'), 'type' => 'text', 'options' => array('text_allow_html' => 1, 'text_allowed_html_tags' => '')))), 'actions_disabled' => array('duplicate', 'view', 'export'), 'actions_custom' => array('add' => array($this, 'admin_add'), 'edit' => array($this, 'admin_edit'), 'delete' => array($this, 'admin_delete')), 'search' => false, 'searchable' => false, 'sortable' => false, 'pagination' => false);
if (isset($roles[pods_var('id', 'get', -1)])) {
$ui['row'] = $roles[pods_var('id', 'get', -1)];
}
if (!pods_is_admin(array('pods_roles_add'))) {
$ui['actions_disabled'][] = 'add';
}
if (!pods_is_admin(array('pods_roles_edit'))) {
$ui['actions_disabled'][] = 'edit';
}
if (count($roles) < 2 || !pods_is_admin(array('pods_roles_delete'))) {
$ui['actions_disabled'][] = 'delete';
}
pods_ui($ui);
}
开发者ID:Ingenex,项目名称:redesign,代码行数:43,代码来源:Roles.php
示例4: migrate_relationships
/**
* @return string
*/
public function migrate_relationships()
{
if (true === $this->check_progress(__FUNCTION__)) {
return '1';
}
$migration_limit = (int) apply_filters('pods_upgrade_item_limit', 1500);
$migration_limit = max($migration_limit, 100);
$last_id = (int) $this->check_progress(__FUNCTION__);
$relationship_fields = $this->api->load_fields(array('type' => array('pick', 'file')));
foreach ($relationship_fields as $field) {
$pod = $this->api->load_pod(array('pod' => $field['pod']));
// Only target pods that are meta-enabled
if (!in_array($pod['type'], array('post_type', 'media', 'user', 'comment'))) {
continue;
}
// Only target multi-select relationships
$single_multi = pods_var($field['type'] . '_format_type', $field['options'], 'single');
if ('multi' == $single_multi) {
$limit = (int) pods_var($field['type'] . '_limit', $field['options'], 0);
} else {
$limit = 1;
}
if ($limit <= 1) {
continue;
}
// Get and loop through relationship meta
$sql = "\n\n ";
// if serialized (or array), save as individual meta items and save new order meta key
}
$last_id = true;
$rel = array();
$this->update_progress(__FUNCTION__, $last_id);
if ($migration_limit == count($rel)) {
return '-2';
} else {
return '1';
}
}
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:41,代码来源:PodsUpgrade_2_1_0.php
示例5: pods_var_raw
echo $indent;
?>
>
<input<?php
PodsForm::attributes($attributes, $name, $form_field_type, $options);
?>
/>
<?php
if (0 < strlen($label)) {
$help = pods_var_raw('help', $options);
if (1 == pods_var('grouped', $options, 0, null, true) || empty($help)) {
$help = '';
}
echo PodsForm::label($attributes['id'], $label, $help);
}
?>
</div>
<?php
if (1 == pods_var('grouped', $options, 0, null, true)) {
?>
</li>
<?php
}
$counter++;
}
if (1 == pods_var('grouped', $options, 0, null, true)) {
?>
</ul>
</div>
<?php
}
开发者ID:centaurustech,项目名称:chipin,代码行数:31,代码来源:radio.php
示例6: migrate_pod
/**
* @param $params
*
* @return mixed|string|void
*/
public function migrate_pod($params)
{
/**
* @var $wpdb WPDB
*/
global $wpdb;
if (!isset($params->pod)) {
return pods_error(__('Invalid Pod.', 'pods'));
}
$pod = pods_sanitize(pods_clean_name($params->pod));
if (!in_array("{$wpdb->prefix}pod_tbl_{$pod}", $this->tables)) {
return pods_error(__('Table not found, items cannot be migrated', 'pods'));
}
if (!in_array("{$wpdb->prefix}pods_{$pod}", $this->tables)) {
return pods_error(__('New table not found, items cannot be migrated', 'pods'));
}
if (!in_array("{$wpdb->prefix}pod_types", $this->tables)) {
return pods_error(__('Pod Types table not found, items cannot be migrated', 'pods'));
}
if (!in_array("{$wpdb->prefix}pod", $this->tables)) {
return pods_error(__('Pod table not found, items cannot be migrated', 'pods'));
}
if (true === $this->check_progress(__FUNCTION__, $pod)) {
return '1';
}
$pod_data = $this->api->load_pod(array('name' => $pod), false);
if (empty($pod_data)) {
return pods_error(sprintf(__('Pod <strong>%s</strong> not found, items cannot be migrated', 'pods'), $pod));
}
$columns = array();
$old_columns = array();
foreach ($pod_data['fields'] as $field) {
if (!in_array($field['name'], array('created', 'modified', 'author')) && !in_array($field['type'], array('file', 'pick'))) {
$columns[] = pods_sanitize($field['name']);
$old_columns[] = pods_var('_pods_1x_field_name', $field['options'], $field['name'], null, false);
}
}
$into = '`id`';
$select = '`t`.`id`';
if (!empty($columns)) {
$into .= ', `' . implode('`, `', $columns) . '`';
$select .= ', `t`.`' . implode('`, `t`.`', $old_columns) . '`';
}
// Copy content from the old table into the new
$sql = "\n REPLACE INTO `@wp_pods_{$pod}`\n ( {$into} )\n ( SELECT {$select}\n FROM `@wp_pod_tbl_{$pod}` AS `t` )\n ";
pods_query($sql);
// Copy index data from the old index table into the new individual table
$sql = "\n UPDATE `@wp_pods_{$pod}` AS `t`\n LEFT JOIN `@wp_pod_types` AS `x` ON `x`.`name` = '{$pod}'\n LEFT JOIN `@wp_pod` AS `p` ON `p`.`datatype` = `x`.`id` AND `p`.`tbl_row_id` = `t`.`id`\n SET `t`.`created` = `p`.`created`, `t`.`modified` = `p`.`modified`\n WHERE `x`.`id` IS NOT NULL AND `p`.`id` IS NOT NULL\n ";
pods_query($sql);
// Copy name data from the old index table into the new individual table (if name empty in indiv table)
$sql = "\n UPDATE `@wp_pods_{$pod}` AS `t`\n LEFT JOIN `@wp_pod_types` AS `x` ON `x`.`name` = '{$pod}'\n LEFT JOIN `@wp_pod` AS `p` ON `p`.`datatype` = `x`.`id` AND `p`.`tbl_row_id` = `t`.`id`\n SET `t`.`name` = `p`.`name`\n WHERE ( `t`.`name` IS NULL OR `t`.`name` = '' ) AND `x`.`id` IS NOT NULL AND `p`.`id` IS NOT NULL\n ";
pods_query($sql);
$this->update_progress(__FUNCTION__, true, $pod);
return '1';
}
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:60,代码来源:PodsUpgrade_2_0_0.php
示例7: fields_setup
/**
* Get options for a field and setup defaults
*
*
* @param null $fields
* @param null $core_defaults
* @param bool $single
*
* @return array|null
*
* @static
* @since 2.0
*/
public static function fields_setup($fields = null, $core_defaults = null, $single = false)
{
if (empty($core_defaults)) {
$core_defaults = array('id' => 0, 'name' => '', 'label' => '', 'description' => '', 'help' => '', 'default' => null, 'attributes' => array(), 'class' => '', 'type' => 'text', 'group' => 0, 'grouped' => 0, 'developer_mode' => false, 'dependency' => false, 'depends-on' => array(), 'excludes-on' => array(), 'options' => array());
}
if ($single) {
$fields = array($fields);
}
foreach ($fields as $f => $field) {
$fields[$f] = self::field_setup($field, $core_defaults, pods_var('type', $field, 'text'));
if (!$single && strlen($fields[$f]['name']) < 1) {
$fields[$f]['name'] = $f;
}
}
if ($single) {
$fields = $fields[0];
}
return $fields;
}
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:32,代码来源:PodsForm.php
示例8: array
<?php
$type = 'textarea';
$attributes = array();
$attributes['tabindex'] = 2;
$attributes = PodsForm::merge_attributes($attributes, $name, $form_field_type, $options);
if (pods_var('readonly', $options, false)) {
$attributes['readonly'] = 'READONLY';
$attributes['class'] .= ' pods-form-ui-read-only';
}
?>
<textarea<?php
PodsForm::attributes($attributes, $name, $form_field_type, $options);
?>
><?php
echo esc_textarea($value);
?>
</textarea>
<?php
PodsForm::regex($form_field_type, $options);
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:20,代码来源:textarea.php
示例9: pods_upgrade
if (isset($_POST['cleanup_1x'])) {
pods_upgrade('2.0.0')->cleanup();
pods_redirect(pods_var_update(array('pods_cleanup_1x' => 1), array('page', 'tab')));
} elseif (isset($_POST['reset'])) {
$pods_init->reset();
$pods_init->setup();
pods_redirect(pods_var_update(array('pods_reset' => 1), array('page', 'tab')));
} elseif (isset($_POST['reset_deactivate'])) {
$pods_init->reset();
deactivate_plugins(PODS_DIR . 'init.php');
pods_redirect('index.php');
} elseif (1 == pods_var('pods_reset')) {
pods_message('Pods 2.x settings and data have been reset.');
} elseif (1 == pods_var('pods_cleanup_1x')) {
pods_message('Pods 1.x data has been deleted.');
} elseif (pods_var('reset_weekend', 'post', pods_var('reset_weekend', 'get', 0, null, true), null, true)) {
if ($monday_mode) {
$html = '<br /><br /><iframe width="480" height="360" src="http://www.youtube-nocookie.com/embed/QH2-TGUlwu4?autoplay=1" frameborder="0" allowfullscreen></iframe>';
pods_message('The weekend has been reset and you have been sent back to Friday night. Unfortunately due to a tear in the fabric of time, you slipped back to Monday. We took video of the whole process and you can see it below..' . $html);
} else {
$html = '<br /><br /><iframe width="480" height="360" src="http://www.youtube-nocookie.com/embed/xhrBDcQq2DM?autoplay=1" frameborder="0" allowfullscreen></iframe>';
pods_message('Oops, sorry! You can only reset the weekend on a Monday before the end of the work day. Somebody call the Waaambulance!' . $html, 'error');
}
}
$old_version = get_option('pods_version');
if (!empty($old_version)) {
?>
<h3><?php
_e('Delete Pods 1.x data', 'pods');
?>
</h3>
开发者ID:centaurustech,项目名称:chipin,代码行数:31,代码来源:settings-reset.php
示例10: 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_var('restrict_role', $options, 0) || 1 == pods_var('restrict_capability', $options, 0) || 1 == pods_var('admin_only', $options, 0)) {
return true;
}
return false;
}
开发者ID:Ingenex,项目名称:redesign,代码行数:20,代码来源:general.php
示例11: _e
$field = $pod;
include PODS_DIR . 'ui/admin/field-option.php';
?>
</div>
<?php
}
if (isset($tabs['extra-fields'])) {
?>
<div id="pods-extra-fields" class="pods-nav-tab">
<p><?php
_e('Taxonomies do not support extra fields natively, but Pods can add this feature for you easily. Table based storage will operate in a way where each field you create for your content type becomes a field in a table.', 'pods');
?>
</p>
<p><?php
echo sprintf(__('Enabling extra fields for this taxonomy will add a custom table into your database as <em>%s</em>.', 'pods'), $wpdb->prefix . 'pods_' . pods_var('name', $pod));
?>
</p>
<p><a href="http://pods.io/docs/comparisons/compare-storage-types/" target="_blank"><?php
_e('Find out more', 'pods');
?>
»</a></p>
<p class="submit">
<a href="<?php
echo esc_url(pods_query_arg(array('enable_extra_fields' => 1)));
?>
" class="button-primary"><?php
_e('Enable Extra Fields', 'pods');
?>
开发者ID:jeremybradbury,项目名称:wp-ninja-kit,代码行数:31,代码来源:setup-edit.php
示例12: format
/**
* Build date/time format string based on options
*
* @param $options
*
* @return string
* @since 2.0
*/
public function format($options)
{
$date_format = array('mdy' => 'm/d/Y', 'mdy_dash' => 'm-d-Y', 'mdy_dot' => 'm.d.Y', 'dmy' => 'd/m/Y', 'dmy_dash' => 'd-m-Y', 'dmy_dot' => 'd.m.Y', 'ymd_slash' => 'Y/m/d', 'ymd_dash' => 'Y-m-d', 'ymd_dot' => 'Y.m.d', 'dMy' => 'd/M/Y', 'dMy_dash' => 'd-M-Y', 'fjy' => 'F j, Y', 'fjsy' => 'F jS, Y', 'c' => 'c');
$time_format = array('h_mm_A' => 'g:i A', 'h_mm_ss_A' => 'g:i:s A', 'hh_mm_A' => 'h:i A', 'hh_mm_ss_A' => 'h:i:s A', 'h_mma' => 'g:ia', 'hh_mma' => 'h:ia', 'h_mm' => 'g:i', 'h_mm_ss' => 'g:i:s', 'hh_mm' => 'h:i', 'hh_mm_ss' => 'h:i:s');
$format_value = pods_var(self::$type . '_format', $options, 'ymd_dash', null, true);
$format = $date_format[$format_value];
if ('c' != $format_value) {
if (12 == pods_var(self::$type . '_time_type', $options)) {
$format .= ' ' . $time_format[pods_var(self::$type . '_time_format', $options, 'hh_mm', null, true)];
} else {
$format .= ' ' . str_replace(array('h:', 'g:'), 'H:', $time_format[pods_var(self::$type . '_time_format', $options, 'hh_mm', null, true)]);
}
}
return $format;
}
开发者ID:centaurustech,项目名称:chipin,代码行数:23,代码来源:datetime.php
示例13: pods_var
<?php
/*
Template Name: Edit A Project Template
*/
$projectID = pods_var(-1, 'url');
$podForm = pods('project');
get_header();
?>
<div class="content clearfix">
<div class="header">
<h1>Edit your project</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div class="start-project clearfix">
<?php
if (is_user_logged_in()) {
// Only show the 'name', 'description', and 'other' fields.
$fields = array('name', 'timeframe', 'budget', 'image', 'description', 'region');
// Output a form with specific fields
echo pods('project', $projectID)->form($fields);
} else {
?>
<h1>Please Login or Register to start a project.</h1>
<?php
}
开发者ID:centaurustech,项目名称:chipin,代码行数:31,代码来源:edit.php
示例14: admin_ajax_relationship
/**
* Handle autocomplete AJAX
*
* @since 2.3
*/
public function admin_ajax_relationship()
{
pods_session_start();
// Sanitize input
$params = pods_unslash((array) $_POST);
foreach ($params as $key => $value) {
if ('action' == $key) {
continue;
}
unset($params[$key]);
$params[str_replace('_podsfix_', '', $key)] = $value;
}
$params = (object) $params;
$uid = @session_id();
if (is_user_logged_in()) {
$uid = 'user_' . get_current_user_id();
}
$nonce_check = 'pods_relationship_' . (int) $params->pod . '_' . $uid . '_' . $params->uri . '_' . (int) $params->field;
if (!isset($params->_wpnonce) || false === wp_verify_nonce($params->_wpnonce, $nonce_check)) {
pods_error(__('Unauthorized request', 'pods'), PodsInit::$admin);
}
$api = pods_api();
$pod = $api->load_pod(array('id' => (int) $params->pod));
$field = $api->load_field(array('id' => (int) $params->field, 'table_info' => true));
$id = (int) $params->id;
$limit = 15;
if (isset($params->limit)) {
$limit = (int) $params->limit;
}
$page = 1;
if (isset($params->page)) {
$page = (int) $params->page;
}
if (!isset($params->query) || strlen(trim($params->query)) < 1) {
pods_error(__('Invalid field request', 'pods'), PodsInit::$admin);
} elseif (empty($pod) || empty($field) || $pod['id'] != $field['pod_id'] || !isset($pod['fields'][$field['name']])) {
pods_error(__('Invalid field request', 'pods'), PodsInit::$admin);
} elseif ('pick' != $field['type'] || empty($field['table_info'])) {
pods_error(__('Invalid field', 'pods'), PodsInit::$admin);
} elseif ('single' == pods_var(self::$type . '_format_type', $field) && 'autocomplete' == pods_var(self::$type . '_format_single', $field)) {
pods_error(__('Invalid field', 'pods'), PodsInit::$admin);
} elseif ('multi' == pods_var(self::$type . '_format_type', $field) && 'autocomplete' == pods_var(self::$type . '_format_multi', $field)) {
pods_error(__('Invalid field', 'pods'), PodsInit::$admin);
}
$object_params = array('name' => $field['name'], 'value' => null, 'options' => array_merge($field, $field['options']), 'pod' => $pod, 'id' => $id, 'context' => 'admin_ajax_relationship', 'data_params' => $params, 'page' => $page, 'limit' => $limit);
$pick_data = apply_filters('pods_field_pick_data_ajax', null, $field['name'], null, $field, $pod, $id);
if (null !== $pick_data) {
$items = $pick_data;
} else {
$items = $this->get_object_data($object_params);
}
if (!empty($items) && isset($items[0]) && !is_array($items[0])) {
$new_items = array();
foreach ($items as $id => $text) {
$new_items[] = array('id' => $id, 'text' => $text, 'image' => '');
}
$items = $new_items;
}
$items = apply_filters('pods_field_pick_data_ajax_items', $items, $field['name'], null, $field, $pod, $id);
$items = array('results' => $items);
wp_send_json($items);
die;
// KBAI!
}
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:69,代码来源:pick.php
示例15: precode
/**
* Run any precode for current Pod Page
*/
public function precode()
{
global $pods;
// Fix any global confusion wherever this runs
if (isset($pods) && !isset($GLOBALS['pods'])) {
$GLOBALS['pods'] =& $pods;
} elseif (!isset($pods) && isset($GLOBALS['pods'])) {
$pods =& $GLOBALS['pods'];
}
if (false !== self::$exists) {
$permission = pods_permission(self::$exists['options']);
$permission = (bool) apply_filters('pods_pages_permission', $permission, self::$exists);
if ($permission) {
$content = false;
if (!is_object($pods) && 404 != $pods && 0 < strlen(pods_var('pod', self::$exists['options']))) {
$slug = pods_var_raw('pod_slug', self::$exists['options'], null, null, true);
// Handle special magic tags
if (0 < strlen($slug)) {
$slug = pods_evaluate_tags($slug, true);
}
$pods = pods(pods_var('pod', self::$exists['options']), $slug);
// Auto 404 handling if item doesn't exist
if (0 < strlen($slug) && !$pods->exists() && apply_filters('pods_pages_auto_404', true, $slug, $pods, self::$exists)) {
$pods = 404;
}
}
if (0 < strlen(trim(self::$exists['precode']))) {
$content = self::$exists['precode'];
}
if (false !== $content && (!defined('PODS_DISABLE_EVAL') || !PODS_DISABLE_EVAL)) {
pods_deprecated('Pod Page Precode has been deprecated, please use WP Page Templates or hook into the pods_content filter instead of embedding PHP.', '2.1');
eval("?>{$content}");
}
do_action('pods_page_precode', self::$exists, $pods, $content);
} elseif (self::$exists['options']['restrict_redirect']) {
$redirect_url = '';
if (self::$exists['options']['restrict_redirect_login']) {
$redirect_url = wp_login_url(pods_current_url());
} elseif (!empty(self::$exists['options']['restrict_redirect_url'])) {
$redirect_url = self::$exists['options']['restrict_redirect_url'];
}
if (!empty($redirect_url)) {
wp_redirect($redirect_url);
die;
}
}
if (!$permission || !is_object($pods) && (404 == $pods || is_wp_error($pods))) {
remove_action('template_redirect', array($this, 'template_redirect'));
remove_action('wp_head', array($this, 'wp_head'));
remove_filter('redirect_canonical', '__return_false');
remove_filter('wp_title', array($this, 'wp_title'));
remove_filter('body_class', array($this, 'body_class'));
remove_filter('status_header', array($this, 'status_header'));
remove_action('wp', array($this, 'silence_404'), 1);
}
}
}
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:60,代码来源:Pages.php
示例16: elseif
$limit_types = 'txt,rtx,csv,tsv';
} elseif ('any' == $limit_file_type) {
$limit_types = '';
} else {
$limit_types = pods_var($form_field_type . '_allowed_extensions', $options, '');
}
$limit_types = str_replace(' ', '', $limit_types);
$tab = pods_var($form_field_type . '_attachment_tab', $options, 'type', null, true);
if ('upload' == $tab) {
$tab = 'type';
} elseif ('browse' == $tab) {
$tab = 'library';
}
$file_limit = 1;
if ('multi' == pods_var($form_field_type . '_format_type', $options, 'single')) {
$file_limit = (int) pods_var($form_field_type . '_limit', $options, 0);
}
$data = array('limit-types' => $limit_types, 'limit-files' => $file_limit);
$the_post_id = '';
if (is_admin() && !empty($post_ID)) {
$the_post_id = '&post_id=' . (int) $post_ID;
}
if (empty($value)) {
$value = array();
} else {
$value = (array) $value;
}
?>
<div<?php
PodsForm::attributes(array('class' => $attributes['class'], 'id' => $attributes['id']), $name, $form_field_type, $options);
?>
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:31,代码来源:attachment.php
示例17: delete_object
public function delete_object($type, $id, $name = null)
{
if (empty($name)) {
$name = $type;
}
$object = $this->object_get($type, $name);
if (!empty($object)) {
$params = array('pod' => pods_var('name', $object), 'pod_id' => pods_var('id', $object), 'id' => $id);
return pods_api()->delete_pod_item($params, false);
} else {
return pods_api()->delete_object_from_relationships($id, $type, $name);
}
}
开发者ID:centaurustech,项目名称:chipin,代码行数:13,代码来源:PodsMeta.php
示例18: restricted
public function restricted($action = 'edit', $row = null)
{
$restricted = false;
$restrict = array();
if (isset($this->restrict[$action])) {
$restrict = (array) $this->restrict[$action];
}
// @todo Build 'edit', 'duplicate', 'delete' action support for 'where' which runs another find() query
/*if ( !in_array( $action, array( 'manage', 'reorder' ) ) ) {
$where = pods_var_raw( $action, $this->where, null, null, true );
if ( !empty( $where ) ) {
$restricted = true;
$old_where = $this->where[ $action ];
$id = $this->row[ $this->sql[ 'field_id' ] ];
if ( is_array( $where ) ) {
if ( 'OR' == pods_var( 'relation', $where ) )
$where = array( $where );
$where[] = "`t`.`" . $this->sql[ 'field_id' ] . "` = " . (int) $id;
}
else
$where = "( {$where} ) AND `t`.`" . $this->sql[ 'field_id' ] . "` = " . (int) $id;
$this->where[ $action ] = $where;
$data = false;
//$data = $this->get_data();
$this->where[ $action ] = $old_where;
if ( empty( $data ) )
$restricted = true;
}
}*/
$author_restrict = false;
if (!empty($this->restrict['author_restrict']) && $restrict === $this->restrict['author_restrict']) {
$restricted = false;
$author_restrict = true;
if (is_object($this->pod)) {
$restricted = true;
if ('settings' == $this->pod->pod_data['type'] && 'add' == $action) {
$action = 'edit';
}
if (pods_is_admin(array('pods', 'pods_content'))) {
$restricted = false;
} elseif ('manage' == $action) {
if (!in_array('edit', $this->actions_disabled) && current_user_can('pods_edit_' . $this->pod->pod) && current_user_can('pods_edit_others_' . $this->pod->pod)) {
$restricted = false;
} elseif (!in_array('delete', $this->actions_disabled) && current_user_can('pods_delete_' . $this->pod->pod) && current_user_can('pods_delete_others_' . $this->pod->pod)) {
$restricted = false;
} elseif (current_user_can('pods_' . $action . '_' . $this->pod->pod) && current_user_can('pods_' . $action . '_others_' . $this->pod->pod)) {
$restricted = false;
}
} elseif (current_user_can('pods_' . $action . '_' . $this->pod->pod) && current_user_can('pods_' . $action . '_others_' . $this->pod->pod)) {
$restricted = false;
}
}
/* @todo determine proper logic for non-pods capabilities
else {
$restricted = true;
if ( pods_is_admin( array( 'pods', 'pods_content' ) ) )
$restricted = false;
elseif ( current_user_can( 'pods_' . $action . '_others_' . $_tbd ) )
$restricted = false;
}*/
}
if ($restricted && !empty($restrict)) {
$relation = strtoupper(trim(pods_var('relation', $restrict, 'AND', null, true)));
if ('AND' != $relation) {
$relation = 'OR';
}
$okay = true;
foreach ($restrict as $field => $match) {
if ('relation' == $field) {
continue;
}
if (is_array($match)) {
$match_okay = true;
$match_relation = strtoupper(trim(pods_var('relation', $match, 'OR', null, true)));
if ('AND' != $match_relation) {
$match_relation = 'OR';
}
foreach ($match as $the_field => $the_match) {
if ('relation' == $the_field) {
continue;
}
$value = null;
if (is_object($this->pod)) {
$value = $this->pod->field($the_match, true);
} else {
if (empty($row)) {
$row = $this->row;
}
if (isset($row[$the_match])) {
//.........这里部分代码省略.........
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:101,代码来源:PodsUI.php
示例19: process_form
/**
* Process a Pod-based form
*
* @param mixed $params
* @param object $obj Pod object
* @param array $fields Fields being submitted in form ( key => settings )
* @param string $thank_you URL to send to upon success
*
* @return mixed
*
* @since 2.0
*/
public function process_form($params, $obj = null, $fields = null, $thank_you = null)
{
$this->display_errors = false;
$form = null;
$nonce = pods_var('_pods_nonce', $params);
$pod = pods_var('_pods_pod', $params);
$id = pods_var('_pods_id', $params);
$uri = pods_var('_pods_uri', $params);
$form = pods_var('_pods_form', $params);
$location = pods_var('_pods_location', $params);
if (is_object($obj)) {
$pod = $obj->pod;
$id = $obj->id();
}
if (!empty($fields)) {
$fields = array_keys($fields);
$form = implode(',', $fields);
} else {
$fields = explode(',', $form);
}
if (empty($nonce) || empty($pod) || empty($uri) || empty($fields)) {
return pods_error(__('Invalid submission', 'pods'), $this);
}
$uid = @session_id();
if (is_user_logged_in()) {
$uid = 'user_' . get_current_user_id();
}
$field_hash = wp_create_nonce('pods_fields_' . $form);
$action = 'pods_form_' . $pod . '_' . $uid . '_' . $id . '_' . $uri . '_' . $field_hash;
if (empty($uid)) {
return pods_error(__('Access denied for your session, please refresh and try again.', 'pods'), $this);
}
if (false === wp_verify_nonce($nonce, $action)) {
return pods_error(__('Access denied, please refresh and try again.', 'pods'), $this);
}
$data = array();
foreach ($fields as $field) {
$data[$field] = pods_var_raw('pods_field_' . $field, $params, '');
}
$params = array('pod' => $pod, 'id' => $id, 'data' => $data, 'from' => 'process_form', 'location' => $location);
$id = $this->save_pod_item($params);
if (0 < $id && !empty($thank_you)) {
$thank_you = str_replace('X_ID_X', $id, $thank_you);
pods_redirect($thank_you);
}
return $id;
}
开发者ID:satokora,项目名称:IT354Project,代码行数:59,代码来源:PodsAPI.php
示例20: pre_save
/**
* Change the value or perform actions after validation but before saving to the DB
*
* @param mixed $value
* @param int $id
* @param string $name
* @param array $options
* @param array $fields
* @param array $pod
* @param object $params
*
* @return mixed|string
* @since 2.0
*/
public function pre_save($value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null)
{
$length = (int) pods_var(self::$type . '_max_length', $options, 255);
if (0 < $length && $length < pods_mb_strlen($value)) {
$value = pods_mb_substr($value, 0, $length);
}
return $value;
}
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:22,代码来源:password.php
注:本文中的pods_var函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论