Author: Sam Stenvall (neggelandia@gmail.com)
Inheritance: extends Base, use trait WatchedIconTrait
Exemple #1
0
    /**
     * Specifically for creating fast starting files.
     * however it can also be used as a standalone function call from the H264Format object.
     *
     * @access public
     * @author Oliver Lillie
     * @param Media $media 
     * @return Media
     */
    public function postProcessFastStart(Media $media)
    {
        // TODO possibly look at setting -movflags faststart options on ffmpeg instead of this.
        //			set the yamdi input and output options.
        $output = $media->getMediaPath();
        $temp_output = $output . '.qtfaststart.' . pathinfo($output, PATHINFO_EXTENSION);
        //			build the qtfaststart process
        $qtfaststart_process = new ProcessBuilder('qtfaststart', $this->_config);
        $exec = $qtfaststart_process->add($output)->add($temp_output)->getExecBuffer();
        //			execute the process.
        $exec->setBlocking(true)->execute();
        //			check for any qt-faststart errors
        if ($exec->hasError() === true) {
            if (is_file($temp_output) === true) {
                //@unlink($temp_output);
            }
            if ($this->_enforce_qt_faststart_success === true) {
                //@unlink($output);
                throw new FfmpegProcessPostProcessException('qt-faststart post processing of "' . $output . '" failed. The output file has been removed. Any additional qt-faststart message follows: 
' . $exec->getExecutedCommand() . '
' . $exec->getBuffer());
            }
            // TODO, log or exception not sure as the original file is ok.
        } else {
            //				nope everything went ok. so delete ffmpeg file, and then rename yamdi file to that of the original.
            unlink($output);
            rename($temp_output, $output);
        }
        return $media;
    }
Exemple #2
0
 public static function combine($type, $files, $compress = false)
 {
     $root = panel::instance()->roots()->assets() . DS . $type;
     $cache = new Media($root . DS . 'panel.' . $type);
     $media = new Collection(array_map(function ($file) use($root) {
         return new Media($root . DS . str_replace('/', DS, $file));
     }, $files));
     // get the max modification date
     $modified = max($media->pluck('modified'));
     if (is_writable($root) and (!$cache->exists() or $cache->modified() < $modified)) {
         $cache->remove();
         $content = '';
         foreach ($media as $asset) {
             $content .= $asset->read() . PHP_EOL;
         }
         if ($compress) {
             $content = static::compress($content);
         }
         f::write($root . DS . 'panel.' . $type, $content);
     }
     if ($cache->exists()) {
         return $type(panel()->urls()->{$type}() . '/panel.' . $type . '?v=' . panel()->version());
     }
     return $type(array_map(function ($item) use($type) {
         return 'panel/assets/' . $type . '/' . $item;
     }, $files));
 }
Exemple #3
0
 /**
  * Download a media file
  * provided the content type
  * on successful response of content type
  * header
  */
 public function getMediaFile()
 {
     $content = $this->client->get($this->media, array(), FALSE);
     $media = new Media();
     $media->setData($content);
     return $media;
 }
 /**
  * Transforms an object (media) to a string (id).
  *
  * @param Media|null $media
  *
  * @return string
  */
 public function transform($media)
 {
     if (null === $media || !$media instanceof \Apoutchika\MediaBundle\Model\MediaInterface) {
         return '';
     }
     return $media->getId();
 }
Exemple #5
0
 public function InstallFiles()
 {
     $media = new Media();
     $media->addModuleFile('modules/preview/vendor/jquery-1.11.1.min.js');
     $media->addModuleFile('modules/preview/xibo-text-render.js');
     $media->addModuleFile('modules/preview/xibo-layout-scaler.js');
 }
 /**
  * @group volume
  */
 public function testUpdate()
 {
     print "\n" . __METHOD__ . ' ';
     $this->_rootLogin();
     $volname = 'pool.file.7d.0001';
     // get info
     $media = new Media();
     $res = $media->getByName($volname);
     $mediaid = $res[0]['mediaid'];
     $poolid = $res[0]['poolid'];
     // update record
     $this->request->setPost(array('mediaid' => $mediaid, 'poolid' => 2, 'volstatus' => 'Append', 'volretention' => 365, 'recycle' => 1, 'slot' => 1, 'inchanger' => 0, 'maxvoljobs' => 99999999, 'maxvolfiles' => 99999, 'comment' => "\n\nmoved\nLorem ipsum dolor sit amet\n"));
     $this->request->setMethod('POST');
     $this->dispatch('volume/update');
     $this->logBody($this->response->outputBody());
     // debug log
     $this->assertController('volume');
     $this->assertAction('update');
     // back
     $this->resetRequest()->resetResponse();
     $this->request->setPost(array('mediaid' => $mediaid, 'poolid' => $poolid, 'volstatus' => 'Append', 'volretention' => 365, 'recycle' => 1, 'slot' => 1, 'inchanger' => 0, 'maxvoljobs' => 999, 'maxvolfiles' => 999, 'comment' => "\n\nback\nLorem ipsum dolor sit amet\n"));
     $this->request->setMethod('POST');
     $this->dispatch('volume/update');
     $this->logBody($this->response->outputBody(), 'a');
     // debug log
     $this->assertController('volume');
     $this->assertAction('update');
 }
 public function updated(Media $media)
 {
     if (is_null($media->getOriginal('model_id'))) {
         return;
     }
     if ($media->manipulations != $media->previousManipulations) {
         app(FileManipulator::class)->createDerivedFiles($media);
     }
 }
 public function DoCheck()
 {
     AssetLoadManager::register('tableList');
     // Search engine
     $vo_search_config_settings = SearchEngine::checkPluginConfiguration();
     $this->view->setVar('search_config_settings', $vo_search_config_settings);
     $this->view->setVar('search_config_engine_name', SearchEngine::getPluginEngineName());
     // Media
     $t_media = new Media();
     $va_plugin_names = $t_media->getPluginNames();
     $va_plugins = array();
     foreach ($va_plugin_names as $vs_plugin_name) {
         if ($va_plugin_status = $t_media->checkPluginStatus($vs_plugin_name)) {
             $va_plugins[$vs_plugin_name] = $va_plugin_status;
         }
     }
     $this->view->setVar('media_config_plugin_list', $va_plugins);
     // PDF Rendering
     $t_pdf_renderer = new PDFRenderer();
     $va_plugin_names = PDFRenderer::getAvailablePDFRendererPlugins();
     $va_plugins = array();
     foreach ($va_plugin_names as $vs_plugin_name) {
         if ($va_plugin_status = $t_pdf_renderer->checkPluginStatus($vs_plugin_name)) {
             $va_plugins[$vs_plugin_name] = $va_plugin_status;
         }
     }
     $this->view->setVar('pdf_renderer_config_plugin_list', $va_plugins);
     // Application plugins
     $va_plugin_names = ApplicationPluginManager::getPluginNames();
     $va_plugins = array();
     foreach ($va_plugin_names as $vs_plugin_name) {
         if ($va_plugin_status = ApplicationPluginManager::checkPluginStatus($vs_plugin_name)) {
             $va_plugins[$vs_plugin_name] = $va_plugin_status;
         }
     }
     $this->view->setVar('application_config_plugin_list', $va_plugins);
     // Barcode generation
     $vb_gd_is_available = caMediaPluginGDInstalled(true);
     $va_barcode_components = array();
     $va_gd = array('name' => 'GD', 'description' => _t('GD is a graphics processing library required for all barcode generation.'));
     if (!$vb_gd_is_available) {
         $va_gd['errors'][] = _t('Is not installed; barcode printing will not be possible.');
     }
     $va_gd['available'] = $vb_gd_is_available;
     $va_barcode_components['GD'] = $va_gd;
     $this->view->setVar('barcode_config_component_list', $va_barcode_components);
     // General system configuration issues
     if (!(bool) $this->request->config->get('dont_do_expensive_configuration_checks_in_web_ui')) {
         ConfigurationCheck::performExpensive();
         if (ConfigurationCheck::foundErrors()) {
             $this->view->setVar('configuration_check_errors', ConfigurationCheck::getErrors());
         }
     }
     $this->render('config_check_html.php');
 }
 public static function getMediaItemMarkup($mediaId, $userID, $tenantID)
 {
     $class = new Media($userID, $tenantID);
     try {
         $media = $class->getEntity($mediaId);
         return Display::getMediaMarkup($media);
     } catch (Exception $ex) {
         // do anything or just ignore if we can't load? Ignoring for now
         //echo '<p>unable to load: ' . $ex->getMessage() . '</p>';
         return '<p class="hidden">Unable to load media id=' . $mediaId . '<p>';
     }
 }
Exemple #10
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show()
 {
     $user_id = Auth::id();
     $media_model = new Media();
     $queue_items = QueueItem::where('user_id', '=', $user_id)->get()->toArray();
     foreach ($queue_items as $key => $queue_item) {
         $queue_items[$key] = $media_model->getMediaFromAPI($queue_item['imdb_id']);
     }
     $view_data['queue_items'] = $queue_items;
     $view_data['side_nav_page'] = 'queue';
     return View::make('queue', $view_data);
 }
 public function allView($id_estabelecimento_id)
 {
     $sql = "SELECT `nome_media` FROM `nome_media` WHERE `id_estabelecimento_id` = {$id_estabelecimento_id} LIMIT 0,1;";
     $vai = new MySQLDB();
     $result = $vai->ExecuteQuery($sql);
     while ($dados = mysql_fetch_array($result)) {
         $cliente = new Media();
         $cliente->setnome_media(array('nome_media' => $dados['nome_media']));
         $arr[] = $cliente;
     }
     return $arr;
 }
Exemple #12
0
 public function photoAttachment(CModel $model, $attr, Media $media)
 {
     static $count = 0;
     $count++;
     $html = '';
     $html .= CHtml::openTag('div', array('class' => 'photo-attachment-container'));
     $html .= $media->getImage(false, array('class' => 'photo-attachment dummy-attachment'));
     $html .= CHtml::tag('div', array('class' => 'remove-attachment-button', 'id' => 'remove-attachment-button-' . $count), X2Html::fa('circle') . X2Html::fa('times-circle-o'));
     $html .= $this->hiddenField($model, $attr . '[]', array('value' => $media->id));
     $html .= CHtml::closeTag('div');
     Yii::app()->clientScript->registerScript('MobileActiveForm::photoAttachment' . $count, "\n            \$('#remove-attachment-button-{$count}').click (function () {\n                \$(this).parent ().remove ();\n            });\n        ");
     return $html;
 }
Exemple #13
0
 public static function getMediaMarkup(\Media $Media)
 {
     switch ($Media->Class) {
         case 'AudioMedia':
             return '<a href="' . $Media->WebPath . '" title="' . htmlspecialchars($Media->Caption) . '" class="media-link audio-link">' . '<img src="' . $Media->getThumbnailRequest(static::$thumbWidth, static::$thumbHeight) . '" alt="' . htmlspecialchars($Media->Caption) . '">' . '</a>';
         case 'VideoMedia':
             return '<div title="' . htmlspecialchars($Media->Caption) . '" class="media-link video-link" id="player-' . $Media->ID . '" style="width:425px;height:300px;">' . '<img src="' . $Media->getThumbnailRequest(static::$thumbWidth, static::$thumbHeight) . '" alt="' . htmlspecialchars($Media->Caption) . '">' . '</div><script>flowplayer("player-' . $Media->ID . '", "/swf/flowplayer-3.2.15.swf",{playlist:["' . $Media->WebPath . '"]})</script>';
         case 'PDFMedia':
             return '<a href="' . $Media->WebPath . '" title="' . htmlspecialchars($Media->Caption) . '" class="media-link pdf-link">' . '<img src="' . $Media->getThumbnailRequest(static::$thumbWidth, static::$thumbHeight) . '" alt="' . htmlspecialchars($Media->Caption) . '">' . '</a>';
         case 'PhotoMedia':
         default:
             return '<figure class="media-figure">' . '<a href="' . $Media->WebPath . '" title="' . htmlspecialchars($Media->Caption) . '" class="media-link image-link">' . '<img class="media-img" src="' . $Media->getThumbnailRequest(static::$fullWidth, static::$fullHeight) . '" alt="' . htmlspecialchars($Media->Caption) . '">' . '</a>' . ($Media->Caption ? '<figcaption class="media-caption">' . htmlspecialchars($Media->Caption) . '</figcaption>' : '') . '</figure>';
     }
 }
Exemple #14
0
 public function __toString()
 {
     /** 
      * make a new file on catapult when we receive an anchor  
      * usage follows:
      *
      * @/storage/my.wav => https://api.catapult.inetwork.com/v1/users/u-xxx/media/my
      */
     if (preg_match("/^@/", $this->url, $m)) {
         $media = new Media();
         $media->create(array("file" => preg_replace("/^@/", "", $this->url), "mediaName" => $this->name));
     }
     return $this->url;
 }
 function parse($value)
 {
     if ($value == '') {
         return null;
     }
     // First attempt to create media with predefined name
     if (preg_match('/^(\\w+)(?:\\s+(portrait|landscape))?$/', $value, $matches)) {
         $name = $matches[1];
         $landscape = isset($matches[2]) && $matches[2] == 'landscape';
         $media =& Media::predefined($name);
         if (is_null($media)) {
             return null;
         }
         return array('size' => array('width' => $media->get_width(), 'height' => $media->get_height()), 'landscape' => $landscape);
     }
     // Second, attempt to create media with predefined size
     $parts = preg_split('/\\s+/', $value);
     $width_str = $parts[0];
     $height_str = isset($parts[1]) ? $parts[1] : $parts[0];
     $width = units2pt($width_str);
     $height = units2pt($height_str);
     if ($width == 0 || $height == 0) {
         return null;
     }
     return array('size' => array('width' => $width / mm2pt(1) / pt2pt(1), 'height' => $height / mm2pt(1) / pt2pt(1)), 'landscape' => false);
 }
Exemple #16
0
 public static function parseRequest($url, &$controllerContext)
 {
     $userRegex = self::getUserRegex();
     $modulesRegex = self::getAvailableModulesRegex();
     $mediaParts = array_map(['Media', 'toString'], Media::getConstList());
     $mediaRegex = implode('|', $mediaParts);
     $regex = '^/?' . '(' . $userRegex . ')' . '(' . $modulesRegex . ')' . '(,(' . $mediaRegex . '))?' . '/?($|\\?)';
     if (!preg_match('#' . $regex . '#', $url, $matches)) {
         return false;
     }
     $controllerContext->userName = $matches[1];
     $media = !empty($matches[4]) ? $matches[4] : 'anime';
     switch ($media) {
         case 'anime':
             $controllerContext->media = Media::Anime;
             break;
         case 'manga':
             $controllerContext->media = Media::Manga;
             break;
         default:
             throw new BadMediaException();
     }
     $rawModule = ltrim($matches[2], '/') ?: 'profile';
     $controllerContext->rawModule = $rawModule;
     $controllerContext->module = self::getModuleByUrlPart($rawModule);
     assert(!empty($controllerContext->module));
     return true;
 }
Exemple #17
0
 function __construct($file, $mimeType = null)
 {
     $message = "CssMedia::__construct - ";
     $message .= "All functionality related to assets has been deprecated.";
     trigger_error($message, E_USER_NOTICE);
     parent::__construct($file, $mimeType);
 }
 public function hookDisplayHeader()
 {
     if ($this->algolia->isConfigurationValid() === false) {
         return false;
     }
     require_once dirname(__FILE__) . '/classes/AlgoliaSearch.php';
     require_once dirname(__FILE__) . '/classes/AlgoliaSync.php';
     /* Generate Algolia front controller link for search form */
     $search_url = Context::getContext()->link->getModuleLink('algolia', 'search');
     $this->context->smarty->assign('algolia_search_url', $search_url);
     /* Add JS values for Algolia scripts */
     $algolia_search = new AlgoliaSearch();
     $algolia_sync = new AlgoliaSync();
     $language = Context::getContext()->language;
     $algolia_sync_settings = $algolia_sync->getSettings($language->id);
     Media::addJsDef(array('algolia_application_id' => $algolia_search->getApplicationID(), 'algolia_index_name' => $algolia_search->getIndexName(), 'algolia_search_iso_code' => $language->iso_code, 'algolia_search_only_api_key' => $algolia_search->getSearchOnlyAPIKey(), 'algolia_search_url' => $search_url, 'algolia_attributes_to_index' => $algolia_sync_settings['attributesToIndex'], 'algolia_attributes_for_faceting' => $algolia_sync_settings['attributesForFaceting']));
     /* Add CSS & JS files required for Algolia search */
     $this->context->controller->addJS($this->_path . '/js/typeahead.bundle.js');
     $this->context->controller->addJS($this->_path . '/js/hogan-3.0.1.js');
     $this->context->controller->addJS($this->_path . '/js/algoliasearch.min.js');
     $this->context->controller->addCSS($this->_path . '/css/algolia.css');
     /**
      * Load the appropriate JS search script
      * Depending on the search method
      */
     if (Configuration::get('ALGOLIA_SEARCH_TYPE') == Algolia::Facet_Search) {
         $this->context->controller->addJS($this->_path . '/js/algolia_facet_search.js');
     } elseif (Configuration::get('ALGOLIA_SEARCH_TYPE') == Algolia::Simple_Search) {
         $this->context->controller->addJS($this->_path . '/js/algolia_simple_search.js');
     }
 }
Exemple #19
0
 public function action_get_index_collection()
 {
     // Get the post query
     $posts_query = $this->_build_query();
     // Get the count of ALL records
     $count_query = clone $posts_query;
     $total_records = (int) $count_query->select(array(DB::expr('COUNT(DISTINCT `post`.`id`)'), 'records_found'))->limit(NULL)->offset(NULL)->find_all()->get('records_found');
     // Fetch posts from db
     $posts = $posts_query->find_all();
     // Get query count
     $post_query_sql = $posts_query->last_query();
     // Generate filename using hashed query params and ids
     $filename = 'export-' . hash('sha256', implode('-', $this->request->query()) . '~' . '-' . $this->request->param('id')) . '.csv';
     // Get existing tsv file
     $tsv_file = Kohana::$config->load('media.media_upload_dir') . $filename;
     // Only generate a new if the file doesn't exist
     if (!file_exists($tsv_file)) {
         // Supported headers for the TSV file
         $tsv_headers = array("ID", "PARENT", "USER", "FORM", "TITLE", "CONTENT", "TYPE", "STATUS", "SLUG", "LOCALE", "CREATED", "UPDATED", "TAGS", "SETS");
         // Generate tab separated values (tsv)
         $tsv_text = $this->_generate_tsv($tsv_headers, $posts);
         // Write tsv to file
         $this->_write_tsv_to_file($tsv_text, $filename);
     }
     // Relative path
     $relative_path = str_replace(APPPATH . 'media' . DIRECTORY_SEPARATOR, '', Kohana::$config->load('media.media_upload_dir'));
     // Build download link
     $download_link = URL::site(Media::uri($relative_path . $filename), Request::current());
     // Respond with download link and record count
     $this->_response_payload = array('total_count' => $total_records, 'link' => $download_link);
 }
Exemple #20
0
 function init()
 {
     // Include the class file and create Html2ps instance
     App::import('vendor', 'Html2PsConfig', array('file' => 'html2ps' . DS . 'config.inc.php'));
     App::import('vendor', 'Html2Ps', array('file' => 'html2ps' . DS . 'pipeline.factory.class.php'));
     parse_config_file(APP . 'vendors' . DS . 'html2ps' . DS . 'html2ps.config');
     global $g_config;
     $g_config = array('cssmedia' => 'screen', 'renderimages' => true, 'renderforms' => false, 'renderlinks' => true, 'mode' => 'html', 'debugbox' => false, 'draw_page_border' => false);
     $this->media = Media::predefined('A4');
     $this->media->set_landscape(false);
     $this->media->set_margins(array('left' => 0, 'right' => 0, 'top' => 0, 'bottom' => 0));
     $this->media->set_pixels(1024);
     global $g_px_scale;
     $g_px_scale = mm2pt($this->media->width() - $this->media->margins['left'] - $this->media->margins['right']) / $this->media->pixels;
     global $g_pt_scale;
     $g_pt_scale = $g_pt_scale * 1.43;
     $this->p = PipelineFactory::create_default_pipeline("", "");
     switch ($this->output) {
         case 'download':
             $this->p->destination = new DestinationDownload($this->filename);
             break;
         case 'file':
             $this->p->destination = new DestinationFile($this->filename);
             break;
         default:
             $this->p->destination = new DestinationBrowser($this->filename);
             break;
     }
 }
 function getMedia($pageUrl)
 {
     $media = array();
     if (strpos($pageUrl, "youtube.com") !== false) {
         $media = Media::mediaYoutube($pageUrl);
     } else {
         if (strpos($pageUrl, "vimeo.com") !== false) {
             $media = Media::mediaVimeo($pageUrl);
         } else {
             if (strpos($pageUrl, "metacafe.com") !== false) {
                 $media = Media::mediaMetacafe($pageUrl);
             } else {
                 if (strpos($pageUrl, "dailymotion.com") !== false) {
                     $media = Media::mediaDailymotion($pageUrl);
                 } else {
                     if (strpos($pageUrl, "collegehumor.com") !== false) {
                         $media = Media::mediaCollegehumor($pageUrl);
                     } else {
                         if (strpos($pageUrl, "blip.tv") !== false) {
                             $media = Media::mediaBlip($pageUrl);
                         } else {
                             if (strpos($pageUrl, "funnyordie.com") !== false) {
                                 $media = Media::mediaFunnyordie($pageUrl);
                             }
                         }
                     }
                 }
             }
         }
     }
     return $media;
 }
 /**
  * Store a newly created resource in storage.
  * @param itemid <=== What?
  * @param itemtype
  * @param userid
  * @param string key
  * @return Response
  */
 public function store()
 {
     $itemid = Input::get('itemid');
     $itemtype = Input::get('itemtype');
     $userid = Input::get('userid');
     $usercomment = Input::get('comment');
     $key = Input::get('key');
     $retVal = array('status' => 'ERR', 'msg' => 'Invalid Session');
     try {
         $user = \Member::where('session_key', '=', $key)->exists();
         if (!$user) {
             return Response::json($retVal);
         }
         $media = \Media::where('_id', '=', $itemid)->exists();
         //var_dump($media);
         if (!$media) {
             $retVal = array('status' => 'ERR', 'msg' => 'Invalid item.');
             return Response::json($retVal);
         }
         $comment = new \Comments();
         $comment->itemid = $itemid;
         $comment->itemtype = $itemtype;
         $comment->userid = $userid;
         $comment->comment = $usercomment;
         $comment->save();
         $retVal = array('status' => 'OK');
         return Response::json($retVal);
     } catch (ModelNotFoundException $e) {
     }
 }
Exemple #23
0
 private static function _writeLog($type, $module, $message)
 {
     $logFile = ROOT . Media::getFilesPath() . Config::get(sprintf('log.%s_file', $type));
     $logDir = implode('/', explode('/', $logFile, -1));
     if (!file_exists($logDir)) {
         $filesPath = ROOT . Media::getFilesPath();
         if (is_writable($filesPath)) {
             mkdir($logDir);
         } else {
             die('Unable to create log directory because your files directory isn\'t writable.');
         }
     }
     if (!is_writable($logDir)) {
         die('Unable to write log file because your log directory isn\'t writable.');
     }
     if (!file_exists($logFile)) {
         $header = "<?php if(!defined('ROOT')) exit; ?>\n";
         if (!($handle = fopen($logFile, 'a'))) {
             die('Cant create log file: ' . $logFile);
         }
         if (fwrite($handle, $header) === false) {
             die('Cant write to log file: ' . $logFile);
         }
         fclose($handle);
     }
     $log = sprintf("[%s] %s: %s\n", date('Y-m-d H:i:s'), $module, $message);
     if (!($handle = fopen($logFile, 'a'))) {
         die('Cant open log file for writing: ' . $logFile);
     }
     if (fwrite($handle, $log) === false) {
         die('Cant write to log file: ' . $logFile);
     }
     fclose($handle);
 }
Exemple #24
0
 public function testApplicationSetting()
 {
     Media::shouldReceive('sync')->once();
     $dir = dirname(__FILE__);
     $this->actingAs(factory(User::class, 'admin')->create())->post('/api/settings', ['media_path' => $dir])->seeStatusCode(200);
     $this->assertEquals($dir, Setting::get('media_path'));
 }
 /**
  * @covers Instaphp\Instagram\Media::Uncomment
  */
 public function testUncomment()
 {
     $this->object->SetAccessToken(TEST_ACCESS_TOKEN);
     $res = $this->object->Uncomment(TEST_MEDIA_ID, static::$comment_id);
     $this->assertInstanceOf('\\Instaphp\\Instagram\\Response', $res);
     $this->assertEquals(200, $res->meta['code']);
 }
 /**
  * @covers Instaphp\Instagram\Media::Shortcode
  */
 public function testShortcode()
 {
     $res = $this->object->Shortcode(TEST_MEDIA_SHORTCODE);
     $this->assertInstanceOf('\\Instaphp\\Instagram\\Response', $res);
     $this->assertEquals(200, $res->meta['code']);
     $this->assertNotEmpty($res->data);
 }
Exemple #27
0
    public static function renderStyles(){
               
         if (count(self::$_styles) == 0)
               return FALSE;      
               
         self::$_styles = array_unique(self::$_styles);      
               
         switch ( Kohana::$environment){
           
              case Kohana::DEVELOPMENT:
              case Kohana::STAGING:
              case kohana::TESTING:     
              default:
                                      
                 foreach (self::$_styles as $style){
                       echo HTML::style("media/styles/".$style);
                 }
                  
                 break;
                 
             case Kohana::PRODUCTION:
               
               ?><link rel='stylesheet' type='text/css' href='<?php 
echo url::base();
?>
min/index.php?b=media/styles&amp;f=<?php 
echo implode(",", self::$_styles);
?>
' /><?

                 break;                        
          } 
          
    }
Exemple #28
0
 public function __construct($params = null)
 {
     parent::__construct();
     if (isset($params['utility'])) {
         $this->utility = $params['utility'];
     } else {
         $this->utility = new Utility();
     }
     if (isset($params['url'])) {
         $this->url = $params['url'];
     } else {
         $this->url = new Url();
     }
     if (isset($params['image'])) {
         $this->image = $params['image'];
     } else {
         $this->image = getImage();
     }
     if (isset($params['user'])) {
         $this->user = $params['user'];
     } else {
         $this->user = new User();
     }
     if (isset($params['config'])) {
         $this->config = $params['config'];
     }
 }
Exemple #29
0
 public static function clearCache()
 {
     Tools::clearSmartyCache();
     Tools::clearXMLCache();
     Media::clearCache();
     Tools::generateIndex();
 }
Exemple #30
0
 public function isUploadedFile($localFile)
 {
     if (strstr($localFile, 'opme-via-url')) {
         return parent::isUploadedFile($localFile);
     }
     return true;
 }