├── .gitignore ├── .craftsman.example ├── .travis.yml ├── tests ├── Codeigniter │ └── 3.1.4 │ │ ├── system │ │ ├── fonts │ │ │ ├── texb.ttf │ │ │ └── index.html │ │ ├── .htaccess │ │ ├── index.html │ │ ├── core │ │ │ ├── index.html │ │ │ ├── compat │ │ │ │ └── index.html │ │ │ ├── Model.php │ │ │ └── Controller.php │ │ ├── database │ │ │ ├── index.html │ │ │ └── drivers │ │ │ │ ├── index.html │ │ │ │ ├── cubrid │ │ │ │ ├── index.html │ │ │ │ └── cubrid_utility.php │ │ │ │ ├── ibase │ │ │ │ ├── index.html │ │ │ │ └── ibase_utility.php │ │ │ │ ├── mssql │ │ │ │ ├── index.html │ │ │ │ └── mssql_utility.php │ │ │ │ ├── mysql │ │ │ │ └── index.html │ │ │ │ ├── mysqli │ │ │ │ └── index.html │ │ │ │ ├── oci8 │ │ │ │ ├── index.html │ │ │ │ └── oci8_utility.php │ │ │ │ ├── odbc │ │ │ │ ├── index.html │ │ │ │ ├── odbc_utility.php │ │ │ │ └── odbc_forge.php │ │ │ │ ├── pdo │ │ │ │ ├── index.html │ │ │ │ ├── subdrivers │ │ │ │ │ ├── index.html │ │ │ │ │ └── pdo_odbc_forge.php │ │ │ │ ├── pdo_forge.php │ │ │ │ └── pdo_utility.php │ │ │ │ ├── postgre │ │ │ │ ├── index.html │ │ │ │ └── postgre_utility.php │ │ │ │ ├── sqlite │ │ │ │ ├── index.html │ │ │ │ └── sqlite_utility.php │ │ │ │ ├── sqlite3 │ │ │ │ ├── index.html │ │ │ │ └── sqlite3_utility.php │ │ │ │ └── sqlsrv │ │ │ │ ├── index.html │ │ │ │ └── sqlsrv_utility.php │ │ ├── helpers │ │ │ ├── index.html │ │ │ ├── language_helper.php │ │ │ ├── email_helper.php │ │ │ ├── path_helper.php │ │ │ ├── xml_helper.php │ │ │ ├── number_helper.php │ │ │ ├── typography_helper.php │ │ │ ├── directory_helper.php │ │ │ └── array_helper.php │ │ ├── language │ │ │ ├── index.html │ │ │ └── english │ │ │ │ ├── index.html │ │ │ │ ├── number_lang.php │ │ │ │ ├── pagination_lang.php │ │ │ │ ├── migration_lang.php │ │ │ │ ├── unit_test_lang.php │ │ │ │ ├── profiler_lang.php │ │ │ │ ├── ftp_lang.php │ │ │ │ ├── calendar_lang.php │ │ │ │ ├── upload_lang.php │ │ │ │ ├── email_lang.php │ │ │ │ ├── imglib_lang.php │ │ │ │ └── db_lang.php │ │ └── libraries │ │ │ ├── index.html │ │ │ ├── Cache │ │ │ ├── index.html │ │ │ └── drivers │ │ │ │ └── index.html │ │ │ ├── Session │ │ │ ├── index.html │ │ │ ├── drivers │ │ │ │ └── index.html │ │ │ └── SessionHandlerInterface.php │ │ │ └── Javascript │ │ │ └── index.html │ │ ├── application │ │ ├── .htaccess │ │ ├── cache │ │ │ ├── .htaccess │ │ │ └── index.html │ │ ├── views │ │ │ ├── errors │ │ │ │ ├── cli │ │ │ │ │ ├── error_404.php │ │ │ │ │ ├── error_general.php │ │ │ │ │ ├── error_db.php │ │ │ │ │ ├── index.html │ │ │ │ │ ├── error_php.php │ │ │ │ │ └── error_exception.php │ │ │ │ ├── index.html │ │ │ │ └── html │ │ │ │ │ ├── index.html │ │ │ │ │ ├── error_php.php │ │ │ │ │ ├── error_exception.php │ │ │ │ │ ├── error_general.php │ │ │ │ │ ├── error_db.php │ │ │ │ │ └── error_404.php │ │ │ ├── index.html │ │ │ └── welcome_message.php │ │ ├── index.html │ │ ├── core │ │ │ └── index.html │ │ ├── logs │ │ │ └── index.html │ │ ├── config │ │ │ ├── index.html │ │ │ ├── hooks.php │ │ │ ├── profiler.php │ │ │ ├── memcached.php │ │ │ ├── routes.php │ │ │ ├── doctypes.php │ │ │ ├── foreign_chars.php │ │ │ ├── migration.php │ │ │ └── smileys.php │ │ ├── helpers │ │ │ └── index.html │ │ ├── hooks │ │ │ └── index.html │ │ ├── language │ │ │ ├── index.html │ │ │ └── english │ │ │ │ └── index.html │ │ ├── libraries │ │ │ └── index.html │ │ ├── models │ │ │ └── index.html │ │ ├── controllers │ │ │ ├── index.html │ │ │ └── Welcome.php │ │ └── third_party │ │ │ └── index.html │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── composer.json │ │ ├── license.txt │ │ └── readme.rst ├── .craftsman ├── bootstrap.php └── unit │ └── NoteCommandTest.php ├── utils ├── templates │ ├── views │ │ └── base.php.twig │ ├── models │ │ └── base.php.twig │ ├── seeders │ │ └── base.php.twig │ ├── migrations │ │ ├── default.php.twig │ │ ├── create.php.twig │ │ └── modify.php.twig │ └── controllers │ │ └── base.php.twig ├── bootstrap.php ├── server.php ├── extend │ └── config │ │ └── migration.php └── codeigniter.php ├── src ├── Interfaces │ ├── Generator.php │ ├── Migration.php │ ├── Seeder.php │ └── Command.php ├── Core │ ├── Codeigniter.php │ └── Generator.php ├── Database │ └── Seeder.php ├── Commands │ ├── Migrations │ │ ├── Reset.php │ │ ├── Refresh.php │ │ ├── Info.php │ │ ├── Latest.php │ │ ├── Rollback.php │ │ └── Version.php │ ├── Generators │ │ ├── Model.php │ │ ├── Seeder.php │ │ └── Controller.php │ ├── Notes.php │ ├── Console.php │ ├── Serve.php │ └── Seeder.php ├── Traits │ └── Migration │ │ └── Info.php └── Hooks │ └── Reporter.php ├── .editorconfig ├── phpunit.xml ├── composer.json ├── README.md └── craftsman /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /vendor/ 3 | composer.lock 4 | -------------------------------------------------------------------------------- /.craftsman.example: -------------------------------------------------------------------------------- 1 | BASEPATH="./system/" 2 | APPPATH="./application/" 3 | CI_FCPATH="./public/" -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - '5.6' 4 | - '7.1' 5 | before_script: 6 | - composer install -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/fonts/texb.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CI-Craftsman/CLI/HEAD/tests/Codeigniter/3.1.4/system/fonts/texb.ttf -------------------------------------------------------------------------------- /utils/templates/views/base.php.twig: -------------------------------------------------------------------------------- 1 |

{{CLASS|upper}}#{{METHOD|upper}}

2 | 3 |

Find me in

{{VIEWPATH}}/{{METHOD|lower}}{{EXT}}

4 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/cache/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | -------------------------------------------------------------------------------- /tests/.craftsman: -------------------------------------------------------------------------------- 1 | BASEPATH = "./tests/Codeigniter/${CI_TEST_VERSION}/system" 2 | APPPATH = "./tests/Codeigniter/${CI_TEST_VERSION}/application" 3 | CI_FCPATH = "./tests/Codeigniter/${CI_TEST_VERSION}" 4 | -------------------------------------------------------------------------------- /src/Interfaces/Generator.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/errors/cli/error_db.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/core/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/logs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/fonts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/helpers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/language/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/libraries/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/cache/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/config/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/helpers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/hooks/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/language/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/libraries/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/models/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/core/compat/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/controllers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/third_party/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/errors/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/language/english/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/libraries/Cache/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/libraries/Session/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Interfaces/Seeder.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/errors/cli/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/errors/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/cubrid/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/ibase/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/mssql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/mysql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/mysqli/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/oci8/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/odbc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/pdo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/postgre/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/sqlite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/sqlite3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/sqlsrv/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/libraries/Cache/drivers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/libraries/Javascript/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Interfaces/Command.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/pdo/subdrivers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | # PHP PSR-2 Coding Standards 5 | # http://www.php-fig.org/psr/psr-2/ 6 | 7 | root = true 8 | 9 | [*.php] 10 | charset = utf-8 11 | end_of_line = lf 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | indent_style = space 15 | indent_size = 4 16 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | # Unix-style newlines with a newline ending every file 5 | [*] 6 | end_of_line = lf 7 | insert_final_newline = true 8 | 9 | # Matches multiple files with brace expansion notation 10 | # Set default charset 11 | [*] 12 | charset = utf-8 13 | 14 | # Tab indentation (no size specified) 15 | indent_style = tab 16 | -------------------------------------------------------------------------------- /utils/templates/models/base.php.twig: -------------------------------------------------------------------------------- 1 | load->database(); 12 | } 13 | } 14 | 15 | /* End of file {{ FILENAME }} */ 16 | /* Location: {{ PATH }}/{{ FILENAME }} */ 17 | -------------------------------------------------------------------------------- /utils/templates/seeders/base.php.twig: -------------------------------------------------------------------------------- 1 | db->truncate($this->table); 12 | 13 | $this->db->insert_batch($this->table, [ 14 | # your data here 15 | ]); 16 | } 17 | } 18 | 19 | /* End of file {{ FILENAME }} */ 20 | /* Location: {{ PATH }}/{{ FILENAME }} */ 21 | -------------------------------------------------------------------------------- /utils/templates/migrations/default.php.twig: -------------------------------------------------------------------------------- 1 | load->dbforge(); 8 | $this->load->database(); 9 | } 10 | 11 | public function up() 12 | { 13 | 14 | } 15 | 16 | public function down() 17 | { 18 | 19 | } 20 | } 21 | 22 | /* End of file {{FILENAME}} */ 23 | /* Location: {{PATH}}/{{FILENAME}} */ 24 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ./tests/unit/ 9 | 10 | 11 | 12 | 13 | ./src/ 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/config/hooks.php: -------------------------------------------------------------------------------- 1 | array( 15 | 'hostname' => '127.0.0.1', 16 | 'port' => '11211', 17 | 'weight' => '1', 18 | ), 19 | ); 20 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | application/cache/* 4 | !application/cache/index.html 5 | !application/cache/.htaccess 6 | 7 | application/logs/* 8 | !application/logs/index.html 9 | !application/logs/.htaccess 10 | 11 | composer.lock 12 | 13 | user_guide_src/build/* 14 | user_guide_src/cilexer/build/* 15 | user_guide_src/cilexer/dist/* 16 | user_guide_src/cilexer/pycilexer.egg-info/* 17 | /vendor/ 18 | 19 | # IDE Files 20 | #------------------------- 21 | /nbproject/ 22 | .idea/* 23 | 24 | ## Sublime Text cache files 25 | *.tmlanguage.cache 26 | *.tmPreferences.cache 27 | *.stTheme.cache 28 | *.sublime-workspace 29 | *.sublime-project 30 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "The CodeIgniter framework", 3 | "name": "codeigniter/framework", 4 | "type": "project", 5 | "homepage": "https://codeigniter.com", 6 | "license": "MIT", 7 | "support": { 8 | "forum": "http://forum.codeigniter.com/", 9 | "wiki": "https://github.com/bcit-ci/CodeIgniter/wiki", 10 | "irc": "irc://irc.freenode.net/codeigniter", 11 | "source": "https://github.com/bcit-ci/CodeIgniter" 12 | }, 13 | "require": { 14 | "php": ">=5.2.4" 15 | }, 16 | "suggest": { 17 | "paragonie/random_compat": "Provides better randomness in PHP 5.x" 18 | }, 19 | "require-dev": { 20 | "mikey179/vfsStream": "1.1.*", 21 | "phpunit/phpunit": "4.* || 5.*" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Core/Codeigniter.php: -------------------------------------------------------------------------------- 1 | getMessage())); 24 | } 25 | } 26 | 27 | public function &get() 28 | { 29 | return \CI_Controller::get_instance(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/errors/cli/error_php.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | A PHP Error was encountered 4 | 5 | Severity: 6 | Message: 7 | Filename: 8 | Line Number: 9 | 10 | 11 | 12 | Backtrace: 13 | 14 | 15 | File: 16 | Line: 17 | Function: 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/unit/NoteCommandTest.php: -------------------------------------------------------------------------------- 1 | add(new Notes); 12 | 13 | $command = $app->find('notes'); 14 | 15 | $tester = new CommandTester($command); 16 | 17 | $tester->execute(array( 18 | 'command' => $command->getName(), 19 | '--env' => sprintf('%s/tests/.craftsman', getcwd()) 20 | )); 21 | 22 | $output = trim(preg_replace('/\s\s+/', ' ', $tester->getDisplay())); 23 | 24 | $this->assertRegexp('/There are not notes marked./', $output); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/controllers/Welcome.php: -------------------------------------------------------------------------------- 1 | 19 | * @see https://codeigniter.com/user_guide/general/urls.html 20 | */ 21 | public function index() 22 | { 23 | $this->load->view('welcome_message'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/errors/cli/error_exception.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | An uncaught Exception was encountered 4 | 5 | Type: 6 | Message: 7 | Filename: getFile(), "\n"; ?> 8 | Line Number: getLine(); ?> 9 | 10 | 11 | 12 | Backtrace: 13 | getTrace() as $error): ?> 14 | 15 | File: 16 | Line: 17 | Function: 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/errors/html/error_php.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 7 |

A PHP Error was encountered

8 | 9 |

Severity:

10 |

Message:

11 |

Filename:

12 |

Line Number:

13 | 14 | 15 | 16 |

Backtrace:

17 | 18 | 19 | 20 | 21 |

22 | File:
23 | Line:
24 | Function: 25 |

26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
-------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/errors/html/error_exception.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 7 |

An uncaught Exception was encountered

8 | 9 |

Type:

10 |

Message:

11 |

Filename: getFile(); ?>

12 |

Line Number: getLine(); ?>

13 | 14 | 15 | 16 |

Backtrace:

17 | getTrace() as $error): ?> 18 | 19 | 20 | 21 |

22 | File:
23 | Line:
24 | Function: 25 |

26 | 27 | 28 | 29 | 30 | 31 | 32 |
-------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "craftsman/cli", 3 | "description": "Craftsman CLI provides a number of helpful commands for your use while developing your Codeigniter application.", 4 | "keywords": [ 5 | "craftsman", 6 | "codeigniter", 7 | "cli" 8 | ], 9 | "homepage": "https://github.com/davidsosavaldes/Craftsman", 10 | "license": "MIT", 11 | "authors": [ 12 | { 13 | "name": "David Sosa Valdes", 14 | "email": "david.sosa.valdes@gmail.com" 15 | } 16 | ], 17 | "require": { 18 | "php": ">=5.5.0", 19 | "symfony/console": "^3.0", 20 | "symfony/filesystem": "^3.0", 21 | "symfony/process": "^3.0", 22 | "symfony/finder": "^3.2", 23 | "twig/twig" : ">=1.27", 24 | "vlucas/phpdotenv": "^2.4", 25 | "psy/psysh": ">=0.8.11" 26 | }, 27 | "autoload": { 28 | "psr-4": { "Craftsman\\": "src/" } 29 | }, 30 | "support":{ 31 | "issues": "https://github.com/davidsosavaldes/Craftsman/issues" 32 | }, 33 | "bin": ["craftsman"], 34 | "extra": { 35 | "branch-alias": { 36 | "dev-master": "5.0.x-dev" 37 | } 38 | }, 39 | "require-dev": { 40 | "phpunit/phpunit": "^5.7" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /utils/server.php: -------------------------------------------------------------------------------- 1 | load->dbforge(); 8 | $this->load->database(); 9 | } 10 | 11 | public function up() 12 | { 13 | $this->create_{{TABLE_NAME}}_table(); 14 | } 15 | 16 | public function down() 17 | { 18 | $this->dbforge->drop_table('{{TABLE_NAME}}'); 19 | } 20 | 21 | private function create_{{TABLE_NAME}}_table() 22 | { 23 | $this->dbforge->add_field(array( 24 | 'id' => array( 25 | 'type' => 'INT', 26 | 'null' => FALSE, 27 | 'auto_increment' => TRUE, 28 | 'unsigned' => TRUE, 29 | 'constraint' => 5 30 | ),{% for field in FIELDS %}{% set command = argument(field) %} 31 | 32 | '{{command.name}}' => array( 33 | 'type' => '{{command.type|upper}}', 34 | 'constraint' => 100, 35 | 'null' => TRUE, 36 | ),{% endfor %} 37 | 38 | )); 39 | $this->dbforge->add_key('id', TRUE); 40 | $this->dbforge->create_table('{{TABLE_NAME}}', TRUE); 41 | } 42 | } 43 | 44 | /* End of file {{FILENAME}} */ 45 | /* Location: {{PATH}}/{{FILENAME}} */ 46 | -------------------------------------------------------------------------------- /utils/templates/migrations/modify.php.twig: -------------------------------------------------------------------------------- 1 | load->dbforge(); 8 | $this->load->database(); 9 | } 10 | 11 | public function up() 12 | { 13 | $this->{{TABLE_NAME}}_table(); 14 | } 15 | 16 | public function down() 17 | { 18 | /** 19 | * Uncomment bellow if you need to destroy the columns you modify. 20 | */ 21 | {% for field in FIELDS %}{% set command = argument(field) %} 22 | #$this->dbforge->drop_column('{{ TABLE_NAME|replace({REPLACE_TAG : ''}) }}', '{{command.name}}'); 23 | {% endfor %} 24 | } 25 | 26 | private function {{TABLE_NAME}}_table() 27 | { 28 | $fields = array({% for field in FIELDS %} 29 | {% set command = argument(field) %}'' => array( 30 | 'name' => '{{command.name}}', 31 | 'type' => '{{command.type|upper}}', 32 | ), 33 | {% endfor %} 34 | ); 35 | 36 | $this->dbforge->modify_column('{{ TABLE_NAME|replace({REPLACE_TAG : ''}) }}', $fields); 37 | } 38 | } 39 | 40 | /* End of file {{FILENAME}} */ 41 | /* Location: {{PATH}}/{{FILENAME}} */ 42 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/license.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 - 2017, British Columbia Institute of Technology 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /src/Database/Seeder.php: -------------------------------------------------------------------------------- 1 | CI =& $instance->get(); 38 | $this->CI->load->database(); 39 | $this->CI->load->dbforge(); 40 | 41 | $this->db = $this->CI->db; 42 | $this->dbforge = $this->CI->dbforge; 43 | } 44 | 45 | /** 46 | * Get CI properties 47 | * @param string $property Property name 48 | * @return object CI property (e.g. Model, Library, Config, etc...) 49 | */ 50 | public function __get($property) 51 | { 52 | return $this->CI->{$property}; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Latest Stable Version](https://poser.pugx.org/craftsman/cli/version?format=flat-square)](https://packagist.org/packages/craftsman/cli) [![Total Downloads](https://poser.pugx.org/craftsman/cli/downloads?format=flat-square)](https://packagist.org/packages/craftsman/cli) [![Latest Unstable Version](https://poser.pugx.org/craftsman/cli/v/unstable?format=flat-square)](//packagist.org/packages/craftsman/cli) [![License](https://poser.pugx.org/craftsman/cli/license?format=flat-square)](https://packagist.org/packages/craftsman/cli) [![composer.lock available](https://poser.pugx.org/craftsman/cli/composerlock?format=flat-square)](https://packagist.org/packages/craftsman/cli) [![Travis branch](https://travis-ci.org/CI-Craftsman/CLI.svg?branch=master&format=flat-square)](https://travis-ci.org/CI-Craftsman/CLI) 2 | 3 | **Documentation for Craftsman is available at [https://ci-craftsman.github.io/documentation/](https://ci-craftsman.github.io/documentation/).** 4 | 5 | # Craftsman CLI 6 | 7 | Craftsman is a command line interface that provides a set of commands that will help you when you're developing your application, in addition to make your job easier. It is driven by the Symfony Console component. 8 | 9 | ### Demo 10 | 11 | [![asciicast](https://asciinema.org/a/95481.png)](https://asciinema.org/a/95481) 12 | 13 | ### Related Projects for CodeIgniter 3.0 14 | 15 | * [kenjis/codeigniter-cli](https://github.com/kenjis/codeigniter-cli) 16 | -------------------------------------------------------------------------------- /src/Commands/Migrations/Reset.php: -------------------------------------------------------------------------------- 1 | migration->find_migrations(); 23 | $db_version = intval($this->migration->get_db_version()); 24 | $version = 0; 25 | 26 | $this->text($this->getMigrationMessage('DOWN', $version, $db_version)); 27 | 28 | $case = 'reverting'; 29 | $signal = '--'; 30 | 31 | $this->newLine(); 32 | 33 | $this->text($this->getSignalMessage($signal, $case)); 34 | 35 | $time_start = microtime(true); 36 | 37 | $this->migration->version($version); 38 | 39 | $time_end = microtime(true); 40 | 41 | list($query_exec_time, $exec_queries) = $this->measureQueries($this->migration->db->queries); 42 | 43 | $this->summary($signal, $time_start, $time_end, $query_exec_time, $exec_queries); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /craftsman: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | 14 | * @license MIT License 15 | * @link https://github.com/davidsosavaldes/Craftsman 16 | * @copyright Copyright (c) 2016, David Sosa Valdes. 17 | */ 18 | $commands = [ 19 | // Generators 20 | new Craftsman\Commands\Generators\Controller, 21 | new Craftsman\Commands\Generators\Model, 22 | new Craftsman\Commands\Generators\Migration, 23 | new Craftsman\Commands\Generators\Seeder, 24 | // Migrations 25 | new Craftsman\Commands\Migrations\Info, 26 | new Craftsman\Commands\Migrations\Version, 27 | new Craftsman\Commands\Migrations\Latest, 28 | new Craftsman\Commands\Migrations\Rollback, 29 | new Craftsman\Commands\Migrations\Reset, 30 | new Craftsman\Commands\Migrations\Refresh, 31 | // General 32 | new Craftsman\Commands\Serve, 33 | new Craftsman\Commands\Console, 34 | new Craftsman\Commands\Notes, 35 | new Craftsman\Commands\Seeder, 36 | ]; 37 | 38 | $application = new Application('Craftsman', CRAFTSMANVERSION); 39 | 40 | // Add the default commands 41 | foreach ($commands as $key => $command) 42 | { 43 | $application->add($command); 44 | } 45 | 46 | $application->run(); 47 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/errors/html/error_general.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | Error 8 | 57 | 58 | 59 |
60 |

61 | 62 |
63 | 64 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/errors/html/error_db.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | Database Error 8 | 57 | 58 | 59 |
60 |

61 | 62 |
63 | 64 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/views/errors/html/error_404.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 404 Page Not Found 8 | 57 | 58 | 59 |
60 |

61 | 62 |
63 | 64 | -------------------------------------------------------------------------------- /src/Commands/Migrations/Refresh.php: -------------------------------------------------------------------------------- 1 | migration->find_migrations(); 23 | $db_version = intval($this->migration->get_db_version()); 24 | $version = 0; 25 | $case = 'refreshing'; 26 | $signal = '--'; 27 | 28 | $this->newLine(); 29 | 30 | $this->text($this->getSignalMessage($signal, $case)); 31 | 32 | $this->text($this->getMigrationMessage('DOWN', $version, $db_version)); 33 | 34 | $time_start = microtime(true); 35 | 36 | $this->migration->version($version); 37 | 38 | $this->text($this->getMigrationMessage('UP', 'LATEST', $db_version)); 39 | 40 | $case = 'migrating'; 41 | $signal = '++'; 42 | 43 | $this->migration->latest(); 44 | 45 | $time_end = microtime(true); 46 | 47 | list($query_exec_time, $exec_queries) = $this->measureQueries($this->migration->db->queries); 48 | 49 | $this->summary($signal, $time_start, $time_end, $query_exec_time, $exec_queries); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Commands/Migrations/Info.php: -------------------------------------------------------------------------------- 1 | migration->find_migrations(); 25 | $db_version = $this->migration->get_db_version(); 26 | $latest_version = $this->migration->get_latest_version($migrations); 27 | 28 | $this->newLine(); 29 | 30 | $this->table( 31 | ['Name', 'Type', 'Database version'], 32 | [ 33 | [ 34 | $this->migration->get_module_name(), 35 | $this->migration->get_type(), 36 | $db_version 37 | ] 38 | ] 39 | ); 40 | 41 | $this->text(sprintf('Local version: %s', $latest_version)); 42 | 43 | if ($latest_version < $db_version) 44 | { 45 | $this->caution('Could not find any migrations, check the migration path.'); 46 | } 47 | elseif ($latest_version > $db_version) 48 | { 49 | $this->note("The Database is not up-to-date, run 'migrate:latest'"); 50 | } 51 | else 52 | { 53 | $this->success('Database is up-to-date.'); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /utils/templates/controllers/base.php.twig: -------------------------------------------------------------------------------- 1 | ] 85 | * @return [type] [] 86 | */ 87 | public function {{action}}() 88 | { 89 | 90 | } 91 | {% endfor %}{% endif %} 92 | } 93 | 94 | /* End of file {{ FILENAME }} */ 95 | /* Location: {{ PATH }}/{{ FILENAME }} */ 96 | -------------------------------------------------------------------------------- /src/Commands/Migrations/Latest.php: -------------------------------------------------------------------------------- 1 | migration->find_migrations(); 23 | $version = $this->migration->get_latest_version($migrations); 24 | $db_version = intval($this->migration->get_db_version()); 25 | 26 | if ($version == $db_version) 27 | { 28 | return $this->note('Database is up-to-date'); 29 | } 30 | elseif ($version > $db_version) 31 | { 32 | $this->text($this->getMigrationMessage('UP', $version, $db_version)); 33 | 34 | $case = 'migrating'; 35 | $signal = '++'; 36 | } 37 | else 38 | { 39 | $this->text($this->getMigrationMessage('DOWN', $version, $db_version)); 40 | 41 | $case = 'reverting'; 42 | $signal = '--'; 43 | } 44 | 45 | $this->newLine(); 46 | $this->text($this->getSignalMessage($signal, $case)); 47 | 48 | $time_start = microtime(true); 49 | 50 | $this->migration->latest(); 51 | 52 | $time_end = microtime(true); 53 | 54 | list($query_exec_time, $exec_queries) = $this->measureQueries($this->migration->db->queries); 55 | 56 | $this->summary($signal, $time_start, $time_end, $query_exec_time, $exec_queries); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Commands/Generators/Model.php: -------------------------------------------------------------------------------- 1 | getArgument('filename')); 23 | $appPath = realpath(getenv('APPPATH')); 24 | $appDir = basename($appPath); 25 | 26 | $this->text(sprintf('Model path: ./%s/models', $appDir)); 27 | $this->text(sprintf('Filename: %s_model.php', $filename)); 28 | 29 | // Confirm the action 30 | if ($this->confirm(sprintf('Do you want to create a %s Model?', $filename), true)) 31 | { 32 | // We could try to create a directory if doesn't exist. 33 | $this->createDirectory(sprintf('%s/models', $appPath)); 34 | 35 | $testFile = sprintf('%s/models/%s_model.php', $appPath, $filename); 36 | 37 | $options = array( 38 | 'NAME' => sprintf('%s_model', $filename), 39 | 'COLLECTION' => $filename, 40 | 'FILENAME' => basename($testFile), 41 | 'PATH' => sprintf('./%s/models', $appDir) 42 | ); 43 | 44 | if ($this->make($testFile, 'models/base.php.twig', $options)) 45 | { 46 | $this->success('Model created successfully!'); 47 | } 48 | } 49 | else 50 | { 51 | $this->warning('Process aborted!'); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Commands/Generators/Seeder.php: -------------------------------------------------------------------------------- 1 | getArgument('filename')); 23 | $appPath = realpath(getenv('APPPATH')); 24 | $appDir = basename($appPath); 25 | 26 | $this->text(sprintf('Seeder path: ./%s/seeders', $appDir)); 27 | $this->text(sprintf('Filename: %s.php', $filename)); 28 | 29 | // Confirm the action 30 | if ($this->confirm(sprintf('Do you want to create a %s Seeder?', $filename), true)) 31 | { 32 | // We could try to create a directory if doesn't exist. 33 | $this->createDirectory(sprintf('%s/seeders', $appPath)); 34 | 35 | $testFile = sprintf('%s/seeders/%s.php', $appPath, $filename); 36 | 37 | $options = array( 38 | 'NAME' => $filename, 39 | 'COLLECTION' => $filename, 40 | 'FILENAME' => basename($testFile), 41 | 'PATH' => sprintf('./%s/seeders', $appDir) 42 | ); 43 | 44 | if ($this->make($testFile, 'seeders/base.php.twig', $options)) 45 | { 46 | $this->success('Model created successfully!'); 47 | } 48 | } 49 | else 50 | { 51 | $this->warning('Process aborted!'); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Commands/Migrations/Rollback.php: -------------------------------------------------------------------------------- 1 | migration->find_migrations(); 23 | $versions = array_map('intval', array_keys($migrations)); 24 | $db_version = intval($this->migration->get_db_version()); 25 | 26 | end($versions); 27 | 28 | while ($version = prev($versions)) 29 | { 30 | if ($version !== $db_version) 31 | { 32 | break; 33 | } 34 | } 35 | 36 | if (($version + $db_version) <= 0) 37 | { 38 | return $this->note("Can't rollback anymore"); 39 | } 40 | else 41 | { 42 | $version === false && $version = 0; 43 | 44 | $this->text($this->getMigrationMessage('DOWN', $version, $db_version)); 45 | 46 | $case = 'reverting'; 47 | $signal = '--'; 48 | } 49 | 50 | $this->newLine(); 51 | 52 | $this->text($this->getSignalMessage($signal, $case)); 53 | 54 | $time_start = microtime(true); 55 | 56 | $this->migration->version($version); 57 | 58 | $time_end = microtime(true); 59 | 60 | list($query_exec_time, $exec_queries) = $this->measureQueries($this->migration->db->queries); 61 | 62 | $this->summary($signal, $time_start, $time_end, $query_exec_time, $exec_queries); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/language/english/number_lang.php: -------------------------------------------------------------------------------- 1 | ignoreUnreadableDirs()->files()->name('*.php')->in($appPath); 36 | 37 | $this->writeln([sprintf('In: ./%s/',$appDir), str_repeat('-', 60)]); 38 | 39 | foreach ($finder as $file) 40 | { 41 | $_file = new \SplFileObject($file->getRealPath()); 42 | 43 | foreach ($_file as $k => $line) { 44 | $exp = preg_match('/TODO|FIXME/', $line); 45 | 46 | if ($exp > 0) { 47 | $line = str_replace(['//','#','TODO:','FIXME:'], ['','','[TODO]','[FIXME]'], trim($line)); 48 | $found[$file->getRelativePath().'/'. basename($file)][] = "[{$k}]{$line}"; 49 | } 50 | } 51 | } 52 | 53 | if (empty($found)) 54 | { 55 | $this->text('There are not notes marked.'); 56 | $this->newLine(); 57 | } 58 | else 59 | { 60 | foreach ($found as $file => $lines) 61 | { 62 | $this->text(sprintf('./%s/%s:', $appDir, $file)); 63 | $this->newLine(); 64 | $this->listing($lines); 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Commands/Migrations/Version.php: -------------------------------------------------------------------------------- 1 | addArgument( 27 | 'version', 28 | InputArgument::REQUIRED, 29 | 'The version name' 30 | ); 31 | } 32 | 33 | public function start() 34 | { 35 | $version = abs($this->getArgument('version')); 36 | $db_version = intval($this->migration->get_db_version()); 37 | 38 | if ($version == $db_version) 39 | { 40 | return $this->note('Database is up-to-date'); 41 | } 42 | elseif ($version > $db_version) 43 | { 44 | $this->text($this->getMigrationMessage('UP', $version, $db_version)); 45 | 46 | $case = 'migrating'; 47 | $signal = '++'; 48 | } 49 | else 50 | { 51 | $this->text($this->getMigrationMessage('DOWN', $version, $db_version)); 52 | 53 | $case = 'reverting'; 54 | $signal = '--'; 55 | } 56 | 57 | $this->newLine(); 58 | 59 | $this->text($this->getSignalMessage($signal, $case)); 60 | 61 | $time_start = microtime(true); 62 | 63 | $this->migration->version($version); 64 | 65 | $time_end = microtime(true); 66 | 67 | list($query_exec_time, $exec_queries) = $this->measureQueries($this->migration->db->queries); 68 | 69 | $this->summary($signal, $time_start, $time_end, $query_exec_time, $exec_queries); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/config/routes.php: -------------------------------------------------------------------------------- 1 | my_controller/index 50 | | my-controller/my-method -> my_controller/my_method 51 | */ 52 | $route['default_controller'] = 'welcome'; 53 | $route['404_override'] = ''; 54 | $route['translate_uri_dashes'] = FALSE; 55 | -------------------------------------------------------------------------------- /src/Traits/Migration/Info.php: -------------------------------------------------------------------------------- 1 | migration->getTable(); 21 | $query_exec_time = 0; 22 | $exec_queries = 0; 23 | 24 | $this->newLine(); 25 | 26 | for ($i = 0; $i < count($queries); $i++) 27 | { 28 | if ((! strpos($queries[$i], $migration_table)) 29 | && (! strpos($queries[$i], $this->migration->db->database))) 30 | { 31 | $this->text(sprintf('-> %s', $queries[$i])); 32 | 33 | $query_exec_time += $this->migration->db->query_times[$i]; 34 | $exec_queries += 1; 35 | } 36 | } 37 | return array($query_exec_time, $exec_queries); 38 | } 39 | 40 | /** 41 | * Display in the console all the migration processes 42 | * 43 | * @param string $signal Migration command signal (++,--) 44 | * @param float $time_start Unix timestamp with microseconds from the start of process 45 | * @param float $time_end Unix timestamp with microseconds from the end of process 46 | * @param float $query_exec_time Queries execution time in seconds 47 | * @param int $exec_queries Amount of executed queries 48 | */ 49 | protected function summary($signal, $time_start, $time_end, $query_exec_time, $exec_queries) 50 | { 51 | $this->newLine(); 52 | $this->text(sprintf( 53 | '%s query process (%s s)', $signal, number_format($query_exec_time, 4) 54 | )); 55 | $this->newLine(); 56 | $this->text(sprintf('%s', str_repeat('-', 30))); 57 | $this->newLine(); 58 | $this->text(sprintf( 59 | '++ finished in %s s', number_format(($time_end - $time_start), 4) 60 | )); 61 | $this->text(sprintf('++ %s sql queries', $exec_queries)); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/sqlite3/sqlite3_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsupported_feature'); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/sqlite/sqlite_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsupported_feature'); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/pdo/pdo_forge.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | Welcome to CodeIgniter 8 | 9 | 67 | 68 | 69 | 70 |
71 |

Welcome to CodeIgniter!

72 | 73 |
74 |

The page you are looking at is being generated dynamically by CodeIgniter.

75 | 76 |

If you would like to edit this page you'll find it located at:

77 | application/views/welcome_message.php 78 | 79 |

The corresponding controller for this page is found at:

80 | application/controllers/Welcome.php 81 | 82 |

If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.

83 |
84 | 85 | 86 |
87 | 88 | 89 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/odbc/odbc_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsupported_feature'); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/pdo/pdo_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsupported_feature'); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/config/doctypes.php: -------------------------------------------------------------------------------- 1 | '', 6 | 'xhtml1-strict' => '', 7 | 'xhtml1-trans' => '', 8 | 'xhtml1-frame' => '', 9 | 'xhtml-basic11' => '', 10 | 'html5' => '', 11 | 'html4-strict' => '', 12 | 'html4-trans' => '', 13 | 'html4-frame' => '', 14 | 'mathml1' => '', 15 | 'mathml2' => '', 16 | 'svg10' => '', 17 | 'svg11' => '', 18 | 'svg11-basic' => '', 19 | 'svg11-tiny' => '', 20 | 'xhtml-math-svg-xh' => '', 21 | 'xhtml-math-svg-sh' => '', 22 | 'xhtml-rdfa-1' => '', 23 | 'xhtml-rdfa-2' => '' 24 | ); 25 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/libraries/Session/SessionHandlerInterface.php: -------------------------------------------------------------------------------- 1 | getApplication()->setCatchExceptions(false); 47 | 48 | try 49 | { 50 | // Create a Codeigniter instance 51 | $CI = new Codeigniter; $CI =& $CI->get(); 52 | 53 | $config = new Configuration; // TODO: Create a method that configures the Psy\Shell 54 | $shell = new Shell($config); 55 | 56 | $this->writeln([ 57 | sprintf('Craftsman %s - Console',$this->getApplication()->getVersion()), 58 | str_repeat('-', 60), 59 | 'Codeigniter : $CI', 60 | sprintf('App Path: ./%s/', basename(APPPATH)), 61 | str_repeat('-', 60) 62 | ]); 63 | 64 | $shell->setScopeVariables(['CI' => $CI]); 65 | $shell->addCommands($this->getCommands()); 66 | $shell->run(); 67 | } 68 | catch (Exception $e) 69 | { 70 | echo $e->getMessage() . PHP_EOL; 71 | // TODO: this triggers the "exited unexpectedly" logic in the 72 | // ForkingLoop, so we can't exit(1) after starting the shell... 73 | // exit(1); 74 | } 75 | } 76 | 77 | private function getCommands() 78 | { 79 | $commands = []; 80 | foreach ($this->getApplication()->all() as $name => $command) 81 | { 82 | in_array($name, $this->commandWhitelist) && $commands[] = $command; 83 | } 84 | return $commands; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/oci8/oci8_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsupported_feature'); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/readme.rst: -------------------------------------------------------------------------------- 1 | ################### 2 | What is CodeIgniter 3 | ################### 4 | 5 | CodeIgniter is an Application Development Framework - a toolkit - for people 6 | who build web sites using PHP. Its goal is to enable you to develop projects 7 | much faster than you could if you were writing code from scratch, by providing 8 | a rich set of libraries for commonly needed tasks, as well as a simple 9 | interface and logical structure to access these libraries. CodeIgniter lets 10 | you creatively focus on your project by minimizing the amount of code needed 11 | for a given task. 12 | 13 | ******************* 14 | Release Information 15 | ******************* 16 | 17 | This repo contains in-development code for future releases. To download the 18 | latest stable release please visit the `CodeIgniter Downloads 19 | `_ page. 20 | 21 | ************************** 22 | Changelog and New Features 23 | ************************** 24 | 25 | You can find a list of all changes for each release in the `user 26 | guide change log `_. 27 | 28 | ******************* 29 | Server Requirements 30 | ******************* 31 | 32 | PHP version 5.6 or newer is recommended. 33 | 34 | It should work on 5.3.7 as well, but we strongly advise you NOT to run 35 | such old versions of PHP, because of potential security and performance 36 | issues, as well as missing features. 37 | 38 | ************ 39 | Installation 40 | ************ 41 | 42 | Please see the `installation section `_ 43 | of the CodeIgniter User Guide. 44 | 45 | ******* 46 | License 47 | ******* 48 | 49 | Please see the `license 50 | agreement `_. 51 | 52 | ********* 53 | Resources 54 | ********* 55 | 56 | - `User Guide `_ 57 | - `Language File Translations `_ 58 | - `Community Forums `_ 59 | - `Community Wiki `_ 60 | - `Community IRC `_ 61 | 62 | Report security issues to our `Security Panel `_ 63 | or via our `page on HackerOne `_, thank you. 64 | 65 | *************** 66 | Acknowledgement 67 | *************** 68 | 69 | The CodeIgniter team would like to thank EllisLab, all the 70 | contributors to the CodeIgniter project and you, the CodeIgniter user. 71 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/pdo/subdrivers/pdo_odbc_forge.php: -------------------------------------------------------------------------------- 1 | db->hostname, $this->db->username, $this->db->password)) 58 | { 59 | $res = ibase_backup($service, $this->db->database, $filename.'.fbk'); 60 | 61 | // Close the service connection 62 | ibase_service_detach($service); 63 | return $res; 64 | } 65 | 66 | return FALSE; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/language/english/unit_test_lang.php: -------------------------------------------------------------------------------- 1 | CI =& get_instance(); 15 | $this->fh = fopen('php://stdout', 'a'); //both (a)ppending, and (w)riting will work 16 | } 17 | 18 | public function request() 19 | { 20 | $date = date('D M t h:i:s Y', $_SERVER['REQUEST_TIME']); 21 | $addr = $_SERVER['REMOTE_ADDR']; 22 | $port = $_SERVER['REMOTE_PORT']; 23 | $status = http_response_code(); 24 | $uri = $_SERVER['REQUEST_URI']; 25 | 26 | fwrite($this->fh, "[{$date}] {$addr}:{$port} [{$status}]: {$uri}\n"); 27 | } 28 | 29 | public function queries() 30 | { 31 | foreach (get_object_vars($this->CI) as $name => $cobject) { 32 | if (is_object($cobject)) { 33 | if ($cobject instanceof \CI_Model) { 34 | foreach (get_object_vars($cobject) as $mname => $mobject) { 35 | if ($mobject instanceof \CI_DB) { 36 | $dbs[get_class($cobject).':$'.$mname] = $mobject; 37 | } 38 | } 39 | } elseif ($cobject instanceof \CI_DB) { 40 | $dbs[get_class($this->CI).':$'.$name] = $cobject; 41 | } 42 | } 43 | } 44 | 45 | if (isset($dbs)) { 46 | foreach ($dbs as $name => $db) { 47 | foreach ($db->queries as $key => $val) { 48 | $time = number_format($db->query_times[$key], 4); 49 | $val = trim(preg_replace('/\s+/', ' ', $val)); 50 | 51 | fwrite($this->fh, "{$name} ({$time}) {$val}\n"); 52 | } 53 | } 54 | } 55 | } 56 | 57 | public static function hook() 58 | { 59 | $repeater = rtrim(str_repeat('../', substr_count(APPPATH, '/')), '/'); 60 | return [ 61 | 'post_controller_constructor' => [ 62 | 'class' => '\Craftsman\Hooks\Reporter', 63 | 'function' => 'request', 64 | 'filename' => 'Reporter.php', 65 | 'filepath' => "{$repeater}".__DIR__ 66 | ], 67 | 'post_controller' => [ 68 | 'class' => '\Craftsman\Hooks\Reporter', 69 | 'function' => 'queries', 70 | 'filename' => 'Reporter.php', 71 | 'filepath' => "{$repeater}".__DIR__ 72 | ] 73 | ]; 74 | } 75 | 76 | public function __destruct() 77 | { 78 | fclose($this->fh); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/mssql/mssql_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsupported_feature'); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/sqlsrv/sqlsrv_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsupported_feature'); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/postgre/postgre_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsupported_feature'); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/core/Model.php: -------------------------------------------------------------------------------- 1 | $key; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/helpers/language_helper.php: -------------------------------------------------------------------------------- 1 | lang->line($line); 67 | 68 | if ($for !== '') 69 | { 70 | $line = ''; 71 | } 72 | 73 | return $line; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/database/drivers/odbc/odbc_forge.php: -------------------------------------------------------------------------------- 1 | db->data_cache['db_names'])) 57 | { 58 | return $this->db->data_cache['db_names']; 59 | } 60 | 61 | return $this->db->data_cache['db_names'] = cubrid_list_dbs($this->db->conn_id); 62 | } 63 | 64 | // -------------------------------------------------------------------- 65 | 66 | /** 67 | * CUBRID Export 68 | * 69 | * @param array Preferences 70 | * @return mixed 71 | */ 72 | protected function _backup($params = array()) 73 | { 74 | // No SQL based support in CUBRID as of version 8.4.0. Database or 75 | // table backup can be performed using CUBRID Manager 76 | // database administration tool. 77 | return $this->db->display_error('db_unsupported_feature'); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/language/english/profiler_lang.php: -------------------------------------------------------------------------------- 1 | 'ae', 14 | '/ö|œ/' => 'oe', 15 | '/ü/' => 'ue', 16 | '/Ä/' => 'Ae', 17 | '/Ü/' => 'Ue', 18 | '/Ö/' => 'Oe', 19 | '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A', 20 | '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a', 21 | '/Б/' => 'B', 22 | '/б/' => 'b', 23 | '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', 24 | '/ç|ć|ĉ|ċ|č/' => 'c', 25 | '/Д/' => 'D', 26 | '/д/' => 'd', 27 | '/Ð|Ď|Đ|Δ/' => 'Dj', 28 | '/ð|ď|đ|δ/' => 'dj', 29 | '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E', 30 | '/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e', 31 | '/Ф/' => 'F', 32 | '/ф/' => 'f', 33 | '/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G', 34 | '/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g', 35 | '/Ĥ|Ħ/' => 'H', 36 | '/ĥ|ħ/' => 'h', 37 | '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I', 38 | '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i', 39 | '/Ĵ/' => 'J', 40 | '/ĵ/' => 'j', 41 | '/Ķ|Κ|К/' => 'K', 42 | '/ķ|κ|к/' => 'k', 43 | '/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L', 44 | '/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l', 45 | '/М/' => 'M', 46 | '/м/' => 'm', 47 | '/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N', 48 | '/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n', 49 | '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O', 50 | '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o', 51 | '/П/' => 'P', 52 | '/п/' => 'p', 53 | '/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R', 54 | '/ŕ|ŗ|ř|ρ|р/' => 'r', 55 | '/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S', 56 | '/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's', 57 | '/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T', 58 | '/ț|ţ|ť|ŧ|т/' => 't', 59 | '/Þ|þ/' => 'th', 60 | '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U', 61 | '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u', 62 | '/Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y', 63 | '/ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y', 64 | '/В/' => 'V', 65 | '/в/' => 'v', 66 | '/Ŵ/' => 'W', 67 | '/ŵ/' => 'w', 68 | '/Ź|Ż|Ž|Ζ|З/' => 'Z', 69 | '/ź|ż|ž|ζ|з/' => 'z', 70 | '/Æ|Ǽ/' => 'AE', 71 | '/ß/' => 'ss', 72 | '/IJ/' => 'IJ', 73 | '/ij/' => 'ij', 74 | '/Œ/' => 'OE', 75 | '/ƒ/' => 'f', 76 | '/ξ/' => 'ks', 77 | '/π/' => 'p', 78 | '/β/' => 'v', 79 | '/μ/' => 'm', 80 | '/ψ/' => 'ps', 81 | '/Ё/' => 'Yo', 82 | '/ё/' => 'yo', 83 | '/Є/' => 'Ye', 84 | '/є/' => 'ye', 85 | '/Ї/' => 'Yi', 86 | '/Ж/' => 'Zh', 87 | '/ж/' => 'zh', 88 | '/Х/' => 'Kh', 89 | '/х/' => 'kh', 90 | '/Ц/' => 'Ts', 91 | '/ц/' => 'ts', 92 | '/Ч/' => 'Ch', 93 | '/ч/' => 'ch', 94 | '/Ш/' => 'Sh', 95 | '/ш/' => 'sh', 96 | '/Щ/' => 'Shch', 97 | '/щ/' => 'shch', 98 | '/Ъ|ъ|Ь|ь/' => '', 99 | '/Ю/' => 'Yu', 100 | '/ю/' => 'yu', 101 | '/Я/' => 'Ya', 102 | '/я/' => 'ya' 103 | ); 104 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/helpers/email_helper.php: -------------------------------------------------------------------------------- 1 | ', '"', "'", '-'), 76 | array('&', '<', '>', '"', ''', '-'), 77 | $str 78 | ); 79 | 80 | // Decode the temp markers back to entities 81 | $str = preg_replace('/'.$temp.'(\d+);/', '&#\\1;', $str); 82 | 83 | if ($protect_all === TRUE) 84 | { 85 | return preg_replace('/'.$temp.'(\w+);/', '&\\1;', $str); 86 | } 87 | 88 | return $str; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/Commands/Generators/Controller.php: -------------------------------------------------------------------------------- 1 | getArgument('filename')); 23 | $appPath = realpath(getenv('APPPATH')); 24 | $appDir = basename($appPath); 25 | $controllersPath = sprintf('%s/controllers', $appPath); 26 | $viewsPath = sprintf('%s/views', $appPath); 27 | 28 | $this->text(sprintf( 29 | 'Controller path: ./%s/controllers', 30 | $appDir 31 | )); 32 | 33 | $this->text(sprintf('Filename: %s.php', $filename)); 34 | 35 | // Confirm the action 36 | if ($this->confirm(sprintf('Do you want to create a %s Controller?', $filename), true)) 37 | { 38 | $controllerFile = sprintf('%s/%s.php', $controllersPath, $filename); 39 | 40 | $this->createDirectory($controllersPath); 41 | 42 | $options = array( 43 | 'NAME' => $filename, 44 | 'COLLECTION' => strtolower($filename), 45 | 'FILENAME' => basename($controllerFile), 46 | 'PATH' => sprintf('./%s/controllers', $appDir), 47 | 'ACTIONS' => $this->getArgument('options') 48 | ); 49 | 50 | $this->comment('Controller'); 51 | 52 | if ($this->make($controllerFile, 'controllers/base.php.twig', $options)) 53 | { 54 | $this->text(sprintf('create %s/controllers/%s', 55 | $appDir, basename($controllerFile) 56 | )); 57 | } 58 | 59 | $views = empty($options['ACTIONS']) 60 | ? array('index','get','create','edit') 61 | : $options['ACTIONS']; 62 | 63 | $resourcePath = sprintf('%s/%s', $viewsPath, strtolower($filename)); 64 | 65 | $this->createDirectory($resourcePath); 66 | 67 | $options['EXT'] = '.php'; 68 | $options['CLASS'] = $filename; 69 | $options['VIEWPATH'] = sprintf('./%s/views', $appDir); 70 | 71 | $this->comment('Views'); 72 | 73 | foreach ($views as $view) 74 | { 75 | $viewFile = sprintf('%s/%s.php', $resourcePath, $view); 76 | $options['METHOD'] = $view; 77 | 78 | $this->make($viewFile, 'views/base.php.twig', $options); 79 | 80 | $this->text(sprintf('create %s/views/%s', 81 | $appDir, basename($viewFile) 82 | )); 83 | } 84 | } else { 85 | $this->warning('Process aborted!'); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/core/Controller.php: -------------------------------------------------------------------------------- 1 | $class) 74 | { 75 | $this->$var =& load_class($class); 76 | } 77 | 78 | $this->load =& load_class('Loader', 'core'); 79 | $this->load->initialize(); 80 | log_message('info', 'Controller Class Initialized'); 81 | } 82 | 83 | // -------------------------------------------------------------------- 84 | 85 | /** 86 | * Get the CI singleton 87 | * 88 | * @static 89 | * @return object 90 | */ 91 | public static function &get_instance() 92 | { 93 | return self::$instance; 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /utils/extend/config/migration.php: -------------------------------------------------------------------------------- 1 | migration->current() this is the version that schema will 69 | | be upgraded / downgraded to. 70 | | 71 | */ 72 | $config['migration_version'] = 0; 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Migrations Path 77 | |-------------------------------------------------------------------------- 78 | | 79 | | Path to your migrations folder. 80 | | Typically, it will be within your application path. 81 | | Also, writing permission is required within the migrations path. 82 | | 83 | */ 84 | $config['migration_path'] = APPPATH.'migrations/'; 85 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/config/migration.php: -------------------------------------------------------------------------------- 1 | migration->current() this is the version that schema will 69 | | be upgraded / downgraded to. 70 | | 71 | */ 72 | $config['migration_version'] = 0; 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Migrations Path 77 | |-------------------------------------------------------------------------- 78 | | 79 | | Path to your migrations folder. 80 | | Typically, it will be within your application path. 81 | | Also, writing permission is required within the migrations path. 82 | | 83 | */ 84 | $config['migration_path'] = APPPATH.'migrations/'; 85 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/language/english/calendar_lang.php: -------------------------------------------------------------------------------- 1 | lang->load('number'); 65 | 66 | if ($num >= 1000000000000) 67 | { 68 | $num = round($num / 1099511627776, $precision); 69 | $unit = $CI->lang->line('terabyte_abbr'); 70 | } 71 | elseif ($num >= 1000000000) 72 | { 73 | $num = round($num / 1073741824, $precision); 74 | $unit = $CI->lang->line('gigabyte_abbr'); 75 | } 76 | elseif ($num >= 1000000) 77 | { 78 | $num = round($num / 1048576, $precision); 79 | $unit = $CI->lang->line('megabyte_abbr'); 80 | } 81 | elseif ($num >= 1000) 82 | { 83 | $num = round($num / 1024, $precision); 84 | $unit = $CI->lang->line('kilobyte_abbr'); 85 | } 86 | else 87 | { 88 | $unit = $CI->lang->line('bytes'); 89 | return number_format($num).' '.$unit; 90 | } 91 | 92 | return number_format($num, $precision).' '.$unit; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/Commands/Serve.php: -------------------------------------------------------------------------------- 1 | addOption( 36 | 'host', 37 | NULL, 38 | InputOption::VALUE_OPTIONAL, 39 | 'The host address to serve the application on.', 40 | 'localhost' 41 | ) 42 | ->addOption( 43 | 'docroot', 44 | NULL, 45 | InputOption::VALUE_OPTIONAL, 46 | 'Specify an explicit document root.', 47 | FALSE 48 | ) 49 | ->addOption( 50 | 'port', 51 | NULL, 52 | InputOption::VALUE_OPTIONAL, 53 | 'The port to serve the application on.', 54 | 8000 55 | ); 56 | } 57 | 58 | /** 59 | * Execute the console command. 60 | * 61 | * @return void 62 | * @throws \Exception 63 | */ 64 | public function start() 65 | { 66 | try 67 | { 68 | $host = $this->getOption('host'); 69 | $port = intval($this->getOption('port')); 70 | $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); 71 | $docroot = ProcessUtils::escapeArgument($this->getOption('docroot')); 72 | $output = $this->output; 73 | 74 | $this->writeln([ 75 | sprintf('Codeigniter development server started at %s', date(DATE_RFC2822)), 76 | sprintf('Listening on http://%s:%s', $host, $port), 77 | sprintf('Document root is %s', getcwd()), 78 | 'Press Ctrl-C to quit.' 79 | ]); 80 | 81 | $process = new Process(sprintf('%s -S %s:%s -t %s', $binary, $host, $port, $docroot)); 82 | 83 | $process 84 | // ->setWorkingDirectory(getcwd()) 85 | ->setTimeout(0) 86 | ->setPTY(true) 87 | ->run(function ($type, $buffer) use($output) { 88 | if (Process::ERR === $type && $output instanceof ConsoleOutputInterface) { 89 | $output = $output->getErrorOutput(); 90 | } 91 | $output->write($buffer, false, OutputInterface::OUTPUT_RAW); 92 | }); 93 | } 94 | catch (Exception $e) 95 | { 96 | $this->error(sprintf( 97 | 'Error starting the server: %s', $e->getMessage() 98 | )); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/application/config/smileys.php: -------------------------------------------------------------------------------- 1 | array('grin.gif', '19', '19', 'grin'), 21 | ':lol:' => array('lol.gif', '19', '19', 'LOL'), 22 | ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), 23 | ':)' => array('smile.gif', '19', '19', 'smile'), 24 | ';-)' => array('wink.gif', '19', '19', 'wink'), 25 | ';)' => array('wink.gif', '19', '19', 'wink'), 26 | ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), 27 | ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), 28 | ':-S' => array('confused.gif', '19', '19', 'confused'), 29 | ':wow:' => array('surprise.gif', '19', '19', 'surprised'), 30 | ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), 31 | ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), 32 | '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), 33 | ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), 34 | ':P' => array('raspberry.gif', '19', '19', 'raspberry'), 35 | ':blank:' => array('blank.gif', '19', '19', 'blank stare'), 36 | ':long:' => array('longface.gif', '19', '19', 'long face'), 37 | ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), 38 | ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), 39 | ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), 40 | '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), 41 | ':down:' => array('downer.gif', '19', '19', 'downer'), 42 | ':red:' => array('embarrassed.gif', '19', '19', 'red face'), 43 | ':sick:' => array('sick.gif', '19', '19', 'sick'), 44 | ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), 45 | ':-/' => array('hmm.gif', '19', '19', 'hmmm'), 46 | '>:(' => array('mad.gif', '19', '19', 'mad'), 47 | ':mad:' => array('mad.gif', '19', '19', 'mad'), 48 | '>:-(' => array('angry.gif', '19', '19', 'angry'), 49 | ':angry:' => array('angry.gif', '19', '19', 'angry'), 50 | ':zip:' => array('zip.gif', '19', '19', 'zipper'), 51 | ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), 52 | ':ahhh:' => array('shock.gif', '19', '19', 'shock'), 53 | ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), 54 | ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), 55 | ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), 56 | ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), 57 | ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), 58 | ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), 59 | ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), 60 | ':snake:' => array('snake.gif', '19', '19', 'snake'), 61 | ':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'), 62 | ':question:' => array('question.gif', '19', '19', 'question') 63 | 64 | ); 65 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/language/english/upload_lang.php: -------------------------------------------------------------------------------- 1 | load->library('typography'); 64 | return $CI->typography->nl2br_except_pre($str); 65 | } 66 | } 67 | 68 | // ------------------------------------------------------------------------ 69 | 70 | if ( ! function_exists('auto_typography')) 71 | { 72 | /** 73 | * Auto Typography Wrapper Function 74 | * 75 | * @param string $str 76 | * @param bool $reduce_linebreaks = FALSE whether to reduce multiple instances of double newlines to two 77 | * @return string 78 | */ 79 | function auto_typography($str, $reduce_linebreaks = FALSE) 80 | { 81 | $CI =& get_instance(); 82 | $CI->load->library('typography'); 83 | return $CI->typography->auto_typography($str, $reduce_linebreaks); 84 | } 85 | } 86 | 87 | // -------------------------------------------------------------------- 88 | 89 | if ( ! function_exists('entity_decode')) 90 | { 91 | /** 92 | * HTML Entities Decode 93 | * 94 | * This function is a replacement for html_entity_decode() 95 | * 96 | * @param string 97 | * @param string 98 | * @return string 99 | */ 100 | function entity_decode($str, $charset = NULL) 101 | { 102 | return get_instance()->security->entity_decode($str, $charset); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/helpers/directory_helper.php: -------------------------------------------------------------------------------- 1 | 0) && is_dir($source_dir.$file)) 86 | { 87 | $filedata[$file] = directory_map($source_dir.$file, $new_depth, $hidden); 88 | } 89 | else 90 | { 91 | $filedata[] = $file; 92 | } 93 | } 94 | 95 | closedir($fp); 96 | return $filedata; 97 | } 98 | 99 | return FALSE; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/language/english/imglib_lang.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT License 7 | * @copyright 2016 David Sosa Valdes 8 | * @link https://github.com/davidsosavaldes/Craftsman 9 | * 10 | * Based on https://raw.githubusercontent.com/kenjis/codeigniter-ss-twig/master/ci_instance.php 11 | */ 12 | 13 | define('ENVIRONMENT', getenv('CI_ENV') ? getenv('CI_ENV') : 'development'); 14 | 15 | $system_path = getenv('BASEPATH'); 16 | $application_folder = getenv('APPPATH'); 17 | $public_folder = getenv('CI_FCPATH'); 18 | 19 | if ($_temp = realpath($system_path)) 20 | { 21 | $system_path = $_temp; 22 | } 23 | 24 | $system_path = rtrim($system_path, '/').'/'; 25 | 26 | if (! is_dir($system_path)) 27 | { 28 | print("Your system folder path does not appear to be set correctly.\n"); 29 | exit(3); 30 | } 31 | 32 | define('BASEPATH', str_replace("\\", "/", $system_path)); 33 | 34 | if (is_dir($application_folder)) 35 | { 36 | if ($_temp = realpath($application_folder)) 37 | { 38 | $application_folder = $_temp; 39 | } 40 | define('APPPATH', $application_folder.'/'); 41 | } 42 | else 43 | { 44 | if (! is_dir(BASEPATH.$application_folder.'/')) 45 | { 46 | print('Your application folder path does not appear to be set correctly.'); 47 | exit(3); 48 | } 49 | define('APPPATH', BASEPATH.$application_folder.'/'); 50 | } 51 | 52 | define('VIEWPATH', $application_folder.'/views/'); 53 | 54 | if ($_temp = realpath($public_folder)) 55 | { 56 | define('FCPATH', $_temp.'/'); 57 | } 58 | else 59 | { 60 | define('FCPATH', realpath('.').'/'); 61 | } 62 | 63 | require(BASEPATH.'core/Common.php'); 64 | 65 | if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php')) 66 | { 67 | require(APPPATH.'config/'.ENVIRONMENT.'/constants.php'); 68 | } 69 | else 70 | { 71 | require(APPPATH.'config/constants.php'); 72 | } 73 | 74 | # Make sure some config variables are set correctly 75 | get_config(['subclass_prefix' => 'Craftsman_']); 76 | 77 | $charset = strtoupper(config_item('charset')); 78 | ini_set('default_charset', $charset); 79 | 80 | if (extension_loaded('mbstring')) 81 | { 82 | define('MB_ENABLED', true); 83 | // mbstring.internal_encoding is deprecated starting with PHP 5.6 84 | // and it's usage triggers E_DEPRECATED messages. 85 | @ini_set('mbstring.internal_encoding', $charset); 86 | // This is required for mb_convert_encoding() to strip invalid characters. 87 | // That's utilized by CI_Utf8, but it's also done for consistency with iconv. 88 | mb_substitute_character('none'); 89 | } 90 | else 91 | { 92 | define('MB_ENABLED', false); 93 | } 94 | 95 | // There's an ICONV_IMPL constant, but the PHP manual says that using 96 | // iconv's predefined constants is "strongly discouraged". 97 | if (extension_loaded('iconv')) 98 | { 99 | define('ICONV_ENABLED', true); 100 | // iconv.internal_encoding is deprecated starting with PHP 5.6 101 | // and it's usage triggers E_DEPRECATED messages. 102 | @ini_set('iconv.internal_encoding', $charset); 103 | } 104 | else 105 | { 106 | define('ICONV_ENABLED', false); 107 | } 108 | 109 | load_class('Config', 'core'); 110 | load_class('Utf8', 'core'); 111 | load_class('Security', 'core'); 112 | // load_class('Router', 'core'); 113 | load_class('Input', 'core'); 114 | load_class('Lang', 'core'); 115 | load_class('Hooks', 'core'); 116 | 117 | require_once(BASEPATH.'core/Controller.php'); 118 | 119 | /** 120 | * Controller alias 121 | */ 122 | class Codeigniter extends \CI_Controller {} 123 | 124 | if (!function_exists('get_instance')) 125 | { 126 | function &get_instance() 127 | { 128 | return Codeigniter::get_instance(); 129 | } 130 | } 131 | 132 | return new Codeigniter; 133 | -------------------------------------------------------------------------------- /src/Core/Generator.php: -------------------------------------------------------------------------------- 1 | fs = new Filesystem(); 42 | $this->twig = new Twig_Environment(new Twig_Loader($templatesPath)); 43 | } 44 | 45 | /** 46 | * Command configuration method. 47 | * Configure all the arguments and options. 48 | */ 49 | protected function configure() 50 | { 51 | parent::configure(); 52 | 53 | $this 54 | ->addArgument( 55 | 'filename', 56 | InputArgument::REQUIRED, 57 | 'Generator filename' 58 | ) 59 | ->addArgument( 60 | 'options', 61 | InputArgument::IS_ARRAY, 62 | 'Options passed to all generated files' 63 | ) 64 | ->addOption( 65 | 'force', 66 | null, 67 | InputOption::VALUE_NONE, 68 | 'If set, the task will force the generation process' 69 | ); 70 | } 71 | 72 | /** 73 | * Generate files based on templates. 74 | * 75 | * @param mixed $filenames The file to be written to 76 | * @param mixed $paths The Twig_Loader_Filesystem template path 77 | * @param array $options The data to write into the file 78 | * @param string $template The template file 79 | * @return bool Returns true if the file has been created 80 | */ 81 | protected function make($filenames, $template = 'base.php.twig', array $options = array()) 82 | { 83 | foreach ((array) $filenames as $filename) 84 | { 85 | if (! $this->getOption('force') && $this->fs->exists($filename)) 86 | { 87 | throw new \RuntimeException(sprintf('Cannot duplicate %s', $filename)); 88 | } 89 | 90 | $reflection = new \ReflectionClass(get_class($this)); 91 | 92 | if ($reflection->getShortName() === 'Migration') 93 | { 94 | $this->twig->addFunction(new \Twig_SimpleFunction('argument', 95 | function ($field = "") { 96 | return array_combine(array('name','type'), explode(':', $field)); 97 | } 98 | )); 99 | 100 | foreach ($this->getArgument('options') as $option) 101 | { 102 | list($key, $value) = explode(':', $option); 103 | $options[$key] = $value; 104 | } 105 | } 106 | 107 | $output = $this->twig->loadTemplate($template)->render($options); 108 | 109 | $this->fs->dumpFile($filename, $output); 110 | } 111 | return true; 112 | } 113 | 114 | /** 115 | * Create a directory if doesn't exists. 116 | * 117 | * @param string $dirPath Directory path 118 | * @return null 119 | */ 120 | public function createDirectory($dirPath) 121 | { 122 | if (! $this->fs->exists($dirPath)) 123 | { 124 | $this->fs->mkdir($dirPath); 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /tests/Codeigniter/3.1.4/system/helpers/array_helper.php: -------------------------------------------------------------------------------- 1 | addArgument( 37 | 'name', 38 | InputArgument::REQUIRED, 39 | 'Seeder filename' 40 | ); 41 | } 42 | 43 | /** 44 | * Execute the Migration command 45 | * 46 | * @param InputInterface $input [description] 47 | * @param OutputInterface $output [description] 48 | * @return [type] [description] 49 | */ 50 | protected function execute(InputInterface $input, OutputInterface $output) 51 | { 52 | $message = "WARNING! You are about to execute a database seed operation " 53 | ."that could result data lost.\n Do you wish to continue?"; 54 | 55 | if (! $this->confirm($message)) 56 | { 57 | $this->error('Process aborted!'); 58 | exit(3); 59 | } 60 | try 61 | { 62 | $filename = ucfirst($this->getArgument('name')); 63 | $appPath = realpath(getenv('APPPATH')); 64 | $appDir = basename($appPath); 65 | 66 | if (file_exists($file = sprintf('%s/seeders/%s.php', $appPath, $filename))) 67 | { 68 | require_once $file; 69 | } 70 | else 71 | { 72 | throw new \RuntimeException('Seeder does not exist.'); 73 | } 74 | 75 | $obj = new $filename(new Codeigniter); 76 | $obj->db->queries = []; 77 | 78 | if (! method_exists($obj, 'run')) 79 | { 80 | throw new \RuntimeException(sprintf( 81 | '[%s] Seeder class does not contain a Seeder::run method', 82 | $filename 83 | )); 84 | } 85 | 86 | $case = 'seeding'; 87 | $signal = '++'; 88 | 89 | $this->newLine(); 90 | $this->text(sprintf('%s %s', $signal, $case)); 91 | 92 | $time_start = microtime(true); 93 | 94 | $obj->run(); 95 | 96 | $time_end = microtime(true); 97 | 98 | list($query_exec_time, $exec_queries) = $this->measureQueries($obj->db->queries, $obj->db->query_times); 99 | 100 | $this->summary($signal, $time_start, $time_end, $query_exec_time, $exec_queries); 101 | } 102 | catch (\Exception $e) 103 | { 104 | $this->error($e->getMessage()); 105 | } 106 | } 107 | 108 | /** 109 | * Measure the queries execution time and show in console 110 | * 111 | * @param array $queries CI Database queries 112 | * @param array $times CI Database query execution times 113 | * @return array Returns a set of total exec time and the amount of queries. 114 | */ 115 | protected function measureQueries(array $queries, array $times) 116 | { 117 | $query_exec_time = 0; 118 | $exec_queries = 0; 119 | 120 | $this->newLine(); 121 | 122 | for ($i = 0; $i < count($queries); $i++) 123 | { 124 | $this->text(sprintf('-> %s', $queries[$i])); 125 | $query_exec_time += $times[$i]; 126 | $exec_queries += 1; 127 | } 128 | return array($query_exec_time, $exec_queries); 129 | } 130 | } 131 | --------------------------------------------------------------------------------