albertlast /
SMF2.1
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * Simple Machines Forum (SMF) |
||
| 5 | * |
||
| 6 | * @package SMF |
||
| 7 | * @author Simple Machines http://www.simplemachines.org |
||
| 8 | * @copyright 2017 Simple Machines and individual contributors |
||
| 9 | * @license http://www.simplemachines.org/about/smf/license.php BSD |
||
| 10 | * |
||
| 11 | * @version 2.1 Beta 4 |
||
| 12 | */ |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Interface search_api_interface |
||
| 16 | */ |
||
| 17 | interface search_api_interface |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * Check whether the specific search operation can be performed by this API. |
||
| 21 | * The operations are the functions listed in the interface, if not supported |
||
| 22 | * they need not be declared |
||
| 23 | * |
||
| 24 | * @access public |
||
| 25 | * @param string $methodName The method |
||
| 26 | * @param array $query_params Any parameters for the query |
||
| 27 | * @return boolean Whether or not the specified method is supported |
||
| 28 | */ |
||
| 29 | public function supportsMethod($methodName, $query_params = array()); |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Whether this method is valid for implementation or not |
||
| 33 | * |
||
| 34 | * @access public |
||
| 35 | * @return bool Whether or not this method is valid |
||
| 36 | */ |
||
| 37 | public function isValid(); |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Callback function for usort used to sort the fulltext results. |
||
| 41 | * the order of sorting is: large words, small words, large words that |
||
| 42 | * are excluded from the search, small words that are excluded. |
||
| 43 | * |
||
| 44 | * @access public |
||
| 45 | * @param string $a Word A |
||
| 46 | * @param string $b Word B |
||
| 47 | * @return int An integer indicating how the words should be sorted |
||
| 48 | */ |
||
| 49 | public function searchSort($a, $b); |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Callback while preparing indexes for searching |
||
| 53 | * |
||
| 54 | * @access public |
||
| 55 | * @param string $word A word to index |
||
| 56 | * @param array $wordsSearch Search words |
||
| 57 | * @param array $wordsExclude Words to exclude |
||
| 58 | * @param bool $isExcluded Whether the specfied word should be excluded |
||
| 59 | */ |
||
| 60 | public function prepareIndexes($word, array &$wordsSearch, array &$wordsExclude, $isExcluded); |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Search for indexed words. |
||
| 64 | * |
||
| 65 | * @access public |
||
| 66 | * @param array $words An array of words |
||
| 67 | * @param array $search_data An array of search data |
||
| 68 | * @return mixed |
||
| 69 | */ |
||
| 70 | public function indexedWordQuery(array $words, array $search_data); |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Callback when a post is created |
||
| 74 | * @see createPost() |
||
| 75 | * |
||
| 76 | * @access public |
||
| 77 | * @param array $msgOptions An array of post data |
||
| 78 | * @param array $topicOptions An array of topic data |
||
| 79 | * @param array $posterOptions An array of info about the person who made this post |
||
| 80 | * @return void |
||
| 81 | */ |
||
| 82 | public function postCreated(array &$msgOptions, array &$topicOptions, array &$posterOptions); |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Callback when a post is modified |
||
| 86 | * @see modifyPost() |
||
| 87 | * |
||
| 88 | * @access public |
||
| 89 | * @param array $msgOptions An array of post data |
||
| 90 | * @param array $topicOptions An array of topic data |
||
| 91 | * @param array $posterOptions An array of info about the person who made this post |
||
| 92 | * @return void |
||
| 93 | */ |
||
| 94 | public function postModified(array &$msgOptions, array &$topicOptions, array &$posterOptions); |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Callback when a post is removed |
||
| 98 | * |
||
| 99 | * @access public |
||
| 100 | * @param int $id_msg The ID of the post that was removed |
||
| 101 | * @return void |
||
| 102 | */ |
||
| 103 | public function postRemoved($id_msg); |
||
| 104 | |||
| 105 | /** |
||
| 106 | * Callback when a topic is removed |
||
| 107 | * |
||
| 108 | * @access public |
||
| 109 | * @param array $topics The ID(s) of the removed topic(s) |
||
| 110 | * @return void |
||
| 111 | */ |
||
| 112 | public function topicsRemoved(array $topics); |
||
| 113 | |||
| 114 | /** |
||
| 115 | * Callback when a topic is moved |
||
| 116 | * |
||
| 117 | * @access public |
||
| 118 | * @param array $topics The ID(s) of the moved topic(s) |
||
| 119 | * @param int $board_to The board that the topics were moved to |
||
| 120 | * @return void |
||
| 121 | */ |
||
| 122 | public function topicsMoved(array $topics, $board_to); |
||
| 123 | |||
| 124 | /** |
||
| 125 | * Callback for actually performing the search query |
||
| 126 | * |
||
| 127 | * @access public |
||
| 128 | * @param array $query_params An array of parameters for the query |
||
| 129 | * @param array $searchWords The words that were searched for |
||
| 130 | * @param array $excludedIndexWords Indexed words that should be excluded |
||
| 131 | * @param array $participants |
||
| 132 | * @param array $searchArray |
||
| 133 | * @return mixed |
||
| 134 | */ |
||
| 135 | public function searchQuery(array $query_params, array $searchWords, array $excludedIndexWords, array &$participants, array &$searchArray); |
||
| 136 | } |
||
| 137 | |||
| 138 | /** |
||
| 139 | * Class search_api |
||
| 140 | */ |
||
| 141 | abstract class search_api implements search_api_interface |
||
| 142 | { |
||
| 143 | /** |
||
| 144 | * @var string The last version of SMF that this was tested on. Helps protect against API changes. |
||
| 145 | */ |
||
| 146 | public $version_compatible = 'SMF 2.1 Beta 4'; |
||
| 147 | |||
| 148 | /** |
||
| 149 | * @var string The minimum SMF version that this will work with |
||
| 150 | */ |
||
| 151 | public $min_smf_version = 'SMF 2.1 Beta 4'; |
||
| 152 | |||
| 153 | /** |
||
| 154 | * @var bool Whether or not it's supported |
||
| 155 | */ |
||
| 156 | public $is_supported = true; |
||
| 157 | |||
| 158 | /** |
||
| 159 | * {@inheritDoc} |
||
| 160 | */ |
||
| 161 | public function isValid() |
||
| 162 | { |
||
| 163 | } |
||
| 164 | |||
| 165 | /** |
||
| 166 | * {@inheritDoc} |
||
| 167 | */ |
||
| 168 | public function searchSort($a, $b) |
||
| 169 | { |
||
| 170 | } |
||
| 171 | |||
| 172 | /** |
||
| 173 | * {@inheritDoc} |
||
| 174 | */ |
||
| 175 | public function prepareIndexes($word, array &$wordsSearch, array &$wordsExclude, $isExcluded) |
||
| 176 | { |
||
| 177 | } |
||
| 178 | |||
| 179 | /** |
||
| 180 | * {@inheritDoc} |
||
| 181 | */ |
||
| 182 | public function indexedWordQuery(array $words, array $search_data) |
||
| 183 | { |
||
| 184 | } |
||
| 185 | |||
| 186 | /** |
||
| 187 | * {@inheritDoc} |
||
| 188 | */ |
||
| 189 | public function postCreated(array &$msgOptions, array &$topicOptions, array &$posterOptions) |
||
| 190 | { |
||
| 191 | } |
||
| 192 | |||
| 193 | /** |
||
| 194 | * {@inheritDoc} |
||
| 195 | */ |
||
| 196 | public function postModified(array &$msgOptions, array &$topicOptions, array &$posterOptions) |
||
| 197 | { |
||
| 198 | } |
||
| 199 | |||
| 200 | /** |
||
| 201 | * {@inheritDoc} |
||
| 202 | */ |
||
| 203 | public function postRemoved($id_msg) |
||
| 204 | { |
||
| 205 | } |
||
| 206 | |||
| 207 | /** |
||
| 208 | * {@inheritDoc} |
||
| 209 | */ |
||
| 210 | public function topicsRemoved(array $topics) |
||
| 211 | { |
||
| 212 | } |
||
| 213 | |||
| 214 | /** |
||
| 215 | * {@inheritDoc} |
||
| 216 | */ |
||
| 217 | public function topicsMoved(array $topics, $board_to) |
||
| 218 | { |
||
| 219 | } |
||
| 220 | |||
| 221 | /** |
||
| 222 | * {@inheritDoc} |
||
| 223 | */ |
||
| 224 | public function searchQuery(array $query_params, array $searchWords, array $excludedIndexWords, array &$participants, array &$searchArray) |
||
| 225 | { |
||
| 226 | } |
||
| 227 | } |
||
| 228 | |||
| 229 | ?> |
||
|
0 ignored issues
–
show
|
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.