本文整理汇总了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];
}
示例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();
}