Pods::do_magic_tags PHP Method

do_magic_tags() public method

Replace magic tags with their values
Since: 2.0
public do_magic_tags ( string $code ) : string
$code string The content to evaluate
return string Code with Magic Tags evaluated
    public function do_magic_tags($code)
    {
        return preg_replace_callback('/({@(.*?)})/m', array($this, 'process_magic_tags'), $code);
    }

Usage Example

 /**
  * @param $code
  * @param bool|array $row
  *
  * @return mixed
  */
 public function do_template($code, $row = false)
 {
     if (is_object($this->pod) && 1 == 0 && 0 < $this->pod->id()) {
         return $this->pod->do_magic_tags($code);
     } else {
         if (false !== $row) {
             $this->temp_row = $this->row;
             $this->row = $row;
         }
         $code = preg_replace_callback("/({@(.*?)})/m", array($this, "do_magic_tags"), $code);
         if (false !== $row) {
             $this->row = $this->temp_row;
             unset($this->temp_row);
         }
     }
     return $code;
 }