/**
  * Metodo statico pubblico accessibile direttamente dall'esterno che
  * restituisce l'html dei pulsanti richiesti.
  *
  * @param array $params Parametri di configurazione generici per la creazione dei pulsanti.
  * @param array $buttons Array multidimensionale contenente i pulsanti richiesti e la loro configurazione.
  * @return string $outhtml Restituisce l'html risultante dalla creazione dei pulsanti.
  */
 public static final function create_image_editbuttons(array $params = [], array $buttons = [])
 {
     if (!isset($buttons[0]['command']) || trim($buttons[0]['command']) == "") {
         exit("Il parametro command e' obbligatorio.");
     }
     $outhtml = "";
     //print_r($params);
     //print_r($buttons);
     /**
      * array('dialog_title' => b('MY_THUMB_EDIT'));
      *
      *
      * array('label' => b('EDIT'),
      *       'width' => $has_thumb ? '161px' : '100%',
      *       'command' => 'user_thumb',
      *       'title'=>b('MY_THUMB_EDIT')
      */
     /**
      * Preparo i pulsanti per la gestione dell'immagine
      */
     $buttonEdit = new aengine_button(['label' => b('EDIT'), 'width' => isset($buttons[0]['width']) ? $buttons[0]['width'] . 'px' : '100%', 'centered' => true, 'css' => 'dark5', 'outer_styles' => ['position:absolute', 'bottom:0px', 'left:0px'], 'command' => 'commandEditButton', 'commandparams' => ['command' => $buttons[0]['command'], 'type' => 'html', 'owner' => 'dialog', 'params' => ['mode' => $params['mode'], 'subgroupId' => isset($params['subgroupId']) ? $params['subgroupId'] : '', 'size' => 'xxl', 'position' => 'auto', 'title' => $params['title'] ? b($params['title']) : b('MY_THUMB_EDIT'), 'close' => true, 'dialog_footer_options' => ['css' => 'dark dark2', 'buttons' => [['label' => b('CHANGE_IMAGE'), 'name' => 'b_back_thumb', 'command' => 'back_thumb', 'hidden' => true, 'commandparams' => ['owner' => $buttons[0]['owner'], 'target' => $buttons[0]['target'], 'params' => ['transition' => 'up@flip', 'callback' => ['type' => "button", 'target' => "b_save_thumb", 'command' => "hide", 'params' => ['transition' => 'prev', 'callback' => ['type' => "button", 'target' => $buttons[0]['subtarget'], 'command' => "hide"]]]]]], ['label' => b('SAVE'), 'type' => 'green', 'name' => 'b_save_thumb', 'command' => 'save_thumb', 'hidden' => true, 'command' => 'uploadImageThumb', 'commandparams' => ['owner' => 'welcome', 'type' => 'component', 'params' => ['mode' => $params['mode']]]]]]]]]);
     $outhtml .= $buttonEdit->display();
     // Se esiste l'immagine allora genero anche il pulsante di eliminazione.
     if (isset($params['avatarImg']) && $params['avatarImg'] != "") {
         //print_r($params);
         $buttonRemove = new aengine_button(['icon' => 'ae-delete-trash-1', 'width' => '40px', 'centered' => true, 'css' => 'brd-left dark5', 'outer_styles' => ['position: absolute', 'bottom: 0px', 'left: ' . $buttons[0]['width'] . 'px'], 'command' => 'buttonImageRemove', 'commandparams' => ['command' => $params['obj'] . '_' . $params['act'], 'target' => isset($params['target']) ? $params['target'] : '', 'type' => 'html', 'params' => $buttons[1]['params']]]);
         $outhtml .= $buttonRemove->display();
     }
     return $outhtml;
 }
Example #2
0
function a()
{
    $a1 = 1;
    b();
    ~_hotspot0;
    // a.a1:1
}
Example #3
0
function a()
{
    $a1 =& $GLOBALS['x1'];
    b();
    ~_hotspot0;
    // main.x1:U/C, main.x2:U/C, a.a1:T/D
}
Example #4
0
function a()
{
    if (rand()) {
        $a1 =& $a2;
    }
    b(&$a1, &$a2);
}
Example #5
0
 /**
  * process event
  *
  * @param Charcoal_IEventContext $context   event context
  *
  * @return boolean
  */
 public function processEvent($context)
 {
     $request = $context->getRequest();
     // get command line options
     $cmd_path = us($request->getString('p2'));
     $options = array('@:help' => '[command_path]', '@:version' => '', '@:db:generate:model' => 'databse table [target directory]', '@:db:show:table' => 'databse table');
     $examples1 = array('@:help' => '@:version => show "@:version" command help', '@:db:generate:model' => 'charcoal blog => generate "blog" table\'s model files in "charcoal" database' . '(model files are generated into current directory).', '@:db:show:table' => 'charcoal blog => show description about "blog" table in "charcoal" database.');
     $examples2 = array('@:help' => 'list => show all supported commands("list" can be omitted)');
     $descriptions = array('@:help' => 'show command help or list all command paths', '@:version' => 'show framework version.', '@:db:generate:model' => 'create model files into [target directory].', '@:db:show:table' => 'show table description');
     if (empty($cmd_path) || $cmd_path == 'list') {
         // show all commands
         echo "Supported command list: ";
         foreach ($options as $path => $opt) {
             echo "\n  " . $path;
         }
     } elseif (isset($options[$cmd_path])) {
         echo "How to use: ";
         echo "\n  charcoal " . $cmd_path . ' ' . $options[$cmd_path];
         if (isset($examples1[$cmd_path])) {
             echo "\nExample:";
             echo "\n  charcoal " . $cmd_path . ' ' . $examples1[$cmd_path];
             if (isset($examples2[$cmd_path])) {
                 echo "\n  charcoal " . $cmd_path . ' ' . $examples2[$cmd_path];
             }
         }
         if (isset($descriptions[$cmd_path])) {
             echo "\n\nThis command " . $descriptions[$cmd_path];
         }
     } else {
         echo "Command not found: {$cmd_path}";
     }
     echo "\n";
     return b(true);
 }
Example #6
0
function a()
{
    $a1 = 1;
    b(&$a1);
    ~_hotspot0;
    // a.a1:2
}
 /**
  * Render debug trace
  *
  * @param Charcoal_String $title  title
  */
 public function render($e)
 {
     //        Charcoal_ParamTrait::validateException( 1, $e );
     if (!$this->renderers) {
         $this->renderers = array();
         if (!$this->sandbox->isLoaded()) {
             return;
         }
         // Create Debug Trace Renderer
         $debugtrace_renderers = $this->sandbox->getProfile()->getArray('DEBUGTRACE_RENDERER');
         if ($debugtrace_renderers) {
             foreach ($debugtrace_renderers as $renderer_name) {
                 if (strlen($renderer_name) === 0) {
                     continue;
                 }
                 try {
                     $renderer = $this->sandbox->createObject($renderer_name, 'debugtrace_renderer', array(), 'Charcoal_IDebugtraceRenderer');
                     $this->renderers[] = $renderer;
                 } catch (Exception $e) {
                     _catch($e);
                     echo "debugtrace_renderer creation failed:{$e}";
                 }
             }
         }
     }
     $result = b(FALSE);
     foreach ($this->renderers as $renderer) {
         $ret = $renderer->render($e);
         if ($ret === TRUE || $ret instanceof Charcoal_Boolean && $ret->isTrue()) {
             $result = b(TRUE);
         }
     }
     return $result;
 }
 /**
  * process event
  *
  * @param Charcoal_IEventContext $context
  *
  * @return boolean|Charcoal_Boolean
  */
 public function processEvent($context)
 {
     /** @var GenerateModelEvent $event */
     $event = $context->getEvent();
     // get event parameters
     $db_name = $event->getDatabase();
     /** @var Charcoal_SmartGateway $gw */
     $gw = $context->getComponent('smart_gateway@:charcoal:db');
     // find models in project/app path
     $find_path = Charcoal_EnumFindPath::FIND_PATH_PROJECT | Charcoal_EnumFindPath::FIND_PATH_APPLICATION;
     $models = $gw->listModels($find_path);
     // switch database
     $gw->selectDatabase($db_name);
     // create tables
     foreach ($models as $model_name => $model) {
         $table = $model->getTableName();
         echo "creating table: [TABLE NAME]{$table} [MODEL NAME]{$model_name}\n";
         $rows_affected = $gw->createTable(null, $model_name, true);
         if ($rows_affected) {
             echo "successfully created table[{$table}].\n";
         } else {
             echo "failed to create table[{$table}].\n";
         }
     }
     return b(true);
 }
 /**
  * イベントを処理する
  *
  * @param Charcoal_IEventContext $context
  *
  * @return boolean
  */
 public function processEvent($context)
 {
     $request = $context->getRequest();
     // パラメータを取得
     $database = us($request->getString('p2'));
     $table = us($request->getString('p3'));
     //=======================================
     // Confirm input parameters
     //=======================================
     if (!empty($database) && !preg_match('/^[0-9a-zA-Z_\\-]*$/', $database)) {
         print "Parameter 2(database name) is wrong: {$database}" . PHP_EOL;
         return b(true);
     }
     if (!empty($table) && !preg_match('/^[0-9a-zA-Z_\\-]*$/', $table)) {
         print "Parameter 3(table name) is wrong: {$table}" . PHP_EOL;
         return b(true);
     }
     //=======================================
     // Send new project event
     //=======================================
     /** @var Charcoal_IEvent $event */
     $event_path = 'show_table_event@:charcoal:db:show:table';
     $event = $context->createEvent($event_path, array($database, $table));
     $context->pushEvent($event);
     return b(true);
 }
Example #10
0
function a()
{
    $a1 =& $a2;
    b();
    ~_hotspot1;
    // u{(main.x, main.y, a.x_gs, a.y_gs) (a.a1, a.a2)} a{}
}
Example #11
0
function a()
{
    $a1 =& $GLOBALS['x1'];
    ~_hotspot0;
    // u{ (a.a1, main.x1, a.x1_gs) } a{ }
    b(&$a1);
}
Example #12
0
function a()
{
    $a1 =& $GLOBALS['x1'];
    b();
    ~_hotspot1;
    // u{ (a.a1, main.x1, main.x2, a.x1_gs) } a{ }
}
Example #13
0
 /**
  * Process events
  *
  * @param Charcoal_IEventContext $context   event context
  *
  * @return boolean|Charcoal_Boolean
  */
 public function processEvent($context)
 {
     // check if the access is granted
     $auth = $this->isAuthorized($context);
     if (ub($auth) !== TRUE) {
         // create security fault event
         /** @var Charcoal_Event $event */
         $event = $this->getSandbox()->createEvent('security_fault');
         $context->pushEvent($event);
         return b(TRUE);
     }
     // check permissions
     $has_permission = $this->hasPermission($context);
     if (ub($has_permission) !== TRUE) {
         $event = $this->permissionDenied($context);
         if ($event) {
             return $event;
         }
         /** @var Charcoal_Event $event */
         $event = $this->getSandbox()->createEvent('permission_denied');
         $context->pushEvent($event);
         return b(TRUE);
     }
     return $this->processEventSecure($context);
 }
Example #14
0
function a()
{
    if ($u) {
        $a1 =& $a2;
    }
    b(&$a1, &$a2);
}
Example #15
0
function a()
{
    if (!function_exists('b')) {
        b();
    }
    echo 'I am a';
}
Example #16
0
function a()
{
    $a1 =& $GLOBALS['x1'];
    b();
    ~_hotspot0;
    // main.x1:3, main.x2:3, a.a1:1
}
 /**
  *  load config
  *
  * @param  string|Charcoal_String $key                  config key
  *
  * @return mixed   configure data
  */
 public function loadConfig($key)
 {
     //        Charcoal_ParamTrait::validateString( 1, $key );
     $source = $key . '.ini';
     $is_debug = b($this->debug)->isTrue();
     $result = NULL;
     if (!is_file($source)) {
         if ($is_debug) {
             print "ini file[{$source}] does not exist." . eol();
             log_warning("system, debug, config", "config", "ini file[{$source}] does not exist.");
         }
     } else {
         // read ini file
         $result = @parse_ini_file($source, TRUE);
         if ($is_debug) {
             print "[{$source}] parse_ini_file({$source})=" . eol();
             ad($result);
             if ($result === FALSE) {
                 print "parse_ini_file failed: [{$source}]" . eol();
                 log_warning("system, debug, config", "config", "parse_ini_file failed: [{$source}]");
             } else {
                 log_debug("system, debug, config", "config", "read ini file[{$source}]:" . print_r($result, true));
             }
         }
     }
     return $result;
 }
Example #18
0
function a()
{
    $a1 = $GLOBALS['evil'];
    b();
    ~_hotspot0;
    // a.a1:T/D
}
Example #19
0
 /**
  * イベントを処理する
  */
 public function processEvent($context)
 {
     $event = $context->getEvent();
     // パラメータを取得
     $app_name = $event->getAppName();
     $project_name = $event->getProjectName();
     $out_dir = $event->getTargetDir();
     //=======================================
     // Confirm input parameters
     //=======================================
     if (!preg_match('/^[0-9a-zA-Z_\\-]*$/', $app_name)) {
         _throw(new Charcoal_InvalidArgumentException($app_name));
     }
     if (!preg_match('/^[0-9a-zA-Z_\\-]*$/', $project_name)) {
         _throw(new Charcoal_InvalidArgumentException($project_name));
     }
     //=======================================
     // Make output directory
     //=======================================
     $out_dir = new Charcoal_File($out_dir);
     $out_dir->makeDirectory(self::DIR_MODE);
     //=======================================
     // Make web_app directory
     //=======================================
     $webapp_dir = new Charcoal_File('web_app', $out_dir);
     $webapp_dir->makeDirectory(self::DIR_MODE);
     //=======================================
     // Make project directory
     //=======================================
     $project_dir = new Charcoal_File($project_name, $webapp_dir);
     $project_dir->makeDirectory(self::DIR_MODE);
     //=======================================
     // Make project/app directory
     //=======================================
     $project_app_dir = new Charcoal_File('app', $project_dir);
     $project_app_dir->makeDirectory(self::DIR_MODE);
     //=======================================
     // Make application directory
     //=======================================
     $application_dir = new Charcoal_File($app_name, $project_app_dir);
     $application_dir->makeDirectory(self::DIR_MODE);
     //=======================================
     // Make application/class directory
     //=======================================
     $app_class_dir = new Charcoal_File('class', $application_dir);
     $app_class_dir->makeDirectory(self::DIR_MODE);
     //=======================================
     // Make application/config directory
     //=======================================
     $app_config_dir = new Charcoal_File('config', $application_dir);
     $app_config_dir->makeDirectory(self::DIR_MODE);
     //=======================================
     // Make application/module directory
     //=======================================
     $module_dir = new Charcoal_File('module', $application_dir);
     $module_dir->makeDirectory(self::DIR_MODE);
     echo "Application[{$app_name}] created at: " . $application_dir->getAbsolutePath() . PHP_EOL;
     return b(true);
 }
Example #20
0
 /**
  * Process events
  *
  * @param Charcoal_IEventContext $context   event context
  *
  * @return boolean
  */
 public function processEvent($context)
 {
     $version = Charcoal_Framework::getVersion()->toString();
     $this_year = date('Y');
     echo "CharcoalPHP {$version}." . PHP_EOL;
     echo "Copyright (c)2008-{$this_year} CharcoalPHP team." . PHP_EOL;
     return b(true);
 }
Example #21
0
function a()
{
    $a1;
    $a2;
    $a3;
    $a1 =& $a2;
    b(&$a1, &$a2, &$a3);
}
Example #22
0
function a()
{
    ~_hotspot1;
    // GET[y]:U/D, GET[z]:U/D
    b();
    ~_hotspot2;
    // GET[y]:U/D, GET[z]:T/D
}
Example #23
0
function a()
{
    $a1 =& $GLOBALS['x1'];
    // a1:1, x1:1
    b();
    ~_hotspot0;
    // a1:7, x1:8, x2:8
}
Example #24
0
function main()
{
    var_dump(a() === 'bar');
    var_dump(b() === 24);
    var_dump(c() === 42);
    var_dump(d() === 42);
    var_dump(e() === null);
}
 /**
  * @param string $oldIdGallery
  * @param string $newIdGallery
  * @param string $oldLang
  * @param string $newLang
  */
 public function renameGallery($oldIdGallery, $newIdGallery, $oldLang, $newLang)
 {
     b($oldIdGallery, 'oI');
     b($newIdGallery, 'nI');
     b($oldLang, 'oL');
     b($newLang, 'nL');
     FileSystem::rename(galleryPath . $oldIdGallery . '_' . $oldLang, galleryPath . $newIdGallery . '_' . $newLang);
 }
Example #26
0
function a()
{
    b(&$a1);
    ~_hotspot0;
    // a1 is NOT an alias of main.x:
    // u{(main.x, a.x_gs)}
    // a{}
}
Example #27
0
function a($b)
{
    if ($b) {
        $x = 'floo';
    } else {
        $x = 'fleeee';
    }
    b($x);
}
Example #28
0
function a()
{
    $a1 = $GLOBALS['evil'];
    ~_hotspot0;
    // a.a1:T/D
    b(&$a1);
    ~_hotspot1;
    // a.a1:T/D
}
Example #29
0
function a()
{
    if ($u) {
        $a1 =& $GLOBALS['x1'];
    }
    ~_hotspot0;
    // u{ (main.x1, a.x1_gs) } a{ (a.a1, main.x1) (a.a1, a.x1_gs) }
    b(&$a1);
}
Example #30
0
function a()
{
    global $x;
    $a1 =& $x;
    b(&$a1);
    ~_hotspot0;
    // nothing happened to the aliasing:
    // u{(main.x, a.x_gs, a.x, a.a1)}
    // a{}
}