示例#1
0
 /**
  * Tests that the KMS class can create an instance of a KMS classes
  */
 public function testFactory()
 {
     $this->assertInstanceOf('KMS_Site', KMS::factory('site', 1));
     try {
         KMS::factory('content');
         $this->fail('KMS_Content did not product exception');
     } catch (Exception $e) {
         $this->assertInstanceOf('Kohana_Exception', $e);
     }
 }
示例#2
0
 /**
  * Helper function for rendering site variables
  * @param   string   data to parse (chunk, snippet, variable)
  * @param   string   specifies what type of data is being passed in ([c]hunk, [s]nippet, [v]ariable, [list])
  * @return  boolean
  */
 protected function _parse($data, $type)
 {
     $found = FALSE;
     foreach ($data as $key => $value) {
         $find = $key;
         if ($type != 'list') {
             $key = preg_quote($key, '/');
         }
         $key = "/\\[\\[{$type}\\*{$key}\\]\\]/";
         if (!preg_match($key, $this->_response, $matches)) {
             continue;
         }
         if ($type == 's') {
             $value = $this->_eval($find, $value);
         } else {
             if ($type == 'list') {
                 $data = KMS::factory('list', $matches)->load();
                 $this->_render_vars += $data;
             }
         }
         $this->_response = preg_replace($key, $value, $this->_response);
         $found = TRUE;
     }
     return $found;
 }
示例#3
0
文件: kms.php 项目: ngonchan/Kooshy
 /**
  * Loads KMS_Content
  */
 public function action_index()
 {
     $this->request->response = KMS::factory('content');
 }