本文整理汇总了PHP中container函数的典型用法代码示例。如果您正苦于以下问题:PHP container函数的具体用法?PHP container怎么用?PHP container使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了container函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
private static function dispatch()
{
$route = Utils::get('appDispatch');
if (!$route instanceof Container) {
context()->is404();
$route = container()->getRoute();
}
if (true !== container()->getIsDispatched()) {
if (true !== $route->getCache()) {
context()->dispatch($route);
} else {
$redis = context()->redis();
$key = sha1(serialize($route->assoc())) . '::routeCache';
$cached = $redis->get($key);
if (!strlen($cached)) {
ob_start();
context()->dispatch($route);
$cached = ob_get_contents();
ob_end_clean();
$redis->set($key, $cached);
$ttl = Config::get('application.route.cache', 7200);
$redis->expire($key, $ttl);
}
echo $cached;
}
}
}
示例2: content_block
function content_block()
{
// Build the FormProcessor, and add the
// form content object that the FormProcessor
// will use.
//
$container = container();
// Create the form
$form = new FlipTurnEditHomePageForm("Home Edit", null, '100%');
// Create the form processor
$fp = new FormProcessor($form);
// Don't display the form again if processing was successful.
$fp->set_render_form_after_success(false);
// Add the Form Processor to the container.
// If the Form Processor was succesful, display
// some statistics about the uploaded file.
if ($fp->is_action_successful()) {
//$container->add($form->get_action_message()) ;
// Add the Form Processor to the container.
$container->add(html_br(2), $fp);
} else {
$container->add($fp);
}
return $container;
}
示例3: content_block
function content_block()
{
// Build the FormProcessor, and add the
// form content object that the FormProcessor
// will use.
//
$container = container();
// Create the form
$form = new ResultsQueuePurgeForm("Purge Results Queue", $_SERVER['PHP_SELF'], 600);
// Create the form processor
$fp = new FormProcessor($form);
// Don't display the form again if processing was successful.
$fp->set_render_form_after_success(false);
// Add the Form Processor to the container.
// If the Form Processor was succesful, display
// some statistics about the uploaded file.
if ($fp->is_action_successful()) {
//$container->add($form->get_action_message()) ;
// Add the Form Processor to the container.
$container->add(html_br(2), $fp);
} else {
$container->add($fp);
}
return $container;
}
示例4: content_block
function content_block()
{
// Build the FormProcessor, and add the
// form content object that the FormProcessor
// will use.
//
$container = container();
// Create the form
if ($this->user_is_logged_in()) {
$form = new FlipTurnAdminLogoutForm("Admin Flip Turn Logout", null, 350);
} else {
$form = new FlipTurnAdminLoginForm("Admin Flip Turn Login", null, 350);
}
// Create the form processor
$fp = new FormProcessor($form);
// Don't display the form again if processing was successful.
$fp->set_render_form_after_success(false);
// Add the Form Processor to the container.
// If the Form Processor was succesful, display
// some a welcome message.
if ($fp->is_action_successful()) {
// Redirect to Member page on successful login
//die($_SERVER['PHP_SELF']) ;
$url = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php';
header("Location: {$url}");
exit;
$container->add(html_br(2), $fp);
} else {
$container->add($fp);
}
return $container;
}
示例5: close
public function close()
{
$configs = container()->getConfig()->getDb();
$config = isAke($configs, $this->entity);
if (empty($config)) {
throw new Exception("Database configuration does not exist.");
}
$username = $config->getUsername();
if (empty($username)) {
throw new Exception("Username is mandatory to connect database.");
}
$adapter = $config->getAdapter();
$password = $config->getPassword();
$dbName = $config->getDatabase();
$host = $config->getHost();
$dsn = $config->getDsn();
if (!empty($dsn)) {
$adapter = 'mysql';
}
$connexions = Utils::get('SQLConnexions');
if (null === $connexions) {
$connexions = array();
}
$keyConnexion = sha1(serialize(array("{$adapter}:dbname={$dbName};host={$host}", $username, $password)));
if (Arrays::exists($keyConnexion, $connexions)) {
$connexions[$keyConnexion] = null;
Utils::set('SQLConnexions', $connexions);
}
$this->_isConnected = false;
return $this;
}
示例6: form
/**
* Este metodo construye el formulario en sí.
*/
function form()
{
$ret_val = container();
$table =& html_table($this->_width, 0, 3);
$table->set_class("mainInterfaceWidth");
//$table->set_style("border: 1px solid");
$row = html_tr("");
$col1 = html_td("");
$col1->set_tag_attribute("align", "right");
$col1->add(html_b(agt("Idioma")));
$col2 = html_td("");
$col2->set_tag_attribute("align", "left");
$col2->add($this->element_form("miguel_lang"));
$row->add($col1, $col2);
$table->add($row);
$ret_val->add($table);
$ret_val->add(html_br(2));
$table =& html_table($this->_width, 0, 0);
$table->set_class("table100 main-info-cell");
$row = html_tr("");
$col1 = html_td("");
$col1->set_tag_attribute("align", "left");
$col1->add($this->element_form("Salir"));
$col2 = html_td("");
$col2->set_tag_attribute("align", "right");
$col2->add($this->element_form("Siguiente"));
$row->add($col1, $col2);
$table->add($row);
$ret_val->add($table);
return $ret_val;
}
示例7: content_block
function content_block()
{
// Add the InfoTableCSS so the tables look right
$this->add_head_css(new InfoTableCSS());
// Build the FormProcessor, and add the
// form content object that the FormProcessor
// will use.
//
$container = container();
// Create the form
$form = new SDIFFileUploadForm("Upload SDIF File", $_SERVER['PHP_SELF'], 600);
$form->setUploadFileLabel("SDIF Filename");
// Create the form processor
$fp = new FormProcessor($form);
// Don't display the form again if processing was successful.
$fp->set_render_form_after_success(false);
// If the Form Processor was succesful, display
// some statistics about the uploaded file.
if ($fp->is_action_successful()) {
$sd3fileinfo = $form->get_file_info();
$container->add($fp, $form->get_file_info_table());
} else {
// Add the Form Processor to the container.
$container->add($fp);
}
return $container;
}
示例8: form
/**
* Este metodo construye el formulario en sí.
*/
function form()
{
$ret_val = container();
$table =& html_table($this->_width, 0, 2);
$table->set_class("table100 main-info-cell");
$row0 = html_tr("");
$col0 = html_td("");
$col0->set_tag_attribute("align", "center");
$col0->set_tag_attribute("colspan", "2");
$col0->add($this->element_form("Licence"));
$row0->add($col0);
$table->add($row0);
$row00 = html_tr("");
$col00 = html_td("");
$col00->set_tag_attribute("align", "center");
$col00->set_tag_attribute("colspan", "2");
$col00->add(html_a(Util::app_urlPath('install/include/gpl_print.txt'), agt('Versión Imprimible')));
$row00->add($col00);
$table->add($row00);
$row = html_tr("");
$col1 = html_td("");
$col1->set_tag_attribute("align", "left");
$col1->add($this->element_form("Salir"));
$container = container();
$container->add($this->element_form("Regresar"));
$container->add($this->element_form("Acepto"));
$col2 = html_td("");
$col2->set_tag_attribute("align", "right");
$col2->add($container);
$row->add($col1, $col2);
$table->add($row);
$ret_val->add($table);
return $ret_val;
}
示例9: content_block
function content_block()
{
// Build the FormProcessor, and add the
// form content object that the FormProcessor
// will use.
//
$container = container();
$sdifqueue = new SDIFResultsQueue();
if (!$sdifqueue->ValidateQueue()) {
$msgs = $sdifqueue->get_status_message();
foreach ($msgs as $msg) {
$container->add($this->status_message($msg['msg'], $msg['severity']));
}
return $container;
}
// Create the form
$form = new SDIFQueueProcessForm("Process SDIF Queue", $_SERVER['PHP_SELF'], 600);
// Create the form processor
$fp = new FormProcessor($form);
// Don't display the form again if processing was successful.
$fp->set_render_form_after_success(false);
// Add the Form Processor to the container.
// If the Form Processor was succesful, display
// some statistics about the uploaded file.
if ($fp->is_action_successful()) {
//$container->add($form->get_action_message()) ;
// Add the Form Processor to the container.
$container->add(html_br(2), $fp);
} else {
$container->add($fp);
}
return $container;
}
示例10: content_block
function content_block()
{
// Build the FormProcessor, and add the
// form content object that the FormProcessor
// will use.
//
$container = container();
// Create the form
$form = new SwimmerAddForm("Add Swimmer", null, 600);
// Create the form processor
$fp = new FormProcessor($form);
// Don't display the form again if processing was successful.
$fp->set_render_form_after_success(false);
// Add the Form Processor to the container.
// If the Form Processor was succesful, display
// some statistics about the uploaded file.
if ($fp->is_action_successful()) {
// Add the InfoTableCSS so the tables look right
$this->add_head_css(new DefaultGUIDataListCSS());
$swimmers = new SwimmersDataList("Swimmers", '100%', "swimmerid");
$div = html_div();
$div->set_id("swimmersgdl");
$div->add($swimmers);
$container->add($div);
// Add the Form Processor to the container.
$container->add(html_br(2), $fp);
} else {
$container->add($fp);
}
return $container;
}
示例11: init
public function init()
{
$this->_url = $this->view->_url = context('url');
$this->action = container()->getRoute()->getAction();
$this->view->isLogged = false;
$this->can();
}
示例12: content_block
function content_block()
{
// Add the InfoTableCSS so the tables look right
$this->add_head_css(new DefaultGUIDataListCSS());
// This allows passing arguments eithers as a GET or a POST
$scriptargs = array_merge($_GET, $_POST);
// The swimteamid is the argument which must be
// dealt with differently for GET and POST operations
if (array_key_exists("swimteamid", $scriptargs)) {
$swimteamid = $scriptargs["swimteamid"];
} else {
if (array_key_exists("_swimteamid", $scriptargs)) {
$swimteamid = $scriptargs["_swimteamid"];
} else {
if (array_key_exists(FT_DB_PREFIX . "radio", $scriptargs)) {
$swimteamid = $scriptargs[FT_DB_PREFIX . "radio"][0];
} else {
$swimteamid = null;
}
}
}
$container = container();
$it = new SwimTeamInfoTable("Swim Team Details");
$it->setSwimTeamId($swimteamid);
$it->BuildInfoTable();
$container->add($it);
$container->add(FlipTurnGUIButtons::getBackHomeButtons());
return $container;
}
示例13: form
function form()
{
$table = html_table('100%', 0, 1, 3);
$elem = html_td('color1-bg', 'left', container(html_b('Ruta del archivo CSV'), $this->element_form('path'), $this->add_action('Procesar')));
$elem->set_id('identification');
$table->add_row($elem);
return $table;
}
示例14: factory
/**
* Resolve a factory. Keep in mind that factory would be resolved via container method.
* So make sure if the accessor is an alias, register it on a container by calling:
*
* ```php
* container()->alias('FooClass', 'foo');
* ```
*
* @param string $factory Name of your registered factory
*
* @return mixed
*/
public function factory($factory)
{
if ($this->hasFactory($factory)) {
if (!$this->factoryHasBeenResolved($factory)) {
$this->resolvedFactories[$factory] = container($this->factories[$factory]);
}
return $this->resolvedFactories[$factory];
}
}
示例15: url
/**
* Create a root-relative url.
*
* @param string $path
* @param array $queryParams Optional query string parameters
* @return string
*/
function url($path = '', array $queryParams = [])
{
$uri = container('request')->getUri();
$url = $uri->getBasePath() . '/' . ltrim($path, '/');
if ($queryParams) {
$url .= '?' . http_build_query($queryParams);
}
return $url;
}