3 Plugin Name: Sample Toolbar
\r
4 Plugin URI: http://yourls.org/
\r
5 Description: Add a "toolbar" wrapping redirected short URLs.
\r
8 Author URI: http://ozh.org/
\r
9 Disclaimer: Toolbars ruin the user experience. Be warned.
\r
12 global $ozh_toolbar;
\r
13 $ozh_toolbar['do'] = false;
\r
14 $ozh_toolbar['keyword'] = '';
\r
16 yourls_add_action( 'redirect_shorturl', 'ozh_toolbar_add' );
\r
17 function ozh_toolbar_add( $args ) {
\r
18 global $ozh_toolbar;
\r
19 $ozh_toolbar['do'] = true;
\r
20 $ozh_toolbar['keyword'] = $args[1];
\r
23 yourls_add_action( 'pre_redirect', 'ozh_toolbar_do' );
\r
24 function ozh_toolbar_do( $args ) {
\r
25 global $ozh_toolbar;
\r
27 if( !$ozh_toolbar['do'] )
\r
32 $pagetitle = yourls_get_keyword_title( $ozh_toolbar['keyword'] );
\r
37 <title>$pagetitle (YOURLS toolbar)</title>
\r
46 background: transparent;
\r
54 font-family: Verdana, Arial;
\r
62 -moz-box-shadow: 0 1px 5px rgba(0,0,0,0.5);
\r
63 -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
\r
75 div.topsy_widget_data { display:inline; float:left; }
\r
77 <script type="text/javascript" src="http://cdn.topsy.com/topsy.js?init=topsyWidgetCreator"></script>
\r
80 <div id="yourlsBar">
\r
82 Toolbar by <a href="http://yourls.org/">YOURLS</a>
\r
83 <div class="topsy_widget_data"><!--
\r
85 "url": "http://labs.topsy.com/widgets/retweet-button/",
\r
86 "title": "Topsy Retweet Button for Web Sites"
\r
89 <span id="selfclose">(<a href="$url">close</a>)</span>
\r
92 <iframe id="yourlsFrame" frameborder="0" noresize="noresize" src="$url" name="yourlsFrame"></iframe>
\r