本文整理汇总了PHP中Theme类的典型用法代码示例。如果您正苦于以下问题:PHP Theme类的具体用法?PHP Theme怎么用?PHP Theme使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Theme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* {@inheritdoc}
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function create($themeName, array $themeDefinition)
{
$theme = new Theme($themeName, isset($themeDefinition['parent']) ? $themeDefinition['parent'] : null);
if (isset($themeDefinition['label'])) {
$theme->setLabel($themeDefinition['label']);
}
if (isset($themeDefinition['screenshot'])) {
$theme->setScreenshot($themeDefinition['screenshot']);
}
if (isset($themeDefinition['icon'])) {
$theme->setIcon($themeDefinition['icon']);
}
if (isset($themeDefinition['logo'])) {
$theme->setLogo($themeDefinition['logo']);
}
if (isset($themeDefinition['directory'])) {
$theme->setDirectory($themeDefinition['directory']);
}
if (isset($themeDefinition['groups'])) {
$theme->setGroups((array) $themeDefinition['groups']);
}
if (isset($themeDefinition['description'])) {
$theme->setDescription($themeDefinition['description']);
}
if (isset($themeDefinition['data'])) {
$theme->setData($themeDefinition['data']);
}
return $theme;
}
示例2: send_form_test
function send_form_test()
{
$theme = new Theme();
$response = $theme->form_test();
echo json_encode($response);
exit;
}
示例3: form
public function form()
{
$text = new FormElement("textarea", "q_post");
$t = new Theme();
$text->addClasses("actualite_area_text");
return $t->process_form_elements($text);
}
示例4: price
public static function price($euro)
{
$theme = new Theme();
$theme->set_title("Convertion euro > franc");
$theme->add_to_body($euro * 6.55957);
$theme->process_theme(Theme::STRUCT_DEFAULT);
}
示例5: _load_themes
function _load_themes()
{
$this->themes = [];
$themes = glob("{$this->theme_dir}*.{{$this->theme_ext}}", GLOB_BRACE);
$p_exts = $this->theme_ext;
$p_exts = preg_split('/,/i', $p_exts);
foreach ($p_exts as &$ext) {
$ext = preg_quote('.' . trim($ext));
}
$p_exts = join('|', $p_exts);
foreach ($themes as $theme_dir) {
$theme = new Theme($theme_dir, $this->theme_file, ['class' => preg_replace('/([^\\/]+\\/(?=[^$])|(' . $p_exts . ')|\\/\\s?$)/i', '', $theme_dir) . "\\" . $this->theme_class]);
$this->themes[] = $theme;
}
foreach ($this->themes as $index => $theme) {
$result = $theme->init();
if (!$result) {
$this->themes[$index] = false;
}
}
$loaded = $this->themes;
$this->themes = [];
foreach ($loaded as $theme) {
if ($theme) {
$this->themes[] = $theme;
}
}
}
示例6: _
/**
* @param string $theme
* @param array $vars
*/
public static function _($theme, $vars = array())
{
$instance = new Theme();
foreach ($vars as $key => $value) {
$instance->set($key, $value);
}
$instance->dispatch($theme);
}
示例7: widget_menu_system
public function widget_menu_system()
{
$theme = new Theme();
$list = array();
$list[] = Theme::linking(Page::url("/admin/modules/"), t("<i class=\"fa fa-puzzle-piece fa-fw\"></i> Modules"));
$list[] = Theme::linking(Page::url("/admin/database/"), t("<i class=\"fa fa-database fa-fw\"></i> Base de données"));
return t("<div class=\"widget_titre\"><i class=\"fa fa-wrench fa-fw\"></i> Système</div>") . $theme->listing($list);
}
示例8: index
function index()
{
list($params, $id) = $this->parse_params(func_get_args());
$t = new Theme();
$final = $t->read();
$final = Shutter::filter('api.themes', array($final));
$this->set_response_data($final);
}
示例9: setCurrentTheme
public static function setCurrentTheme($x)
{
self::$set_theme = $x;
$theme = new Theme(self::$set_theme);
if ($theme->validate()) {
self::$curr_theme = $theme;
}
}
示例10: theme_linkoid
/**
* Respond to call to $theme->linkoid() in template
*
* @param string $return The return value to the template function (passed through other potential plugin calls)
* @param Theme $theme The theme object
* @param string $tag An optional tag to use instead of the one defined in the plugin options.
* @return string The return value to the template function
*/
public function theme_linkoid($theme, $tag = null)
{
if (!isset($tag)) {
$tag = Options::get('linkoid__show');
}
$linkoids = Posts::get(array('tag_slug' => $tag, 'limit' => Options::get('linkoid__count')));
$theme->linkoids = $linkoids;
return $theme->fetch('linkoid');
}
示例11: exampleImageUrls
public function exampleImageUrls()
{
$layout = new ThemeLayout(1);
$template = new ThemeTemplate(1);
$theme = new Theme(1);
print_d($layout->getThemeConfig());
var_dump($theme->getPath());
var_dump($template->getImageUrl());
echo '<br>';
var_dump($layout->getImageUrl());
echo '<br>';
var_dump($theme->getImageUrl());
}
示例12: page_permissions
public function page_permissions()
{
if (isset($_POST['save-permissions'])) {
PermissionObject::removeAllPermissions();
if (isset($_POST['permission'])) {
foreach ($_POST['permission'] as $perm => $groups) {
foreach ($groups as $grp => $d) {
PermissionObject::addPermission($grp, $perm);
}
}
}
Notification::statusNotify(t("configuration enregistrée"), Notification::STATUS_SUCCESS);
}
$defined_permissions = PermissionObject::loadAllPermissions();
$df = array();
foreach ($defined_permissions as $p) {
if (!isset($df[$p->pid])) {
$df[$p->pid] = array();
}
$df[$p->pid][$p->gid] = 1;
}
$p = new PermissionsManager();
$permissions = $p->scanForPermission();
$groups = GroupObject::loadAll();
$table = array();
$hcol = array("");
$hrow = array();
foreach ($permissions as $u => $t) {
$hrow[] = $t;
$row = array();
foreach ($groups as $gd => $g) {
if ($u == 0) {
$hcol[] = $g->label;
}
$pm = new PermissionObject();
$pm->loadByName($t);
$tlabel = "permission[" . $g->gid . "][" . $pm->pid . "]";
if (isset($df[$pm->pid][$g->gid])) {
$row[] = "<input type='checkbox' name='{$tlabel}' id='{$tlabel}' checked='checked'/>";
} else {
$row[] = "<input type='checkbox' name='{$tlabel}' id='{$tlabel}' />";
}
}
$table[] = $row;
}
$theme = new Theme();
$theme->set_title(t("Permissions déclarées"));
$table = Themed::tabling($table, $hcol, $hrow);
$theme->add_to_body("<form method='POST' action=''>{$table} <input type='submit' name='save-permissions' value='" . t("Enregistrer") . "'/></form>");
$theme->process_theme(Theme::STRUCT_ADMIN);
}
示例13: test_db_methods
function test_db_methods()
{
$theme = new Theme("Master", "And Servant");
$sp1 = new BackgroundColorSP("#FFFCF0");
$id1 = $theme->registerSP($sp1);
$sp2 = new ColorSP("#2E2B33");
$id2 = $theme->registerSP($sp2);
$sp3 = new FontSP("Verdana", "10pt");
$id3 = $theme->registerSP($sp3);
$this->manager->setTheme($theme);
$this->manager->saveTheme();
$id = $theme->getId();
$this->assertIsA($id, "HarmoniId");
$theme1 = new Theme("Master", "And Servant");
$sp1 = new BackgroundColorSP("#241");
$id1 = $theme1->registerSP($sp1);
$sp2 = new ColorSP("#325");
$id2 = $theme1->registerSP($sp2);
$sp3 = new FontSP("Arial", "9pt");
$id3 = $theme1->registerSP($sp3);
$this->manager->loadTheme($id);
$themea = $this->manager->getTheme();
$this->assertIdentical($theme, $themea);
/*** testing method replaceThemeState ***/
$theme2 = new Theme("Master", "And Servant");
$sp1 = new BackgroundColorSP("#241");
$id1 = $theme2->registerSP($sp1);
$sp2 = new ColorSP("#325");
$id2 = $theme2->registerSP($sp2);
$sp3 = new FontSP("Arial", "9pt");
$id3 = $theme2->registerSP($sp3);
$this->manager->saveTheme($id, $theme2);
$this->manager->loadTheme($id, $theme1);
$this->assertIdentical($theme2, $theme1);
/*** testing method deleteThemeState ***/
$dbHandler =& Services::getService("DatabaseManager");
$dbIndex = $dbHandler->addDatabase(new MySQLDatabase("devo", "doboHarmoniTest", "test", "test"));
$dbHandler->connect($dbIndex);
$this->manager->deleteTheme($id);
$idValue = $id->getIdString();
$query = new SelectQuery();
$query->addColumn("gui_theme");
$query->addColumn("gui_state");
$query->addTable("gui");
$query->addWhere("gui_id = " . $idValue);
$queryResult = $dbHandler->query($query, $dbIndex);
$affectedRows = $queryResult->getNumberOfRows();
$this->assertIdentical($affectedRows, 0);
$queryResult->free();
}
示例14: getStyleConfig
public function getStyleConfig()
{
$conf = array();
foreach ($this->getAllParentThemes() as $theme) {
$inst = new Theme($theme, $this->application);
$conf = $this->array_merge_recursive_distinct($conf, $inst->getStyleConfig());
}
$path = $this->application->getRenderer()->getTemplatePath('theme/' . $this->name . '/.theme/style.ini');
if ($path) {
//$conf = $this->array_merge_recursive_distinct($conf, parse_ini_file($path, true));
$conf = parse_ini_file($path, true);
}
return $conf;
}
示例15: on_get
private function on_get()
{
$response = [];
foreach (['langs', 'options', 'types'] as $name) {
if ($this->request->query_boolean($name, false)) {
$methodname = 'get_' . $name;
$response[$name] = $this->context->{$methodname}();
}
}
if ($this->request->query_boolean('setup', false)) {
$response['setup'] = $this->setup->to_jsono($this->context->is_admin());
}
if ($this->request->query_boolean('theme', false)) {
$theme = new Theme($this->context);
$response['theme'] = $theme->get_icons();
}
if ($this->request->query('items', false)) {
$href = $this->request->query('items.href');
$what = $this->request->query_numeric('items.what');
$response['items'] = $this->context->get_items($href, $what);
}
if ($this->request->query('custom', false)) {
Util::json_fail(Util::ERR_DISABLED, 'custom disabled', !$this->context->query_option('custom.enabled', false));
$href = $this->request->query('custom');
$custom = new Custom($this->context);
$response['custom'] = $custom->get_customizations($href);
}
if ($this->request->query('l10n', false)) {
Util::json_fail(Util::ERR_DISABLED, 'l10n disabled', !$this->context->query_option('l10n.enabled', false));
$iso_codes = $this->request->query_array('l10n');
$iso_codes = array_filter($iso_codes);
$response['l10n'] = $this->context->get_l10n($iso_codes);
}
if ($this->request->query('search', false)) {
Util::json_fail(Util::ERR_DISABLED, 'search disabled', !$this->context->query_option('search.enabled', false));
$href = $this->request->query('search.href');
$pattern = $this->request->query('search.pattern');
$search = new Search($this->context);
$response['search'] = $search->get_items($href, $pattern);
}
if ($this->request->query('thumbs', false)) {
Util::json_fail(Util::ERR_DISABLED, 'thumbnails disabled', !$this->context->query_option('thumbnails.enabled', false));
Util::json_fail(Util::ERR_UNSUPPORTED, 'thumbnails not supported', !$this->setup->get('HAS_PHP_JPEG'));
$thumbs = $this->request->query_array('thumbs');
$response['thumbs'] = $this->context->get_thumbs($thumbs);
}
Util::json_exit($response);
}