예제 #1
0
파일: block.php 프로젝트: 4otaku/draw
	public function postprocess () {
		$this->data['settings'] = $this->flag;
		
		if (!empty($this->data['latest'])) {
			$latest = & $this->data['latest'];
			$latest = (array) $latest;
			
			foreach ($latest as & $item) {
				if (is_array($item) && !empty($item['text'])) {
					$item['headline'] = Transform_Text::headline($item['text']);
					unset($item['text']);
				}
			}
		}
		
		parent::postprocess();
	} 
예제 #2
0
파일: comment.php 프로젝트: 4otaku/draw
	public function postprocess () {

		switch ($this->flag) {
			case 'quotation':
			
				if (
					empty($this->data['quotation']) &&
					!empty($this->data['parent']) && 
					!empty($this->parent->data['items'][$this->data['parent']])
				) {
					$this->data['quotation'] = $this->parent->data['items'][$this->data['parent']];
				}
				break;
			case 'ladder':

				if (!empty($this->parent)) {

					$keys = array_keys($this->parent->data['items']);
					$local_index = array_search($this->data['id'], $keys) + 1;
					
					$this->data['index'] = $this->parent->data['index'].'.'.$local_index;
				}
			
				if (!empty($this->data['items'])) {
					if (empty($this->parent)) {
						$tree_length = 0;
						
						foreach ($this->data['items'] as $child) {
							$tree_length = max($tree_length, count($child['tree']));
						}
						
						$config = Globals::user('comments', 'single_item');
						
						if ($tree_length * $config['max_single_margin'] < $config['max_margin']) {
							$this->data['margin'] = $config['max_single_margin'];
						} else {
							$this->data['margin'] = round($config['max_margin'] / $tree_length);
						}
					}
					
					$indirect_children = array();
					
					foreach ($this->data['items'] as $id => $child) {
						if ($this->data['id'] != $child->last_of('tree')) {
							$indirect_children[$id] = $child;
							unset($this->data['items'][$id]);
						}
					}
					
					foreach ($this->data['items'] as $id => $child) {
						foreach ($indirect_children as $indirect_id => $indirect_child) {
							if (in_array($id, $indirect_child['tree'])) {
								$this->data['items'][$id]->add_to('items', $indirect_child, $indirect_id);
							}
						}
					}
				}
				break;
			default: 
				break;
		}
		
		parent::postprocess();
		
		if (!empty($this->parent) && !empty($this->parent->data['place'])) {
			$this->data['place'] = $this->parent->data['place'];
			$this->data['link'] = $this->parent['link'];
		}
	}