Esempio n. 1
0
function prtools_main_tablerow($tablerow, $row)
{
    global $prtools_absolute_path;
    global $prtools_plugin_path;
    $prtools_settings = get_option('pagerank_tools_settings');
    $page = $_SERVER['PHP_SELF'] . "?page=" . $_GET['page'];
    $title = $row->title;
    if ($title == "") {
        $title = "<i>(" . __('Title not read yet, processing soon ...', 'prtools') . ")</i>";
    } else {
        $title = "" . $title . "";
    }
    // Getting pagerannk image
    $pr = prtools_html_pr($row->pr);
    // Change of pagerannk
    if ($row->prchange > 0) {
        $change = '<span style="color:#5eaa5e;">+' . $row->prchange . '</span><br />';
    }
    if ($row->prchange < 0) {
        $change = '<span style="color:#F00;">' . $row->prchange . '</span><br />';
    }
    if ($row->pr - $row->diff_last_pr < 0) {
        $change .= '<span style="font-size:10px; color:#CCC;">(NEW)</span>';
    } else {
        $change .= '<span style="font-size:10px; color:#CCC;">(PR' . ($row->pr - $row->diff_last_pr) . ')</span>';
    }
    if ($row->prchange == 0) {
        $change = "-";
    }
    // Calculating next check
    if ($row->queue == 1) {
        $next_update = "Immediately";
    } else {
        if ($row->pr == -2 || $row->pr == -1) {
            $next_update = $row->lastcheck + $prtools_settings['fetch_url_interval_new'] * 24 * 60 * 60;
        } else {
            $next_update = $row->lastcheck + $prtools_settings['fetch_url_interval'] * 24 * 60 * 60;
        }
        if ($row->lastcheck != 0) {
            $next_update = date("d.m.Y", $next_update);
        } else {
            $next_update = "Immediately";
        }
    }
    // Calculating last check
    if ($row->lastcheck != 0) {
        $lastcheck = date("d.m.Y", $row->lastcheck);
    } else {
        $lastcheck = "-";
    }
    $tablerow = '<tr>';
    $tablerow .= '<td scope="row">' . $pr . '</td>';
    $tablerow .= '<td scope="row">' . $change . '</td>';
    // $tablerow.= '<td scope="row">' . $pr . '<br />' . $row->pr . '</td>';
    // $tablerow.= '<td scope="row">' . $change . '<br />' . $row->diff_last_pr . '</td>';
    if (ini_get('allow_url_fopen') == 1) {
        $tablerow .= '<td scope="row"><a href="' . $row->url . '" target="_blank">' . $title . '</a><br /><a href="' . $row->url . '" target="_blank" style="color:#CCC;">' . $row->url . '</a></td>';
    } else {
        $tablerow .= '<td scope="row"><a href="' . $row->url . '" target="_blank">' . $row->url . '</a></td>';
    }
    $tablerow .= '<td scope="row" width="75">
					<a href="' . str_replace('%7E', '~', $_SERVER['REQUEST_URI']) . '&url=' . $row->url . '" title="Details">
						<img src="' . $prtools_plugin_path . '/extended/images/icon-info.png" border="0" alt="Details" />
				    </a>
					<a href="' . $row->url . '" target="_blank" border="0" title="Visit">
						<img src="' . $prtools_plugin_path . '/extended/images/icon-visit.png" border="0" alt="Visit" />
					</a>
					<a href="#" border="0" title="Delete" onclick="question_redirect(\'' . __('Do you really want to delete', 'prtools') . ' ' . $row->url . ' and all data from Pagerank tools?\', \'' . str_replace('%7E', '~', $_SERVER['REQUEST_URI']) . '&delete_url=' . $row->url . '\' );">
					<img src="' . $prtools_plugin_path . '/extended/images/icon-delete.png" border="0" alt="Visit" />
					</a>
				 </td>';
    $tablerow .= '<td scope="row">' . $row->url_type . '</td>';
    $tablerow .= '<td scope="row">' . $row->date . '</td>';
    $tablerow .= '<td scope="row">' . $lastcheck . '</td>';
    $tablerow .= '<td scope="row">' . $next_update . '</td>';
    $tablerow .= '</tr>';
    return $tablerow;
}
function prtools_url()
{
    global $wpdb;
    global $prtools_url_table;
    global $prtools_pr_table;
    global $prtools_plugin_path;
    $prtools_rows = $wpdb->get_results("SELECT * FROM " . $prtools_pr_table . " WHERE url='" . $_GET['url'] . "' ORDER BY " . $prtools_pr_table . ".entrydate DESC");
    ?>

<!-- Head of entry //-->
<div class="tab-head">
	<h2><?php 
    _e('Pagerank History', 'prtools');
    ?>
</h2>
    
</div>

<div class="spacer"></div>

<div class="tab-menue">
	<input class="button-secondary action" type="button" value="Back to overview" onClick="history.back(-1);" />
</div>

<div class="statistics">
	<div class="diagram" style="width:700px;margin:0.83em 0;">
    <img src="<?php 
    echo $prtools_plugin_path;
    ?>
/extended/stat_graph_url.php?url=<?php 
    echo $_GET['url'];
    ?>
" alt="Pagerank overview" width="700" height="230" />
	</div>
    <p><a href="<?php 
    echo $_GET['url'];
    ?>
" target="_blank"><?php 
    echo $_GET['url'];
    ?>
</a></p>
</div>

<!-- Listing pagerank  history of site //-->
<table class="widefat">
	<thead>
		<tr>
        	<th scope='col'><?php 
    _e('PR', 'prtools');
    ?>
</th>
            <th scope='col'><?php 
    _e('URL', 'prtools');
    ?>
</a></th>
            <th scope='col'><?php 
    _e('Update', 'prtools');
    ?>
</th></tr>
	</thead>
     
    <tbody>
    	<?php 
    $i = 0;
    ?>
		<?php 
    foreach ($prtools_rows as $row) {
        ?>
        <?php 
        $i++;
        ?>
        <tr>
            <td scope='row'><?php 
        echo prtools_html_pr($row->pr);
        ?>
</td>
            <td scope='row'><a href="<?php 
        echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
        ?>
&url=<?php 
        echo $row->url;
        ?>
"><?php 
        echo $row->url;
        ?>
</a></td>
            <td scope='row'><?php 
        echo date("d.m.Y", $row->entrydate);
        ?>
</td>
        </tr>
        <?php 
    }
    ?>
        <?php 
    if ($i == 0) {
        ?>
        <tr>
            <td scope='row' colspan='5'>There could be no pagerank data fetched yet.</td>
        </tr>
        <?php 
    }
    ?>
    </tbody>

</table>

<?php 
}