| 2156 | | |
| 2157 | | |
| 2158 | | /* ************************************************************* |
| 2159 | | * |
| 2160 | | * VOTE FUNCTIONS |
| 2161 | | * |
| 2162 | | * *********************************************************** */ |
| 2163 | | |
| 2164 | | |
| 2165 | | /** |
| 2166 | | * Get Individual Vote Rating |
| 2167 | | * |
| 2168 | | * @param int $post_id |
| 2169 | | * @param int $user_id |
| 2170 | | * @param string $ip |
| 2171 | | * @param bool $anon |
| 2172 | | * @return int - vote rating e.g. 10, -10 |
| 2173 | | */ |
| 2174 | | public function getVoteRating($post_id = 0, $user_id = 0, $ip = '', $anon = false) |
| 2175 | | { |
| 2176 | | return VoteFunctions::getVoteRating($this, $post_id, $user_id, $ip, $anon); |
| 2177 | | } |
| 2178 | | |
| 2179 | | |
| 2180 | | /** |
| 2181 | | * Get Post Vote Info |
| 2182 | | * |
| 2183 | | * @param int $post_id |
| 2184 | | * @return array|false |
| 2185 | | */ |
| 2186 | | public function getPostVoteInfo($post_id = 0) |
| 2187 | | { |
| 2188 | | return VoteFunctions::getPostVoteInfo($this, $post_id); |
| 2189 | | } |
| 2190 | | |
| 2191 | | |
| 2192 | | /** |
| 2193 | | * Add Vote to PostVotes table |
| 2194 | | * |
| 2195 | | * @param int $post_id |
| 2196 | | * @param int $user_id |
| 2197 | | * @param string $ip |
| 2198 | | * @param int $rating |
| 2199 | | * @param string $type - usually the plugin name |
| 2200 | | */ |
| 2201 | | public function addVote($post_id = 0, $user_id = 0, $ip = '', $rating = 0, $type = 'vote') |
| 2202 | | { |
| 2203 | | VoteFunctions::addVote($this, $post_id, $user_id, $ip, $rating, $type); |
| 2204 | | } |
| 2205 | | |
| 2206 | | |
| 2207 | | /** |
| 2208 | | * Update Post Vote Info |
| 2209 | | * |
| 2210 | | * @param int $post_id |
| 2211 | | * @param int $post_votes_up - either -1, 0 or 1 |
| 2212 | | * @param int $post_votes_down - either -1, 0 or 1 |
| 2213 | | * @param string $post_status |
| 2214 | | * @param bool $pub_date - set to TRUE to update to current time |
| 2215 | | */ |
| 2216 | | public function updatePostVoteInfo($post_id = 0, $post_votes_up = 0, $post_votes_down = 0, $post_status = '', $pub_date = FALSE) |
| 2217 | | { |
| 2218 | | VoteFunctions::updatePostVoteInfo($this, $post_id, $post_votes_up, $post_votes_down, $post_status, $pub_date); |
| 2219 | | } |
| 2220 | | |
| 2221 | | |
| 2222 | | /** |
| 2223 | | * Delete Vote from PostVotes table |
| 2224 | | * |
| 2225 | | * @param int $post_id |
| 2226 | | * @param int $user_id |
| 2227 | | * @param int $rating |
| 2228 | | * @param string $ip |
| 2229 | | * @param bool $anon |
| 2230 | | */ |
| 2231 | | public function deleteVote($post_id = 0, $user_id = 0, $rating = 0, $ip = '', $anon = FALSE) |
| 2232 | | { |
| 2233 | | VoteFunctions::deleteVote($this, $post_id, $user_id, $rating, $ip, $anon); |
| 2234 | | } |
| 2235 | | |
| 2236 | | |
| 2237 | | /** |
| 2238 | | * Count votes by a user |
| 2239 | | * |
| 2240 | | * @param string $type - 'all', 'pos', 'neg', 'flags' (flags not included in 'all') |
| 2241 | | * @param int $user_id |
| 2242 | | * return int|false |
| 2243 | | */ |
| 2244 | | public function countUserVotes($type = 'all', $user_id = 0) |
| 2245 | | { |
| 2246 | | return VoteFunctions::countUserVotes($this, $type, $user_id); |
| 2247 | | } |
| | 2156 | |