コード例 #1
0
ファイル: SMOBPostListMap.php プロジェクト: anukat2015/smob
 private function get_location()
 {
     $loc = SMOBTools::location();
     if ($loc) {
         $uri = $loc[0];
         $loc = SMOBStore::query("SELECT ?lat ?long WHERE { <{$uri}> geo:lat ?lat ; geo:long ?long .}");
         return array($loc[0]['lat'], $loc[0]['long']);
     } else {
         return array(0, 0);
     }
 }
コード例 #2
0
ファイル: SMOBTemplate.php プロジェクト: anukat2015/smob
    public function publisher_header($reply_of = null)
    {
        $contentblock = $reply_of ? "\$('.content-details').show();" : "\n\t\t\$('#content').focus(function() {\n\t\t\t\$('.content-details').show();\n\t\t});";
        $form_js = <<<__END__
\t\t<script type="text/javascript">
\t\t\$(document).ready(function() {
\t\t\t\$("#publish").click(function () {
\t\t\t\tpublish();
\t\t\t});
\t\t\t{$contentblock}
\t\t\tnumwords = 0;
\t\t\t// XXX form.blur doesn't work :-/
\t\t\t\$('#content-form').blur(function() {
\t\t\t\tif (\$('#content').val().length == 0) {
\t\t\t\t\t\$('.content-details').hide();
\t\t\t\t}
\t\t\t});
\t\t\t\$('#content').keyup(function(){
\t\t\t\tinterlink();
\t\t\t\tcharsleft();
\t\t\t});
\t\t});
\t\t</script>
__END__;
        $form = '<h2>What&apos;s on your mind?</h2>';
        if ($reply_of) {
            $r = explode('/', $reply_of);
            if ($r[2] == 'twitter.com') {
                $reply = '@' . $r[3] . ' ';
            }
            $len = 140 - strlen($reply);
            $form .= "<p>You are replying to post <a href='{$reply_of}'>{$reply_of}</a></p>";
            $form .= "<input type='hidden' name='reply_of' id='reply_of' value='{$reply_of}' />";
        } else {
            $len = 140;
            $form .= "<input type='hidden' name='reply_of' id='reply_of'/>";
        }
        $form .= '
			<span class="content-details" style="display: none;">
			(You have <span id="charsleft">' . $len . '</span> characters left)
			</span>
			<form id="content-form">
			<textarea name="content" id="content" rows="5" cols="82">' . $reply . '</textarea>
			<div class="content-details" style="display: none;">
';
        if ($loc = SMOBTools::location()) {
            $location_uri = 'value ="' . $loc[0] . '"';
            $location = 'value ="' . $loc[1] . '"';
        }
        $form .= '
			<fieldset><legend>Current location</legend>
			<input type="text" name="location" id="location" class="autocomplete" ' . $location . '/>
			<input type="hidden" name="location_uri" id="location_uri" ' . $location_uri . '/>
			</fieldset>
';
        $form .= '	
			<fieldset><legend>Interlinking</legend>
			<div id="lod-form">Links will be suggested while typing ... (space required after each #tag)
				<div id="tabs"><ul></ul></div>
			</div>
			</fieldset>
';
        $form .= '<fieldset><legend>Broadcast</legend>';
        if (TWITTER_POST) {
            $form .= "<input type='checkbox' name='twitter' id='twitter' checked='true'/>Twitter as " . TWITTER_USER . "<br/>";
        }
        $form .= "<input type='checkbox' name='sindice' id='sindice' checked='true'/>Ping Sindice<br/>";
        $form .= '</fieldset>';
        $form .= '
			</div>
			</form>

			<button id="publish" class="content-details" style="display: none;">SMOB it!</button>

			<div id="smob-publish" style="display: none;">
				<br/><em>Publishing content ...</em>
			</div>
';
        return array($form_js, $form);
    }