Пример #1
0
 /**
  * Extension-aware version of the template drawing function
  *
  * @param string $templateName
  * @param bool $returnBlank Should we return a blank string if the template doesn't exist? (Defaults to true)
  * @param book $replacements Should we honor template replacements? (Defaults to true)
  * @return \Bonita\false|string
  */
 function draw($templateName, $returnBlank = true, $replacements = true)
 {
     $result = '';
     if (!empty($this->prepends[$templateName])) {
         foreach ($this->prepends[$templateName] as $template) {
             $result .= parent::draw($template, $returnBlank);
         }
     }
     if (!empty($this->replacements[$templateName]) && $replacements == true) {
         $result .= parent::draw($this->replacements[$templateName], $returnBlank);
     } else {
         $result .= parent::draw($templateName, $returnBlank);
     }
     if (!empty($this->extensions[$templateName])) {
         foreach ($this->extensions[$templateName] as $template) {
             $result .= parent::draw($template, $returnBlank);
         }
     }
     if (!empty($this->rendered_extensions[$templateName])) {
         $result .= $this->rendered_extensions[$templateName];
     }
     if (!empty($result)) {
         return $result;
     }
     if ($returnBlank) {
         return '';
     }
     return false;
 }
Пример #2
0
 /**
  * Extension-aware version of the template drawing function
  *
  * @param string $templateName
  * @param bool $returnBlank
  * @return \Bonita\false|string
  */
 function draw($templateName, $returnBlank = true)
 {
     $result = parent::draw($templateName, $returnBlank);
     if (!empty($this->extensions[$templateName])) {
         foreach ($this->extensions[$templateName] as $template) {
             $result .= parent::draw($template, $returnBlank);
         }
     }
     return $result;
 }
Пример #3
0
 /**
  * Extension-aware version of the template drawing function
  *
  * @param string $templateName
  * @param bool $returnBlank Should we return a blank string if the template doesn't exist? (Defaults to true)
  * @param book $replacements Should we honor template replacements? (Defaults to true)
  * @return \Bonita\false|string
  */
 function draw($templateName, $returnBlank = true, $replacements = true)
 {
     $result = '';
     if (!empty($this->prepends[$templateName])) {
         foreach ($this->prepends[$templateName] as $template) {
             $result .= parent::draw($template, $returnBlank);
         }
     }
     $replaced = false;
     foreach (['*', $this->getTemplateType()] as $templateType) {
         if (!empty($this->replacements[$templateName][$templateType]) && $replacements == true) {
             $result .= parent::draw($this->replacements[$templateName][$templateType], $returnBlank);
             $replaced = true;
         }
         if (!empty($this->extensions[$templateName][$templateType])) {
             foreach ($this->extensions[$templateName][$templateType] as $template) {
                 $result .= parent::draw($template, $returnBlank);
             }
         }
     }
     if (!$replaced) {
         $result .= parent::draw($templateName, $returnBlank);
     }
     if (!empty($this->rendered_extensions[$templateName])) {
         $result .= $this->rendered_extensions[$templateName];
     }
     if ($templateName == 'shell' && !empty(Idno::site()->config()->filter_shell)) {
         if (is_array(Idno::site()->config()->filter_shell)) {
             foreach (Idno::site()->config()->filter_shell as $search => $replace) {
                 $result = str_replace($search, $replace, $result);
             }
         }
     }
     if (!empty($result)) {
         return $result;
     }
     if ($returnBlank) {
         return '';
     }
     return false;
 }