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


PHP cmb2_dir函数代码示例

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


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

示例1: cmb2_autoload_classes

/**
 * Autoloads files with CMB2 classes when needed
 * @since  1.0.0
 * @param  string $class_name Name of the class being requested
 */
function cmb2_autoload_classes($class_name)
{
    if (0 !== strpos($class_name, 'CMB2')) {
        return;
    }
    include_once cmb2_dir("includes/{$class_name}.php");
}
开发者ID:jrajalu,项目名称:myxon,代码行数:12,代码来源:helper-functions.php

示例2: cmb2_autoload_classes

/**
 * Autoloads files with CMB2 classes when needed
 * @since  1.0.0
 * @param  string $class_name Name of the class being requested
 */
function cmb2_autoload_classes($class_name)
{
    if (class_exists($class_name, false) || false === strpos($class_name, 'CMB2_')) {
        return;
    }
    $file = cmb2_dir("includes/{$class_name}.php");
    if (file_exists($file)) {
        @(include_once $file);
    }
}
开发者ID:emzo,项目名称:Recipe-Hero,代码行数:15,代码来源:helper-functions.php

示例3: cmb2_autoload_classes

/**
 * Autoloads files with CMB2 classes when needed
 * @since  1.0.0
 * @param  string $class_name Name of the class being requested
 */
function cmb2_autoload_classes($class_name)
{
    if (0 !== strpos($class_name, 'CMB2')) {
        return;
    }
    $path = 'includes';
    if ('CMB2_Type' === $class_name || 0 === strpos($class_name, 'CMB2_Type_')) {
        $path .= '/types';
    }
    include_once cmb2_dir("{$path}/{$class_name}.php");
}
开发者ID:jrfnl,项目名称:CMB2,代码行数:16,代码来源:helper-functions.php

示例4: url

 /**
  * Defines the url which is used to load local resources.
  * This may need to be filtered for local Window installations.
  * If resources do not load, please check the wiki for details.
  * @since  1.0.1
  * @return string URL to CMB resources
  */
 public function url($path = '')
 {
     if ($this->url) {
         return $this->url . $path;
     }
     if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
         // Windows
         $content_dir = str_replace('/', DIRECTORY_SEPARATOR, WP_CONTENT_DIR);
         $content_url = str_replace($content_dir, WP_CONTENT_URL, cmb2_dir());
         $cmb2_url = str_replace(DIRECTORY_SEPARATOR, '/', $content_url);
     } else {
         $cmb2_url = str_replace(array(WP_CONTENT_DIR, WP_PLUGIN_DIR), array(WP_CONTENT_URL, WP_PLUGIN_URL), cmb2_dir());
     }
     /**
      * Filter the CMB location url
      *
      * @param string $cmb2_url Currently registered url
      */
     $this->url = trailingslashit(apply_filters('cmb2_meta_box_url', set_url_scheme($cmb2_url), CMB2_VERSION));
     return $this->url . $path;
 }
开发者ID:kps3,项目名称:wordpress-base,代码行数:28,代码来源:CMB2_Utils.php

示例5: test_url_set

 public function test_url_set()
 {
     $cmb2_url = str_replace(array(WP_CONTENT_DIR, WP_PLUGIN_DIR), array(WP_CONTENT_URL, WP_PLUGIN_URL), cmb2_dir());
     $this->assertEquals(cmb2_utils()->url(), $cmb2_url);
 }
开发者ID:Makenrro,项目名称:repos,代码行数:5,代码来源:test-cmb-core.php

示例6: cmb2_dir

<?php

/**
 * Helper function to provide directory path to CMB
 * @since  2.0.0
 * @param  string  $path Path to append
 * @return string        Directory with optional path appended
 */
function cmb2_dir($path = '')
{
    return trailingslashit(dirname(__FILE__)) . $path;
}
require_once cmb2_dir('includes/helper-functions.php');
$meta_boxes_config = apply_filters('cmb2_meta_boxes', array());
foreach ((array) $meta_boxes_config as $meta_box) {
    $cmb = new CMB2($meta_box);
    if ($cmb->prop('hookup')) {
        $hookup = new CMB2_hookup($cmb);
    }
}
/**
 * Create meta boxes
 */
class CMB2
{
    /**
     * Current field's ID
     * @var   string
     * @since 2.0.0
     */
    protected $cmb_id = '';
开发者ID:jasonHalsey,项目名称:qandc_blog-child,代码行数:31,代码来源:CMB2.php

示例7: url

 /**
  * Defines the url which is used to load local resources.
  * This may need to be filtered for local Window installations.
  * If resources do not load, please check the wiki for details.
  * @since  1.0.1
  * @return string URL to CMB2 resources
  */
 public function url($path = '')
 {
     if ($this->url) {
         return $this->url . $path;
     }
     $cmb2_url = self::get_url_from_dir(cmb2_dir());
     /**
      * Filter the CMB location url
      *
      * @param string $cmb2_url Currently registered url
      */
     $this->url = trailingslashit(apply_filters('cmb2_meta_box_url', $cmb2_url, CMB2_VERSION));
     return $this->url . $path;
 }
开发者ID:WordImpress,项目名称:maps-builder-core,代码行数:21,代码来源:CMB2_Utils.php


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