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


PHP wc_sanitize_tooltip函数代码示例

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


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

示例1: wc_help_tip

 /**
  * Backports wc_help_tip() to WC 2.4/2.3
  *
  * @link https://github.com/woothemes/woocommerce/pull/9417
  *
  * @since 4.2.0
  * @param string $tip help tip content, HTML allowed if $has_html is true
  * @param bool $has_html false by default, true to indicate tip content has HTML
  * @return string help tip HTML, a <span> in WC 2.5, <img> in WC 2.4/2.3
  */
 public static function wc_help_tip($tip, $has_html = false)
 {
     if (self::is_wc_version_gte_2_5()) {
         return wc_help_tip($tip, $has_html);
     } else {
         $tip = $has_html ? wc_sanitize_tooltip($tip) : esc_attr($tip);
         return sprintf('<img class="help_tip" data-tip="%1$s" src="%2$s" height="16" width="16" />', $tip, esc_url(WC()->plugin_url()) . '/assets/images/help.png');
     }
 }
开发者ID:lilweirdward,项目名称:blofishwordpress,代码行数:19,代码来源:class-sv-wc-plugin-compatibility.php

示例2: render_shop_order_columns

        /**
         * Output custom columns for coupons
         * @param  string $column
         */
        public function render_shop_order_columns($column)
        {
            global $post, $woocommerce, $the_order;
            if (empty($the_order) || $the_order->id != $post->ID) {
                $the_order = wc_get_order($post->ID);
            }
            switch ($column) {
                case 'order_status':
                    printf('<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title($the_order->get_status()), wc_get_order_status_name($the_order->get_status()), wc_get_order_status_name($the_order->get_status()));
                    break;
                case 'order_date':
                    if ('0000-00-00 00:00:00' == $post->post_date) {
                        $t_time = $h_time = __('Unpublished', 'woocommerce');
                    } else {
                        $t_time = get_the_time(__('Y/m/d g:i:s A', 'woocommerce'), $post);
                        $h_time = get_the_time(__('Y/m/d', 'woocommerce'), $post);
                    }
                    echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('post_date_column_time', $h_time, $post)) . '</abbr>';
                    break;
                case 'customer_message':
                    if ($the_order->customer_message) {
                        echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip($the_order->customer_message) . '">' . __('Yes', 'woocommerce') . '</span>';
                    } else {
                        echo '<span class="na">&ndash;</span>';
                    }
                    break;
                case 'order_items':
                    echo '<a href="#" class="show_order_items">' . apply_filters('woocommerce_admin_order_item_count', sprintf(_n('%d item', '%d items', $the_order->get_item_count(), 'woocommerce'), $the_order->get_item_count()), $the_order) . '</a>';
                    if (sizeof($the_order->get_items()) > 0) {
                        echo '<table class="order_items" cellspacing="0">';
                        foreach ($the_order->get_items() as $item) {
                            $product = apply_filters('woocommerce_order_item_product', $the_order->get_product_from_item($item), $item);
                            $item_meta = new WC_Order_Item_Meta($item, $product);
                            $item_meta_html = $item_meta->display(true, true);
                            ?>
						<tr class="<?php 
                            echo apply_filters('woocommerce_admin_order_item_class', '', $item);
                            ?>
">
							<td class="qty"><?php 
                            echo absint($item['qty']);
                            ?>
</td>
							<td class="name">
								<?php 
                            if ($product) {
                                ?>
									<?php 
                                echo wc_product_sku_enabled() && $product->get_sku() ? $product->get_sku() . ' - ' : '';
                                ?>
<a href="<?php 
                                echo get_edit_post_link($product->id);
                                ?>
" title="<?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
"><?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
</a>
								<?php 
                            } else {
                                ?>
									<?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
								<?php 
                            }
                            ?>
								<?php 
                            if (!empty($item_meta_html)) {
                                ?>
									<a class="tips" href="#" data-tip="<?php 
                                echo esc_attr($item_meta_html);
                                ?>
">[?]</a>
								<?php 
                            }
                            ?>
							</td>
						</tr>
						<?php 
                        }
                        echo '</table>';
                    } else {
                        echo '&ndash;';
                    }
                    break;
                case 'shipping_address':
                    if ($address = $the_order->get_formatted_shipping_address()) {
                        echo '<a target="_blank" href="' . esc_url($the_order->get_shipping_address_map_url()) . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $address)) . '</a>';
                    } else {
                        echo '&ndash;';
                    }
                    if ($the_order->get_shipping_method()) {
                        echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->get_shipping_method()) . '</small>';
//.........这里部分代码省略.........
开发者ID:vkolova,项目名称:bgscena,代码行数:101,代码来源:class-wc-admin-post-types.php

示例3: get_tooltip_html

 /**
  * Get HTML for tooltips
  *
  * @param  array $data
  * @return string
  */
 public function get_tooltip_html($data)
 {
     if ($data['desc_tip'] === true) {
         $tip = $data['description'];
     } elseif (!empty($data['desc_tip'])) {
         $tip = $data['desc_tip'];
     } else {
         $tip = '';
     }
     return $tip ? '<img class="help_tip" data-tip="' . wc_sanitize_tooltip($tip) . '" src="' . WC()->plugin_url() . '/assets/images/help.png" height="16" width="16" />' : '';
 }
开发者ID:flasomm,项目名称:Montkailash,代码行数:17,代码来源:abstract-wc-settings-api.php

示例4: wc_help_tip

/**
 * Display a WooCommerce help tip.
 *
 * @since  2.5.0
 *
 * @param  string $tip        Help tip text
 * @param  bool   $allow_html Allow sanitized HTML if true or escape
 * @return string
 */
function wc_help_tip($tip, $allow_html = false)
{
    if ($allow_html) {
        $tip = wc_sanitize_tooltip($tip);
    } else {
        $tip = esc_attr($tip);
    }
    return '<span class="woocommerce-help-tip" data-tip="' . $tip . '"></span>';
}
开发者ID:WPprodigy,项目名称:woocommerce,代码行数:18,代码来源:wc-core-functions.php

示例5: test_wc_sanitize_tooltip

 /**
  * Test wc_sanitize_tooltip() - note this is a basic type test as WP core already.
  * has coverage for wp_kses().
  *
  * @since 2.4
  */
 public function test_wc_sanitize_tooltip()
 {
     $this->assertEquals('alert();cleaned', wc_sanitize_tooltip('<script>alert();</script>cleaned'));
 }
开发者ID:jimlove7273,项目名称:woocommerce,代码行数:10,代码来源:functions.php

示例6: render_shop_order_columns

 public function render_shop_order_columns($column)
 {
     global $post, $woocommerce, $the_order;
     if (empty($the_order) || $the_order->id != $post->ID) {
         $the_order = wc_get_order($post->ID);
     }
     switch ($column) {
         case 'order_title':
             $crm_customer_link = get_option('wc_crm_customer_link', 'customer');
             if ($crm_customer_link == 'customer') {
                 $url = '';
                 $customer_tip = array();
                 if ($address = $the_order->get_formatted_billing_address()) {
                     $customer_tip[] = __('Billing:', 'woocommerce') . ' ' . $address . '<br/><br/>';
                 }
                 if ($the_order->billing_phone) {
                     $customer_tip[] = __('Tel:', 'woocommerce') . ' ' . $the_order->billing_phone;
                 }
                 echo '<div class="tips wc_crm_customer_link" data-tip="' . wc_sanitize_tooltip(implode("<br/>", $customer_tip)) . '">';
                 $user_id = $the_order->user_id;
                 $email = $the_order->billing_email;
                 if ($user_id) {
                     $user = wc_crm_get_customer($user_id, 'user_id');
                     if ($user) {
                         $url = get_admin_url() . 'admin.php?page=' . WC_CRM_TOKEN . '&c_id=' . $user->c_id;
                     }
                 } else {
                     if ($email) {
                         $user = wc_crm_get_customer($email);
                         if ($user) {
                             $url = get_admin_url() . 'admin.php?page=' . WC_CRM_TOKEN . '&c_id=' . $user->c_id;
                         }
                     }
                 }
                 $username = '';
                 if (!empty($url) && $user) {
                     $username = '<a href="' . $url . '">';
                     if ($user->first_name || $user->last_name) {
                         $username .= esc_html(ucfirst($user->first_name) . ' ' . ucfirst($user->last_name));
                     } else {
                         if ($the_order->user_id) {
                             $user_info = get_userdata($the_order->user_id);
                         }
                         if (!empty($user_info)) {
                             $username .= esc_html(ucfirst($user_info->display_name));
                         } else {
                             $username = __('Guest', 'woocommerce');
                         }
                     }
                     $username .= '</a>';
                 }
                 printf(_x('%s by %s', 'Order number by X', 'woocommerce'), '<a href="' . admin_url('post.php?post=' . absint($post->ID) . '&action=edit') . '" class="row-title"><strong>#' . esc_attr($the_order->get_order_number()) . '</strong></a>', $username);
                 if ($the_order->billing_email) {
                     echo '<small class="meta email"><a href="' . esc_url('mailto:' . $the_order->billing_email) . '">' . esc_html($the_order->billing_email) . '</a></small>';
                 }
                 echo '</div>';
             }
             break;
     }
 }
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:60,代码来源:class-wc-crm-admin-orders-page.php


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