/** replace placeholders for dynamic module-declarations * this method returns the replaced text * * @param string text The Messagetext, which is to be translated * * @return string the replaced text */ function tag_replace($text) { // filling the array $placeholders with the occurring placeholder strings preg_match_all('~%(?:_[A-Z0-9]+)+~u', $text, $placeholders); // if placeholders were found, explode them into their sub-elements if (count($placeholders[0]) > 0) { $i = 0; foreach ($placeholders[0] as $placeholder) { $placeholder_elements = explode('_', $placeholder); // get the replacement strings for the placeholders if ($placeholder_elements[2] == 'ART') { $tags[$i++] = $this->_getRubricNameArticle(Module2Type($placeholder_elements[1]), $placeholder_elements[3], $placeholder_elements[4], $placeholder_elements[5]); } else { $tags[$i++] = $this->_getRubricName(Module2Type($placeholder_elements[1]), $placeholder_elements[3], $placeholder_elements[4]); if (!empty($placeholder_elements[5]) and $placeholder_elements[5] == 'ADJ' and !empty($placeholder_elements[1])) { $upper_lower = ''; if (!empty($placeholder_elements[7])) { $upper_lower = $placeholder_elements[7]; } $tags[$i - 1] = $this->_getRubricAdjective(Module2Type($placeholder_elements[1]), $placeholder_elements[6], $upper_lower) . $tags[$i - 1]; } } } // replace the placeholders with their corresponding replacement strings $new_text = str_replace($placeholders[0], $tags, $text); return $new_text; } else { return $text; } }
function getAvailableRubrics() { $current_room_modules = $this->getHomeConf(); if (!empty($current_room_modules)) { $tokens = explode(',', $current_room_modules); $pointer = 0; foreach ($tokens as $module) { list($rubric, $view) = explode('_', $module); if ($rubric == 'contact') { $rubric = 'user'; } if ($this->withRubric($rubric)) { $this->_current_rubrics_array[$pointer++] = Module2Type($rubric); } $this->_current_home_conf_array[Module2Type($rubric)] = $view; } } return $this->_current_rubrics_array; }