• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pods_has_permissions函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pods_is_admin函数代码示例发布时间:2022-05-15
下一篇:
PHP pods_evaluate_tags函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap