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


PHP settings::default_api方法代码示例

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


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

示例1: element

 /**
  * Create the HTML
  *
  * @param string $action Name of AJAX action to run.
  * @param string|bool $atts Optional. Additional data-* to use in element. Each att must start with data-, unless it is whitelisted in the allow_without_data_prefix() method. "class" & 'data-action' can never be set here. The filter "baldrick_wp_front_end_html_attributes" gives you the ability to override those.
  * @param string|bool $text Optional. Text to use for link trigger. If false, the default, there will be no trigger.
  * *@param string|bool $api Optional. URL for AJAX API to process with. Default is WordPress' AJAX API
  *
  * @return string
  */
 public static function element($action, $atts = false, $text = false, $api = false)
 {
     $atts['class'] = settings::$baldrick_class;
     $atts['data-action'] = $action;
     if (!isset($atts['data-request'])) {
         if ($api && filter_var($api, FILTER_VALIDATE_URL)) {
             $atts['data-request'] = $api;
         } else {
             $atts['data-request'] = settings::default_api();
         }
     }
     $att_out = array();
     foreach ($atts as $att => $value) {
         if (0 !== strpos($att, 'data-')) {
             if (self::allow_without_data_prefix($att)) {
                 $att = 'data-' . $att;
             }
         }
         $att_out[] = esc_attr($att) . '="' . esc_attr($value) . '"';
     }
     /**
      * Filter the attributes used to build the HTML element for the Baldrick trigger
      *
      * IMPORTANT: This filter runs <em>after</em> attributes are validated and sanitized. No further validation, sanitization, or escaping is provided after this point, other than ensuring it returns an array.
      *
      * @param array $att_out The array of attributes that will be used to build the HTML element
      * @param string $action Current action being run.
      * @param array $atts The attributes passed to method, before validation.
      */
     $filter_atts = apply_filters('baldrick_wp_front_end_html_attributes', $att_out, $action, $atts);
     if (is_array($filter_atts)) {
         $att_out = $filter_atts;
     }
     $att_out = implode(' ', $att_out);
     $out[] = '<a ';
     $out[] = $att_out;
     $out[] = ' >';
     if ($text) {
         $out[] = $text;
     }
     $out[] = '</a>';
     return implode('', $out);
 }
开发者ID:calderawp,项目名称:baldrick-wp-front-end,代码行数:53,代码来源:html.php

示例2: js_var

 /**
  * Set up JS Var to enqueue
  *
  * @return array
  */
 protected static function js_var()
 {
     return array('ajaxURL' => settings::default_api(), 'className' => settings::$baldrick_class, 'transportMethod' => settings::$default_transport);
 }
开发者ID:calderawp,项目名称:baldrick-wp-front-end,代码行数:9,代码来源:assets.php


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