Beispiel #1
0
 public static function getInstance($type, $prefix = '', $config = array())
 {
     $type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
     $modelClass = $prefix . ucfirst($type);
     if (!class_exists($modelClass)) {
         $path = SnapJobs::get_setting('plugin_path') . 'models' . DIRECTORY_SEPARATOR . $type . '.php';
         if ($path) {
             require_once $path;
             if (!class_exists($modelClass)) {
                 return false;
             }
         } else {
             return false;
         }
     }
     return new $modelClass($config);
 }
Beispiel #2
0
 function get_plugin_url($path = '')
 {
     $plugin_url = get_template_directory_uri() . SnapJobs::get_setting('plugin_uri');
     return $plugin_url . $path;
 }