1 | <?php |
||
20 | class SmartpartnerKeyhighlighter |
||
|
|||
21 | { |
||
22 | /** |
||
23 | * @access private |
||
24 | */ |
||
25 | public $preg_keywords = ''; |
||
26 | /** |
||
27 | * @access private |
||
28 | */ |
||
29 | public $keywords = ''; |
||
30 | /** |
||
31 | * @access private |
||
32 | */ |
||
33 | public $singlewords = false; |
||
34 | /** |
||
35 | * @access private |
||
36 | */ |
||
37 | public $replace_callback = null; |
||
38 | |||
39 | public $content; |
||
40 | |||
41 | /** |
||
42 | * Main constructor |
||
43 | * |
||
44 | * This is the main constructor of keyhighlighter class. <br> |
||
45 | * It's the only public method of the class. |
||
46 | * @param string $keywords the keywords you want to highlight |
||
47 | * @param boolean $singlewords specify if it has to highlight also the single words. |
||
48 | * @param callback $replace_callback a custom callback for keyword highlight. |
||
49 | * <code> |
||
50 | * <?php |
||
51 | * require ('keyhighlighter.class.php'); |
||
52 | * |
||
53 | * function my_highlighter ($matches) { |
||
54 | * return '<span style="font-weight: bolder; color: #FF0000;">' . $matches[0] . '</span>'; |
||
55 | * } |
||
56 | * |
||
57 | * new keyhighlighter ('W3C', false, 'my_highlighter'); |
||
58 | * readfile ('http://www.w3c.org/'); |
||
59 | * ?> |
||
60 | * </code> |
||
61 | */ |
||
62 | // public function __construct () |
||
63 | public function __construct($keywords, $singlewords = false, $replace_callback = null) |
||
69 | |||
70 | /** |
||
71 | * @access private |
||
72 | * @param $replace_matches |
||
73 | * @return mixed |
||
74 | */ |
||
75 | public function replace($replace_matches) |
||
99 | |||
100 | /** |
||
101 | * @access private |
||
102 | * @param $buffer |
||
103 | * @return mixed|string |
||
104 | */ |
||
105 | public function highlight($buffer) |
||
114 | } |
||
115 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.