Ejemplo n.º 1
0
 private function _normalizeIncomingShortcodeOptionMap(array $optionMap)
 {
     if (!isset($this->_optionMapCache)) {
         $this->_optionMapCache = array();
         $allKnownOptionNames = $this->_optionsReference->getAllOptionNames();
         foreach ($allKnownOptionNames as $camelCaseOptionName) {
             $asLowerCase = strtolower($camelCaseOptionName);
             $this->_optionMapCache[$asLowerCase] = $camelCaseOptionName;
         }
     }
     $toReturn = array();
     foreach ($optionMap as $lowerCaseCandidate => $value) {
         if (isset($this->_optionMapCache[$lowerCaseCandidate])) {
             $camelCaseOptionName = $this->_optionMapCache[$lowerCaseCandidate];
             $toReturn[$camelCaseOptionName] = $value;
         }
     }
     return $toReturn;
 }
Ejemplo n.º 2
0
 private function _addAnyMissingOptions(array $optionsInThisStorageManager)
 {
     if ($this->_flagCheckedForMissingOptions) {
         return;
     }
     $optionNamesFromProvider = $this->_optionsReference->getAllOptionNames();
     $toPersist = array();
     $missingOptions = array_diff($optionNamesFromProvider, array_keys($optionsInThisStorageManager));
     /*
      * @var string
      */
     foreach ($missingOptions as $optionName) {
         if ($this->_optionsReference->isMeantToBePersisted($optionName)) {
             $toPersist[$optionName] = $this->_optionsReference->getDefaultValue($optionName);
         }
     }
     if (!empty($toPersist)) {
         $this->_backend->createEach($toPersist);
         $this->_forceReloadOfOptionsCache();
     }
     $this->_flagCheckedForMissingOptions = true;
 }