当前位置: 首页>>代码示例>>PHP>>正文


PHP Registry::getInstance方法代码示例

本文整理汇总了PHP中Registry::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::getInstance方法的具体用法?PHP Registry::getInstance怎么用?PHP Registry::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Registry的用法示例。


在下文中一共展示了Registry::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param string $filename
  * @throws AException
  */
 public function __construct($filename)
 {
     if (is_dir($filename)) {
         $filename .= (substr($filename, -1) != '/' ? '/' : '') . 'error.txt';
     }
     $this->filename = $filename;
     if (!is_writable(pathinfo($filename, PATHINFO_DIRNAME))) {
         // if it happens see errors in httpd error log!
         throw new AException(AC_ERR_LOAD, 'Error: Log directory ' . DIR_LOGS . ' is non-writable. Please change permissions.');
     }
     //check is log-file writable
     //1.create file if it not exists
     $handle = @fopen($filename, 'a+');
     @fclose($handle);
     //2. then change mode to 777
     if (is_file($filename) && decoct(fileperms($filename) & 0777) != 777) {
         chmod($filename, 0777);
         //3.if log-file non-writable create new one
         if (!is_writable($filename)) {
             $this->filename = DIR_LOGS . 'error_0.txt';
             $handle = @fopen($this->filename, 'a+');
             @fclose($handle);
         }
     }
     if (class_exists('Registry')) {
         // for disabling via settings
         $registry = Registry::getInstance();
         if (is_object($registry->get('config'))) {
             $this->mode = $registry->get('config')->get('config_error_log') ? true : false;
         }
     }
 }
开发者ID:afshinnj,项目名称:abantecart-src,代码行数:36,代码来源:log.php

示例2: __construct

 function __construct($params)
 {
     parent::__construct($params);
     $this->conf = Registry::getInstance();
     $this->model = new minsert();
     $this->view = new vinsert();
 }
开发者ID:AidaDC,项目名称:to,代码行数:7,代码来源:insert.php

示例3: execute

 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('showUserdata');
     // Variablen der Template-Dateien Werte zuordnen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Suche nach Benutzernamen starten.
     if ($request->issetParameter('userSearch')) {
         if ($request->issetParameter('namefilter') and $request->issetParameter('namefilter') != '') {
             $sessionRegistry->set('activeNamefilter', $request->getParameter('namefilter'));
         } else {
             $sessionRegistry->set('activeNamefilter', '*');
         }
         $sessionRegistry->set('activeGroup', $request->getParameter('groupSelect'));
     }
     if ($sessionRegistry->get('activeGroup') != null) {
         $view->assign('namefilter', $sessionRegistry->get('activeNamefilter'));
         $view->assign('groupSelect', $sessionRegistry->get('activeGroup'));
         $view->assign('results', $registry->get('ldapAccess')->search($sessionRegistry->get('activeNamefilter'), $sessionRegistry->get('activeGroup')));
     }
     if ($request->issetParameter('userSelect')) {
         $view->assign('userSelect', $request->getParameter('userSelect'));
         $view->assign('userdata', $registry->get('ldapAccess')->getUserInformation($request->getParameter('userSelect')));
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
开发者ID:open-steam,项目名称:usermanagement-ldap,代码行数:29,代码来源:showUserdataCommand.php

示例4: init

 /**
  * @param string $session_name
  */
 public function init($session_name)
 {
     $path = dirname($_SERVER['PHP_SELF']);
     session_set_cookie_params(0, $path, null, defined('HTTPS') && HTTPS, true);
     session_name($session_name);
     // for shared ssl domain set session id of non-secure domain
     $registry = Registry::getInstance();
     if ($registry->get('config')) {
         if ($registry->get('config')->get('config_shared_session') && isset($_GET['session_id'])) {
             header('P3P: CP="CAO COR CURa ADMa DEVa OUR IND ONL COM DEM PRE"');
             session_id($_GET['session_id']);
             setcookie($session_name, $_GET['session_id'], 0, $path, null, defined('HTTPS') && HTTPS, true);
         }
     }
     if (isset($_GET[EMBED_TOKEN_NAME]) && !isset($_COOKIE[$session_name])) {
         session_id($_GET[EMBED_TOKEN_NAME]);
         setcookie($session_name, $_GET[EMBED_TOKEN_NAME], 0, $path, null, defined('HTTPS') && HTTPS);
         $session_mode = 'embed_token';
     } else {
         $session_mode = '';
     }
     session_start();
     /*
     NOTE: You can enable this section if you need extra security to prevent session attacks. 
     We recomed to use of SSL on all admin pages and customer related storefront pages.
     if(!$this->_prevent_hijacking()){
     	$this->clear();
     	session_name($this->ses_name);
     	session_start();
     }
     */
     $_SESSION['session_mode'] = $session_mode;
 }
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info-store,代码行数:36,代码来源:session.php

示例5: ac_exception_handler

/**
 * called for caught exceptions
 * @param  AException $e
 * @return null
 */
function ac_exception_handler($e)
{
    //fix for default PHP handler call in third party PHP libraries
    if (!method_exists($e, 'logError')) {
        $e = new AException($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
    }
    if (class_exists('Registry')) {
        $registry = Registry::getInstance();
        $config = $registry->get('config');
        if (!$config || !$config->has('config_error_log') && !$config->has('config_error_display')) {
            $e->logError();
            $e->displayError();
        } else {
            if ($config->has('config_error_log') && $config->get('config_error_log')) {
                $e->logError();
            }
            if ($config->has('config_error_display') && $config->get('config_error_display')) {
                $e->displayError();
            }
        }
        return null;
    }
    $e->logError();
    $e->displayError();
}
开发者ID:nelkihel,项目名称:abantecart-src,代码行数:30,代码来源:exceptions.php

示例6: recoveryDate

 public static function recoveryDate(\DateTime $data)
 {
     print_r($data);
     die;
     $data->format("d/m/Y H:s:i");
     Registry::getInstance()->set('data_hoje', $data);
 }
开发者ID:pelif,项目名称:curso-design-pattern,代码行数:7,代码来源:DadosImportantes.php

示例7: execute

 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('changeSchool');
     // Template-Variablen Werte zuweisen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('districtList', $registry->get('ldapAccess')->getDistricts());
     if ($request->issetParameter('districtSelect')) {
         $view->assign('districtSelect', $request->getParameter('districtSelect'));
     }
     // Benutzeraktion: Kreis gewählt.
     if ($request->issetParameter('changeDistrict')) {
         $view->assign('schoolList', $registry->get('ldapAccess')->getSchools($request->getParameter('districtSelect')));
     }
     // Benutzeraktion: Schule gewechselt.
     if ($request->issetParameter('changeSchool')) {
         $sessionRegistry->set('school', 'ou=' . $request->getParameter('schoolSelect'));
         $sessionRegistry->set('district', 'ou=' . $request->getParameter('districtSelect'));
         $view->assign('schoolList', $registry->get('ldapAccess')->getSchools($request->getParameter('districtSelect')));
         $view->assign('schoolSelect', str_replace('ou=', '', $sessionRegistry->get('school')));
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
开发者ID:open-steam,项目名称:usermanagement-ldap,代码行数:25,代码来源:changeSchoolCommand.php

示例8: __construct

 function __construct()
 {
     ob_start();
     $conf = Registry::getInstance();
     // access to app_data that configures html-view
     $this->view_data = (array) $conf->app;
 }
开发者ID:puleva4ever,项目名称:ProjectPDO,代码行数:7,代码来源:view.php

示例9: save

 function save()
 {
     foreach (array_keys(Registry::getInstance()->get('locales')) as $locale) {
         $data[$locale] = ['html' => $this->get('html', $locale)];
     }
     parent::saveData($this->parentId, self::TABLE, $data);
 }
开发者ID:jne21,项目名称:WBT,代码行数:7,代码来源:TemplateL10n.php

示例10: execute

 public function execute(Request $request, Response $response)
 {
     $view = new TemplateView('createDistrict');
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     // Benutzeraktion: neuen Kreis anlegen.
     if ($request->issetParameter('create')) {
         // Eingabedaten auf Korrektheit prüfen
         $datacorrectness = true;
         if (!$request->issetParameter('districtName') or $request->getParameter('districtName') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte geben Sie einen Namen für den Kreis an!');
         }
         if ($datacorrectness) {
             $status = $registry->get('ldapAccess')->createDistrict($request->getParameter('districtName'));
             if ($status != false) {
                 $view->assign('status', 'ok');
                 $view->assign('statusMsg', 'Der Kreis wurde korrekt angelegt!');
             } else {
                 $view->assign('status', 'warning');
                 $view->assign('statusMsg', 'Es ist ein Fehler aufgetreten!');
             }
         }
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
开发者ID:open-steam,项目名称:usermanagement-ldap,代码行数:29,代码来源:createDistrictCommand.php

示例11: __construct

 /**
  * @param string $filename
  * @throws AException
  */
 public function __construct($filename)
 {
     if (is_dir($filename)) {
         $filename .= (substr($filename, -1) != '/' ? '/' : '') . 'error.txt';
     }
     $this->filename = $filename;
     if (!is_writable(pathinfo($filename, PATHINFO_DIRNAME))) {
         // if it happens see errors in httpd error log!
         throw new AException(AC_ERR_LOAD, 'Error: Log directory ' . DIR_LOGS . ' is non-writable. Please change permissions.');
     }
     //1.create file if it not exists
     if (!file_exists($this->filename)) {
         $handle = @fopen($this->filename, 'a+');
         @fclose($handle);
     } else {
         if (!is_writable($this->filename)) {
             //create second log file if original is not writable
             $this->filename = DIR_LOGS . 'error_0.txt';
             $handle = @fopen($this->filename, 'a+');
             @fclose($handle);
         }
     }
     if (class_exists('Registry')) {
         // for disabling via settings
         $registry = Registry::getInstance();
         if (is_object($registry->get('config'))) {
             $this->mode = $registry->get('config')->get('config_error_log') ? true : false;
         }
     }
 }
开发者ID:siddht1,项目名称:abantecart-src,代码行数:34,代码来源:log.php

示例12: __construct

 function __construct($contents)
 {
     $this->reg = Registry::getInstance();
     //access to app_data
     $array_app = (array) $this->reg->app_data;
     Template::load($contents, $array_app);
 }
开发者ID:adrisnz,项目名称:projectefinal,代码行数:7,代码来源:view.php

示例13: getInstance

 /**
  * Get the config static object
  *
  * @return self
  */
 public static function getInstance($basePath = null)
 {
     if (!isset(self::$_Registry)) {
         self::$_Registry = parent::getInstance($basePath);
     }
     return self::$_Registry;
 }
开发者ID:dianadevargas,项目名称:php-framework,代码行数:12,代码来源:sessionRegistry.php

示例14: buildStoreFrontMenuTree

function buildStoreFrontMenuTree($menu_array, $level = 0)
{
    $menu_array = (array) $menu_array;
    if (!$menu_array) {
        return '';
    }
    $result = '';
    //for submenus build new UL node
    if ($level > 0) {
        $result .= "<ul class='sub_menu dropdown-menu'>\r\n";
    }
    $registry = Registry::getInstance();
    $logged = $registry->get('customer')->isLogged();
    $ar = new AResource('image');
    foreach ($menu_array as $item) {
        if ($logged && $item['id'] == 'login' || !$logged && $item['id'] == 'logout') {
            continue;
        }
        //build appropriate menu id and classes for css controll
        $id = empty($item['id']) ? '' : ' data-id="menu_' . $item['id'] . '" ';
        // li ID
        if ($level != 0) {
            if (empty($item['children'])) {
                $class = $item['icon'] ? ' class="top nobackground"' : ' class="sub menu_' . $item['id'] . '" ';
            } else {
                $class = $item['icon'] ? ' class="parent nobackground" ' : ' class="parent menu_' . $item['id'] . '" ';
            }
        } else {
            $class = $item['icon'] ? ' class="top nobackground"' : ' class="top menu_' . $item['id'] . '" ';
        }
        $href = empty($item['href']) ? '' : ' href="' . $item['href'] . '" ';
        //construct HTML
        $current = '';
        if ($item['current']) {
            $current = 'current';
        }
        $result .= '<li ' . $id . ' class="dropdown ' . $current . '">';
        $result .= '<a ' . $class . $href . '>';
        //check icon rl type html, image or none.
        $rl_id = $item['icon_rl_id'];
        if ($rl_id) {
            $resource = $ar->getResource($rl_id);
            if ($resource['resource_path'] && is_file(DIR_RESOURCE . 'image/' . $resource['resource_path'])) {
                $result .= '<img class="menu_image" src="' . HTTPS_DIR_RESOURCE . 'image/' . $resource['resource_path'] . '" alt="" />';
            } elseif ($resource['resource_code']) {
                $result .= $resource['resource_code'];
            }
        }
        $result .= '<span class="menu_text">' . $item['text'] . '</span></a>';
        //if children build inner clild tree
        if (!empty($item['children'])) {
            $result .= "\r\n" . buildStoreFrontMenuTree($item['children'], $level + 1);
        }
        $result .= "</li>\r\n";
    }
    if ($level > 0) {
        $result .= "</ul>\r\n";
    }
    return $result;
}
开发者ID:siddht1,项目名称:abantecart-src,代码行数:60,代码来源:html.php

示例15: __construct

 public function __construct($custom_block_id)
 {
     $this->registry = Registry::getInstance();
     $this->custom_block_id = (int) $custom_block_id;
     // datasources hardcode
     $this->data_sources = array('catalog_product_getPopularProducts' => array('text' => 'text_products_popular', 'rl_object_name' => 'products', 'data_type' => 'product_id', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getPopularProducts', 'storefront_view_path' => 'product/product'), 'catalog_product_getSpecialProducts' => array('text' => 'text_products_special', 'rl_object_name' => 'products', 'data_type' => 'product_id', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getProductSpecials', 'storefront_view_path' => 'product/product'), 'catalog_category_getcategories' => array('text' => 'text_categories', 'rl_object_name' => 'categories', 'data_type' => 'category_id', 'storefront_model' => 'catalog/category', 'storefront_method' => 'getCategories', 'storefront_view_path' => 'product/category'), 'catalog_category_getmanufacturers' => array('text' => 'text_manufacturers', 'rl_object_name' => 'manufacturers', 'data_type' => 'manufacturer_id', 'storefront_model' => 'catalog/manufacturer', 'storefront_method' => 'getManufacturers', 'storefront_view_path' => 'product/manufacturer'), 'catalog_product_getfeatured' => array('text' => 'text_featured', 'rl_object_name' => 'products', 'data_type' => 'product_id', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getFeaturedProducts', 'storefront_view_path' => 'product/product'), 'catalog_product_getlatest' => array('text' => 'text_latest', 'rl_object_name' => 'products', 'data_type' => 'product_id', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getLatestProducts', 'storefront_view_path' => 'product/product'), 'catalog_product_getbestsellers' => array('text' => 'text_bestsellers', 'rl_object_name' => 'products', 'data_type' => 'product_id', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getBestsellerProducts', 'storefront_view_path' => 'product/product'), 'media' => array('text' => 'text_media'), 'custom_products' => array('model' => 'catalog/product', 'total_method' => 'getTotalProducts', 'method' => 'getProducts', 'language' => 'catalog/product', 'data_type' => 'product_id', 'view_path' => 'catalog/product/update', 'rl_object_name' => 'products', 'text' => 'text_custom_products', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getProduct', 'storefront_view_path' => 'product/product', 'items_list_url' => 'product/product/related'), 'custom_categories' => array('model' => 'catalog/category', 'total_method' => 'getTotalCategories', 'method' => 'getCategoriesData', 'language' => 'catalog/category', 'data_type' => 'category_id', 'view_path' => 'catalog/category/update', 'rl_object_name' => 'categories', 'text' => 'text_custom_categories', 'storefront_model' => 'catalog/category', 'storefront_method' => 'getCategory', 'storefront_view_path' => 'product/category', 'items_list_url' => 'product/product/product_categories'), 'custom_manufacturers' => array('model' => 'catalog/manufacturer', 'total_method' => 'getTotalManufacturers', 'method' => 'getManufacturers', 'language' => 'catalog/manufacturer', 'data_type' => 'manufacturer_id', 'view_path' => 'catalog/category/update', 'rl_object_name' => 'manufacturers', 'text' => 'text_custom_manufacturers', 'storefront_model' => 'catalog/manufacturer', 'storefront_method' => 'getManufacturer', 'storefront_view_path' => 'product/manufacturer', 'items_list_url' => 'catalog/manufacturer_listing/getManufacturers'));
 }
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:7,代码来源:listing.php


注:本文中的Registry::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。