Exemplo n.º 1
0
 function replace_tag($data, $params = array(), $tagdata = FALSE)
 {
     $this->EE->load->helper('custom_field');
     $data = decode_multi_field($data);
     if ($tagdata) {
         return $this->_parse_multi($data, $params, $tagdata);
     } else {
         return $this->_parse_single($data, $params);
     }
 }
Exemplo n.º 2
0
 public function grid_replace_tag($data, $params = array(), $tagdata = FALSE)
 {
     ee()->load->helper('custom_field_helper');
     $date = decode_multi_field($data);
     if (!isset($date[0])) {
         return '';
     }
     if (isset($params['format'])) {
         $localize = TRUE;
         if ($this->settings['localize'] !== TRUE && isset($date[1])) {
             $localize = $date[1];
         }
         return ee()->TMPL->process_date($date[0], $params, FALSE, $localize);
     }
     return $date[0];
 }
 /**
  * Parse a single tag
  * 
  * @access private
  * @param $entries array The entry ids
  * @param $params array the tag params
  * @return string The entry ids concatenated with glue
  */
 private function _parseSingle($entries, $params)
 {
     $ret = array();
     foreach ($entries as $entry_id => $entry) {
         if (self::_isTrue($params["multi_field"])) {
             $entry[$params["value"]] = implode($params["multi_field_glue"], decode_multi_field($entry[$params["value"]]));
         }
         $ret[] = $entry[$params["value"]];
     }
     return implode($params["glue"], $ret);
 }
 /**
  * Parse a single tag
  * 
  * @access private
  * @param $members array The entry ids
  * @param $params array the tag params
  * @return string The entry ids concatenated with glue
  */
 private function _parseSingle($members, $params)
 {
     if (empty($members)) {
         return false;
     }
     $values = array();
     foreach ($members as $member_id => $member_data) {
         // It's possible that the member data we're trying to get is a pipe delimited array
         // In that case we need to split the value and glue it back together
         if ($this->_isTrue($params["multi_field"])) {
             // decode the multi field into an array
             $multi_field_values = decode_multi_field($member_data[$params["value"]]);
             // glue it back together
             $member_data[$params["value"]] = $this->_glueValues($multi_field_values, $params["multi_field_glue"], $params["multi_field_glue_last"]);
         }
         // Build up the values we want to glue together
         $values[] = $member_data[$params["value"]];
     }
     return $this->_glueValues($values, $params["glue"], $params["glue_last"]);
 }