示例#1
0
/**
 * Display the Quick Share box
 *
 */
function yourls_share_box($longurl, $shorturl, $title = '', $text = '', $shortlink_title = '', $share_title = '', $hidden = false)
{
    if ($shortlink_title == '') {
        $shortlink_title = '<h2>' . yourls__('Your short link') . '</h2>';
    }
    if ($share_title == '') {
        $share_title = '<h2>' . yourls__('Quick Share') . '</h2>';
    }
    // Allow plugins to short-circuit the whole function
    $pre = yourls_apply_filter('shunt_share_box', false);
    if (false !== $pre) {
        return $pre;
    }
    $text = $text ? '"' . $text . '" ' : '';
    $title = $title ? "{$title} " : '';
    $share = yourls_esc_textarea($title . $text . $shorturl);
    $count = 140 - strlen($share);
    $hidden = $hidden ? 'style="display:none;"' : '';
    // Allow plugins to filter all data
    $data = compact('longurl', 'shorturl', 'title', 'text', 'shortlink_title', 'share_title', 'share', 'count', 'hidden');
    $data = yourls_apply_filter('share_box_data', $data);
    extract($data);
    $_share = rawurlencode($share);
    $_url = rawurlencode($shorturl);
    ?>
	
	<div id="shareboxes" <?php 
    echo $hidden;
    ?>
>

		<?php 
    yourls_do_action('shareboxes_before', $longurl, $shorturl, $title, $text);
    ?>

		<div id="copybox" class="share">
		<?php 
    echo $shortlink_title;
    ?>
			<p><input id="copylink" class="text" size="32" value="<?php 
    echo yourls_esc_url($shorturl);
    ?>
" /></p>
			<p><small><?php 
    yourls_e('Long link');
    ?>
: <a id="origlink" href="<?php 
    echo yourls_esc_url($longurl);
    ?>
"><?php 
    echo yourls_esc_url($longurl);
    ?>
</a></small>
			<?php 
    if (yourls_do_log_redirect()) {
        ?>
			<br/><small><?php 
        yourls_e('Stats');
        ?>
: <a id="statlink" href="<?php 
        echo yourls_esc_url($shorturl);
        ?>
+"><?php 
        echo yourls_esc_url($shorturl);
        ?>
+</a></small>
			<input type="hidden" id="titlelink" value="<?php 
        echo yourls_esc_attr($title);
        ?>
" />
			<?php 
    }
    ?>
			</p>
		</div>

		<?php 
    yourls_do_action('shareboxes_middle', $longurl, $shorturl, $title, $text);
    ?>

		<div id="sharebox" class="share">
			<?php 
    echo $share_title;
    ?>
			<div id="tweet">
				<span id="charcount" class="hide-if-no-js"><?php 
    echo $count;
    ?>
</span>
				<textarea id="tweet_body"><?php 
    echo $share;
    ?>
</textarea>
			</div>
			<p id="share_links"><?php 
    yourls_e('Share with');
    ?>
 
				<a id="share_tw" href="http://twitter.com/home?status=<?php 
    echo $_share;
    ?>
" title="<?php 
    yourls_e('Tweet this!');
    ?>
" onclick="share('tw');return false">Twitter</a>
				<a id="share_fb" href="http://www.facebook.com/share.php?u=<?php 
    echo $_url;
    ?>
" title="<?php 
    yourls_e('Share on Facebook');
    ?>
" onclick="share('fb');return false;">Facebook</a>
				<?php 
    yourls_do_action('share_links', $longurl, $shorturl, $title, $text);
    // Note: on the main admin page, there are no parameters passed to the sharebox when it's drawn.
    ?>
			</p>
		</div>
		
		<?php 
    yourls_do_action('shareboxes_after', $longurl, $shorturl, $title, $text);
    ?>
	
	</div>
	
	<?php 
}
示例#2
0
/**
 * Display the Quick Share box
 *
 */
function yourls_share_box($longurl, $shorturl, $title = '', $text = '', $shortlink_title = '', $share_title = '', $hidden = false)
{
    if ($shortlink_title == '') {
        $shortlink_title = '<h2>' . yourls__('Dein Kurzlink') . '</h2>';
    }
    if ($share_title == '') {
        $share_title = '<h2>' . yourls__('Teilen') . '</h2>';
    }
    // Allow plugins to short-circuit the whole function
    $pre = yourls_apply_filter('shunt_share_box', false);
    if (false !== $pre) {
        return $pre;
    }
    $text = $text ? '"' . $text . '" ' : '';
    $title = $title ? "{$title} " : '';
    $share = yourls_esc_textarea($title . $text . $shorturl);
    $count = 140 - strlen($share);
    $hidden = $hidden ? 'style="display:none;"' : '';
    // Allow plugins to filter all data
    $data = compact('longurl', 'shorturl', 'title', 'text', 'shortlink_title', 'share_title', 'share', 'count', 'hidden');
    $data = yourls_apply_filter('share_box_data', $data);
    extract($data);
    $_share = rawurlencode($share);
    $_url = rawurlencode($shorturl);
    ?>

	<!-- This is somewhat pointless -->
	<!-- <div id="shareboxes" <?php 
    echo $hidden;
    ?>
> -->

		<?php 
    yourls_do_action('shareboxes_before', $longurl, $shorturl, $title, $text);
    ?>

		<div class="main-column">
		<div id="copybox" class="panel panel-regular">
			<div class="panel-header">
				<?php 
    echo $shortlink_title;
    ?>
			</div>
			<div class="panel-body">
				<p><input id="copylink" class="form-control input-lg" value="<?php 
    echo yourls_esc_url($shorturl);
    ?>
" /></p>
				<p><?php 
    yourls_e('Verweist auf');
    ?>
: <a id="origlink" href="<?php 
    echo yourls_esc_url($longurl);
    ?>
"><?php 
    echo yourls_esc_url($longurl);
    ?>
</a>
				<?php 
    if (yourls_do_log_redirect()) {
        ?>
				<br/><?php 
        yourls_e('Statistiken');
        ?>
: <a id="statlink" href="<?php 
        echo yourls_esc_url($shorturl);
        ?>
+"><?php 
        echo yourls_esc_url($shorturl);
        ?>
+</a>
				<input type="hidden" id="titlelink" value="<?php 
        echo yourls_esc_attr($title);
        ?>
" />
				<?php 
    }
    ?>
				</p>
			</div>
		</div>

		<?php 
    yourls_do_action('shareboxes_middle', $longurl, $shorturl, $title, $text);
    ?>
		</div><!-- /.main-column -->

		<div class="sidebar-column">
			<div class="panel panel-sidebar">
				<?php 
    echo $share_title;
    /* is h2 */
    ?>
				<div class="panel-body">
					<span class="caret"></span>

					<div id="tweet">
						<!--<span id="charcount" class="hide-if-no-js"><?php 
    echo $count;
    ?>
</span>-->
						<textarea id="tweet_body" class="form-control" rows="5"><?php 
    echo $share;
    ?>
</textarea>
					</div>
					<p id="share_links"><?php 
    yourls_e('Teilen über');
    ?>
						<a id="share_tw" href="http://twitter.com/home?status=<?php 
    echo $_share;
    ?>
" title="<?php 
    yourls_e('Tweet this!');
    ?>
" onclick="share('tw');return false">Twitter</a>
						<a id="share_fb" href="http://www.facebook.com/share.php?u=<?php 
    echo $_url;
    ?>
" title="<?php 
    yourls_e('Share on Facebook');
    ?>
" onclick="share('fb');return false;">Facebook</a>
						<a id="share_ff" href="http://friendfeed.com/share/bookmarklet/frame#title=<?php 
    echo $_share;
    ?>
" title="<?php 
    yourls_e('Share on Friendfeed');
    ?>
" onclick="share('ff');return false;">FriendFeed</a>
						<?php 
    yourls_do_action('share_links', $longurl, $shorturl, $title, $text);
    // Note: on the main admin page, there are no parameters passed to the sharebox when it's drawn.
    ?>
					</p>
				</div>
			</div>
		</div><!-- /.sidebar-column -->

		<?php 
    yourls_do_action('shareboxes_after', $longurl, $shorturl, $title, $text);
    ?>

	<!-- </div> /#shareboxes -->

	<?php 
}