public function getTutorial($name) { $route = str_replace('.', '/', $name); $lang = \Raptor\Raptor::getInstance()->getLanguage()->getUserCurrentLanguage(); if (isset($this->tags[$name])) { $tutorial = new \Raptor\Util\ItemList($this->tags[$name]); if (!file_exists($this->tags[$name]['bundle'] . "/Tutorials/{$lang}")) { $default = $this->getDefault(); $default['found'] = FALSE; return $default; } if (file_exists($this->tags[$name]['bundle'] . "/Tutorials/{$lang}/docs/{$route}.html")) { $tutorial->set('text', file_get_contents($this->tags[$name]['bundle'] . "/Tutorials/{$lang}/docs/{$route}.html")); $tutorial->set('bundle', ''); } if ($this->tags[$name]['author'] == NULL) { $tutorial->set('author', array('img' => 'Raptor/img/logo.png')); } else { $author = str_replace('.', '/', $this->tags[$name]['author']); $obj = json_decode(file_get_contents($this->tags[$name]['bundle'] . "/Tutorials/{$lang}/authors/{$author}.json")); $result = array(); if ($obj->img == '') { $obj->img = 'Raptor/img/accountblue.png'; } foreach ($obj as $key => $value) { $result[$key] = $value; } $tutorial->set('author', $result); } if ($tutorial->get('next') == NULL) { $tutorial->set('next', $this->getConditionalTutorial($name)); } if ($tutorial->has('pointer')) { $pointerOrig = $tutorial->get('pointer'); $pointer = array(); if (preg_match('/^arrow:((up)|(down)|(left)|(right)) /', $pointerOrig)) { if (count(explode('arrow:up', $pointerOrig)) > 1) { $pointer['arrow'] = 'up'; $pointer['selector'] = str_replace('arrow:up', '', $pointerOrig); } if (count(explode('arrow:down', $pointerOrig)) > 1) { $pointer['arrow'] = 'down'; $pointer['selector'] = str_replace('arrow:down', '', $pointerOrig); } if (count(explode('arrow:left', $pointerOrig)) > 1) { $pointer['arrow'] = 'left'; $pointer['selector'] = str_replace('arrow:left', '', $pointerOrig); } if (count(explode('arrow:right', $pointerOrig)) > 1) { $pointer['arrow'] = 'right'; $pointer['selector'] = str_replace('arrow:right', '', $pointerOrig); } } else { $pointer = array('selector' => $pointerOrig, 'arrow' => 'up'); } $tutorial->set('pointer', $pointer); } return $tutorial; } $default = $this->getDefault(); $default['next'] = $this->getConditionalTutorial($name); return new \Raptor\Util\ItemList($default); }