_changeSectionName

Removes parents from the section name

section3 : section2 : section 1     ===> section3

If the section has parents then creates a new key in the array and unset the old

@param array     $array
@param string    $section
439737
private function _changeSectionName(&$array, $section)
    {
        $sectionName = explode(':', $section);

        if (sizeof($sectionName) > 1) {

            $newSectionName = trim($sectionName[0]);
            $array[$newSectionName] = $array[$section];
            unset($array[$section]);
        }
    }
245907
public function removeSection(\Coral\ContentBundle\Entity\Section $sections)
    {
        $this->sections->removeElement($sections);
    }
666484
public function section($section, $position = null)
    {
        if (is_string($section)) {
            $section = new FormSection($section);
        }

        return null !== $position ? $this->insert($section, $position) : $this->push($section);
    }
536241
private function storeSection($section, $content)
    {
        if (!isset($this->scope->sections[$section])) {
            $this->scope->sections[$section] = $content;
        }
    }
705897
public function clearCovers($section)
    {
        $q = Eresus_DB::getHandler()->createUpdateQuery();
        $q->update($this->getName())->
            set('cover', $q->bindValue(false, null, PDO::PARAM_BOOL))->
            where($q->expr->eq('section', $q->bindValue($section, null, PDO::PARAM_INT)));
        $q->execute();
    }
35721
public function markSections(array $sectionsData, $sectionNames = null, $updateIds = false)
    {
        if (!$sectionNames) {
            $sectionNames = array_keys($sectionsData);
        }
        $markId = $this->initMark($updateIds);

        foreach ($sectionNames as $name) {
            if ($updateIds || !array_key_exists(self::SECTION_KEY, $sectionsData[$name])) {
                $sectionsData[$name][self::SECTION_KEY] = $markId;
            }
            if(!isset($sectionsData[$name])){
                $sectionsData[$name] = [];
            }
        }
        return $sectionsData;
    }
928063
public void removeSection(final TimeSection SECTION) {
        if (null == SECTION) return;
        sections.remove(SECTION);
        Collections.sort(sections, new TimeSectionComparator());
        fireUpdateEvent(SECTION_EVENT);
    }
20507
public function addSection($key, $value = null)
    {
        if ($key instanceof Section) {
            $section = $key;
            $this->sections[$section->getKey()]
                = $section->getValue();
            return;
        }
        $this->sections[$key] = (string)$value;
    }
1141019
protected function processSection(array $section)
        {
            $config = array();

            foreach ($section as $key => $value) {
                $this->processKey($key, $value, $config);
            }

            return $config;
        }
597847
public function renameSection( $oldSection, $newSection )
	{
		if( !$this->usesSections() )
			throw new RuntimeException( 'Sections are disabled' );
		$content	= FS_File_Reader::load( $this->fileName );
		$content	= preg_replace( "/(.*)(\[".$oldSection."\])(.*)/si", "$1[".$newSection."]$3", $content );
		$result		= FS_File_Writer::save( $this->fileName, $content );
		$this->added	= array();
		$this->deleted	= array();
		$this->renamed	= array();
		$this->read();
		return is_int( $result );
	}
219552
public function startSection($section, $content = null)
    {
        if ($content === null) {
            if (ob_start()) {
                $this->sectionStack[] = $section;
            }
        } else {
            $this->extendSection($section, e($content));
        }
    }
185783
public function delete_all($section)
	{
		// determine the section index name
		$section = empty($section) ? '' : '.'.$section;

		// get the directory index
		$index = static::$redis->get($this->config['cache_id'].':dir:');
		is_null($index) or $index = $this->_unserialize($index);

		if (is_array($index))
		{
			if (!empty($section))
			{
				// limit the delete if we have a valid section
				$dirs = array();
				foreach ($index as $entry)
				{
					if ($entry == $section or strpos($entry, $section.'.') === 0)
					{
						$dirs[] = $entry;
					}
				}
			}
			else
			{
				// else delete the entire contents of the cache
				$dirs = $index;
			}

			// loop through the selected indexes
			foreach ($dirs as $dir)
			{
				// get the stored cache entries for this index
				$list = static::$redis->get($this->config['cache_id'].':index:'.$dir);
				if (is_null($list))
				{
					$list = array();
				}
				else
				{
					$list = $this->_unserialize($list);
				}

				// delete all stored keys
				foreach($list as $item)
				{
					static::$redis->del($item[0]);
				}

				// and delete the index itself
				static::$redis->del($this->config['cache_id'].':index:'.$dir);
			}

			// update the directory index
			static::$redis->set($this->config['cache_id'].':dir:', $this->_serialize(array_diff($index, $dirs)));
		}
	}
206121
protected static function removeSegments(array &$array, $key)
    {
        $parts = self::explodeDotNotationKeys($key);

        while (count($parts) > 1) {
            $part = array_shift($parts);
            if (isset($array[$part]) && is_array($array[$part])) {
                $array =& $array[$part];
            }
        }
        unset($array[array_shift($parts)]);
    }
1051906
public static function delete(&$array, $key)
	{
		if (is_null($key))
		{
			return false;
		}

		if (is_array($key))
		{
			$return = array();
			foreach ($key as $k)
			{
				$return[$k] = static::delete($array, $k);
			}
			return $return;
		}

		$key_parts = explode('.', $key);

		if (! is_array($array) or ! array_key_exists($key_parts[0], $array))
		{
			return false;
		}

		$this_key = array_shift($key_parts);

		if (! empty($key_parts))
		{
			$key = implode('.', $key_parts);
			return static::delete($array[$this_key], $key);
		}
		else
		{
			unset($array[$this_key]);
		}

		return true;
	}
364538
public function removeSection($section)
    {
        if ($has = $this->hasSection($section)) {
            unset($this->sections[$section]);
        }

        return $has;
    }
476024
private function build_section_tree($sections) {
    $level_tree = array();

    foreach ($sections as $level => $section) {
      // array_filter removes the last, empty value
      // from the level array that is created by the explode function
      $level_depth_arr = array_filter(explode('.', $level));

      $level_depth = count($level_depth_arr);

      // Get the parent level
      array_pop($level_depth_arr);
      $level_parent = $level_depth > 1 ? implode('.', $level_depth_arr) . '.' : $level;

      // Add the current section to the level tree
      $level_tree[$level_depth][$level_parent][$level] = $section;
    }

    // Run over all main sections in $level_tree[1]
    foreach ($level_tree[1] as $section_level => $section) {
      // Add corresponding sub levels to the main level
      $section[$section_level]['sub'] = $this->build_section_sub_tree($level_tree, 2, $section_level);

      $this->sections += $section;
    }
  }
1363156
public function setProperty( $section, $key, $value )
	{
		if( !$this->hasSection( $section ) )
			$this->addSection( $section );
		$this->data[$section][$key]	= $value;
		return is_int( $this->write() );
	}