當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。