示例#1
0
<?php

\org\rhaco\Dt::create_table(null, true);
示例#2
0
文件: send.php 项目: tokushima/rhaco3
<?php

$vars = array('abc' => 'ABC');
$mail = new \org\rhaco\net\mail\Mail();
$mail->to("*****@*****.**");
$mail->send_template('send.xml', $vars);
$xml = \org\rhaco\Dt::find_mail('*****@*****.**');
eq('ボディーテストABC' . PHP_EOL, $xml->message());
eq('テストサブジェクト', $xml->subject());
$vars = array('abc' => 'ABC');
$mail = new \org\rhaco\net\mail\Mail();
$mail->to("*****@*****.**");
$mail->send_template('send_html.xml', $vars);
$xml = \org\rhaco\Dt::find_mail('*****@*****.**');
eq('ボディーテストABC' . PHP_EOL, $xml->message());
eq('テストサブジェクト', $xml->subject());
meq('Content-Type: text/html;', $xml->manuscript());
meq('<p class="abc">ピーボディー</p>', mb_convert_encoding($xml->manuscript(), 'UTF8', 'JIS'));
meq('send_html.css', mb_convert_encoding($xml->manuscript(), 'UTF8', 'JIS'));
示例#3
0
<?php

/**
 * モデルからtableを作成する
 * @param string $model
 * @param boolean $drop
 */
foreach (\org\rhaco\Dt::create_table($model, $drop) as $result) {
    if ($result[0] == -1) {
        print 'dropped ' . $result[1] . PHP_EOL;
    } else {
        if ($result[0] == 1) {
            print 'created ' . $result[1] . PHP_EOL;
        }
    }
}
示例#4
0
<?php

\testman\Conf::set('urls', \org\rhaco\Dt::get_urls());
\testman\Conf::set('ssl-verify', false);
\testman\Conf::set('coverage-dir', dirname(__DIR__) . '/src');
\org\rhaco\Conf::set('org.rhaco.store.db.Dbc', 'autocommit', true);
示例#5
0
<?php

/**
 * dao data export
 * @param string $file
 */
if (empty($file)) {
    $file = getcwd() . '/dump.ddj';
}
\org\rhaco\io\File::write($file, '');
foreach (\org\rhaco\Dt::classes('\\org\\rhaco\\store\\db\\Dao') as $class_info) {
    $r = new \ReflectionClass($class_info['class']);
    if ($r->getParentClass()->getName() == 'org\\rhaco\\store\\db\\Dao') {
        \cmdman\Std::println_info('Find ' . $r->getName());
        \org\rhaco\io\File::append($file, '[[' . $r->getName() . ']]' . PHP_EOL);
        $find = call_user_func(array($r->getName(), 'find'));
        foreach ($find as $obj) {
            \org\rhaco\io\File::append($file, json_encode($obj->props()) . PHP_EOL);
        }
    }
}
\cmdman\Std::println_success('Written ' . $file);
示例#6
0
文件: man.php 项目: tokushima/rhaco3
 if (!empty($module)) {
     $rtn = \org\rhaco\Dt::class_info($arg);
     if (!isset($rtn['modules'][$module])) {
         throw new \RuntimeException('module `' . $module . '` not found');
     }
     $module_info = $rtn['modules'][$module];
     print "\n" . 'class ' . $arg . ' in module ' . $module . ':' . PHP_EOL;
     print ' Description:' . PHP_EOL;
     print '   ' . str_replace("\n", "\n   ", $module_info[0]) . PHP_EOL;
     print "\n" . ' Parameter:' . PHP_EOL;
     $len = \org\rhaco\lang\Text::length(array_keys($module_info[1]));
     foreach ($module_info[1] as $p) {
         print '    ' . str_pad('', $len) . '    (' . $p[1] . ') ' . $p[0] . ' : ' . $p[2] . PHP_EOL;
     }
 } else {
     $rtn = \org\rhaco\Dt::class_info($arg);
     print "\n" . 'class ' . $rtn['package'] . ':' . PHP_EOL;
     print '  Version: ' . $rtn['version'] . PHP_EOL . PHP_EOL;
     print '  Description:' . PHP_EOL;
     print '   ' . str_replace("\n", "\n  ", $rtn['description']) . PHP_EOL . PHP_EOL;
     list($static_methods, $methods, $protected_static_methods, $protected_methods, $properties, $modules) = array($rtn['static_methods'], $rtn['methods'], $rtn['protected_static_methods'], $rtn['protected_methods'], $rtn['properties'], $rtn['modules']);
     $len = \org\rhaco\lang\Text::length(array_merge(array_keys($static_methods), array_keys($methods), array_keys($properties), array_keys($modules)));
     if (!empty($static_methods)) {
         print "\n" . '  Static methods defined here:' . PHP_EOL;
         foreach ($static_methods as $k => $v) {
             print '    ' . str_pad($k, $len) . ' : ' . $v . PHP_EOL;
         }
     }
     if (!empty($methods)) {
         print "\n" . '  Methods defined here:' . PHP_EOL;
         foreach ($methods as $k => $v) {
示例#7
0
$cmddir = defined('COMMONDIR') ? constant('COMMONDIR') : getcwd() . '/commons';
$mode_list = array();
if (is_dir($cmddir)) {
    foreach (new \RecursiveDirectoryIterator($cmddir, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS) as $f) {
        if (substr($f->getFilename(), -4) == '.php') {
            $mode_list[] = substr($f->getFilename(), 0, -4);
        }
    }
}
$default = empty($appmode) || array_search($appmode, $mode_list) !== false ? $appmode : 'local';
$mode = \cmdman\Std::read('Application mode', $default, $mode_list);
$settings_file = getcwd() . '/__settings__.php';
file_put_contents($settings_file, '<?php' . PHP_EOL . 'define(\'APPMODE\',\'' . $mode . '\');' . PHP_EOL . 'define(\'COMMONDIR\',\'' . $cmddir . '\');' . PHP_EOL);
\cmdman\Std::println_success('Written: ' . realpath($settings_file));
if ($mode != $appmode) {
    \cmdman\Std::println_info('Application mode changed.');
    exit;
}
if (\cmdman\Std::read('create .htaccess?', 'n', array('y', 'n')) == 'y') {
    $base = \cmdman\Std::read('base path?', '/' . basename(getcwd()));
    list($path, $rules) = \org\rhaco\Dt::htaccess($base);
    \cmdman\Std::println_success('Written ' . realpath($path));
}
$setup_cmd = substr(\org\rhaco\Dt::setup_file(), 0, -4) . '.cmd.php';
if (is_file($setup_cmd)) {
    include $setup_cmd;
}
if (is_file($f = \org\rhaco\Dt::setup_file())) {
    \cmdman\Std::println_success('Loading ' . $f);
    \org\rhaco\Dt::setup();
}
示例#8
0
<?php

/**
 * .htaccessを書き出す
* @param string $base
*/
if (!isset($base)) {
    $base = '/' . basename(getcwd());
}
list($path, $rules) = \org\rhaco\Dt::htaccess($base);
\cmdman\Std::println_success('Written: ' . $path);
\cmdman\Std::println_default(str_repeat('-', 60));
\cmdman\Std::println_info(trim($rules));
\cmdman\Std::println_default(str_repeat('-', 60));