protected function replace_widgets($str) { return preg_replace_callback(WIDGETS_REPLACE_PATTERN, function ($matches) { $params = explode('/', $matches[2]); if ($params[0] != 'widget') { return ''; } $action = 'action_' . strip_tags($params[1]); $c = new C_Widget($params); $content = $c->Go($action, 'C_Widget'); unset($controller); return $content; }, $str); }