Example #1
0
function create_img(&$img, $rows, $id, &$dy, &$colors)
{
    global $img_width, $font_size, $font_path, $line_height;
    $sname = substr($_SERVER['SERVER_NAME'], 0, 100);
    # $sname = substr(filter_input(INPUT_SERVER, 'SERVER_NAME'), 0, 200);
    # if(!$sname)$sname = substr(filter_input(INPUT_SERVER, 'SERVER_ADDR'), 0, 200);
    $sself = substr(filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING), 0, 200);
    # error_log("getdir:$sname $sself");
    $surl = '源码[ ' . get_short_url(dirname("http://" . $sname . $sself) . "/show_code.php?id={$id}") . ' ]';
    $dy = strlen($surl) < 38 ? 20 : 0;
    $img = imagecreate($img_width, 35 + $dy + $line_height * $rows) or die("fail to create img");
    # error_log("width:$img_width Rows:$rows id:$id dy:$dy line_height:$line_height");
    imagecolorallocate($img, 255, 255, 255);
    $colors[2] = imagecolorallocate($img, 0, 110, 0);
    $colors[3] = imagecolorallocate($img, 255, 20, 147);
    $colors[0] = imagecolorallocate($img, 0, 0, 0);
    $colors[1] = imagecolorallocate($img, 60, 60, 180);
    $colors[4] = imagecolorallocate($img, 166, 166, 166);
    if ($dy > 0) {
        $d = imagettfbbox($font_size, 0, $font_path, $surl);
        $x = $img_width - 10 - abs($d[4] - $d[0]);
        //p_word($img, $surl, $colors[4], $x, 1, 5);
        imagettftext($img, $font_size, 0, $x, $line_height + 5, $colors[4], $font_path, $surl);
    }
}
Example #2
0
							<div class="widget-box widget-share">
								<h4>Bagikan isu ini</h4>
								<div class="sss_kk_main" style="max-width: 560px;">
									<div class="sss_shares_block">
										<span class="sss_shares_number"><?php 
    echo get_share_count($post->ID);
    ?>
</span><strong>SHARES</strong>
									</div>
									
									<a rel="nofollow" href="<?php 
    echo get_twitter_share_url($post->ID);
    ?>
" target="_blank" title="Tweet this" class="btn-twitter"><span class="sss_twitter_button icon-twitter"></span>Tweet</a>
									<?php 
    $fb_url = build_query(array('u' => get_short_url($post->ID)));
    ?>
									<a rel="nofollow" href="https://www.facebook.com/sharer/sharer.php?<?php 
    echo $fb_url;
    ?>
" title="Share this on Facebook" target="_blank" class="btn-facebook"><span class="sss_fb_button icon-facebook"></span>Share</a>
								</div>
								<p class="description">Saat share Facebook gunakanlah <span>#l<?php 
    echo $post->ID;
    ?>
</span> untuk memperkuat pendapat Anda</p>
							</div>
							<div class="widget-box widget-popular">
								<h4>Isu Terpopuler</h4>
								<?php 
    $popular = get_popular_posts(5);
Example #3
0
function get_twitter_share_url($post_id)
{
    $args = array('text' => get_the_title($post_id), 'hashtags' => 'l' . $post_id, 'url' => get_short_url($post_id));
    return add_query_arg($args, 'https://twitter.com/intent/tweet');
}
Example #4
0
if ($result = $con->query($sql, SQLITE_BOTH, $error)) {
    if ($row = $result->fetch()) {
        if ($customword != '') {
            echo "Oops, that word is already taken. Try again!<br>";
        } else {
            $shorturl = $row['short'];
            $note = "I found that URL in my database, the code above was generated on " . date("m/d/Y @ H:i:s", $row['date']);
            echo "Your speakable URL is <a href={$base_path}/{$shorturl}>{$base_path}/{$shorturl}</a><br>";
        }
    } else {
        if (isValidURL($urlinput)) {
            if ($customword != '') {
                $shorturl = $customword;
                $note = "Chances are your word is safe, I won't let someone overwrite it on purpose<br> However, there could be a 1 in " . number_format($total_ids) . " chance it could be recycled by an autogenerated phrase";
            } else {
                $shorturl = get_short_url($id);
                $note = "This address should be safe for awhile. I'll generate " . number_format($total_ids) . " new phrases before I reuse yours";
            }
            $sql = "replace into URLS ('id','url','short','date') values('{$id}','{$urlinput}','{$shorturl}','" . time() . "')";
            if (!$con->queryExec($sql, $error)) {
                die($error);
            }
            echo "Your speakable URL is <a href={$base_path}/{$shorturl}>{$base_path}/{$shorturl}</a><br>";
        } else {
            echo "Thats not much of a URL, maybe you should try again?<br>";
        }
    }
    echo "<span class=small>{$note}</span><br>";
}
function get_short_url($id)
{