private function restoreFromRememberMeCookie()
 {
     if (!$this->cookiesWrapper->isValueSet(self::KEY_REMEMBER_ME)) {
         return null;
     }
     return $this->rememberMeGenerator->decode($this->cookiesWrapper->getValue(self::KEY_REMEMBER_ME));
 }
 function showJsonTimeline($notice, $original)
 {
     $this->initDocument('json');
     $statuses = array();
     $originals = array();
     if (is_array($original)) {
         $original = new ArrayWrapper($original);
     }
     while ($original->fetch()) {
         try {
             $twitter_status = $this->twitterStatusArray($original);
             $originals[$twitter_status['id']] = $twitter_status;
             //array_push($originals, $twitter_status);
         } catch (Exception $e) {
             common_log(LOG_ERR, $e->getMessage());
             continue;
         }
     }
     if (is_array($notice)) {
         $notice = new ArrayWrapper($notice);
     }
     while ($notice->fetch()) {
         try {
             $twitter_status = $this->twitterStatusArray($notice);
             $twitter_status['in_reply_to_status'] = $originals[$twitter_status['in_reply_to_status_id']];
             array_push($statuses, $twitter_status);
         } catch (Exception $e) {
             common_log(LOG_ERR, $e->getMessage());
             continue;
         }
     }
     $this->showJsonObjects($statuses);
     $this->endDocument('json');
 }
Ejemplo n.º 3
0
 public function extractValueFromArray(ArrayWrapper $arrayWrapper, &$valueChanged)
 {
     if ($arrayWrapper->IsValueSet($this->GetName())) {
         $valueChanged = true;
         return $arrayWrapper->GetValue($this->GetName());
     } else {
         $valueChanged = false;
         return null;
     }
 }
Ejemplo n.º 4
0
 public function extractValueFromArray(ArrayWrapper $arrayWrapper, &$valueChanged)
 {
     if ($this->GetReadOnly()) {
         $valueChanged = false;
         return null;
     } else {
         $valueChanged = true;
         return $arrayWrapper->isValueSet($this->GetName()) ? '1' : '0';
     }
 }
Ejemplo n.º 5
0
 /**
  * @{inheritdoc}
  */
 public function extractValueFromArray(ArrayWrapper $arrayWrapper, &$valueChanged)
 {
     $valueChanged = true;
     if ($arrayWrapper->isValueSet($this->GetName())) {
         $valuesArray = $arrayWrapper->GetValue($this->GetName());
         $result = '';
         foreach ($valuesArray as $value) {
             AddStr($result, $value, ',');
         }
         return $result;
     } else {
         return '';
     }
 }
Ejemplo n.º 6
0
 public function extractValueFromArray(ArrayWrapper $arrayWrapper, &$valueChanged)
 {
     if ($arrayWrapper->IsValueSet($this->GetName())) {
         $valueChanged = true;
         $value = $arrayWrapper->GetValue($this->GetName());
         if (!$this->allowHtmlCharacters) {
             $value = htmlspecialchars($value, ENT_QUOTES);
         }
         return $value;
     } else {
         $valueChanged = false;
         return null;
     }
 }
Ejemplo n.º 7
0
 public function extractValueFromArray(ArrayWrapper $arrayWrapper, &$valueChanged)
 {
     if ($arrayWrapper->IsValueSet($this->GetName())) {
         $valueChanged = true;
         $value = $arrayWrapper->GetValue($this->GetName());
         if ($value == '') {
             return null;
         } else {
             return $value;
         }
         // return SMDateTime::Parse($value, $this->format);
     } else {
         $valueChanged = false;
         return null;
     }
 }
 /**
  * {@inheritDoc}
  * @see \Owebia\AdvancedSettingCore\Model\Wrapper\AbstractWrapper::loadData()
  */
 protected function loadData($key)
 {
     switch ($key) {
         case 'memory_limit':
             return ini_get('memory_limit');
         case 'memory_usage':
             return memory_get_usage(true);
     }
     return parent::loadData($key);
 }
Ejemplo n.º 9
0
 function showJsonTimeline($notice)
 {
     $this->initDocument('json');
     $statuses = array();
     if (is_array($notice)) {
         $notice = new ArrayWrapper($notice);
     }
     while ($notice->fetch()) {
         try {
             $twitter_status = $this->twitterStatusArray($notice);
             array_push($statuses, $twitter_status);
         } catch (Exception $e) {
             common_log(LOG_ERR, $e->getMessage());
             continue;
         }
     }
     $this->showJsonObjects($statuses);
     $this->endDocument('json');
 }
 /**
  * @param Renderer $renderer
  * @return void
  */
 public function Render(Renderer $renderer)
 {
     $params = ArrayWrapper::createGetWrapper();
     $term = $params->isValueSet('term') ? $params->getValue('term') : '';
     if ($params->isValueSet('term')) {
         $this->dataset->AddFieldFilter($this->valueField, new FieldFilter('%' . $term . '%', 'ILIKE', true));
     }
     if ($params->isValueSet('id')) {
         $this->dataset->AddFieldFilter($this->idField, FieldFilter::Equals($params->getValue('id')));
     }
     if ($this->itemCount > 0) {
         $this->dataset->SetUpLimit(0);
         $this->dataset->SetLimit($this->itemCount);
     }
     $this->dataset->Open();
     $result = array();
     $highLightCallback = Delegate::CreateFromMethod($this, 'ApplyHighlight')->Bind(array(Argument::$Arg3 => $this->valueField, Argument::$Arg4 => $term));
     while ($this->dataset->Next()) {
         $result[] = array("id" => $this->dataset->GetFieldValueByName($this->idField), "label" => $highLightCallback->Call($this->dataset->GetFieldValueByName($this->valueField), $this->valueField), "value" => $this->dataset->GetFieldValueByName($this->valueField));
     }
     echo SystemUtils::ToJSON($result);
     $this->dataset->Close();
 }
Ejemplo n.º 11
0
 public function AfterSetAllDatasetValues()
 {
     $valueChanged = true;
     $postWrapper = ArrayWrapper::createPostWrapper();
     $filesWrapper = ArrayWrapper::createFilesWrapper();
     $value = $this->GetEditControl()->extractFilePathFromArray($postWrapper, $filesWrapper, $valueChanged);
     if ($valueChanged && $value === null) {
         $this->clearImageAndThumbnail();
         return;
     }
     $original_file_extension = $this->GetEditControl()->extractFileTypeFromArray($postWrapper, $filesWrapper);
     $original_file_name = $this->GetEditControl()->extractFileNameFromArray($postWrapper, $filesWrapper);
     $file_size = $this->GetEditControl()->extractFileSizeFromArray($postWrapper, $filesWrapper);
     $target = $this->GetNewFileName($original_file_name, $original_file_extension, $file_size);
     if ($valueChanged && isset($target) && !empty($target)) {
         FileUtils::MoveUploadedFile($value, $target, $this->replaceUploadedFileIfExist);
         if ($this->GetSetToNullFromPost()) {
             $this->clearImageAndThumbnail();
         } elseif ($this->GetSetToDefaultFromPost()) {
             $this->GetDataset()->SetFieldValueByName($this->GetFieldName(), null, true);
             if ($this->useThumbnailGeneration) {
                 $this->GetDataset()->SetFieldValueByName($this->fieldNameToSaveThumbnailPath, null);
             }
         } else {
             $this->GetDataset()->SetFieldValueByName($this->GetFieldName(), $target);
             if ($this->useThumbnailGeneration) {
                 $image = file_get_contents($target);
                 $thumbnailFileName = $this->GetThumbnailFileName($original_file_name, $original_file_extension, $file_size);
                 $this->thumbnailImageFilter->ApplyFilter($image, $thumbnailFileName);
                 $this->GetDataset()->SetFieldValueByName($this->fieldNameToSaveThumbnailPath, $thumbnailFileName);
             }
         }
     }
 }
 public function extractValueFromArray(ArrayWrapper $arrayWrapper, &$changed)
 {
     $editorName = $this->GetEditorName($this->GetLevelCount() - 1);
     if ($arrayWrapper->isValueSet($editorName)) {
         $changed = true;
         $value = $arrayWrapper->getValue($editorName);
         return $value;
     } else {
         $changed = false;
         return null;
     }
 }
Ejemplo n.º 13
0
 public function extractFileSizeFromArray(ArrayWrapper $postWrapper, ArrayWrapper $filesWrapper)
 {
     $action = $this->extractImageActionFromArray($postWrapper);
     if ($action !== REPLACE_IMAGE_ACTION) {
         return;
     }
     $fileInfo = $filesWrapper->getValue($this->GetName() . "_filename");
     return $fileInfo['size'];
 }
Ejemplo n.º 14
0
 public static function createFromReference(&$arrayToWrap, $prefix = null)
 {
     $wrapper = new ArrayWrapper(array(), $prefix);
     $wrapper->setArrayByReference($arrayToWrap);
     return $wrapper;
 }
Ejemplo n.º 15
0
 public function ExtractSearchValuesFromPost()
 {
     $valueChanged = true;
     $this->applyNotOperator = GetApplication()->GetSuperGlobals()->IsPostValueSet($this->GetNotMarkInputName());
     $this->filterIndex = GetApplication()->GetSuperGlobals()->GetPostValueDef($this->GetFilterTypeInputName(), '');
     $this->firstValue = $this->GetEditorControl()->extractValueFromArray(ArrayWrapper::createPostWrapper(), $valueChanged);
     $this->secondValue = $this->GetSecondEditorControl()->extractValueFromArray(ArrayWrapper::createPostWrapper(), $valueChanged);
     $this->SaveSearchValuesToSession();
     $this->SetEditorControlValue($this->firstValue);
     $this->SetSecondEditorControlValue($this->secondValue);
 }