示例#1
0
function yourls_load_plugins()
{
    global $ydb;
    $ydb->plugins = array();
    $active_plugins = yourls_get_option('active_plugins');
    // Don't load plugins when installing or updating
    if (!$active_plugins or defined('YOURLS_INSTALLING') and YOURLS_INSTALLING or yourls_upgrade_is_needed()) {
        return;
    }
    foreach ((array) $active_plugins as $key => $plugin) {
        if (yourls_validate_plugin_file(YOURLS_PLUGINDIR . '/' . $plugin)) {
            include_once YOURLS_PLUGINDIR . '/' . $plugin;
            $ydb->plugins[] = $plugin;
            unset($active_plugins[$key]);
        }
    }
    // $active_plugins should be empty now, if not, a plugin could not be find: remove it
    if (count($active_plugins)) {
        $missing = '<strong>' . join('</strong>, <strong>', $active_plugins) . '</strong>';
        yourls_update_option('active_plugins', $ydb->plugins);
        $message = 'Could not find and deactivated ' . yourls_plural('plugin', count($active_plugins)) . ' ' . $missing;
        yourls_add_notice($message);
    }
}
示例#2
0
					<h3>Direct vs Referrer Traffic</h3>
					<?php 
        yourls_stats_pie(array('Direct' => $direct, 'Referrers' => $notdirect), 5, '440x220');
        ?>
					<p>Direct traffic: <strong><?php 
        echo $direct;
        ?>
</strong> <?php 
        echo yourls_plural('hit', $direct);
        ?>
 </p>
					<p>Referrer traffic: <strong><?php 
        echo $notdirect;
        ?>
</strong> <?php 
        echo yourls_plural('hit', $notdirect);
        ?>
 </p>

				</td>
			</tr>
			</table>

		<?php 
    } else {
        echo "<p>No referrer data.</p>";
    }
    ?>
			
	</div>
示例#3
0
function ozh_toolbar_do($args)
{
    global $ozh_toolbar;
    // Does this redirection need a toolbar?
    if (!$ozh_toolbar['do']) {
        return;
    }
    // Do we have a cookie stating the user doesn't want a toolbar?
    if (isset($_COOKIE['yourls_no_toolbar']) && $_COOKIE['yourls_no_toolbar'] == 1) {
        return;
    }
    // Get URL and page title
    $url = $args[0];
    $pagetitle = yourls_get_keyword_title($ozh_toolbar['keyword']);
    // Update title if it hasn't been stored yet
    if ($pagetitle == '') {
        $pagetitle = yourls_get_remote_title($url);
        yourls_edit_link_title($ozh_toolbar['keyword'], $pagetitle);
    }
    $_pagetitle = htmlentities(yourls_get_remote_title($url));
    $www = YOURLS_SITE;
    $ver = YOURLS_VERSION;
    $md5 = md5($url);
    $sql = yourls_get_num_queries();
    // When was the link created (in days)
    $diff = abs(time() - strtotime(yourls_get_keyword_timestamp($ozh_toolbar['keyword'])));
    $days = floor($diff / (60 * 60 * 24));
    if ($days == 0) {
        $created = 'today';
    } else {
        $created = $days . ' ' . yourls_plural('day', $days) . ' ago';
    }
    // How many hits on the page
    $hits = 1 + yourls_get_keyword_clicks($ozh_toolbar['keyword']);
    $hits = $hits . ' ' . yourls_plural('view', $hits);
    // Plugin URL (no URL is hardcoded)
    $pluginurl = YOURLS_PLUGINURL . '/' . yourls_plugin_basename(dirname(__FILE__));
    // All set. Draw the toolbar itself.
    echo <<<PAGE
<html>
<head>
\t<title>{$pagetitle} &mdash; YOURLS</title>
\t<link rel="icon" type="image/gif" href="{$www}/images/favicon.gif" />
\t<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\t<meta http-equiv="X-UA-Compatible" content="chrome=1" />
\t<meta name="generator" content="YOURLS v{$ver}" />
\t<meta name="ROBOTS" content="NOINDEX, FOLLOW" />
\t<link rel="stylesheet" href="{$pluginurl}/css/toolbar.css" type="text/css" media="all" />
</head>
<body>
<div id="yourls-bar">
\t<div id="yourls-about">
\t\tShort link powered by <a href="http://yourls.org/">YOURLS</a> and created {$created}. {$hits}.
\t\t<!-- {$sql} queries -->
\t</div>
\t
\t<div id="yourls-delicious">
\t<img src="http://static.delicious.com/img/delicious.small.gif" height="10" width="10" alt="Delicious" />
\t<a id="yourls-delicious-link" title="Bookmark on delicious" href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;"> Bookmark on Delicious</a>
\t</div>

\t<script type="text/javascript" id="topsy_global_settings">
\tvar topsy_theme = "light-blue";
\tvar topsy_nick = " ";
\tvar topsy_style = "small";
\tvar topsy_order = "count,retweet,badge";
\t</script>
\t<div id="yourls-topsy" class="topsy_widget_data">
\t\t<!--{
\t\t        "url": "{$www}/{$ozh_toolbar['keyword']}",
\t\t        "title": "{$_pagetitle}",
\t\t}-->
\t</div>
\t
\t<div id="yourls-selfclose">
\t\t<a id="yourls-once" href="{$url}" title="Close this toolbar">close</a>
\t\t<a id="yourls-always" href="{$url}" title="Never show me this toolbar again">close</a>
\t\t
\t</div>
</div>

<iframe id="yourls-frame" frameborder="0" noresize="noresize" src="{$url}" name="yourlsFrame"></iframe>
<script type="text/javascript" src="{$pluginurl}/js/toolbar.js"></script>
<script type="text/javascript" src="http://cdn.topsy.com/topsy.js?init=topsyWidgetCreator"></script>
<script type="text/javascript" src="http://feeds.delicious.com/v2/json/urlinfo/{$md5}?callback=yourls_get_books"></script>
</body>
</html>
PAGE;
    // Don't forget to die, to interrupt the flow of normal events (ie redirecting to long URL)
    die;
}
示例#4
0
	<p><?php 
    echo $search_display;
    ?>
</p>
	<p>Display <strong><?php 
    echo $display_on_page;
    ?>
</strong> to <strong class='increment'><?php 
    echo $max_on_page;
    ?>
</strong> of <strong class='increment'><?php 
    echo $total_items;
    ?>
</strong> URLs<?php 
    if ($total_items_clicks !== false) {
        echo ", counting <strong>{$total_items_clicks}</strong> " . yourls_plural('click', $total_items_clicks);
    }
    ?>
.</p>
	<?php 
}
?>
	<p>Overall, tracking <strong class='increment'><?php 
echo number_format($total_urls);
?>
</strong> links, <strong><?php 
echo number_format($total_clicks);
?>
</strong> clicks, and counting!</p>

	<?php 
示例#5
0
}
yourls_html_head('plugins', 'Manage Plugins');
yourls_html_logo();
yourls_html_menu();
?>

	<h2>Plugins</h2>
	
	<?php 
$plugins = (array) yourls_get_plugins();
$count = count($plugins);
$count_active = yourls_has_active_plugins();
?>
	
	<p id="plugin_summary">You currently have <strong><?php 
echo $count . ' ' . yourls_plural('plugin', $count);
?>
</strong> installed, and <strong><?php 
echo $count_active;
?>
</strong> activated</p>

	<table id="main_table" class="tblSorter" cellpadding="0" cellspacing="1">
	<thead>
		<tr>
			<th>Plugin Name</th>
			<th>Version</th>
			<th>Description</th>
			<th>Author</th>
			<th>Action</th>
		</tr>