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


PHP cmb2_ajax函数代码示例

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


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

示例1: render

 public function render()
 {
     $field = $this->field;
     $meta_value = trim($field->escaped_value());
     $oembed = !empty($meta_value) ? cmb2_ajax()->get_oembed(array('url' => $field->escaped_value(), 'object_id' => $field->object_id, 'object_type' => $field->object_type, 'oembed_args' => array('width' => '640'), 'field_id' => $this->_id())) : '';
     return parent::render(array('class' => 'cmb2-oembed regular-text', 'data-objectid' => $field->object_id, 'data-objecttype' => $field->object_type)) . '<p class="cmb-spinner spinner" style="display:none;"></p>' . '<div id="' . $this->_id('-status') . '" class="cmb2-media-status ui-helper-clearfix embed_wrap">' . $oembed . '</div>';
 }
开发者ID:jrfnl,项目名称:CMB2,代码行数:7,代码来源:CMB2_Type_Oembed.php

示例2: hooks

 public function hooks()
 {
     // Handle oembed Ajax
     $this->once('wp_ajax_cmb2_oembed_handler', array(cmb2_ajax(), 'oembed_handler'));
     $this->once('wp_ajax_nopriv_cmb2_oembed_handler', array(cmb2_ajax(), 'oembed_handler'));
     foreach (get_class_methods('CMB2_Show_Filters') as $filter) {
         add_filter('cmb2_show_on', array('CMB2_Show_Filters', $filter), 10, 3);
     }
 }
开发者ID:emaxees,项目名称:elpandecadadia,代码行数:9,代码来源:CMB2_hookup.php

示例3: universal_hooks

 public function universal_hooks()
 {
     // Handle oembed Ajax
     $this->once('wp_ajax_cmb2_oembed_handler', array(cmb2_ajax(), 'oembed_handler'));
     $this->once('wp_ajax_nopriv_cmb2_oembed_handler', array(cmb2_ajax(), 'oembed_handler'));
     foreach (get_class_methods('CMB2_Show_Filters') as $filter) {
         add_filter('cmb2_show_on', array('CMB2_Show_Filters', $filter), 10, 3);
     }
     if (is_admin()) {
         // register our scripts and styles for cmb
         $this->once('admin_enqueue_scripts', array(__CLASS__, 'register_scripts'), 8);
     }
 }
开发者ID:plusplusminus,项目名称:asbd,代码行数:13,代码来源:CMB2_hookup.php

示例4: cmb2_get_oembed

/**
 * Get a cmb oEmbed. Handles oEmbed getting for non-post objects
 * @since  2.0.0
 * @param  array   $args Arguments. Accepts:
 *
 *         'url'         - URL to retrieve the oEmbed from,
 *         'object_id'   - $post_id,
 *         'object_type' - 'post',
 *         'oembed_args' - $embed_args, // array containing 'width', etc
 *         'field_id'    - false,
 *         'cache_key'   - false,
 *         'wp_error'    - true/false, // To return a wp_error object if no embed found.
 *
 * @return string        oEmbed string
 */
function cmb2_get_oembed($args = array())
{
    $oembed = cmb2_ajax()->get_oembed_no_edit($args);
    // Send back our embed
    if ($oembed['embed'] && $oembed['embed'] != $oembed['fallback']) {
        return '<div class="cmb2-oembed">' . $oembed['embed'] . '</div>';
    }
    $error = sprintf(__('No oEmbed Results Found for %s. View more info at %s.', 'cmb2'), $oembed['fallback'], ' <a href="http://codex.wordpress.org/Embeds" target="_blank">codex.wordpress.org/Embeds</a>');
    if (isset($args['wp_error']) && $args['wp_error']) {
        return new WP_Error('cmb2_get_oembed_result', $wp_error, compact('oembed', 'args'));
    }
    // Otherwise, send back error info that no oEmbeds were found
    return '<p class="ui-state-error-text">' . $error . '</p>';
}
开发者ID:jrfnl,项目名称:CMB2,代码行数:29,代码来源:helper-functions.php

示例5: cmb2_get_oembed

/**
 * Get a cmb oEmbed. Handles oEmbed getting for non-post objects
 * @since  2.0.0
 * @param  array   $args Arguments. Accepts:
 *
 *         'url'         - URL to retrieve the oEmbed from,
 *         'object_id'   - $post_id,
 *         'object_type' - 'post',
 *         'oembed_args' - $embed_args, // array containing 'width', etc
 *         'field_id'    - false,
 *         'cache_key'   - false,
 *
 * @return string        oEmbed string
 */
function cmb2_get_oembed($args = array())
{
    return cmb2_ajax()->get_oembed($args);
}
开发者ID:jrajalu,项目名称:myxon,代码行数:18,代码来源:helper-functions.php

示例6: test_class_getters

 public function test_class_getters()
 {
     $this->assertInstanceOf('CMB2_Ajax', cmb2_ajax());
     $this->assertInstanceOf('CMB2_Utils', cmb2_utils());
     $this->assertInstanceOf('CMB2_Option', cmb2_options('test'));
 }
开发者ID:Makenrro,项目名称:repos,代码行数:6,代码来源:test-cmb-core.php

示例7: add_field

 /**
  * Add a field to the metabox
  * @since  2.0.0
  * @param  array  $field           Metabox field config array
  * @param  int    $position        (optional) Position of metabox. 1 for first, etc
  * @return mixed                   Field id or false
  */
 public function add_field(array $field, $position = 0)
 {
     if (!is_array($field) || !array_key_exists('id', $field)) {
         return false;
     }
     if ('oembed' === $field['type']) {
         // Initiate oembed Ajax hooks
         cmb2_ajax();
     }
     if (isset($field['column']) && false !== $field['column']) {
         $this->has_columns = true;
         $column = is_array($field['column']) ? $field['column'] : array();
         $field['column'] = wp_parse_args($column, array('name' => isset($field['name']) ? $field['name'] : '', 'position' => false));
     }
     $this->_add_field_to_array($field, $this->meta_box['fields'], $position);
     return $field['id'];
 }
开发者ID:wordimpress,项目名称:give,代码行数:24,代码来源:CMB2.php

示例8: add_field

 /**
  * Add a field to the metabox
  * @since  2.0.0
  * @param  array  $field           Metabox field config array
  * @param  int    $position        (optional) Position of metabox. 1 for first, etc
  * @return mixed                   Field id or false
  */
 public function add_field(array $field, $position = 0)
 {
     if (!is_array($field) || !array_key_exists('id', $field)) {
         return false;
     }
     if ('oembed' === $field['type']) {
         // Initiate oembed Ajax hooks
         cmb2_ajax();
     }
     $this->_add_field_to_array($field, $this->meta_box['fields'], $position);
     return $field['id'];
 }
开发者ID:markbiek,项目名称:Silencio,代码行数:19,代码来源:CMB2.php


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