コード例 #1
0
ファイル: Storage.php プロジェクト: gigaai/framework
 private function createConfigFromWordPress()
 {
     if (defined('DB_HOST') && defined('DB_NAME') && defined('DB_USER') && defined('DB_PASSWORD') && defined('DB_CHARSET')) {
         global $wpdb;
         $mysql = ['host' => DB_HOST, 'database' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASSWORD, 'charset' => DB_CHARSET, 'collation' => null, 'prefix' => $wpdb->prefix];
         Config::set('mysql', $mysql);
     }
 }
コード例 #2
0
ファイル: MessengerBot.php プロジェクト: gigaai/framework
 /**
  * Load the required resources
  *
  * @param $instance
  */
 public function __construct($instance = null)
 {
     // Package Version
     if (!defined('GIGAAI_VERSION')) {
         define('GIGAAI_VERSION', '2.0.3');
     }
     // Setup the configuration data
     $this->config = Config::getInstance();
     if (!empty($config)) {
         $this->config->set($config);
     }
     // Make a Request instance. Not required but it will help user use $bot->request syntax
     $this->request = Request::getInstance();
     // Make a Session instance. Not required but it will help user use $bot->session syntax
     $this->conversation = Conversation::getInstance();
     // Load the storage
     $this->storage = new Storage();
     // Load the model
     $this->model = new Model();
     // We need to serialize Closure for dynamic data and intended actions
     $this->serializer = new Serializer();
     // Boot the subscription feature
     $this->subscription = Subscription::getInstance();
 }