0) {
foreach ($res as $fn) GDSRHelper::clean_cache($fn);
}
}
/**
* Cleans IP.
*
* @param string $ip start IP
* @return string cleaned IP
*/
function clean_ip($ip) {
$parts = explode(".", $ip);
for ($i = 0; $i < count($parts); $i++)
$parts[$i] = intval($parts[$i]);
return join(".", $parts);
}
function timer_value($t_type, $t_date = '', $t_count_value = 0, $t_count_type = 'D') {
$value = '';
switch ($t_type) {
case 'D':
$value = $t_date;
break;
case 'T':
$value = $t_count_type.$t_count_value;
break;
}
return $value;
}
function get_categories_hierarchy($cats, $depth = 0, $level = 0) {
$h = array();
foreach ($cats as $cat) {
if($cat->parent == $level) {
$cat->depth = $depth;
$h[] = $cat;
$recats = GDSRHelper::get_categories_hierarchy($cats, $depth + 1, $cat->term_id);
$h = array_merge($h, $recats);
}
}
return $h;
}
function render_taxonomy_select($tax = "") {
global $wp_taxonomies, $gdsr;
foreach ($wp_taxonomies as $taxonomy => $cnt) {
$valid = false;
if ($gdsr->wp_version < 30) {
if ($taxonomy != "category" && $cnt->object_type == "post") $valid = true;
} else {
if ($taxonomy != "category" && $cnt->public) $valid = true;
}
if ($valid) {
$current = $tax == $taxonomy ? ' selected="selected"' : $current = '';
echo "\t\r\n";
}
}
}
function render_styles_select($styles, $selected = '', $version = false) {
foreach ($styles as $style) {
$title = $version ? $style->name." ".$style->version : $style->name;
$current = $selected == $style->folder ? ' selected="selected"' : $current = '';
echo "\t\r\n";
}
}
function render_class_select($styles) {
for ($i = 0; $i < count($styles); $i++) {
$style = $styles[$i];
echo "\t\r\n";
}
}
function render_stars_select($selected = 10) {
GDSRHelper::render_stars_select_full($selected);
}
function render_stars_select_full($selected = 10, $stars = 20, $start = 1, $prefix = '') {
for ($i = $start; $i < $stars + 1; $i++) {
if ($selected == $i) $current = ' selected="selected"';
else $current = '';
if ($prefix != '') $name = $prefix.': '.$i;
else $name = $i;
echo "\t\r\n";
}
}
function render_gfx_js($styles) {
$js = array();
foreach ($styles as $style)
$js[] = '"'.$style->folder.'": "'.$style->gfx_url.'"';
echo join(", ", $js);
}
function render_ext_gfx_js($styles) {
$js = array();
foreach ($styles as $style)
$js[] = '"'.$style->folder.'": "'.$style->type.'"';
echo join(", ", $js);
}
function render_authors_gfx_js($styles) {
$js = array();
foreach ($styles as $style) {
$info = '"name": "'.$style->author.'", ';
$info.= '"email": "'.$style->email.'", ';
$info.= '"url": "'.$style->url.'"';
$js[] = '"'.$style->folder.'": { '.$info.' }';
}
echo join(", ", $js);
}
function render_custom_fields($name, $selected = "N", $width = 180, $style = '') {
$fields = gdWPGDSR::get_all_custom_fieds(false);
?>
user_level);
echo '
';
$first = true;
$tr_class = "";
foreach ($data as $row) {
$user = $row->user_id == 0 ? __("visitor", "gd-star-rating") : $row->display_name;
$voteon = $votevl = $loguser = $pocmlog = $postlog = "";
if ($row->vote_type == "artthumb" || $row->vote_type == "cmmthumb") {
$votevl = __("Thumb", "gd-star-rating")."
".($row->vote > 0 ? "UP" : "DOWN")." ";
} else if ($row->vote_type == "multis") {
$voteval = intval($row->vote) / 10;
if ($row->vote == 0) {
$set = wp_gdget_multi_set($row->multi_id);
$voteval = GDSRDBMulti::get_multi_rating_from_single_object($set, unserialize($row->object));
}
$votevl = __("Multi Vote", "gd-star-rating")."
".$voteval." ";
} else {
$votevl = __("Vote", "gd-star-rating")."
".$row->vote." ";
}
if ($row->vote_type == "article" || $row->vote_type == "artthumb" || $row->vote_type == "multis") {
$post = get_post($row->id);
$voteon = '
'.$post->post_title.'';
$pocmlog = sprintf("admin.php?page=gd-star-rating-stats&gdsr=voters&pid=%s&vt=%s&vg=total", $row->id, $row->vote_type);
$pocmlog = sprintf('
%s', $pocmlog, __("post", "gd-star-rating"));
} else {
$comment = get_comment($row->id);
$post = get_post($comment->comment_post_ID);
$voteon = '
'.__("comment", "gd-star-rating").' '.__("for", "gd-star-rating").'
'.$post->post_title.'';
$pocmlog = sprintf("admin.php?page=gd-star-rating-stats&gdsr=voters&pid=%s&vt=%s&vg=total", $row->id, $row->vote_type);
$pocmlog = sprintf('
%s', $pocmlog, __("comment", "gd-star-rating"));
$pctype = $row->vote_type == "comment" ? "article" : "artthumb";
$postlog = sprintf("admin.php?page=gd-star-rating-stats&gdsr=voters&pid=%s&vt=%s&vg=total", $comment->comment_post_ID, $pctype);
$postlog = sprintf('
%s', $postlog, __("post", "gd-star-rating"));
}
if ($row->user_id == 0) {
$loguser = sprintf("admin.php?page=gd-star-rating-users&gdsr=userslog&ui=0&vt=%s&un=Visitor", $row->vote_type);
$loguser = sprintf('
%s', $loguser, __("visitors", "gd-star-rating"));
} else {
$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);
$loguser = sprintf('
%s', $loguser, __("user", "gd-star-rating"));
}
?>
user_id > 0 ? " user" : ""; ?>">
user_email, 32); ?>
'.$votevl.''; _e("from", "gd-star-rating"); ?> ">
voted; ?>
= intval($gdsr->o["security_showip_user_level"])) { ?>
: ip; ?> |
: ,
';
}
}
?>