private static function _GetPluginsFor($for) { $locs = new Model_PlugLoc(); $locs->where('skin = ?', Typeframe_Skin::Current()); $locs->where('socket = ?', $for); $locs->where('plugin.siteid = ?', Typeframe::CurrentPage()->siteid()); $locs->order('sortnum'); $result = array(); foreach ($locs->select() as $loc) { $show = true; if ($loc['rules']) { $show = self::ProcessRules($loc['rules']); } if ($show) { $plug = $loc['plugin']; $result[] = $plug; } } return $result; }
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream) { $this->name = 'html'; $pm = new Pagemill($data); $skin = $data->parseVariables($this->getAttribute('skin')); $oldskin = null; if ($skin) { $oldskin = Typeframe_Skin::Current(); Typeframe_Skin::Set($skin); } else { $skin = Typeframe_Skin::Current(); } if (file_exists(TYPEF_DIR . '/skins/' . $skin . '/skin.html')) { $skinTree = $pm->parseFile(TYPEF_DIR . '/skins/' . $skin . '/skin.html'); } else { $skinTree = $pm->parseFile(TYPEF_DIR . '/skins/default/skin.html'); } $skinTree->process($data, $stream); if (!is_null($oldskin)) { Typeframe_Skin::Set($oldskin); } }
function skin_path($path) { $path = (string) $path; $uri = Typeframe::CurrentPage()->uri(); if (substr($path, 0, 1) != '/') { $path = '/' . $path; } if (file_exists(TYPEF_DIR . '/skins/' . Typeframe_Skin::Current() . $path)) { return TYPEF_ROOT_WEB_DIR . '/skins/' . Typeframe_Skin::Current() . $path; /*} else if (file_exists(TYPEF_DIR . '/skins/default' . $path)) { return TYPEF_ROOT_WEB_DIR . '/skins/default' . $path; } else if (file_exists(TYPEF_DIR . '/files/static' . $path)) { return TYPEF_ROOT_WEB_DIR . '/files/static' . $path; } else { // TODO: This might not be the best default. Should it trigger an error? return TYPEF_ROOT_WEB_DIR . $path; }*/ } else { if (Typeframe_Skin::Current() != TYPEF_SITE_SKIN && $uri != TYPEF_WEB_DIR . '/admin' && substr($uri, 0, strlen(TYPEF_WEB_DIR . '/admin/')) != TYPEF_WEB_DIR . '/admin/') { if (file_exists(TYPEF_DIR . '/skins/' . TYPEF_SITE_SKIN . $path)) { return TYPEF_ROOT_WEB_DIR . '/skins/' . TYPEF_SITE_SKIN . $path; } } else { return TYPEF_ROOT_WEB_DIR . '/skins/default' . $path; } } }
private function _resolveTemplate($path) { $skin = Typeframe_Skin::Current(); if (file_exists(TYPEF_DIR . '/skins/' . $skin . '/templates' . $path) && is_file(TYPEF_DIR . '/skins/' . $skin . '/templates' . $path)) { return TYPEF_DIR . '/skins/' . $skin . '/templates' . $path; } /*if (file_exists(TYPEF_DIR . '/skins/default/templates' . $path) && is_file(TYPEF_DIR . '/skins/default/templates' . $path)) { return TYPEF_DIR . '/skins/default/templates' . $path; }*/ if (file_exists(TYPEF_SOURCE_DIR . '/templates' . $path) && is_file(TYPEF_SOURCE_DIR . '/templates' . $path)) { return TYPEF_SOURCE_DIR . '/templates' . $path; } return false; }