PageRenderTime 26ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/wordpress/wp-content/plugins/gd-star-rating/code/adm/elements.php

http://ownerpress.googlecode.com/
PHP | 402 lines | 342 code | 39 blank | 21 comment | 160 complexity | 79e104a5d9948515f561d6d58f170aed MD5 | raw file
Possible License(s): Apache-2.0, AGPL-1.0, GPL-2.0, GPL-3.0, LGPL-2.1
  1. <?php
  2. class GDSRHelper {
  3. /**
  4. * Creates extra folders.
  5. *
  6. * @return bool cache folder exists and is writeable
  7. */
  8. function create_folders($version) {
  9. if (is_dir(STARRATING_XTRA_PATH)) {
  10. if (is_writable(STARRATING_XTRA_PATH)) {
  11. if (!is_dir(STARRATING_CACHE_PATH)) mkdir(STARRATING_CACHE_PATH, 0755);
  12. if (!is_dir(STARRATING_XTRA_PATH."stars/")) mkdir(STARRATING_XTRA_PATH."stars/", 0755);
  13. if (!is_dir(STARRATING_XTRA_PATH."trends/")) mkdir(STARRATING_XTRA_PATH."trends/", 0755);
  14. if (!is_dir(STARRATING_XTRA_PATH."css/")) mkdir(STARRATING_XTRA_PATH."css/", 0755);
  15. if (!file_exists(STARRATING_XTRA_PATH."css/rating.css")) {
  16. copy(STARRATING_PATH."css/rating.css", STARRATING_XTRA_PATH."css/rating.css");
  17. }
  18. }
  19. } else {
  20. $path = WP_CONTENT_DIR;
  21. if (is_writable($path)) {
  22. mkdir(STARRATING_XTRA_PATH, 0755);
  23. GDSRHelper::create_folders($version);
  24. } else return false;
  25. }
  26. return is_dir(STARRATING_CACHE_PATH) && is_writable(STARRATING_CACHE_PATH);
  27. }
  28. /**
  29. * Removes all files from cache
  30. *
  31. * @param string $path Path to the cache folder
  32. */
  33. function clean_cache($path) {
  34. if (!file_exists($path)) return;
  35. if (is_file($path)) {
  36. unlink ($path);
  37. return;
  38. }
  39. $res = glob($path."/*");
  40. if (is_array($res) && count($res) > 0) {
  41. foreach ($res as $fn) GDSRHelper::clean_cache($fn);
  42. }
  43. }
  44. /**
  45. * Cleans IP.
  46. *
  47. * @param string $ip start IP
  48. * @return string cleaned IP
  49. */
  50. function clean_ip($ip) {
  51. $parts = explode(".", $ip);
  52. for ($i = 0; $i < count($parts); $i++)
  53. $parts[$i] = intval($parts[$i]);
  54. return join(".", $parts);
  55. }
  56. function timer_value($t_type, $t_date = '', $t_count_value = 0, $t_count_type = 'D') {
  57. $value = '';
  58. switch ($t_type) {
  59. case 'D':
  60. $value = $t_date;
  61. break;
  62. case 'T':
  63. $value = $t_count_type.$t_count_value;
  64. break;
  65. }
  66. return $value;
  67. }
  68. function get_categories_hierarchy($cats, $depth = 0, $level = 0) {
  69. $h = array();
  70. foreach ($cats as $cat) {
  71. if($cat->parent == $level) {
  72. $cat->depth = $depth;
  73. $h[] = $cat;
  74. $recats = GDSRHelper::get_categories_hierarchy($cats, $depth + 1, $cat->term_id);
  75. $h = array_merge($h, $recats);
  76. }
  77. }
  78. return $h;
  79. }
  80. function render_taxonomy_select($tax = "") {
  81. global $wp_taxonomies, $gdsr;
  82. foreach ($wp_taxonomies as $taxonomy => $cnt) {
  83. $valid = false;
  84. if ($gdsr->wp_version < 30) {
  85. if ($taxonomy != "category" && $cnt->object_type == "post") $valid = true;
  86. } else {
  87. if ($taxonomy != "category" && $cnt->public) $valid = true;
  88. }
  89. if ($valid) {
  90. $current = $tax == $taxonomy ? ' selected="selected"' : $current = '';
  91. echo "\t<option value='".$taxonomy."'".$current.">".$cnt->label."</option>\r\n";
  92. }
  93. }
  94. }
  95. function render_styles_select($styles, $selected = '', $version = false) {
  96. foreach ($styles as $style) {
  97. $title = $version ? $style->name." ".$style->version : $style->name;
  98. $current = $selected == $style->folder ? ' selected="selected"' : $current = '';
  99. echo "\t<option value='".$style->folder."'".$current.">".$title."</option>\r\n";
  100. }
  101. }
  102. function render_class_select($styles) {
  103. for ($i = 0; $i < count($styles); $i++) {
  104. $style = $styles[$i];
  105. echo "\t<option value='".$style["class"]."'>".$style["name"]."</option>\r\n";
  106. }
  107. }
  108. function render_stars_select($selected = 10) {
  109. GDSRHelper::render_stars_select_full($selected);
  110. }
  111. function render_stars_select_full($selected = 10, $stars = 20, $start = 1, $prefix = '') {
  112. for ($i = $start; $i < $stars + 1; $i++) {
  113. if ($selected == $i) $current = ' selected="selected"';
  114. else $current = '';
  115. if ($prefix != '') $name = $prefix.': '.$i;
  116. else $name = $i;
  117. echo "\t<option value='".$i."'".$current.">".$name."</option>\r\n";
  118. }
  119. }
  120. function render_gfx_js($styles) {
  121. $js = array();
  122. foreach ($styles as $style)
  123. $js[] = '"'.$style->folder.'": "'.$style->gfx_url.'"';
  124. echo join(", ", $js);
  125. }
  126. function render_ext_gfx_js($styles) {
  127. $js = array();
  128. foreach ($styles as $style)
  129. $js[] = '"'.$style->folder.'": "'.$style->type.'"';
  130. echo join(", ", $js);
  131. }
  132. function render_authors_gfx_js($styles) {
  133. $js = array();
  134. foreach ($styles as $style) {
  135. $info = '"name": "'.$style->author.'", ';
  136. $info.= '"email": "'.$style->email.'", ';
  137. $info.= '"url": "'.$style->url.'"';
  138. $js[] = '"'.$style->folder.'": { '.$info.' }';
  139. }
  140. echo join(", ", $js);
  141. }
  142. function render_custom_fields($name, $selected = "N", $width = 180, $style = '') {
  143. $fields = gdWPGDSR::get_all_custom_fieds(false);
  144. ?>
  145. <select style="width: <?php echo $width ?>px; <?php echo $style; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>">
  146. <?php
  147. foreach ($fields as $s) {
  148. echo sprintf('<option value="%s"%s>%s</option>', $s, ($selected == $s ? ' selected="selected"' : ''), $s);
  149. }
  150. ?>
  151. </select>
  152. <?php
  153. }
  154. function render_moderation_combo($name, $selected = "N", $width = 180, $style = '', $row_zero = false, $cat = false, $parent = false) {
  155. ?>
  156. <select style="width: <?php echo $width ?>px; <?php echo $style; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>">
  157. <?php if ($row_zero) { ?> <option value=""<?php echo $selected == '/' ? ' selected="selected"' : ''; ?>>/</option> <?php } ?>
  158. <option value="N"<?php echo $selected == 'N' ? ' selected="selected"' : ''; ?>><?php _e("No moderation", "gd-star-rating"); ?> </option>
  159. <option value="V"<?php echo $selected == 'V' ? ' selected="selected"' : ''; ?>><?php _e("Moderate visitors", "gd-star-rating"); ?></option>
  160. <option value="U"<?php echo $selected == 'U' ? ' selected="selected"' : ''; ?>><?php _e("Moderate users", "gd-star-rating"); ?></option>
  161. <option value="A"<?php echo $selected == 'A' ? ' selected="selected"' : ''; ?>><?php _e("Moderate all", "gd-star-rating"); ?></option>
  162. <?php if (!$cat) { ?><option value="I"<?php echo $selected == 'I' ? ' selected="selected"' : ''; ?>><?php _e("Inherit from Category", "gd-star-rating"); ?></option><?php } ?>
  163. <?php if ($parent) { ?><option value="P"<?php echo $selected == 'P' ? ' selected="selected"' : ''; ?>><?php _e("Inherit from Parent", "gd-star-rating"); ?></option><?php } ?>
  164. </select>
  165. <?php
  166. }
  167. function render_rules_combo($name, $selected = "A", $width = 180, $style = '', $row_zero = false, $cat = false, $parent = false) {
  168. ?>
  169. <select style="width: <?php echo $width ?>px; <?php echo $style; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>">
  170. <?php if ($row_zero) { ?> <option value=""<?php echo $selected == '/' ? ' selected="selected"' : ''; ?>>/</option> <?php } ?>
  171. <option value="A"<?php echo $selected == 'A' ? ' selected="selected"' : ''; ?>><?php _e("Everyone can vote", "gd-star-rating"); ?></option>
  172. <option value="V"<?php echo $selected == 'V' ? ' selected="selected"' : ''; ?>><?php _e("Only visitors", "gd-star-rating"); ?></option>
  173. <option value="U"<?php echo $selected == 'U' ? ' selected="selected"' : ''; ?>><?php _e("Only users", "gd-star-rating"); ?></option>
  174. <option value="N"<?php echo $selected == 'N' ? ' selected="selected"' : ''; ?>><?php _e("Locked", "gd-star-rating"); ?></option>
  175. <option value="H"<?php echo $selected == 'H' ? ' selected="selected"' : ''; ?>><?php _e("Locked and hidden", "gd-star-rating"); ?></option>
  176. <?php if (!$cat) { ?><option value="I"<?php echo $selected == 'I' ? ' selected="selected"' : ''; ?>><?php _e("Inherit from Category", "gd-star-rating"); ?></option><?php } ?>
  177. <?php if ($parent) { ?><option value="P"<?php echo $selected == 'P' ? ' selected="selected"' : ''; ?>><?php _e("Inherit from Parent", "gd-star-rating"); ?></option><?php } ?>
  178. </select>
  179. <?php
  180. }
  181. function render_timer_combo($name, $selected = "N", $width = 180, $style = '', $row_zero = false, $onchange = '', $cat = false, $parent = false) {
  182. if ($onchange != '') $onchange = ' onchange="'.$onchange.'"';
  183. ?>
  184. <select<?php echo $onchange; ?> style="width: <?php echo $width ?>px; <?php echo $style; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>">
  185. <?php if ($row_zero) { ?> <option value="_"<?php echo $selected == '/' ? ' selected="selected"' : ''; ?>>/</option> <?php } ?>
  186. <option value="N"<?php echo $selected == 'N' ? ' selected="selected"' : ''; ?>><?php _e("No timer", "gd-star-rating"); ?></option>
  187. <option value="T"<?php echo $selected == 'T' ? ' selected="selected"' : ''; ?>><?php _e("Countdown timer", "gd-star-rating"); ?></option>
  188. <option value="D"<?php echo $selected == 'D' ? ' selected="selected"' : ''; ?>><?php _e("Date limited", "gd-star-rating"); ?></option>
  189. <?php if (!$cat) { ?><option value="I"<?php echo $selected == 'I' ? ' selected="selected"' : ''; ?>><?php _e("Inherit from Category", "gd-star-rating"); ?></option><?php } ?>
  190. <?php if ($parent) { ?><option value="P"<?php echo $selected == 'P' ? ' selected="selected"' : ''; ?>><?php _e("Inherit from Parent", "gd-star-rating"); ?></option><?php } ?>
  191. </select>
  192. <?php
  193. }
  194. function render_insert_position($name, $selected = "bottom", $width = 180, $style = '') {
  195. ?>
  196. <select style="width: <?php echo $width ?>px; <?php echo $style; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>">
  197. <option value="bottom"<?php echo $selected == 'bottom' ? ' selected="selected"' : ''; ?>><?php _e("Bottom", "gd-star-rating"); ?></option>
  198. <option value="top"<?php echo $selected == 'top' ? ' selected="selected"' : ''; ?>><?php _e("Top", "gd-star-rating"); ?></option>
  199. <option value="both"<?php echo $selected == 'both' ? ' selected="selected"' : ''; ?>><?php _e("Top and Bottom", "gd-star-rating"); ?></option>
  200. </select>
  201. <?php
  202. }
  203. function render_countdown_combo($name, $selected = "H", $width = 180, $style = '', $row_zero = false, $cat = false) {
  204. ?>
  205. <select style="width: <?php echo $width ?>px; <?php echo $style; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>">
  206. <?php if ($row_zero) { ?> <option value=""<?php echo $selected == '/' ? ' selected="selected"' : ''; ?>>/</option> <?php } ?>
  207. <option value="H"<?php echo $selected == 'H' ? ' selected="selected"' : ''; ?>><?php _e("Hours", "gd-star-rating"); ?></option>
  208. <option value="D"<?php echo $selected == 'D' ? ' selected="selected"' : ''; ?>><?php _e("Days", "gd-star-rating"); ?></option>
  209. <option value="M"<?php echo $selected == 'M' ? ' selected="selected"' : ''; ?>><?php _e("Months", "gd-star-rating"); ?></option>
  210. <?php if (!$cat) { ?><option value="I"<?php echo $selected == 'I' ? ' selected="selected"' : ''; ?>><?php _e("Inherit from Category", "gd-star-rating"); ?></option><?php } ?>
  211. </select>
  212. <?php
  213. }
  214. function render_star_sizes($name, $selected = 20, $width = 120, $extraSel = "") {
  215. ?>
  216. <select style="width: <?php echo $width ?>px;" name="<?php echo $name; ?>" id="<?php echo $name; ?>" <?php echo $extraSel; ?>>
  217. <option value="12"<?php echo $selected == 12 ? ' selected="selected"' : ''; ?>><?php _e("Mini", "gd-star-rating"); ?> [12px]</option>
  218. <option value="16"<?php echo $selected == 16 ? ' selected="selected"' : ''; ?>><?php _e("Icon", "gd-star-rating"); ?> [16px]</option>
  219. <option value="20"<?php echo $selected == 20 ? ' selected="selected"' : ''; ?>><?php _e("Small", "gd-star-rating"); ?> [20px]</option>
  220. <option value="24"<?php echo $selected == 24 ? ' selected="selected"' : ''; ?>><?php _e("Standard", "gd-star-rating"); ?> [24px]</option>
  221. <option value="30"<?php echo $selected == 30 ? ' selected="selected"' : ''; ?>><?php _e("Medium", "gd-star-rating"); ?> [30px]</option>
  222. <option value="46"<?php echo $selected == 46 ? ' selected="selected"' : ''; ?>><?php _e("Big", "gd-star-rating"); ?> [46px]</option>
  223. </select>
  224. <?php
  225. }
  226. function render_thumbs_sizes($name, $selected = 20, $width = 120, $extraSel = "") {
  227. ?>
  228. <select style="width: <?php echo $width ?>px;" name="<?php echo $name; ?>" id="<?php echo $name; ?>" <?php echo $extraSel; ?>>
  229. <option value="12"<?php echo $selected == 12 ? ' selected="selected"' : ''; ?>><?php _e("Mini", "gd-star-rating"); ?> [12px]</option>
  230. <option value="16"<?php echo $selected == 16 ? ' selected="selected"' : ''; ?>><?php _e("Icon", "gd-star-rating"); ?> [16px]</option>
  231. <option value="20"<?php echo $selected == 20 ? ' selected="selected"' : ''; ?>><?php _e("Small", "gd-star-rating"); ?> [20px]</option>
  232. <option value="24"<?php echo $selected == 24 ? ' selected="selected"' : ''; ?>><?php _e("Standard", "gd-star-rating"); ?> [24px]</option>
  233. <option value="32"<?php echo $selected == 32 ? ' selected="selected"' : ''; ?>><?php _e("Medium", "gd-star-rating"); ?> [32px]</option>
  234. <option value="40"<?php echo $selected == 40 ? ' selected="selected"' : ''; ?>><?php _e("Big", "gd-star-rating"); ?> [40px]</option>
  235. </select>
  236. <?php
  237. }
  238. function render_thumbs_sizes_tinymce($name, $selected = "20", $width = 130) {
  239. GDSRHelper::render_thumbs_sizes($name, $selected, $width);
  240. }
  241. function render_star_sizes_tinymce($name, $selected = "20", $width = 130) {
  242. GDSRHelper::render_star_sizes($name, $selected, $width);
  243. }
  244. function render_rss_render($name, $selected = 'both', $width = 180) {
  245. ?>
  246. <select style="width: <?php echo $width ?>px;" name="<?php echo $name; ?>" id="<?php echo $name; ?>">
  247. <option value="both"<?php echo $selected == 'both' ? ' selected="selected"' : ''; ?>><?php _e("Stars and text", "gd-star-rating"); ?></option>
  248. <option value="stars"<?php echo $selected == 'stars' ? ' selected="selected"' : ''; ?>><?php _e("Stars only", "gd-star-rating"); ?></option>
  249. <option value="text"<?php echo $selected == 'text' ? ' selected="selected"' : ''; ?>><?php _e("Text only", "gd-star-rating"); ?></option>
  250. </select>
  251. <?php
  252. }
  253. function render_alignment($name, $selected = 'left', $width = 180) {
  254. ?>
  255. <select style="width: <?php echo $width ?>px;" name="<?php echo $name; ?>" id="<?php echo $name; ?>">
  256. <option value="none"<?php echo $selected == 'none' ? ' selected="selected"' : ''; ?>><?php _e("No alignment", "gd-star-rating"); ?></option>
  257. <option value="left"<?php echo $selected == 'left' ? ' selected="selected"' : ''; ?>><?php _e("Left", "gd-star-rating"); ?></option>
  258. <option value="center"<?php echo $selected == 'center' ? ' selected="selected"' : ''; ?>><?php _e("Center", "gd-star-rating"); ?></option>
  259. <option value="right"<?php echo $selected == 'right' ? ' selected="selected"' : ''; ?>><?php _e("Right", "gd-star-rating"); ?></option>
  260. </select>
  261. <?php
  262. }
  263. function render_loaders($name, $selected = 'bar', $cls = 'jqloaderarticle', $width = 180, $extraSel = "", $square_only = false) {
  264. ?>
  265. <select class="<?php echo $cls ?>" style="width: <?php echo $width ?>px;" name="<?php echo $name; ?>" id="<?php echo $name; ?>" <?php echo $extraSel; ?>>
  266. <option value=""<?php echo $selected == '' ? ' selected="selected"' : ''; ?>><?php _e("No Animation", "gd-star-rating"); ?></option>
  267. <option value="arrows"<?php echo $selected == 'arrows' ? ' selected="selected"' : ''; ?>>Arrows [16x16]</option>
  268. <?php if (!$square_only) { ?><option value="bar"<?php echo $selected == 'bar' ? ' selected="selected"' : ''; ?>>Bar [208x13]</option><?php } ?>
  269. <option value="circle"<?php echo $selected == 'circle' ? ' selected="selected"' : ''; ?>>Circle [16x16]</option>
  270. <option value="flower"<?php echo $selected == 'flower' ? ' selected="selected"' : ''; ?>>Flower [15x15]</option>
  271. <?php if (!$square_only) { ?><option value="gauge"<?php echo $selected == 'gauge' ? ' selected="selected"' : ''; ?>>Gauge [128x15]</option><?php } ?>
  272. <?php if (!$square_only) { ?><option value="squares"<?php echo $selected == 'squares' ? ' selected="selected"' : ''; ?>>Squares [43x11]</option><?php } ?>
  273. <?php if (!$square_only) { ?><option value="fountain"<?php echo $selected == 'fountain' ? ' selected="selected"' : ''; ?>>Fountain [128x16]</option><?php } ?>
  274. <option value="broken"<?php echo $selected == 'broken' ? ' selected="selected"' : ''; ?>>Broken [16x16]</option>
  275. <option value="brokenbig"<?php echo $selected == 'brokenbig' ? ' selected="selected"' : ''; ?>>Broken Big [24x24]</option>
  276. <?php if (!$square_only) { ?><option value="lines"<?php echo $selected == 'lines' ? ' selected="selected"' : ''; ?>>Lines [96x12]</option><?php } ?>
  277. <option value="snake"<?php echo $selected == 'snake' ? ' selected="selected"' : ''; ?>>Snake [12x12]</option>
  278. <option value="radar"<?php echo $selected == 'radar' ? ' selected="selected"' : ''; ?>>Radar [16x16]</option>
  279. <option value="snakebig"<?php echo $selected == 'snakebig' ? ' selected="selected"' : ''; ?>>Snake Big [24x24]</option>
  280. <option value="triangles"<?php echo $selected == 'triangles' ? ' selected="selected"' : ''; ?>>Triangles [12x12]</option>
  281. </select>
  282. <?php
  283. }
  284. function render_placement($name, $selected = 'bottom', $width = 180) {
  285. ?>
  286. <select style="width: <?php echo $width ?>px;" name="<?php echo $name; ?>" id="<?php echo $name; ?>">
  287. <option value="hide"<?php echo $selected == 'hide' ? ' selected="selected"' : ''; ?>><?php _e("Always hide", "gd-star-rating"); ?></option>
  288. <option value="top"<?php echo $selected == 'top' ? ' selected="selected"' : ''; ?>><?php _e("Top", "gd-star-rating"); ?></option>
  289. <option value="top_hidden"<?php echo $selected == 'top_hidden' ? ' selected="selected"' : ''; ?>><?php _e("Top (hide if empty)", "gd-star-rating"); ?></option>
  290. <option value="bottom"<?php echo $selected == 'bottom' ? ' selected="selected"' : ''; ?>><?php _e("Bottom", "gd-star-rating"); ?></option>
  291. <option value="bottom_hidden"<?php echo $selected == 'bottom_hidden' ? ' selected="selected"' : ''; ?>><?php _e("Bottom (hide if empty)", "gd-star-rating"); ?></option>
  292. <option value="left"<?php echo $selected == 'left' ? ' selected="selected"' : ''; ?>><?php _e("Left", "gd-star-rating"); ?></option>
  293. <option value="left_hidden"<?php echo $selected == 'left_hidden' ? ' selected="selected"' : ''; ?>><?php _e("Left (hide if empty)", "gd-star-rating"); ?></option>
  294. <option value="right"<?php echo $selected == 'right' ? ' selected="selected"' : ''; ?>><?php _e("Right", "gd-star-rating"); ?></option>
  295. <option value="right_hidden"<?php echo $selected == 'right_hidden' ? ' selected="selected"' : ''; ?>><?php _e("Right (hide if empty)", "gd-star-rating"); ?></option>
  296. </select>
  297. <?php
  298. }
  299. function render_dash_widget_vote($data, $cls = "", $id = "") {
  300. global $userdata, $gdsr;
  301. $user_level = intval($userdata->user_level);
  302. echo '<div id="gdsr-latest-votes'.$id.'"'.($cls != "" ? ' class="'.$cls.'"' : '').'>';
  303. $first = true;
  304. $tr_class = "";
  305. foreach ($data as $row) {
  306. $user = $row->user_id == 0 ? __("visitor", "gd-star-rating") : $row->display_name;
  307. $voteon = $votevl = $loguser = $pocmlog = $postlog = "";
  308. if ($row->vote_type == "artthumb" || $row->vote_type == "cmmthumb") {
  309. $votevl = __("Thumb", "gd-star-rating")." <strong>".($row->vote > 0 ? "UP" : "DOWN")."</strong> ";
  310. } else if ($row->vote_type == "multis") {
  311. $voteval = intval($row->vote) / 10;
  312. if ($row->vote == 0) {
  313. $set = wp_gdget_multi_set($row->multi_id);
  314. $voteval = GDSRDBMulti::get_multi_rating_from_single_object($set, unserialize($row->object));
  315. }
  316. $votevl = __("Multi Vote", "gd-star-rating")." <strong>".$voteval."</strong> ";
  317. } else {
  318. $votevl = __("Vote", "gd-star-rating")." <strong>".$row->vote."</strong> ";
  319. }
  320. if ($row->vote_type == "article" || $row->vote_type == "artthumb" || $row->vote_type == "multis") {
  321. $post = get_post($row->id);
  322. $voteon = '<a href="'.get_permalink($post->ID).'"><span style="color: #2683AE">'.$post->post_title.'</span></a>';
  323. $pocmlog = sprintf("admin.php?page=gd-star-rating-stats&gdsr=voters&pid=%s&vt=%s&vg=total", $row->id, $row->vote_type);
  324. $pocmlog = sprintf('<a href="%s">%s</a>', $pocmlog, __("post", "gd-star-rating"));
  325. } else {
  326. $comment = get_comment($row->id);
  327. $post = get_post($comment->comment_post_ID);
  328. $voteon = ' <a href="'.get_comment_link($comment).'">'.__("comment", "gd-star-rating").'</a> '.__("for", "gd-star-rating").' <a href="'.get_permalink($post->ID).'"><span style="color: #2683AE">'.$post->post_title.'</span></a>';
  329. $pocmlog = sprintf("admin.php?page=gd-star-rating-stats&gdsr=voters&pid=%s&vt=%s&vg=total", $row->id, $row->vote_type);
  330. $pocmlog = sprintf('<a href="%s">%s</a>', $pocmlog, __("comment", "gd-star-rating"));
  331. $pctype = $row->vote_type == "comment" ? "article" : "artthumb";
  332. $postlog = sprintf("admin.php?page=gd-star-rating-stats&gdsr=voters&pid=%s&vt=%s&vg=total", $comment->comment_post_ID, $pctype);
  333. $postlog = sprintf('<a href="%s">%s</a>', $postlog, __("post", "gd-star-rating"));
  334. }
  335. if ($row->user_id == 0) {
  336. $loguser = sprintf("admin.php?page=gd-star-rating-users&gdsr=userslog&ui=0&vt=%s&un=Visitor", $row->vote_type);
  337. $loguser = sprintf('<a href="%s">%s</a>', $loguser, __("visitors", "gd-star-rating"));
  338. } else {
  339. $loguser = sprintf("admin.php?page=gd-star-rating-users&gdsr=userslog&ui=%s&vt=%s&un=%s", $row->user_id, $row->vote_type, $row->display_name);
  340. $loguser = sprintf('<a href="%s">%s</a>', $loguser, __("user", "gd-star-rating"));
  341. }
  342. ?>
  343. <div class="gdsr-latest-item<?php echo $tr_class; echo $first ? " first" : ""; ?><?php echo $row->user_id > 0 ? " user" : ""; ?>">
  344. <?php echo get_avatar($row->user_email, 32); ?>
  345. <h5><?php echo '<span style="color: #CC0000">'.$votevl.'</span>'; _e("from", "gd-star-rating"); ?> <strong style="color: <?php echo $row->user_id == 0 ? "blue" : "green"; ?>"><?php echo $user; ?></strong> <?php _e("on", "gd-star-rating"); ?> <?php echo $voteon; ?></h5>
  346. <p class="datx"><?php echo $row->voted; ?></p>
  347. <p class="linx">
  348. <?php if ($user_level >= intval($gdsr->o["security_showip_user_level"])) { ?>
  349. <strong><?php _e("ip", "gd-star-rating"); ?>:</strong> <span style="color: blue"><?php echo $row->ip; ?></span> |
  350. <?php } ?>
  351. <strong><?php _e("log", "gd-star-rating"); ?>:</strong> <?php echo $loguser; ?>, <?php echo $pocmlog; ?><?php if ($postlog != "") echo ", "; echo $postlog; ?>
  352. </p>
  353. <div class="clear"></div>
  354. </div>
  355. <?php
  356. $tr_class = $tr_class == "" ? " alter" : "";
  357. $first = false;
  358. }
  359. echo '</div>';
  360. }
  361. }
  362. ?>