Пример #1
0
	/**
	 * Parse Step Tag
	 */
	private function _parse_sibling_tag($match)
	{
		if ($match[1] == 'prev_row')
		{
			// ignore if this is the first row
			if ($this->_field_row_index == 0) return;

			$row_id = $this->_field_row_ids[$this->_field_row_index-1];
		}
		else
		{
			// ignore if this is the last row
			if ($this->_field_row_index == $this->_field_total_rows - 1) return;

			$row_id = $this->_field_row_ids[$this->_field_row_index+1];
		}

		$obj = new Matrix_ft();
		$obj->settings = $this->settings;
		$obj->row = $this->row;
		$obj->field_id = $this->field_id;
		$obj->field_name = $this->field_name;
		return $obj->replace_tag('', array('row_id' => $row_id), $match[2]);
	}
Пример #2
0
 /**
  * Parse Tag Pair
  */
 private function _parse_tag_pair($m)
 {
     // prevent {exp:channel:entries} from double-parsing this tag
     unset($this->EE->TMPL->var_pair[$m[1]]);
     //$params_str = isset($m[2]) ? $m[2] : '';
     $tagdata = isset($m[3]) ? $m[3] : '';
     // get the params
     $params = array();
     if (isset($m[2]) && $m[2] && preg_match_all('/\\s+([\\w-:]+)\\s*=\\s*([\'\\"])([^\\2]*)\\2/sU', $m[2], $param_matches)) {
         for ($i = 0; $i < count($param_matches[0]); $i++) {
             $params[$param_matches[1][$i]] = $param_matches[3][$i];
         }
     }
     // get the tagdata
     $tagdata = isset($m[3]) ? $m[3] : '';
     // -------------------------------------------
     //	Call the tag's method
     // -------------------------------------------
     if (!class_exists('Matrix_ft')) {
         require_once PATH_THIRD . 'matrix/ft.matrix' . EXT;
     }
     $Matrix_ft = new Matrix_ft();
     $Matrix_ft->row = $this->row;
     $Matrix_ft->field_id = $this->field['field_id'];
     $Matrix_ft->field_name = $this->field['field_name'];
     $Matrix_ft->entry_id = $this->row['entry_id'];
     $Matrix_ft->settings = array_merge($this->row, $this->field['field_settings']);
     return (string) $Matrix_ft->replace_tag(NULL, $params, $tagdata);
 }