protected final function get_api($url, $authenticated = false) { if ($authenticated) { $url .= '/token:' . $this->request_read_token(); } return Koken::api($url); }
if (isset($routed_variables['content_id'])) { $routed_variables['id'] = $routed_variables['content_id']; unset($routed_variables['content_id']); } else { $routed_variables['slug'] = $routed_variables['content_slug']; unset($routed_variables['content_slug']); } if ($final_path !== 'lightbox') { $final_path = 'content'; } $page['source'] = 'content'; $page['filters'] = array(); } else { if ($final_path === 'lightbox' && isset($info['source']) && $info['source'] === 'album') { $id = isset($routed_variables['id']) ? $routed_variables['id'] : 'slug:' . $routed_variables['slug']; $album = Koken::api('/albums/' . $id . '/content'); $url = $album['content'][0]['url'] . '/lightbox'; header("Location: {$url}"); exit; } } if (isset($matches['template'])) { foreach (Koken::$site['url_data'] as $key => $data) { if (isset($data['plural']) && $matches['template'] === strtolower($data['plural'])) { $type = $key . 's'; $final_path .= '.' . $type; $page['filters'] = array("members={$type}"); break; } } }
/** * Extracts images from text * * @param $text * @return array|bool|mixed|string */ protected function extractImagesFormText($text) { $images = FALSE; preg_match('/filter:id="([^"]*)"/', $text, $matches); if ($matches[1]) { list($apiUrl) = koken::load(array('source' => 'contents', 'filter:id' => $matches[1])); $images = Koken::api($apiUrl); if ($images['content']) { $images = $images['content']; } else { $images = array($images); } } return $images; }