/** * Checks if the input parameter are correct and load the parsed classes if needed * * @param mixed $arg * @param string $custom_list_path */ private static function checkInputArgs($arg, CodeGenerator $codeGenerator) { $custom_path = $codeGenerator->getPathToClassesMethodsList(); self::$returnValuesManager = $arg instanceof ReturnValuesManager ? $arg : new ReturnValuesManager($arg, $custom_path); self::$className = self::$returnValuesManager->getClassName(); self::$extends = self::$returnValuesManager->getExtends(); self::$implements = self::$returnValuesManager->getImplements(); self::$classesMethods = !is_null($custom_path) ? require $custom_path : array(); }
public function actionIndex() { //* $message = ''; $model = new RegisterCodeForm(); try { if (isset($_POST['RegisterCodeForm'])) { $model->attributes = $_POST['RegisterCodeForm']; if ($model->validate()) { self::serverValidationRegisterCodeForm($model); $activationCode = CodeGenerator::activationAccountCodeGenerator($model); UsersDao::getInstance()->registerNewUserWithCode($model, $activationCode); $ulrActivationCode = Constants::URL_REGISTER_CONFIRMATION_CODE . $activationCode; $message = Constants::SUCCESS_USER_REGISTER; $successMail = UtilsFunctions::sendMail(strtolower($model->email), Constants::SUBJECT_EMAIL, Constants::HEAD_TEXT, $ulrActivationCode, Constants::FOOTER_TEXT); $message .= "<br/>" . $successMail ? Constants::SUCCESS_MAIL_DELIVERY : Constants::NOT_SUCCESS_MsAIL_DELIVERY; Yii::app()->user->setFlash('registerCode', $message); $this->refresh(); } } } catch (Exception $e) { Yii::app()->user->setFlash('registerCode', $e->getMessage()); $this->refresh(); } $this->render('index', array('model' => $model, "errorSummary" => $message)); }
public function __construct($dir, $name) { parent::__construct($name); $this->path = Config::get('view_dir'); $this->dir = $dir; $this->name = $name; }
public function __construct($name, $from = '') { parent::__construct($name); $this->path = Config::get('migr_dir'); $this->from = $from; if ($this->from == 'model') { $this->template = $this->table_template; } }
/** * Get C++ code for function * * @return string C++ code */ public function getCode() { $this->variablesFromCode(); $this->codeGenerator->getScope()->debug(); $variables = ''; foreach ($this->vars as $var) { $var->setVariable($this->codeGenerator->getScope()['$' . $var->getName()]); $variables .= $var->getCode(); } return 'Php::Value phpFunc_' . $this->getName() . '(Php::Parameters &args)' . "\n" . '{' . "\n" . '' . $variables . "\n" . '' . $this->codeGenerator->getCode() . "\n" . ' return nullptr;' . "\n" . '}' . "\n\n"; }
public function generate() { $code = $this->security . ' '; $code .= $this->static ? 'static ' : ''; $code .= '$' . $this->name . ' = '; if (is_array($this->value)) { $code .= \CodeGenerator::genArray($this->value); } else { $code .= '"' . str_replace('"', '\\"', $this->value) . '";'; } return $code; }
/** * Esta funcion genera los codigos para vender y para usar como promocion por un numero determinado de dias * Por defautl se generan 1 codigos de longitud 8 con duracion 1, lo que significa que nos de venta (duracion = 0 son de venta) * @param number $numCodes * @param number $lenCode * @param number $duration */ public function generator($numCodes = 1, $lenCode = 8, $duration = 1) { /*Parametros para enviar por url*/ /*$numCodes = 50; $lenCode = 8; $duration = 3;*/ $codes = array(); for ($index = 0; $index < $numCodes; $index++) { $code = CodeGenerator::generatorCode($lenCode, $duration); if (strlen($code) > 0) { Yii::log("Se ha creado el codigo: {$code}"); array_push($codes, $code); } else { Yii::log("Ocurrio un problema al generar un codigo"); } } return $codes; }
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('FontAwesome', 'FontAwesome.otf', 'FA', "Font Awesome v4.6.3 http://fontawesome.io/icons"); $generator->generateFromCssFile('font-awesome.css', 'fa');
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('MyFontIcons', 'myfonticons.ttf', 'MF', "Demonstrator for using custom icon fonts. \nhttps://github.com/ElfSundae/IconFontKit", null, false); $generator->setClassPrefix(null); $generator->generateFromCssFile('myfonticons.css', 'icon');
public function __construct($name, $from = '') { parent::__construct($name); $this->path = Config::get('model_dir'); }
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('Dripicons', 'dripicons.ttf', 'Dripicon', "Dripicons v1.0 http://demo.amitjakhu.com/dripicons"); $generator->generateFromCssFile('webfont.css', 'icon');
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('Linea', 'Linea.ttf', 'Linea', 'Linea, a free outline iconset designed by Dario Ferrando, v1.0 http://www.linea.io'); $generator->generateFromCssFile('style.css', 'linea');
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('MetrizeIcons', 'Metrize-Icons.ttf', 'Metrize', 'Metrize Icons v1.0 http://www.alessioatzeni.com/metrize-icons'); $generator->generateFromCssFile('style.css', 'icon');
public function __invoke() { $mapper = new CodeCoordinateMapper(); $generator = new CodeGenerator($mapper); $this->write("Code: " . $generator->codeAt(2981, 3075)); }
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('Genericons', 'Genericons.ttf', 'Genericon', 'Genericons v3.4.1 http://genericons.com'); $generator->generateFromCssFile('genericons.css', 'genericon');
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('Meteocons', 'meteocons.ttf', 'Meteocons', 'Meteocons: free weather icons, v1.0 http://www.alessioatzeni.com/meteocons'); $generator->generateFromCssFile('meteocons.css', 'icon');
/** * Save config * * @param string $type * @param array $data * @param string $module * @param \App $app */ public static function save($type, $data, $module = '', $app = null) { if (!$app) { $app = App::$primary; } switch ($type) { case 'system': $path = INJI_SYSTEM_DIR . '/config/config.php'; self::$_configs['system'] = $data; Inji::$inst->event('Config-change-system', $data); break; case 'app': $path = $app->path . "/config/config.php"; self::$_configs['app'][$app->name] = $data; Inji::$inst->event('Config-change-app-' . $app->name, $data); break; case 'module': $path = $app->path . "/config/modules/{$module}.php"; self::$_configs['module'][$app->name][$module] = $data; Inji::$inst->event('Config-change-module-' . $app->name . '-' . $module, $data); break; case 'share': if ($module) { $path = INJI_PROGRAM_DIR . "/config/modules/{$module}.php"; self::$_configs['shareModules'][$module] = $data; Inji::$inst->event('Config-change-shareModules-' . $module, $data); } else { $path = INJI_PROGRAM_DIR . "/config/config.php"; self::$_configs['share'] = $data; Inji::$inst->event('Config-change-share', $data); } break; default: $path = $type; self::$_configs['custom'][$path] = $data; break; } $text = "<?php\nreturn " . CodeGenerator::genArray($data); Tools::createDir(substr($path, 0, strripos($path, '/'))); file_put_contents($path, $text); }
public function __construct($name, $functions = array()) { parent::__construct($name); $this->path = Config::get('ctrl_dir'); $this->functions = $functions; }
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('WeatherIcons', 'weathericons-regular-webfont.ttf', 'WeatherIcon', 'WeatherIcons v2.0.10 http://erikflowers.github.io/weather-icons', 'Weather Icons'); $generator->generateFromCssFile('weather-icons.css', 'wi');
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('HawconsStroke', 'Hawcons-Stroke.ttf', 'HawconsStroke', 'Hawcons, stroke style, v1.0 http://hawcons.com'); $generator->generateFromCssFile('style.css', 'hawcons-stroke');
<?php $plik = file_get_contents("HelloWorld.php"); $generator = new CodeGenerator(); $generator->GenerateCode("PHP", "Java", $plik); class CodeGenerator { public function GenerateCode($current, $desired, $kod) { $kod = preg_replace("/\n|\\s|\\s+/", '', $kod); $generator = new PhpToJava($kod); $generator->Generate($kod); $generator->ShowCode(); } } class PhpToJava { protected $slownik; protected $translated; function __construct($kod) { $this->translated = new JavaCode(); $this->slownik = array("<?php" => array("wpisz" => "", "stop" => ""), "{" => array("wpisz" => "{\n", "stop" => ""), "}" => array("wpisz" => "\n}", "stop" => ""), ";" => array("wpisz" => ";", "stop" => ""), "class" => array("wpisz" => "\npublic class ", "stop" => "{"), "publicfunction" => array("wpisz" => "\npublic void ", "stop" => "{"), "__construct()" => array("wpisz" => " static void main(String[] args)", "stop" => "{"), "+" => array("wpisz" => "+", "stop" => ""), "-" => array("wpisz" => "-", "stop" => ""), "*" => array("wpisz" => "*", "stop" => ""), "/" => array("wpisz" => "/", "stop" => ""), "=" => array("wpisz" => "=", "stop" => ""), "\"" => array("wpisz" => "\"", "stop" => ""), 1 => array("wpisz" => "1", "stop" => ""), "echo" => array("ExternalTranslateMethod" => "EchoMethod"), "\$" => array("wpisz" => "", "stop" => ""), "cuztojest" => array("wpisz" => "cuztojest", "stop" => "")); } public function ShowCode() { echo $this->translated->code; } protected function Translate($arrayKey, $kod, $child = false) { if (isset($this->slownik[$arrayKey]["ExternalTranslateMethod"])) {
public function addActionToController($module, $type, $controller, $url) { $modulePath = Module::getModulePath($module); $path = Modules::getModulePath($module) . '/' . $type . '/' . $controller . '.php'; $class = CodeGenerator::parseClass($path); $class->addMethod($url . 'Action'); $controllerCode = "<?php\n\n" . $class->generate(); Tools::createDir(pathinfo($path, PATHINFO_DIRNAME)); file_put_contents($path, $controllerCode); $config = Config::custom($modulePath . '/generatorHash.php'); $config[$type . '/' . $module . 'Controller.php'] = md5($controllerCode); Config::save($modulePath . '/generatorHash.php', $config); }
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('EvilIcons', 'EvilIcons.ttf', 'Evil', 'Evil Icons, v1.8.0, http://evil-icons.io'); $generator->generateFromCssFile('style.css', 'ei');
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('Devicons', 'devicons.ttf', 'DEV', "Devicons, v1.8.0, https://github.com/vorillaz/devicons"); $generator->generateFromCssFile('devicons.css', 'devicons');
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('MaterialDesignIcons', 'materialdesignicons-webfont.ttf', 'MDI', 'Material Design Icons v1.6.50 https://materialdesignicons.com', 'Material Design Icons'); $generator->generateFromCssFile('materialdesignicons.css', 'mdi');
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('ThemifyIcons', 'themify.ttf', 'Themify', 'ThemifyIcons, handcrafted icons that draw inspiration from Apple iOS 7, http://themify.me/themify-icons'); $generator->generateFromCssFile('themify-icons.css', 'ti');
<?php $table = new Ui\Table(); $table->name = 'Страницы'; $table->setCols(['Адрес', 'Операции']); $table->addButton(['href' => "/admin/modules/createControllerMethod/{$module}/{$type}/{$controller}", 'text' => 'Создать']); $class = CodeGenerator::parseClass(Modules::getModulePath($module) . '/' . $type . '/' . $controller . '.php'); foreach ($class->methods as $method) { $name = str_replace('Action', '', $method->name); $table->addRow([$name, ['class' => 'actionTd', 'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/editControllerMethod/' . $module . '/' . $type . '/' . $controller . '/' . $name . '"><i class="glyphicon glyphicon-edit"></i></a>' . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delControllerMethod/' . $module . '/' . $type . '/' . $controller . '/' . $name . '"><i class="glyphicon glyphicon-remove"></i></a>']]); } $table->draw();
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('ElusiveIcons', 'elusiveicons-webfont.ttf', 'EL', 'Elusive Icons v2.0.0 http://elusiveicons.com', 'elusiveicons'); $generator->generateFromCssFile('elusive-icons.css', 'el');
<?php chdir(dirname(__FILE__)); require '../CodeGenerator.php'; $generator = new CodeGenerator('OpenWebIcons', 'openwebicons.ttf', 'OpenWeb', 'OpenWebIcons v1.4.0 http://pfefferle.github.io/openwebicons', 'OpenWeb Icons'); $generator->generateFromCssFile('style.css', 'openwebicons');
/** * if(<expr>) [{] <code> [}] [elseif(<expr>) { <code> }]+ [else { <code> }] * * @param $codeGenerator */ public function parse_if(CodeGenerator $codeGenerator) { // 'if' eaten $prec = new Precedence($this->scanner); $prec->run(); // If $token = $this->scanner->next(); $bodyCode = new CodeGenerator($codeGenerator->getIndent() + 1, $codeGenerator->getScope()); if ($token['code'] == T_LCURLY_PARENTHESIS) { $this->parse_body($bodyCode); $this->check(T_RCURLY_PARENTHESIS); } else { $this->scanner->back(); $this->parser_command($bodyCode); } $codeGenerator->addIf(new ExprGenerator($prec->getData(), $codeGenerator->getScope()), $bodyCode); //$codeGenerator->addVariables($prec->getUsedVariables()); // Elseif $token = $this->scanner->next(); while ($token['code'] == T_ELSEIF) { $prec = new Precedence($this->scanner); $prec->run(); $token = $this->scanner->next(); $bodyCode = new CodeGenerator($codeGenerator->getIndent() + 1, $codeGenerator->getScope()); if ($token['code'] == T_LCURLY_PARENTHESIS) { $this->parse_body($bodyCode); $this->check(T_RCURLY_PARENTHESIS); } else { $this->scanner->back(); $this->parser_command($bodyCode); } //$codeGenerator->addVariables($prec->getUsedVariables()); $codeGenerator->addElseif(new ExprGenerator($prec->getData(), $codeGenerator->getScope()), $bodyCode); $token = $this->scanner->next(); } // else if ($token['code'] == T_ELSE) { $token = $this->scanner->next(); $bodyCode = new CodeGenerator($codeGenerator->getIndent() + 1, $codeGenerator->getScope()); if ($token['code'] == T_LCURLY_PARENTHESIS) { $this->parse_body($bodyCode); $this->check(T_RCURLY_PARENTHESIS); } else { $this->scanner->back(); $this->parser_command($bodyCode); } //$codeGenerator->addVariables($prec->getUsedVariables()); $codeGenerator->addElse($bodyCode); } else { $this->scanner->back(); } }