コード例 #1
0
 function load($path = true)
 {
     $_this =& SparkFormConfig::getInstance();
     if (!$_this->loaded) {
         config('plugins/spark_form');
         $config = Configure::read('SparkForm');
         $config = Set::merge($_this->defaultConfig, $config);
         Configure::write('SparkForm', $config);
         $_this->loaded = true;
         if (in_array('Filter', App::Objects('plugin'))) {
             Configure::Write('Filter.FormHelper', 'SparkForm.SparkForm');
         }
     }
     if (!empty($path)) {
         return Configure::read('SparkForm' . ($path !== true ? '.' . $path : ''));
     }
 }
コード例 #2
0
 function loadAsset($alias, $type = 'js', $inline = false, $default = null)
 {
     static $loaded = array();
     if (empty($loaded[$type][$alias])) {
         if (method_exists($this, '_' . $alias . 'Asset')) {
             $loaded[$type][$alias] = 1;
             $res = $this->{'_' . $alias . 'Asset'}($inline);
             return $res;
         }
         $url = $default;
         $res = '';
         App::import('Lib', 'SparkForm.SparkFormConfig');
         $conf = SparkFormConfig::load('load' . ucfirst($type) . '.' . $alias);
         if ($conf) {
             $url = $conf;
         }
         if ($url) {
             $loaded[$type][$alias] = 1;
             if (method_exists($this, '_' . $type . 'Asset')) {
                 $res = $this->{'_' . $type . 'Asset'}($url, $inline);
             }
             return $res;
         }
     }
     return '';
 }