示例#1
0
/**
 * Create a new property array or rendering a template property file.
 *
 * @param  mixed $file_or_options
 * @param  array $values
 *
 * @return null|Papi_Property
 */
function papi_property($file_or_options, $values = [])
{
    if (papi_is_empty($file_or_options)) {
        return;
    }
    if (is_array($file_or_options)) {
        $file_or_options = papi_get_property_options($file_or_options);
    }
    if (is_string($file_or_options) && is_array($values)) {
        $file_or_options = papi_template($file_or_options, $values);
    }
    if (is_object($file_or_options)) {
        return papi_get_property_type($file_or_options);
    }
}
示例#2
0
文件: property.php 项目: wp-papi/papi
/**
 * Create a new property array or rendering a template property file.
 *
 * @param  mixed $file_or_options
 * @param  array $values
 *
 * @return Papi_Core_Property
 */
function papi_property($file_or_options, array $values = [])
{
    if (papi_is_empty($file_or_options)) {
        return;
    }
    if (is_array($file_or_options)) {
        if ($property = Papi_Core_Property::factory($file_or_options)) {
            $file_or_options = $property->get_options();
        }
    }
    if (is_string($file_or_options) && is_array($values)) {
        $file_or_options = papi_template($file_or_options, $values);
        if (is_object($file_or_options)) {
            $file_or_options = papi_property((array) $file_or_options->get_options());
        }
    }
    if (is_object($file_or_options)) {
        return papi_get_property_type($file_or_options);
    }
}
示例#3
0
 /**
  * Load template file.
  *
  * @param  string $file
  * @param  array  $values
  *
  * @return array
  */
 protected function template($file, $values = [])
 {
     return papi_template($file, $values);
 }