當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tiki_Profile::fromString方法代碼示例

本文整理匯總了PHP中Tiki_Profile::fromString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tiki_Profile::fromString方法的具體用法?PHP Tiki_Profile::fromString怎麽用?PHP Tiki_Profile::fromString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tiki_Profile的用法示例。


在下文中一共展示了Tiki_Profile::fromString方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
 }
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:25,代碼來源:templateslib.php

示例2: 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'));
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:9,代碼來源:AnalyserTest.php

示例3: read_module_file

 /**
  * @param $filename
  * @return array|mixed
  */
 private function read_module_file($filename)
 {
     $cachelib = TikiLib::lib('cache');
     $expiry = filemtime($filename);
     if ($modules = $cachelib->getSerialized($filename, 'modules', $expiry)) {
         return $modules;
     }
     $content = file_get_contents($filename);
     if (!$content) {
         TikiLib::lib('errorreport')->report(tr('Module file "%0" not found.', $filename));
         return '';
     }
     $profile = Tiki_Profile::fromString("{CODE(caption=>YAML)}{$content}{CODE}");
     $out = array_fill_keys(array_values($this->module_zones), array());
     foreach ($profile->getObjects() as $object) {
         if ($object->getType() == 'module') {
             $handler = new Tiki_Profile_InstallHandler_Module($object, array());
             $data = $handler->getData();
             $object->replaceReferences($data);
             $data = $handler->formatData($data);
             $data['groups'] = unserialize($data['groups']);
             $position = $data['position'];
             $zone = $this->module_zones[$position];
             $out[$zone][] = $data;
         }
     }
     $cachelib->cacheItem($filename, serialize($out), 'modules');
     return $out;
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:33,代碼來源:modlib.php

示例4: action_edit_template

 function action_edit_template($input)
 {
     if (!Perms::get()->admin) {
         throw new Services_Exception_Denied();
     }
     global $prefs;
     $template = $this->utilities->getTemplate($input->id->int());
     if ($template['is_advanced'] == 'y') {
         return array('FORWARD' => array('action' => 'advanced_edit', 'id' => $input->id->int()));
     }
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $builder = new Services_Workspace_ProfileBuilder();
         if ($prefs['feature_areas'] == 'y' && $input->area->int()) {
             $builder->addObject('area_binding', 'binding', array('category' => $builder->user('category'), 'perspective' => $builder->user('perspective')));
         }
         foreach ($input->groups as $internal => $info) {
             $permissions = array_filter(preg_split('/\\W+/', $info->permissions->none()));
             $builder->addGroup($internal, $info->name->text(), $info->autojoin->int() > 0);
             $builder->setPermissions($internal, 'category', $builder->user('category'), $permissions);
         }
         $builder->setManagingGroup($input->managingGroup->word());
         foreach ($input->pages as $page) {
             $builder->addObject('wiki_page', uniqid(), array('name' => $page->name->pagename(), 'namespace' => $page->namespace->pagename(), 'content' => $page->content->wikicontent(), 'categories' => $builder->user('category')));
         }
         $this->utilities->replaceTemplate($input->id->int(), array('name' => $input->name->text(), 'definition' => $builder->getContent()));
     }
     $template = $this->utilities->getTemplate($input->id->int());
     $profile = Tiki_Profile::fromString($template['definition']);
     $analyser = new Services_Workspace_ProfileAnalyser($profile);
     $hasArea = $analyser->contains(array('type' => 'area_binding', 'ref' => 'binding', 'category' => $analyser->user('category'), 'perspective' => $analyser->user('perspective'))) ? 'y' : 'n';
     return array('title' => tr('Edit template %0', $template['name']), 'id' => $input->id->int(), 'name' => $template['name'], 'area' => $prefs['feature_areas'] == 'y' ? $hasArea : null, 'groups' => $analyser->getGroups('category', $analyser->user('category')), 'pages' => $analyser->getObjects('wiki_page', array('name' => '{namespace}', 'namespace' => null, 'content' => '')));
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:32,代碼來源:Controller.php

示例5: str_replace

         }
         // need to reload sources as cache is cleared after install
         $sources = $list->getSources();
     }
 }
 if (isset($_POST['test'], $_POST['profile_tester'], $_POST['profile_tester_name'])) {
     $test_source = $_POST['profile_tester'];
     if (strpos($test_source, '{CODE}') === false) {
         // wrap in CODE tags if none there
         $test_source = "{CODE(caption=>YAML)}\n{$test_source}\n{CODE}";
     }
     // desanitize the input, prefs etc will filter as required in the profile installer
     $test_source = str_replace('<x>', '', $test_source);
     $smarty->assign('test_source', $test_source);
     $smarty->assign('profile_tester_name', $_POST['profile_tester_name']);
     $profile = Tiki_Profile::fromString($test_source, $_POST['profile_tester_name']);
     $profile->removeSymbols();
     $installer = new Tiki_Profile_Installer();
     $empty_cache = $_REQUEST['empty_cache'];
     $smarty->assign('empty_cache', $empty_cache);
     $installer->install($profile, $empty_cache);
     if ($target = $profile->getInstructionPage()) {
         $wikilib = TikiLib::lib('wiki');
         $target = $wikilib->sefurl($target);
         header('Location: ' . $target);
         exit;
     } else {
         $profilefeedback = $installer->getFeedback();
         if (count($profilefeedback) > 0) {
             $smarty->assign_by_ref('profilefeedback', $profilefeedback);
         }
開發者ID:linuxwhy,項目名稱:tiki-1,代碼行數:31,代碼來源:include_profiles.php

示例6: action_import_profile

 public function action_import_profile($input)
 {
     $tikilib = TikiLib::lib('tiki');
     $perms = Perms::get();
     if (!$perms->admin) {
         throw new Services_Exception_Denied(tr('Reserved for administrators'));
     }
     unset($success);
     $confirm = $input->confirm->int();
     if ($confirm) {
         $transaction = $tikilib->begin();
         $installer = new Tiki_Profile_Installer();
         $yaml = $input->yaml->string();
         $name = "tracker_import:" . md5($yaml);
         $profile = Tiki_Profile::fromString('{CODE(caption="yaml")}' . "\n" . $yaml . "\n" . '{CODE}', $name);
         if ($installer->isInstallable($profile) == true) {
             if ($installer->isInstalled($profile) == true) {
                 $installer->forget($profile);
             }
             $installer->install($profile);
             $feedback = $installer->getFeedback();
             $transaction->commit();
             return $feedback;
             $success = 1;
         } else {
             return false;
         }
     }
     return array('title' => tr('Import Tracker From Profile/YAML'), 'modal' => $input->modal->int());
 }
開發者ID:ameoba32,項目名稱:tiki,代碼行數:30,代碼來源:Controller.php

示例7: upgrade_99999999_image_plugins_kill_tiki


//.........這裏部分代碼省略.........
     pattern: %file%
     params:
      file:
       token: file
    id:
     pattern: %id%
     params:
      id:
       token: id
    src:
     pattern: %image%
     params:
      image:
       token: image
    max:
     pattern: %max%
     params:
      max:
       token: max
    imalign:
     pattern: %float%
     params:
      float:
       token: float
    link:
     pattern: %url%
     params:
      url:
       token: url
    thumb: mouseover
{CODE}
PLUGINTEXT;
    $profile_installer = new Tiki_Profile_Installer();
    $profile = Tiki_Profile::fromString($plugstring, 'THUMB');
    $profile->removeSymbols();
    $profile_installer->install($profile);
    // ********************************  IMAGE plugin
    $plugstring = <<<PLUGINTEXT
{CODE(caption=>YAML,wrap=1)}
objects:
 -
  type: plugin_alias
  ref: combine_image
  data:
   name: IMAGE
   implementation: img
   description:
    name: Image
    documentation: PluginImage
    description: Display images (transitional alias, use IMG plugin instead)
    params:
     fileId:
      required: false
      name: File ID
      description: Numeric ID of an image in a File Gallery (or comma-separated list). "fileId", "id" or "src" required.
     id:
      required: false
      name: Image ID
      description: Numeric ID of an image in an Image Gallery (or comma-separated list). "fileId", "id" or "src" required.
     src:
      required: false
      name: Image source
      description: Full URL to the image to display. "fileId", "id" or "src" required.
      filter: url
     scalesize:
      required: false
開發者ID:jkimdon,項目名稱:cohomeals,代碼行數:67,代碼來源:99999999_image_plugins_kill_tiki.php

示例8: applyTemplate

 function applyTemplate(array $template, array $data)
 {
     $profile = Tiki_Profile::fromString($template['definition'], uniqid());
     $installer = new Tiki_Profile_Installer();
     $installer->setUserData($data);
     $value = $installer->install($profile);
     if (!$value) {
         throw new Services_Exception('Profile could not be installed.');
     }
 }
開發者ID:jkimdon,項目名稱:cohomeals,代碼行數:10,代碼來源:Utilities.php

示例9: action_import_profile

 public function action_import_profile($input)
 {
     global $tikilib, $access;
     $access->check_permission('tiki_p_admin');
     $transaction = $tikilib->begin();
     $installer = new Tiki_Profile_Installer();
     $yaml = $input->yaml->string();
     $name = "tracker_import:" . md5($yaml);
     $profile = Tiki_Profile::fromString('{CODE(caption="yaml")}' . "\n" . $yaml . "\n" . '{CODE}', $name);
     if ($installer->isInstallable($profile) == true) {
         if ($installer->isInstalled($profile) == true) {
             $installer->forget($profile);
         }
         $installer->install($profile);
         $feedback = $installer->getFeedback();
         $transaction->commit();
         return $feedback;
     } else {
         return false;
     }
 }
開發者ID:hurcane,項目名稱:tiki-azure,代碼行數:21,代碼來源:Controller.php

示例10: action_export_profile

 function action_export_profile($input)
 {
     if (!Perms::get()->admin_trackers) {
         throw new Services_Exception(tr('Reserved to tracker administrators'), 403);
     }
     $trackerId = $input->trackerId->int();
     include_once 'lib/profilelib/installlib.php';
     include_once 'lib/profilelib/profilelib.php';
     $profile = Tiki_Profile::fromString('dummy', '');
     $data = array();
     $profileObject = new Tiki_Profile_Object($data, $profile);
     $profileTrackerInstallHandler = new Tiki_Profile_InstallHandler_Tracker($profileObject, array());
     $export_yaml = $profileTrackerInstallHandler->_export($trackerId, $profileObject);
     include_once 'lib/wiki-plugins/wikiplugin_code.php';
     $export_yaml = wikiplugin_code($export_yaml, array('caption' => 'YAML', 'colors' => 'yaml'));
     $export_yaml = preg_replace('/~[\\/]?np~/', '', $export_yaml);
     return array('trackerId' => $trackerId, 'yaml' => $export_yaml);
 }
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:18,代碼來源:Controller.php


注:本文中的Tiki_Profile::fromString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。