コード例 #1
0
ファイル: beautifier.php プロジェクト: alachaum/timetrex
#!/usr/bin/php
<?php 
require_once 'PHP/Beautifier.php';
// Create the instance
$oBeautifier = new PHP_Beautifier();
echo "Filter Directory: " . dirname(__FILE__) . '/beautifier_filters' . "\n";
$oBeautifier->addFilterDirectory(dirname(__FILE__) . '/beautifier_filters');
// Add a filter, without any parameter
$oBeautifier->addFilter('TTDefault');
// Set the indent char, number of chars to indent and newline char
$oBeautifier->setIndentChar(' ');
$oBeautifier->setIndentNumber(4);
$oBeautifier->setNewLine("\n");
// Define the input file
$oBeautifier->setInputFile($argv[1]);
// Define an output file.
//$oBeautifier->setOutputFile( $argv[1] .'.beautified.php');
$oBeautifier->setOutputFile($argv[1]);
// Process the file. DONT FORGET TO USE IT
$oBeautifier->process();
// Show the file (echo to screen)
//$oBeautifier->show();
// Save the file
$oBeautifier->save();
コード例 #2
0
ファイル: GenCode.php プロジェクト: ksecor/civicrm
    $smarty->clear_all_cache();
    echo "Generating {$name} as " . $tables[$name]['fileName'] . "\n";
    $smarty->clear_all_assign();
    $smarty->assign_by_ref('table', $tables[$name]);
    $php = $smarty->fetch('dao.tpl');
    $beautifier->setInputString($php);
    if (empty($tables[$name]['base'])) {
        echo "No base defined for {$name}, skipping output generation\n";
        continue;
    }
    $directory = $phpCodePath . $tables[$name]['base'];
    createDir($directory);
    $beautifier->setOutputFile($directory . $tables[$name]['fileName']);
    $beautifier->process();
    // required
    $beautifier->save();
}
echo "Generating CRM_Core_I18n_SchemaStructure...\n";
$columns = array();
$indices = array();
foreach ($tables as $table) {
    if ($table['localizable']) {
        $columns[$table['name']] = array();
    } else {
        continue;
    }
    foreach ($table['fields'] as $field) {
        if ($field['localizable']) {
            $columns[$table['name']][$field['name']] = $field['sqlType'];
        }
    }