Author: Nick Sagona, III (nick@popphp.org)
Example #1
0
 public function testCheck()
 {
     $results = Version::check();
     $results = Version::check(Version::HTML);
     $results = Version::check(Version::DATA);
     $this->assertGreaterThan(0, count($results));
 }
Example #2
0
 /**
  * Get the init field values
  *
  * @return array
  */
 protected function getInitFields()
 {
     $check = Version::check(Version::DATA);
     foreach ($check as $key => $value) {
         if (strpos($key, 'db') !== false) {
             if ($value == 'Yes' && stripos($key, 'sqlsrv') === false && stripos($key, 'oracle') === false) {
                 $db = str_replace('db', '', $key);
                 if (strpos($db, 'Pdo') !== false && $db != 'Pdo') {
                     $db = 'Pdo\\' . ucfirst(strtolower(str_replace('Pdo', '', $db)));
                     $this->dbAdapters[$db] = $db;
                 } else {
                     if ($db != 'Pdo') {
                         $db = ucfirst(strtolower($db));
                         if ($db != 'Mysql') {
                             $this->dbAdapters[$db] = $db;
                         }
                     }
                 }
             }
         }
     }
     $langs = I18n::getLanguages(__DIR__ . '/../../../data/assets/i18n');
     foreach ($langs as $key => $value) {
         $langs[$key] = substr($value, 0, strpos($value, ' ('));
     }
     $fields = array('language' => array('type' => 'select', 'label' => $this->i18n->__('Language'), 'value' => $langs, 'marked' => POP_LANG, 'attributes' => array('onchange' => "changeLanguage(this);", 'style' => 'width: 260px;')), 'db_adapter' => array('type' => 'select', 'label' => $this->i18n->__('DB Adapter'), 'required' => true, 'value' => $this->dbAdapters, 'attributes' => array('style' => 'width: 260px;')), 'db_name' => array('type' => 'text', 'label' => $this->i18n->__('DB Name'), 'attributes' => array('size' => 30)), 'db_username' => array('type' => 'text', 'label' => $this->i18n->__('DB Username'), 'attributes' => array('size' => 30)), 'db_password' => array('type' => 'text', 'label' => $this->i18n->__('DB Password'), 'attributes' => array('size' => 30)), 'db_host' => array('type' => 'text', 'label' => $this->i18n->__('DB Host'), 'attributes' => array('size' => 30), 'value' => 'localhost'), 'db_prefix' => array('type' => 'text', 'name' => 'db_prefix', 'label' => $this->i18n->__('DB Table Prefix'), 'attributes' => array('size' => 30), 'value' => 'ph_'), 'app_uri' => array('type' => 'text', 'label' => $this->i18n->__('Application URI') . '<br /><em style="font-size: 0.9em; color: #666; font-weight: normal;">(' . $this->i18n->__('How you will access the system') . ')</em>', 'attributes' => array('size' => 30), 'value' => APP_URI), 'content_path' => array('type' => 'text', 'label' => $this->i18n->__('Content Path') . '<br /><em style="font-size: 0.9em; color: #666; font-weight: normal;">(' . $this->i18n->__('Where assets will be located') . ')</em>', 'required' => true, 'attributes' => array('size' => 30), 'value' => CONTENT_PATH), 'password_encryption' => array('type' => 'hidden', 'value' => 4), 'submit' => array('type' => 'submit', 'label' => '&nbsp;', 'value' => $this->i18n->__('NEXT'), 'attributes' => array('class' => 'install-btn')));
     return $fields;
 }
Example #3
0
echo PHP_EOL;
echo 'Pop PHP Framework CLI' . PHP_EOL;
echo '=====================' . PHP_EOL . PHP_EOL;
if (!empty($argv[1])) {
    // Check for version
    if ($argv[1] == '-v' || $argv[1] == '--version') {
        echo 'Version Check' . PHP_EOL;
        echo '-------------' . PHP_EOL;
        echo 'Installed: ' . Version::getVersion() . PHP_EOL;
        echo 'Latest Available: ' . Version::getLatest() . PHP_EOL . PHP_EOL;
        // Else, check dependencies
    } else {
        if ($argv[1] == '-c' || $argv[1] == '--check') {
            echo 'Dependencies Check' . PHP_EOL;
            echo '------------------' . PHP_EOL;
            echo Version::check() . PHP_EOL;
            // Else, display help
        } else {
            if ($argv[1] == '-h' || $argv[1] == '--help') {
                echo 'Help' . PHP_EOL;
                echo '----' . PHP_EOL;
                Install::cliHelp();
                // Else, show instructions
            } else {
                if ($argv[1] == '-s' || $argv[1] == '--show') {
                    echo 'Project Install Instructions' . PHP_EOL;
                    echo '----------------------------' . PHP_EOL;
                    Install::instructions();
                    // Else, set default project language
                } else {
                    if ($argv[1] == '-l' || $argv[1] == '--lang') {