Esempio n. 1
0
 public function postArticle(&$article)
 {
     $msg = '';
     $link = $article->url();
     $title = $article->title();
     $caption = preg_replace("#^https?://", "", $link);
     $description = strip_tags(\Kiki\Misc::textSummary($article->body(), 400));
     $storageId = $article->topImage();
     // 500x500 cropped is good enough for Facebook
     $picture = $storageId ? \Kiki\Storage::url($storageId, 500, 500, true) : \Kiki\Config::$siteLogo;
     $result = $this->post($article->objectId(), $msg, $link, $title, $caption, $description, $picture);
     return $result;
 }
Esempio n. 2
0
$tmpFile = $_FILES['attachment']['tmp_name'];
$name = $_FILES['attachment']['name'];
$size = $_FILES['attachment']['size'];
$target = $_POST['target'];
$id = $tmpFile ? Storage::save($name, file_get_contents($tmpFile)) : 0;
$html = null;
$albumId = isset($_POST['albumId']) ? $_POST['albumId'] : null;
if ($albumId && $id) {
    $album = new Album($albumId);
    $pictures = $album->addPictures(null, null, array($id));
    $html = $album->formItem($pictures[0]['id']);
}
// fileUploadHandler is defined in htdocs/scripts/default.js
?>
<script type="text/javascript">
window.parent.fileUploadHandler( '<?php 
echo $target;
?>
', '<?php 
echo $id;
?>
', '<?php 
echo Storage::url($id);
?>
', <?php 
echo json_encode($html);
?>
 );
</script>
<?php 
exit;