]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/oembed.php
Create a bundled & minified JS file for Mapstraction's common case (using OpenLayers...
[quix0rs-gnu-social.git] / actions / oembed.php
index 3e46a7262fad4a3e91afb93d2f777d594aa744d2..e25e4cb2592407857d8b1bf69318f64eb161b189 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
- * Laconica-only extensions to the Twitter-like API
+ * StatusNet-only extensions to the Twitter-like API
  *
  * PHP version 5
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Twitter
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @copyright 2008 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2008 StatusNet, Inc.
+ * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
+ * @link      http://status.net/
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -37,11 +38,11 @@ if (!defined('LACONICA')) {
  * This class handles all /main/oembed(.xml|.json)/ requests.
  *
  * @category  oEmbed
- * @package   Laconica
+ * @package   StatusNet
  * @author    Craig Andrews <candrews@integralblue.com>
- * @copyright 2008 Control Yourself, Inc.
+ * @copyright 2008 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
+ * @link      http://status.net/
  */
 
 class OembedAction extends Action
@@ -60,7 +61,7 @@ class OembedAction extends Action
             $proxy_args = $r->map($path);
 
             if (!$proxy_args) {
-                $this->serverError(_("$path not found"), 404);
+                $this->serverError(_("$path not found."), 404);
             }
             $oembed=array();
             $oembed['version']='1.0';
@@ -72,11 +73,11 @@ class OembedAction extends Action
                     $id = $proxy_args['notice'];
                     $notice = Notice::staticGet($id);
                     if(empty($notice)){
-                        $this->serverError(_("notice $id not found"), 404);
+                        $this->serverError(_("Notice $id not found."), 404);
                     }
                     $profile = $notice->getProfile();
                     if (empty($profile)) {
-                        $this->serverError(_('Notice has no profile'), 500);
+                        $this->serverError(_('Notice has no profile.'), 500);
                     }
                     if (!empty($profile->fullname)) {
                         $authorname = $profile->fullname . ' (' . $profile->nickname . ')';
@@ -95,7 +96,7 @@ class OembedAction extends Action
                     $id = $proxy_args['attachment'];
                     $attachment = File::staticGet($id);
                     if(empty($attachment)){
-                        $this->serverError(_("attachment $id not found"), 404);
+                        $this->serverError(_("Attachment $id not found."), 404);
                     }
                     if(empty($attachment->filename) && $file_oembed = File_oembed::staticGet('file_id', $attachment->id)){
                         // Proxy the existing oembed information
@@ -123,7 +124,7 @@ class OembedAction extends Action
                     if($attachment->title) $oembed['title']=$attachment->title;
                     break;
                 default:
-                    $this->serverError(_("$path not supported for oembed requests"), 501);
+                    $this->serverError(_("$path not supported for oembed requests."), 501);
             }
             switch($args['format']){
                 case 'xml':
@@ -154,10 +155,12 @@ class OembedAction extends Action
                     $this->end_document('json');
                     break;
                 default:
-                    $this->serverError(_('content type ' . $apidata['content-type'] . ' not supported'), 501);
+                    // TRANS: Error message displaying attachments. %s is a raw MIME type (eg 'image/png')
+                    $this->serverError(sprintf(_('Content type %s not supported.'), $apidata['content-type']), 501);
             }
         }else{
-            $this->serverError(_('Only ' . common_root_url() . ' urls over plain http please'), 404);
+            // TRANS: Error message displaying attachments. %s is the site's base URL.
+            $this->serverError(sprintf(_('Only %s URLs over plain HTTP please.'), common_root_url()), 404);
         }
     }