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


PHP PodsForm::field_type方法代码示例

本文整理汇总了PHP中PodsForm::field_type方法的典型用法代码示例。如果您正苦于以下问题:PHP PodsForm::field_type方法的具体用法?PHP PodsForm::field_type怎么用?PHP PodsForm::field_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PodsForm的用法示例。


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

示例1: field_loader

 /**
  * Autoload a Field Type's class
  *
  * @param string $field_type Field Type indentifier
  * @param string $file The Field Type class file location
  *
  * @return string
  * @access public
  * @static
  * @since 2.0
  */
 public static function field_loader($field_type, $file = '')
 {
     if (isset(self::$loaded[$field_type])) {
         $class_vars = get_class_vars(get_class(self::$loaded[$field_type]));
         // PHP 5.2.x workaround
         self::$field_group = isset($class_vars['group']) ? $class_vars['group'] : '';
         self::$field_type = $class_vars['type'];
         if ('Unknown' != $class_vars['label']) {
             return self::$loaded[$field_type];
         }
     }
     include_once PODS_DIR . 'classes/PodsField.php';
     $field_type = self::clean($field_type, true, true);
     $class_name = ucfirst($field_type);
     $class_name = "PodsField_{$class_name}";
     $content_dir = realpath(WP_CONTENT_DIR);
     $plugins_dir = realpath(WP_PLUGIN_DIR);
     $muplugins_dir = realpath(WPMU_PLUGIN_DIR);
     $abspath_dir = realpath(ABSPATH);
     if (!class_exists($class_name)) {
         if (isset(self::$field_types[$field_type]) && !empty(self::$field_types[$field_type]['file'])) {
             $file = realpath(self::$field_types[$field_type]['file']);
         }
         if (!empty($file) && 0 === strpos($file, $abspath_dir) && file_exists($file)) {
             include_once $file;
         } else {
             $file = str_replace('../', '', apply_filters('pods_form_field_include', PODS_DIR . 'classes/fields/' . basename($field_type) . '.php', $field_type));
             $file = realpath($file);
             if (file_exists($file) && (0 === strpos($file, $content_dir) || 0 === strpos($file, $plugins_dir) || 0 === strpos($file, $muplugins_dir) || 0 === strpos($file, $abspath_dir))) {
                 include_once $file;
             }
         }
     }
     if (class_exists($class_name)) {
         $class = new $class_name();
     } else {
         $class = new PodsField();
         $class_name = 'PodsField';
     }
     $class_vars = get_class_vars($class_name);
     // PHP 5.2.x workaround
     self::$field_group = isset($class_vars['group']) ? $class_vars['group'] : '';
     self::$field_type = $class_vars['type'];
     self::$loaded[$field_type] =& $class;
     return self::$loaded[$field_type];
 }
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:57,代码来源:PodsForm.php

示例2: markup

    /**
     * Handle file row output for uploaders
     *
     * @param array $attributes
     * @param int $limit
     * @param bool $editable
     * @param int $id
     * @param string $icon
     * @param string $name
     *
     * @return string
     * @since 2.0
     */
    public function markup($attributes, $limit = 1, $editable = true, $id = null, $icon = null, $name = null)
    {
        // Preserve current file type
        $field_type = PodsForm::$field_type;
        ob_start();
        if (empty($id)) {
            $id = '{{id}}';
        }
        if (empty($icon)) {
            $icon = '{{icon}}';
        }
        if (empty($name)) {
            $name = '{{name}}';
        }
        $editable = (bool) $editable;
        ?>
    <li class="pods-file hidden" id="pods-file-<?php 
        echo $id;
        ?>
">
        <?php 
        echo PodsForm::field($attributes['name'] . '[' . $id . '][id]', $id, 'hidden');
        ?>

        <ul class="pods-file-meta media-item">
            <?php 
        if (1 != $limit) {
            ?>
                <li class="pods-file-col pods-file-handle">Handle</li>
            <?php 
        }
        ?>

            <li class="pods-file-col pods-file-icon">
                <img class="pinkynail" src="<?php 
        echo $icon;
        ?>
" alt="Icon" />
            </li>

            <li class="pods-file-col pods-file-name">
                <?php 
        if ($editable) {
            echo PodsForm::field($attributes['name'] . '[' . $id . '][title]', $name, 'text');
        } else {
            echo empty($name) ? '{{name}}' : $name;
        }
        ?>
            </li>

            <li class="pods-file-col pods-file-delete">Delete</li>
        </ul>
    </li>
    <?php 
        PodsForm::$field_type = $field_type;
        return ob_get_clean();
    }
开发者ID:centaurustech,项目名称:chipin,代码行数:70,代码来源:file.php


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