当前位置: 首页>>代码示例>>PHP>>正文


PHP pods_has_permissions函数代码示例

本文整理汇总了PHP中pods_has_permissions函数的典型用法代码示例。如果您正苦于以下问题:PHP pods_has_permissions函数的具体用法?PHP pods_has_permissions怎么用?PHP pods_has_permissions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pods_has_permissions函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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_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())));
 }
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:40,代码来源:boolean.php

示例2: 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(' ', $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())));
 }
开发者ID:Ingenex,项目名称:redesign,代码行数:32,代码来源:email.php

示例3: save_pod_item


//.........这里部分代码省略.........
     if (isset($params->bypass_helpers) && false !== $params->bypass_helpers) {
         $bypass_helpers = true;
     }
     // Allow Custom Fields not defined by Pods to be saved
     $allow_custom_fields = false;
     if (isset($params->allow_custom_fields) && false !== $params->allow_custom_fields) {
         $allow_custom_fields = true;
     }
     // Get array of Pods
     $pod = $this->load_pod(array('id' => $params->pod_id, 'name' => $params->pod, 'table_info' => true));
     if (false === $pod) {
         return pods_error(__('Pod not found', 'pods'), $this);
     }
     $params->pod = $pod['name'];
     $params->pod_id = $pod['id'];
     if ('settings' == $pod['type']) {
         $params->id = $pod['id'];
     }
     $fields = $pod['fields'];
     $object_fields = (array) pods_var_raw('object_fields', $pod, array(), null, true);
     $fields_active = array();
     $custom_data = array();
     // Find the active fields (loop through $params->data to retain order)
     if (!empty($params->data) && is_array($params->data)) {
         $custom_fields = array();
         foreach ($params->data as $field => $value) {
             if (isset($object_fields[$field])) {
                 $object_fields[$field]['value'] = $value;
                 $fields_active[] = $field;
             } elseif (isset($fields[$field])) {
                 if ('save' == $params->from || true === PodsForm::permission($fields[$field]['type'], $field, $fields[$field], $fields, $pod, $params->id, $params)) {
                     $fields[$field]['value'] = $value;
                     $fields_active[] = $field;
                 } elseif (!pods_has_permissions($fields[$field]['options']) && pods_var('hidden', $fields[$field]['options'], false)) {
                     $fields[$field]['value'] = $value;
                     $fields_active[] = $field;
                 }
             } else {
                 $found = false;
                 foreach ($object_fields as $object_field => $object_field_opt) {
                     if (in_array($field, $object_field_opt['alias'])) {
                         $object_fields[$object_field]['value'] = $value;
                         $fields_active[] = $object_field;
                         $found = true;
                         break;
                     }
                 }
                 if ($allow_custom_fields && !$found) {
                     $custom_fields[] = $field;
                 }
             }
         }
         if ($allow_custom_fields && !empty($custom_fields)) {
             foreach ($custom_fields as $field) {
                 $custom_data[$field] = $params->data[$field];
             }
         }
         if ($pod['type'] === 'taxonomy' && isset($params->data) && !empty($params->data)) {
             $term_data = $params->data;
         }
         unset($params->data);
     }
     if (empty($params->id) && !in_array('created', $fields_active) && isset($fields['created']) && in_array($fields['created']['type'], array('date', 'datetime'))) {
         $fields['created']['value'] = current_time('mysql');
         $fields_active[] = 'created';
     }
开发者ID:satokora,项目名称:IT354Project,代码行数:67,代码来源:PodsAPI.php

示例4: foreach

} else {
    $duplicate = (bool) $duplicate;
}
// unset fields
foreach ($fields as $k => $field) {
    if (in_array($field['name'], array('created', 'modified'))) {
        unset($fields[$k]);
    } elseif (false === PodsForm::permission($field['type'], $field['name'], $field['options'], $fields, $pod, $pod->id())) {
        if (pods_var('hidden', $field['options'], false)) {
            $fields[$k]['type'] = 'hidden';
        } elseif (pods_var('read_only', $field['options'], false)) {
            $fields[$k]['readonly'] = true;
        } else {
            unset($fields[$k]);
        }
    } elseif (!pods_has_permissions($field['options'])) {
        if (pods_var('hidden', $field['options'], false)) {
            $fields[$k]['type'] = 'hidden';
        } elseif (pods_var('read_only', $field['options'], false)) {
            $fields[$k]['readonly'] = true;
        }
    }
}
$submittable_fields = $fields;
foreach ($submittable_fields as $k => $field) {
    if (pods_var('readonly', $field, false)) {
        unset($submittable_fields[$k]);
    }
}
if (!isset($thank_you_alt)) {
    $thank_you_alt = $thank_you;
开发者ID:Ingenex,项目名称:redesign,代码行数:31,代码来源:form.php

示例5: meta_comment

    /**
     * @param $comment
     * @param $metabox
     */
    public function meta_comment($comment, $metabox)
    {
        wp_enqueue_style('pods-form');
        $hidden_fields = array();
        ?>
    <table class="form-table editcomment pods-metabox">
        <?php 
        $id = null;
        if (is_object($comment)) {
            $id = $comment->comment_ID;
        }
        $pod = pods($metabox['args']['group']['pod']['name'], $id, true);
        foreach ($metabox['args']['group']['fields'] as $field) {
            if (false === PodsForm::permission($field['type'], $field['name'], $field, $metabox['args']['group']['fields'], $pod, $id)) {
                if (pods_var('hidden', $field['options'], false, null, true)) {
                    $field['type'] = 'hidden';
                } else {
                    continue;
                }
            } elseif (!pods_has_permissions($field['options']) && pods_var('hidden', $field['options'], false, null, true)) {
                $field['type'] = 'hidden';
            }
            $value = '';
            if (!empty($pod)) {
                $value = $pod->field(array('name' => $field['name'], 'in_form' => true));
            }
            if ('hidden' == $field['type']) {
                $hidden_fields[] = array('field' => $field, 'value' => $value);
            } else {
                ?>
            <tr class="form-field pods-field <?php 
                echo 'pods-form-ui-row-type-' . $field['type'] . ' pods-form-ui-row-name-' . Podsform::clean($field['name'], true);
                ?>
">
                <th scope="row" valign="top"><?php 
                echo PodsForm::label('pods_meta_' . $field['name'], $field['label'], $field['help'], $field);
                ?>
</th>
                <td>
                    <?php 
                echo PodsForm::field('pods_meta_' . $field['name'], $value, $field['type'], $field, $pod, $id);
                ?>
                    <?php 
                echo PodsForm::comment('pods_meta_' . $field['name'], $field['description'], $field);
                ?>
                </td>
            </tr>
        <?php 
            }
        }
        ?>
    </table>
<?php 
        foreach ($hidden_fields as $hidden_field) {
            $field = $hidden_field['field'];
            echo PodsForm::field('pods_meta_' . $field['name'], $hidden_field['value'], 'hidden');
        }
    }
开发者ID:centaurustech,项目名称:chipin,代码行数:62,代码来源:PodsMeta.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);
     }
     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())));
 }
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:40,代码来源:wysiwyg.php

示例7: foreach

if (!isset($duplicate)) {
    $duplicate = false;
} else {
    $duplicate = (bool) $duplicate;
}
// unset fields
foreach ($fields as $k => $field) {
    if (in_array($field['name'], array('created', 'modified'))) {
        unset($fields[$k]);
    } elseif (false === PodsForm::permission($field['type'], $field['name'], $field['options'], $fields, $pod, $pod->id())) {
        if (pods_var('hidden', $field['options'], false)) {
            $fields[$k]['type'] = 'hidden';
        } else {
            unset($fields[$k]);
        }
    } elseif (!pods_has_permissions($field['options']) && pods_var('hidden', $field['options'], false)) {
        $fields[$k]['type'] = 'hidden';
    }
}
$submittable_fields = $fields;
foreach ($submittable_fields as $k => $field) {
    if (pods_var('readonly', $field, false)) {
        unset($submittable_fields[$k]);
    }
}
if (!isset($thank_you_alt)) {
    $thank_you_alt = $thank_you;
}
$uri_hash = wp_create_nonce('pods_uri_' . $_SERVER['REQUEST_URI']);
$field_hash = wp_create_nonce('pods_fields_' . implode(',', array_keys($submittable_fields)));
$uid = @session_id();
开发者ID:satokora,项目名称:IT354Project,代码行数:31,代码来源:form-settings.php


注:本文中的pods_has_permissions函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。