コード例 #1
0
ファイル: HuradSanitize.php プロジェクト: hurad/hurad
 public static function htmlAttribute($attribute)
 {
     $rawAttribute = $attribute;
     $attribute = filter_var($attribute, FILTER_SANITIZE_SPECIAL_CHARS);
     return HuradHook::apply_filters('sanitize_html_attribute', $attribute, $rawAttribute);
 }
コード例 #2
0
ファイル: HookHelper.php プロジェクト: hurad/hurad
 /**
  * Remove all of the hooks from an action.
  *
  * @param string   $tag      The action to remove hooks from.
  * @param bool|int $priority The priority number to remove them from.
  *
  * @return bool True when finished.
  */
 function removeAllActions($tag, $priority = false)
 {
     return HuradHook::remove_all_actions($tag, $priority);
 }
コード例 #3
0
ファイル: default_filters.php プロジェクト: hurad/hurad
<?php

/**
 * Default filters
 *
 * PHP 5
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright Copyright (c) 2012-2014, Hurad (http://hurad.org)
 * @link      http://hurad.org Hurad Project
 * @since     Version 0.1.0
 * @license   http://opensource.org/licenses/MIT MIT license
 */
HuradHook::add_filter('the_title', 'trim');
HuradHook::add_filter('commentText', 'HuradFormatting::clickAbleLink', 9);
HuradHook::add_filter('commentText', 'HuradFormatting::convertEmoticons', 20);
HuradHook::add_filter('editable_slug', 'urldecode');
HuradHook::add_filter('editable_slug', 'HuradSanitize::textarea');
コード例 #4
0
ファイル: HuradHook.php プロジェクト: hurad/hurad
 /**
  * Execute functions hooked on a specific action hook, specifying arguments in an array.
  *
  * @see    do_action() This function is identical, but the arguments passed to the
  * functions hooked to <tt>$tag</tt> are supplied using an array.
  *
  * @param string $tag  The name of the action to be executed.
  * @param array  $args The arguments supplied to the functions hooked to <tt>$tag</tt>
  *
  * @return null Will return null if $tag does not exist in $wp_filter array
  */
 public static function do_action_ref_array($tag, $args)
 {
     if (!isset(self::$hr_actions)) {
         self::$hr_actions = array();
     }
     if (!isset(self::$hr_actions[$tag])) {
         self::$hr_actions[$tag] = 1;
     } else {
         ++self::$hr_actions[$tag];
     }
     // Do 'all' actions first
     if (isset(self::$hr_filter['all'])) {
         self::$hr_current_filter[] = $tag;
         $all_args = func_get_args();
         self::_hr_call_all_hook($all_args);
     }
     if (!isset(self::$hr_filter[$tag])) {
         if (isset(self::$hr_filter['all'])) {
             array_pop(self::$hr_current_filter);
         }
         return;
     }
     if (!isset(self::$hr_filter['all'])) {
         self::$hr_current_filter[] = $tag;
     }
     // Sort
     if (!isset(self::$merged_filters[$tag])) {
         ksort(self::$hr_filter[$tag]);
         self::$merged_filters[$tag] = true;
     }
     reset(self::$hr_filter[$tag]);
     do {
         foreach ((array) current(self::$hr_filter[$tag]) as $the_) {
             if (!is_null($the_['function'])) {
                 call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
             }
         }
     } while (next(self::$hr_filter[$tag]) !== false);
     array_pop(self::$hr_current_filter);
 }
コード例 #5
0
ファイル: HuradFunctions.php プロジェクト: hurad/hurad
 /**
  * Convert integer number to format based on the locale.
  *
  * @param int $number   The number to convert based on locale.
  * @param int $decimals Precision of the number of decimal places.
  *
  * @return string Converted number in string format.
  */
 public static function numberFormatI18n($number, $decimals = 0)
 {
     $rawNumber = $number;
     $formatted = number_format($number, self::absInt($decimals), Configure::read('decimal_point'), Configure::read('thousands_sep'));
     return HuradHook::apply_filters('Lib.HuradFunctions.numberFormatI18n', $formatted, $rawNumber);
 }