本文整理汇总了PHP中Tiki_Profile类的典型用法代码示例。如果您正苦于以下问题:PHP Tiki_Profile类的具体用法?PHP Tiki_Profile怎么用?PHP Tiki_Profile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tiki_Profile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_parsed_template
function get_parsed_template($templateId, $lang = null, $format = 'yaml')
{
$res = $this->get_template($templateId, $lang);
if (!$res) {
return false;
}
switch ($format) {
case 'yaml':
require_once 'lib/profilelib/profilelib.php';
require_once 'lib/profilelib/installlib.php';
$content = "{CODE(caption=>YAML)}objects:\n" . " -\n" . " type: file_gallery\n" . " data:\n" . " " . implode("\n ", explode("\n", $res['content'])) . "{CODE}";
$profile = Tiki_Profile::fromString($content, $res['name']);
$installer = new Tiki_Profile_Installer();
$objects = $profile->getObjects();
if (isset($objects[0])) {
$data = $installer->getInstallHandler($objects[0])->getData();
unset($data['galleryId'], $data['parentId'], $data['name'], $data['user']);
$res['content'] = $data;
} else {
$res['content'] = array();
}
break;
}
return $res;
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$profileName = $input->getArgument('profile');
$repository = $input->getArgument('repository');
$force = $input->getOption('force');
$profile = \Tiki_Profile::fromNames($repository, $profileName);
if (!$profile) {
$output->writeln('<error>Profile not found.</error>');
return;
}
$tikilib = \TikiLib::lib('tiki');
$installer = new \Tiki_Profile_Installer();
$isInstalled = $installer->isInstalled($profile);
if ($isInstalled && $force) {
$installer->forget($profile);
$isInstalled = false;
}
if (!$isInstalled) {
$transaction = $tikilib->begin();
if ($installer->install($profile)) {
$transaction->commit();
$output->writeln('Profile applied.');
} else {
$output->writeln("<error>Installation failed:</error>");
foreach ($installer->getFeedback() as $error) {
$output->writeln("<error>{$error}</error>");
}
}
} else {
$output->writeln('<info>Profile was already applied. Nothing happened.</info>');
}
}
示例3: getData
function getData()
{
if ($this->data) {
return $this->data;
}
$data = $this->obj->getData();
$data = Tiki_Profile::convertYesNo($data);
return $this->data = $data;
}
示例4: testGetObjects
function testGetObjects()
{
$builder = new Services_Workspace_ProfileBuilder();
$builder->addObject('wiki_page', 'foo', array('name' => 'Foo', 'namespace' => $builder->user('namespace'), 'content' => 'Hello', 'categories' => $builder->user('category')));
$builder->addObject('wiki_page', 'bar', array('name' => 'Bar', 'namespace' => $builder->user('namespace'), 'content' => 'World', 'categories' => $builder->user('category')));
$profile = Tiki_Profile::fromString($builder->getContent());
$analyser = new Services_Workspace_ProfileAnalyser($profile);
$this->assertEquals(array(array('name' => 'Foo', 'namespace' => '{namespace}', 'content' => 'Hello'), array('name' => 'Bar', 'namespace' => '{namespace}', 'content' => 'World')), $analyser->getObjects('wiki_page'));
}
示例5: getData
function getData()
{
if ($this->data) {
return $this->data;
}
$defaults = array('sections' => array('wiki'), 'type' => 'static');
$data = array_merge($defaults, $this->obj->getData());
$data = Tiki_Profile::convertYesNo($data);
return $this->data = $data;
}
示例6: getData
function getData()
{
if ($this->data) {
return $this->data;
}
$defaults = array('description' => '', 'user' => 'admin', 'public' => 'n', 'max_posts' => 10, 'heading' => '', 'post_heading' => '', 'use_find' => 'y', 'comments' => 'n', 'show_avatar' => 'n');
$data = array_merge($defaults, $this->obj->getData());
$data = Tiki_Profile::convertYesNo($data);
return $this->data = $data;
}
示例7: getData
function getData()
{
if ($this->data) {
return $this->data;
}
$defaults = array('title' => 'Title', 'private' => 'n', 'user' => '', 'geolocation' => '');
$data = array_merge($defaults, $this->obj->getData());
$data = Tiki_Profile::convertYesNo($data);
return $this->data = $data;
}
示例8: getData
private function getData()
{
if ($this->data) {
return $this->data;
}
$data = $this->obj->getData();
$data = Tiki_Profile::convertLists($data, array('show' => 'y', 'allow' => 'y'), true);
$data = Tiki_Profile::convertYesNo($data);
return $this->data = $data;
}
示例9: getData
function getData()
{
if ($this->data) {
return $this->data;
}
$defaults = array();
$data = array_merge($defaults, $this->obj->getData());
$data = Tiki_Profile::convertYesNo($data);
return $this->data = $data;
}
示例10: getData
function getData()
{
if ($this->data) {
return $this->data;
}
$defaults = array('preferences' => array());
$data = array_merge($defaults, $this->obj->getData());
$data['preferences'] = Tiki_Profile::convertLists($data['preferences'], array('enable' => 'y', 'disable' => 'n'));
$data['preferences'] = Tiki_Profile::convertYesNo($data['preferences']);
return $this->data = $data;
}
示例11: getData
function getData()
{
if ($this->data) {
return $this->data;
}
$defaults = array('cache' => 0, 'rows' => 10, 'custom' => null, 'groups' => array(), 'params' => array(), 'parse' => null);
$data = array_merge($defaults, $this->obj->getData());
$data = Tiki_Profile::convertYesNo($data);
$data['params'] = Tiki_Profile::convertYesNo($data['params']);
return $this->data = $data;
}
示例12: getProfiles
function getProfiles(array $channelNames)
{
$profiles = array();
foreach ($channelNames as $channelName) {
$info = $this->channels[$channelName];
if ($profile = Tiki_Profile::fromNames($info['domain'], $info['profile'])) {
$profiles[$channelName] = $profile;
}
}
return $profiles;
}
示例13: serializeNamedObject
public static function serializeNamedObject($object)
{
if (strpos($object['domain'], '://') === false) {
if (is_dir($object['domain'])) {
$object['domain'] = "file://" . $object['domain'];
} else {
$object['domain'] = "http://" . $object['domain'];
}
}
return sprintf("%s#%s", Tiki_Profile::getProfileKeyfor($object['domain'], $object['profile']), $object['object']);
}
示例14: getData
function getData()
{
if ($this->data) {
return $this->data;
}
$data = $this->obj->getData();
$data = Tiki_Profile::convertLists($data, array('show' => 'y'), true);
$defaults = array('description' => null, 'refresh' => 30, 'show_title' => 'n', 'show_publication_date' => 'n', 'article_generator' => null);
$data = array_merge($defaults, $data);
$data = Tiki_Profile::convertYesNo($data);
return $this->data = $data;
}
示例15: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$addon_utilities = new \TikiAddons_Utilities();
$addonName = $input->getArgument('addon');
if (strpos($addonName, '/') !== false && strpos($addonName, '_') === false) {
$package = $addonName;
$folder = str_replace('/', '_', $addonName);
} else {
$package = str_replace('_', '/', $addonName);
$folder = $addonName;
}
$repository = 'file://addons/' . $folder . '/profiles';
$reapply = $input->getOption('reapply');
$ignoredepends = $input->getOption('ignoredepends');
if (empty(glob(TIKI_PATH . '/addons/' . $folder . '/profiles/*.yml'))) {
$output->writeln("<error>No profiles found.</error>");
return false;
}
if (!$ignoredepends) {
$addon_utilities->checkDependencies($folder);
}
$addons = \TikiAddons::getInstalled();
$tikilib = \TikiLib::lib('tiki');
$installer = new \Tiki_Profile_Installer();
foreach (glob(TIKI_PATH . '/addons/' . $folder . '/profiles/*.yml') as $file) {
$profileName = str_replace('.yml', '', basename($file));
$profile = \Tiki_Profile::fromNames($repository, $profileName);
if (!$profile) {
$output->writeln("<error>Profile {$profileName} not found.</error>");
continue;
}
$isInstalled = $installer->isInstalled($profile);
if ($isInstalled && $reapply) {
$installer->forget($profile);
$isInstalled = false;
}
if (!$isInstalled) {
$transaction = $tikilib->begin();
if ($installer->install($profile)) {
$addon_utilities->updateProfile($folder, $addons[$package]->version, $profileName);
$transaction->commit();
$output->writeln("Profile {$profileName} applied.");
} else {
$output->writeln("<error>Profile {$profileName} installation failed:</error>");
foreach ($installer->getFeedback() as $error) {
$output->writeln("<error>{$error}</error>");
}
}
} else {
$output->writeln("<info>Profile {$profileName} was already applied. Nothing happened.</info>");
}
}
}