public function counterize_plugin_report_callback($output, $what)
 {
     $items = counterize_get_option('amount2');
     $subitems = $items;
     ob_start();
     if (in_array('browsers', $what)) {
         $this->counterize_render_most_used_browsers_collapsible($items, $subitems);
         $this->counterize_render_most_used_browsers($items);
         $this->counterize_render_most_used_browsers_without_version($items);
     }
     $tmp = ob_get_contents();
     if (!empty($tmp)) {
         $output .= $tmp;
     }
     ob_end_clean();
     return $output;
 }
 public function counterize_plugin_report_callback($output, $what)
 {
     $items = counterize_get_option('amount2');
     ob_start();
     if (in_array('urls', $what)) {
         $this->counterize_render_most_requested_urls($items);
         $this->counterize_render_most_requested_urls24hrs($items);
     }
     if (in_array('posts', $what)) {
         $this->counterize_render_most_popular_posts($items);
         $this->counterize_render_most_popular_posts24hrs($items);
     }
     $tmp = ob_get_contents();
     if (!empty($tmp)) {
         $output .= $tmp;
     }
     ob_end_clean();
     return $output;
 }
    public function counterize_display_dashboard_traffic_page_callback()
    {
        // Amount to pass as option to the graphs...
        $amount2 = counterize_get_option('amount2');
        if ($amount2 == '' || $amount2 == ' ' || !is_numeric($amount2)) {
            $amount2 = 0;
        }
        echo '
		<div id="icon-plugins" class="icon32"></div>
		<h1>' . __('Counterize', COUNTERIZE_PLUGIN_TRAFFIC_TD) . ' - ' . __('Dashboard', COUNTERIZE_PLUGIN_TRAFFIC_TD) . ' - ' . __('Traffic', COUNTERIZE_PLUGIN_TRAFFIC_TD) . '</h1>
		';
        $this->counterize_show_data_traffic(true, $amount2, true);
        //Print the footer
        counterize_pagefooter();
    }
 public function counterize_plugin_report_callback($output, $what)
 {
     $items = counterize_get_option('amount2');
     ob_start();
     if (in_array('keywords', $what)) {
         $this->counterize_render_most_searched_keywords($items);
         $this->counterize_render_most_searched_keywords24hrs($items);
     }
     $tmp = ob_get_contents();
     if (!empty($tmp)) {
         $output .= $tmp;
     }
     ob_end_clean();
     return $output;
 }
Example #5
0
function counterize_add_pages_callback()
{
    //global $counterize_dashboard_capability;
    $capability = counterize_get_option('display_dashboard_capability');
    //specify that we want to add a dashboard widget
    add_action('wp_dashboard_setup', 'counterize_add_dashboard_widget_callback');
    $counterize_dashboard_handles = counterize_add_dashboard($capability);
}
 public function counterize_plugin_report_callback($output, $what)
 {
     $items = counterize_get_option('amount2');
     ob_start();
     if (in_array('outlinks', $what)) {
         $this->counterize_render_most_clicked_outlinks($items);
         $this->counterize_render_most_clicked_outlinks24hrs($items);
     }
     if (in_array('exitpages', $what)) {
         $this->counterize_render_exit_pages($items);
         $this->counterize_render_exit_pages24hrs($items);
     }
     $tmp = ob_get_contents();
     if (!empty($tmp)) {
         $output .= $tmp;
     }
     ob_end_clean();
     return $output;
 }
function counterize_options_display_reportwhat_callback()
{
    global $wpdb;
    $options = get_option('counterize_options');
    $report_what = explode(',', counterize_get_option('reportwhat'));
    $stats = array('all' => __('Complete report', COUNTERIZE_TD));
    if (empty($report_what) || count($report_what) == 0 || empty($report_what[0])) {
        $report_what = array('all');
    }
    $stats = apply_filters('counterize_report_what_filter', $stats);
    ?>

	<select id='counterize_setting_reportwhat' name='counterize_options[reportwhat][]' multiple='multiple' size='10' style='height: auto;'>

	<?php 
    foreach ($stats as $value => $name) {
        ?>

		<option value="<?php 
        echo $value;
        ?>
" <?php 
        if (in_array($value, $report_what)) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $name;
        ?>
</option>

		<?php 
    }
    unset($stats);
    ?>

	</select>

	<?php 
}
function counterize_renderstats_vertical($rows, $header, $max_width = "500", $nofollow = true, $maxwidth = "100%", $shorten = true, $htmlspecialchars_for_label = false)
{
    $max_label = counterize_get_option('maxwidth');
    $items = 0;
    $complete_amount = 0;
    $max = 0;
    foreach ($rows as $row) {
        $items++;
        $complete_amount += $row->amount;
        if ($row->amount > $max) {
            $max = $row->amount;
        }
    }
    ?>

			<table width="<?php 
    echo $maxwidth;
    ?>
" summary="<?php 
    _e('Statistics', COUNTERIZE_TD);
    ?>
">
				<tr class="alternate">
					<td style="width: 25%"><small><strong><?php 
    echo htmlspecialchars(__($header, COUNTERIZE_TD));
    ?>
</strong></small></td>
					<td style="width: 10%"><small><strong><?php 
    _e('Amount', COUNTERIZE_TD);
    ?>
</strong></small></td>
					<td style="width: 65%"><small><strong><?php 
    _e('Percentage', COUNTERIZE_TD);
    ?>
</strong></small></td>
				</tr>

	<?php 
    $counter = 0;
    foreach ($rows as $row) {
        $percent = round($row->amount / $complete_amount * 100, 2);
        if (isset($row->amount) || array_key_exists('amount', get_object_vars($row))) {
            $width = round($row->amount * $max_width / $max);
        } else {
            $width = 0;
        }
        $group = round($width / $max_width * 100);
        ?>

				<tr<?php 
        if ($counter % 2) {
            echo " class=\"alternate\"";
        }
        ?>
>
					<td style="width: 25%">
						<small><?php 
        if (strlen($row->label) > $max_label && $shorten == true) {
            $label = substr($row->label, 0, $max_label) . '...';
        } else {
            $label = $row->label;
        }
        if (isset($row->url) || array_key_exists('url', get_object_vars($row))) {
            // ( $htmlspecialchars_for_url ? htmlspecialchars( $row->url ) : $row->url )
            echo "\n\t\t\t\t\t\t\t<a href=\"" . htmlspecialchars($row->url) . "\"";
            if ($nofollow) {
                echo " rel=\"nofollow\"";
            }
            echo " target=\"_blank\">\n\t\t\t\t\t\t\t\t" . ($htmlspecialchars_for_label ? htmlspecialchars($label) : $label) . "\n\t\t\t\t\t\t\t</a>\n";
        } else {
            echo $htmlspecialchars_for_label ? htmlspecialchars($label) : $label;
        }
        ?>
						</small>
					</td>

					<td style="width: 10%">
						<small><?php 
        echo htmlspecialchars($row->amount);
        ?>
</small>
					</td>

					<td style="width: 65%">
						<img	src="<?php 
        echo htmlspecialchars(COUNTERIZE_PLUGIN_URL);
        if ($group < 40) {
            echo "/counterize_red.png";
        } else {
            if ($group < 80) {
                echo "/counterize_yellow.png";
            } else {
                echo "/counterize_green.png";
            }
        }
        ?>
"
							style="height:8px; width:<?php 
        echo $width;
        ?>
px; vertical-align:bottom"
							alt="<?php 
        echo htmlspecialchars($header . ' - ' . $row->label2 . ' - ' . $row->amount . ' - ' . $percent) . ' %';
        ?>
" />
						<small><strong><?php 
        echo htmlspecialchars($percent);
        ?>
 %</strong></small>
					</td>
				</tr>

	<?php 
        $counter++;
    }
    ?>

			</table>

<?php 
}
function counterize_display_dashboard_history_page_callback()
{
    // Amount to pass as option to the graphs...
    $amount2 = counterize_get_option('amount2');
    if ($amount2 == '' || $amount2 == ' ' || !is_numeric($amount2)) {
        $amount2 = 10;
    }
    echo '
	<div id="icon-plugins" class="icon32"></div>
	<h1>' . __('Counterize', COUNTERIZE_TD) . ' - ' . __('Dashboard', COUNTERIZE_TD) . ' - ' . __('History', COUNTERIZE_TD) . '</h1>
	';
    if (current_user_can('manage_options')) {
        $updateText = '';
        if (isset($_GET['killmass']) && check_admin_referer('action_killmass')) {
            if ($_GET['killmass'] == 'yes') {
                if (isset($_POST['counterize_killemall'])) {
                    foreach ($_POST['counterize_killemall'] as $key => $val) {
                        $val = intval($val);
                        counterize_killEntry($val);
                        $updateText .= __('Entry: ' . $val . ' removed<br />', COUNTERIZE_TD);
                    }
                    counterize_updateText($updateText);
                    unset($updateText);
                }
            }
        }
        // For the zap-an-entry-option
        if (isset($_GET['kill']) && check_admin_referer('action_uri_kill')) {
            $val = intval($_GET['kill']);
            counterize_killEntry($val);
            counterize_updateText(__('Deleting entry ', COUNTERIZE_TD) . $val);
        }
        //Show latest entries
        counterize_show_history('counterize_dashboard_history', true);
    }
    //Print the footer
    counterize_pagefooter();
}
Example #10
0
    public function render_feed_vertical($nofollow = true, $tablewidth = "100%", $shorten = true, $htmlspecialchars_for_label = false, $is_subitem = false, $print_header = true)
    {
        /* check if the feed contains collapsible items */
        $has_collapsible_items = false;
        foreach ($this->data as $item) {
            if (isset($item->feed) && $item->feed->count > 0) {
                $has_collapsible_items = true;
                break;
            }
        }
        $max_label = counterize_get_option('maxwidth');
        $offset = $is_subitem ? 1 : 0;
        //echo "print_header {" . $print_header ? "1" : "0" . "}";
        if ($print_header === true && $is_subitem === false) {
            ?>

		<h2><?php 
            echo $this->title . ' &#x202A;(' . $this->count . ')&#x202C;';
            ?>
</h2>

		<?php 
        }
        ?>

		<table width="<?php 
        echo $tablewidth;
        ?>
" summary="<?php 
        _e('Statistics', COUNTERIZE_TD);
        ?>
"<?php 
        if ($is_subitem) {
            echo ' class="counterize_subtable"';
        }
        ?>
>

			<tr<?php 
        if (!$is_subitem) {
            echo ' class="alternate"';
        }
        ?>
>
				<?php 
        if ($has_collapsible_items || $is_subitem) {
            ?>
<td style="width: 2%"><?php 
            if ($is_subitem) {
                echo '<small><strong>#</strong></small>';
            } else {
                echo '&nbsp;';
            }
            ?>
</td><?php 
        }
        ?>
				<td style="width: 25%"><small><strong><?php 
        echo htmlspecialchars($this->caption);
        ?>
</strong></small></td>
				<td style="width: 10%"><small><strong><?php 
        _e('Amount', COUNTERIZE_TD);
        ?>
</strong></small></td>
				<td style="width: 60%"><small><strong><?php 
        _e('Percentage', COUNTERIZE_TD);
        ?>
</strong></small></td>
			</tr>

		<?php 
        $counter = 0;
        foreach ($this->data as $item) {
            $percent = round($item->percent, 2);
            $group = $this->max > 0 ? round($item->value * 100 / $this->max) : 0;
            $has_subitems = isset($item->feed) && $item->feed->count > 0;
            $uniqueid = uniqid();
            ?>

			<tr<?php 
            if (($counter + $offset) % 2) {
                echo ' class="alternate"';
            }
            ?>
>

				<?php 
            if ($has_collapsible_items || $is_subitem) {
                ?>
<td>

				<?php 
                //if the items has a feed, display its feed as subitems
                if ($has_subitems) {
                    ?>

					<span>
						<a id="counterize_parent_<?php 
                    echo "{$uniqueid}_{$counter}";
                    ?>
" href="javascript:counterize_fold( 'counterize_parent_<?php 
                    echo "{$uniqueid}_{$counter}";
                    ?>
', 'counterize_child_<?php 
                    echo "{$uniqueid}_{$counter}";
                    ?>
' );">[&nbsp;+&nbsp;]</a>
					</span>
				<?php 
                } elseif ($is_subitem) {
                    ?>
					<small><?php 
                    echo $counter + 1;
                    ?>
</small>
				<?php 
                } else {
                    ?>
					&nbsp;
				<?php 
                }
                ?>

				</td><?php 
            }
            ?>

				<td>
					<small><?php 
            //generate the label
            if (strlen($item->caption) > $max_label && $shorten == true) {
                $label = substr($item->caption, 0, $max_label) . '...';
            } else {
                $label = $item->caption;
            }
            //display the associated picture if present
            if (isset($item->img)) {
                echo $item->img->render();
            }
            //add a link for the label if an URL is provided, or just display the label otherwise
            if (!empty($item->url)) {
                echo '<a href="' . htmlspecialchars($item->url) . '"';
                if ($nofollow) {
                    echo ' rel="nofollow"';
                }
                echo ' target="_blank">' . ($htmlspecialchars_for_label ? htmlspecialchars($label) : $label) . '</a>';
            } else {
                echo $htmlspecialchars_for_label ? htmlspecialchars($label) : $label;
            }
            ?>
</small>
				</td>

				<td>
					<small><?php 
            echo htmlspecialchars($item->value);
            ?>
</small>
				</td>

				<td>
					<?php 
            if ($group < 40) {
                $color = 'red';
            } elseif ($group < 80) {
                $color = 'yellow';
            } elseif ($percent > 99) {
                $color = 'blue';
            } else {
                $color = 'green';
            }
            ?>

					<span class="counterize_chart_bar counterize_chart_bar_horizontal <?php 
            echo $color;
            ?>
"
						  style="width:<?php 
            echo $percent * 0.9;
            ?>
%;"
						  alt="<?php 
            echo htmlspecialchars($this->caption . ' - ' . $item->caption . ' - ' . $item->value . ' - ' . $percent) . ' %';
            ?>
">&nbsp;</span>
					<small><strong><?php 
            echo htmlspecialchars($percent);
            ?>
&nbsp;%</strong></small>
				</td>
			</tr>
			<?php 
            //if the item has sub-items, we must render the item feed inside a new line
            if ($has_subitems) {
                ?>

			<tr id="counterize_child_<?php 
                echo "{$uniqueid}_{$counter}";
                ?>
" class="collapsed">
				<td colspan="4">

					<?php 
                $item->feed->render_feed_vertical($nofollow, $tablewidth, $shorten, $htmlspecialchars_for_label, true);
                ?>

				</td>
			</tr>
			<?php 
            }
            $counter++;
        }
        ?>

		</table>
		<?php 
    }