Exemplo n.º 1
0
 public function generate_file()
 {
     $filename = $this->get_filename();
     $content = $this->get_contents();
     echonl('generate ' . abbr_path($this->get_path()) . '/' . $filename);
     $f = fopen($this->get_path() . '/' . $filename, 'w');
     fwrite($f, $content, strlen($content));
     fclose($f);
 }
Exemplo n.º 2
0
/**
 * 셀렉트 박스 출력
 */
function input_select($name, $options = array(), $selected_value = '', $id = '', $class = '')
{
    echonl("<select name=\"{$name}\" id=\"{$id}\" class=\"{$class}\">");
    foreach ($options as $value => $html) {
        $selected = $value == $selected_value ? 'selected="selected" ' : '';
        echonl("<option value=\"{$value}\" {$selected}>{$html}</option>");
    }
    echonl("</select>");
}
Exemplo n.º 3
0
    echonl("\t`php script/generate.php model User`");
    echonl("\t`php script/generate.php migration AddPrice`");
    echonl("\t`php script/generate.php controller Welcome login logout`");
    exit(0);
}
// init
array_shift($argv);
$kind = $argv[0];
array_shift($argv);
$name = $argv[0];
array_shift($argv);
$params = $argv;
if (!file_exists(Config::get('plugin_classes') . '/generator/' . $kind . '_generator.class.php')) {
    echonl("No " . $kind . ' generator exist.');
    exit(0);
}
try {
    $classname = under_to_camel($kind) . 'Generator';
    $generator = new $classname($name, $params);
    $generator->generate();
} catch (Skip $e) {
    Context::get('db')->rollback();
} catch (DbError $e) {
    Context::get('db')->rollback();
    Log::error($e->getMessage());
    echonl($e->getMessage());
} catch (Exception $e) {
    Context::get('db')->rollback();
    Log::error($e->getMessage());
    echonl($e->getMessage());
}
Exemplo n.º 4
0
function print_migration_status($direction, $classname, $version)
{
    echonl('================================================================================');
    echonl($classname . '.' . strtolower($direction) . '() is executed.');
    echonl('Schema version is ' . $version . ' now.');
}
Exemplo n.º 5
0
    // Add the correct URLs to the URL list
    if ($mod_rewrite) {
        foreach ($public_news as $public_article) {
            $urls[] = 'news/' . urlencode($public_article['titlelink']);
        }
    } else {
        foreach ($public_news as $public_article) {
            $urls[] = '?p=news&amp;title=' . urlencode($public_article['titlelink']);
        }
    }
    // Zenpage news categories
    $public_cats = query_full_array('SELECT `cat_link` FROM ' . prefix('zenpage_news_categories') . ';');
    // Add the correct URLs to the URL list
    if ($mod_rewrite) {
        foreach ($public_cats as $public_cat) {
            $urls[] = 'news/category/' . urlencode($public_cat['cat_link']);
        }
    } else {
        foreach ($public_cats as $public_cat) {
            $urls[] = '?p=news&amp;category=' . urlencode($public_cat['cat_link']);
        }
    }
}
// Print out all of the URLs collected
foreach ($urls as $url) {
    echonl("\t<url><loc>" . FULLWEBPATH . "/{$url}</loc></url>");
}
// End off the <urlset> tag
echonl('</urlset>');
// Stop execution of the rest of Zenphoto
exit;