Esempio n. 1
0
 public static function onMakeGlobalVariablesScript(&$vars)
 {
     if (F::app()->wg->title->isSpecial('EditHub')) {
         $editHubModel = new EditHubModel();
         $vars['wgEditHubConstants'] = $editHubModel->getAvailableStatuses();
         $vars['wgEditHubThumbnailSize'] = $editHubModel->getThumbnailSize();
         $vars['wgEditHubUrlRegex'] = trim(WikiaValidatorRestrictiveUrl::URL_RESTRICTIVE_REGEX, 'i/');
         $vars['wgEditHubUrl'] = SpecialPage::getTitleFor('EditHub', 'editHub')->getFullURL();
     }
     return true;
 }
 public function renderEditor($data)
 {
     $model = new EditHubModel();
     $fileNameField = $data['form']->getField('fileName');
     if (!empty($fileNameField['value'])) {
         $imageModel = new WikiaHubsImageModel($fileNameField['value']);
         $data['file'] = $imageModel->getImageThumbData($model->getThumbnailSize());
     }
     $sponsoredImageField = $data['form']->getField('sponsoredImage');
     if (!empty($sponsoredImageField['value'])) {
         $imageModel = new WikiaHubsImageModel($sponsoredImageField['value']);
         $data['sponsoredImage'] = $imageModel->getImageThumbData();
     }
     return parent::renderEditor($data);
 }
 public function renderEditor($data)
 {
     $model = new EditHubModel();
     $videoField = $data['form']->getField('video');
     $videoUrlField = $data['form']->getField('videoUrl');
     if (!empty($videoField['value'])) {
         foreach ($videoField['value'] as $i => $video) {
             $data['videos'][$i] = $model->getVideoData($video, $model->getThumbnailSize());
             $data['videos'][$i]['title'] = $video;
             //we enabled curators to edit a video url so if they've changed it we change it here
             $data['videos'][$i]['fullUrl'] = !empty($videoUrlField['value'][$i]) ? $videoUrlField['value'][$i] : $data['videos'][$i]['fileUrl'];
             //numbers next to section starts with 2
             $data['videos'][$i]['section-no'] = $i + 2;
         }
     }
     return parent::renderEditor($data);
 }
 public function uploadAndGetVideo()
 {
     if (!$this->checkAccess()) {
         return false;
     }
     $url = $this->getVal('url');
     $response = $this->sendRequest('VideosController', 'addVideo', array('url' => $url));
     $error = $response->getVal('error');
     if ($error) {
         $this->error = $error;
         return;
     }
     $videoInfo = $response->getVal('videoInfo');
     $fileName = $videoInfo[0]->getText();
     $this->videoData = $this->editHubModel->getVideoData($fileName, $this->editHubModel->getThumbnailSize());
     $this->videoFileName = $fileName;
     $this->videoUrl = $url;
 }
 public function renderEditor($data)
 {
     $sliderModel = new WikiaHubsSliderModel();
     $data['slidesCount'] = $sliderModel->getSlidesCount();
     $data['photos'] = array();
     $model = new EditHubModel();
     $imageSize = $model->getThumbnailSize();
     for ($i = 1; $i <= $data['slidesCount']; $i++) {
         $photo = $data['form']->getField('photo' . $i);
         if (!empty($photo['value'])) {
             $imageData = $this->getImageInfo($photo['value'], $imageSize);
             $data['photos'][$i]['url'] = $imageData->url;
             $data['photos'][$i]['imageWidth'] = $imageData->width;
             $data['photos'][$i]['imageHeight'] = $imageData->height;
         }
     }
     return parent::renderEditor($data);
 }
 public function renderEditor($data)
 {
     $data['sectionLimit'] = $this->sectionsLimit;
     $fileNameField = $data['form']->getField('fileName');
     if (!empty($fileNameField['value'])) {
         $model = new EditHubModel();
         $imageData = $this->getImageInfo($fileNameField['value'], $model->getThumbnailSize());
         $data['fileUrl'] = $imageData->url;
         $data['imageWidth'] = $imageData->width;
         $data['imageHeight'] = $imageData->height;
     }
     return parent::renderEditor($data);
 }