本文整理汇总了PHP中collection::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP collection::getInstance方法的具体用法?PHP collection::getInstance怎么用?PHP collection::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collection
的用法示例。
在下文中一共展示了collection::getInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*/
protected function __construct()
{
global $section;
parent::__construct(__FILE__);
// create mailer support
$system_mailer = new ContactForm_SystemMailer($this->language);
$smtp_mailer = new ContactForm_SmtpMailer($this->language);
$this->registerMailer('system', $system_mailer);
$this->registerMailer('smtp', $smtp_mailer);
// configure SMTP mailer
$smtp_mailer->set_server($this->settings['smtp_server'], $this->settings['smtp_port'], $this->settings['use_ssl']);
if ($this->settings['smtp_authenticate']) {
$smtp_mailer->set_credentials($this->settings['smtp_username'], $this->settings['smtp_password']);
}
// register backend
if ($section == 'backend' && class_exists('backend')) {
$backend = backend::getInstance();
$contact_menu = new backend_MenuItem($this->getLanguageConstant('menu_contact'), url_GetFromFilePath($this->path . 'images/icon.svg'), 'javascript:void(0);', $level = 5);
$contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_manage_forms'), url_GetFromFilePath($this->path . 'images/forms.svg'), window_Open('contact_forms', 600, $this->getLanguageConstant('title_forms_manage'), true, true, backend_UrlMake($this->name, 'forms_manage')), $level = 5));
$contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_manage_templates'), url_GetFromFilePath($this->path . 'images/templates.svg'), window_Open('contact_form_templates', 550, $this->getLanguageConstant('title_templates_manage'), true, true, backend_UrlMake($this->name, 'templates_manage')), $level = 5));
$contact_menu->addSeparator(5);
$contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_settings'), url_GetFromFilePath($this->path . 'images/settings.svg'), window_Open('contact_form_settings', 400, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'settings_show')), $level = 5));
$contact_menu->addSeparator(5);
$contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_submissions'), url_GetFromFilePath($this->path . 'images/submissions.svg'), window_Open('contact_form_submissions', 650, $this->getLanguageConstant('title_submissions'), true, true, backend_UrlMake($this->name, 'submissions')), $level = 5));
$backend->addMenu($this->name, $contact_menu);
// add backend support script
$head_tag = head_tag::getInstance();
$head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/backend.js'), 'type' => 'text/javascript'));
$head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/backend.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
}
if (class_exists('collection') && $section != 'backend') {
$collection = collection::getInstance();
$collection->includeScript(collection::DIALOG);
$collection->includeScript(collection::COMMUNICATOR);
}
if (class_exists('head_tag') && $section != 'backend') {
$head_tag = head_tag::getInstance();
$head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/contact_form.js'), 'type' => 'text/javascript'));
$head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/contact_form.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
}
}
示例2: __construct
/**
* Constructor
*
* @return backend
*/
protected function __construct()
{
global $section, $language;
parent::__construct(__FILE__);
// create events
Events::register('backend', 'user-create');
Events::register('backend', 'user-change');
Events::register('backend', 'user-delete');
Events::register('backend', 'user-password-change');
// load CSS and JScript
if (class_exists('head_tag') && $section == 'backend') {
$head_tag = head_tag::getInstance();
$collection = collection::getInstance();
$collection->includeScript(collection::JQUERY);
$collection->includeScript(collection::JQUERY_EVENT_DRAG);
$collection->includeScript(collection::WINDOW_SYSTEM);
if ($_SESSION['logged']) {
$collection->includeScript(collection::JQUERY_EXTENSIONS);
$collection->includeScript(collection::NOTEBOOK);
$collection->includeScript(collection::SHOWDOWN);
$collection->includeScript(collection::TOOLBAR);
}
$head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/backend.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
$head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/backend.js'), 'type' => 'text/javascript'));
}
// add admin level menus
if ($section == 'backend') {
$system_menu = new backend_MenuItem($this->getLanguageConstant('menu_system'), url_GetFromFilePath($this->path . 'images/icons/16/system.svg'), 'javascript:void(0);', $level = 1);
$system_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_modules'), url_GetFromFilePath($this->path . 'images/icons/16/modules.svg'), window_Open('system_modules', 610, $this->getLanguageConstant('title_modules'), true, false, backend_UrlMake($this->name, 'modules')), $level = 10));
$system_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_users'), url_GetFromFilePath($this->path . 'images/icons/16/users.svg'), window_Open('system_users', 690, $this->getLanguageConstant('title_users_manager'), true, false, backend_UrlMake($this->name, 'users')), $level = 10));
$system_menu->addSeparator(10);
$system_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_change_password'), url_GetFromFilePath($this->path . 'images/icons/16/change_password.svg'), window_Open('change_password_window', 350, $this->getLanguageConstant('title_change_password'), true, false, backend_UrlMake($this->name, 'change_password')), $level = 1));
$system_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_logout'), url_GetFromFilePath($this->path . 'images/icons/16/logout.svg'), window_Open('logout_window', 350, $this->getLanguageConstant('title_logout'), true, false, backend_UrlMake($this->name, 'logout')), $level = 1));
$this->addMenu($this->name, $system_menu);
}
}
示例3: addElements
/**
* Method called by the page module to add elements before printing
*/
public function addElements()
{
global $section, $db_use, $optimize_code, $url_rewrite;
$head_tag = head_tag::getInstance();
$collection = collection::getInstance();
$language_handler = MainLanguageHandler::getInstance();
$default_language = $language_handler->getDefaultLanguage();
$language_list = $language_handler->getLanguages(false);
// add base url tag
$head_tag->addTag('base', array('href' => _BASEURL));
// add mobile menu script
if (_MOBILE_VERSION && !in_array('mobile_menu', $this->omit_elements)) {
$collection->includeScript(collection::MOBILE_MENU);
}
// content meta tags
if (!in_array('content_type', $this->omit_elements)) {
$head_tag->addTag('meta', array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8'));
}
if (!in_array('viewport', $this->omit_elements) && _MOBILE_VERSION) {
$head_tag->addTag('meta', array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0'));
}
if (!in_array('language', $this->omit_elements) && _STANDARD == 'html401') {
$head_tag->addTag('meta', array('http-equiv' => 'Content-Language', 'content' => join(', ', $language_list)));
}
// add other languages if required
if (count($language_list) > 1 && $url_rewrite && class_exists('language_menu')) {
language_menu::getInstance()->addMeta();
}
// robot tags
$head_tag->addTag('meta', array('name' => 'robots', 'content' => 'index, follow'));
$head_tag->addTag('meta', array('name' => 'googlebot', 'content' => 'index, follow'));
$head_tag->addTag('meta', array('name' => 'rating', 'content' => 'general'));
if ($section != 'backend' && $section != 'backend_module' && $db_use) {
// google analytics
if (!empty($this->settings['analytics'])) {
$head_tag->addGoogleAnalytics($this->settings['analytics'], $this->settings['analytics_domain'], $this->settings['analytics_version']);
}
// google website optimizer
if (!empty($this->settings['optimizer'])) {
$head_tag->addGoogleSiteOptimizer($this->settings['optimizer'], $this->settings['optimizer_key'], $this->optimizer_page, $this->optimizer_show_control);
}
// google webmaster tools
if (!empty($this->settings['wm_tools'])) {
$head_tag->addTag('meta', array('name' => 'google-site-verification', 'content' => $this->settings['wm_tools']));
}
// bing webmaster tools
if (!empty($this->settings['bing_wm_tools'])) {
$head_tag->addTag('meta', array('name' => 'msvalidate.01', 'content' => $this->settings['bing_wm_tools']));
}
// page description
if ($db_use) {
if (!is_null($this->page_description)) {
$value = $this->page_description;
} else {
$value = $this->settings['description'];
}
}
$head_tag->addTag('meta', array('name' => 'description', 'content' => $value));
}
// copyright
if (!in_array('copyright', $this->omit_elements) && _STANDARD == 'html401') {
$copyright = MainLanguageHandler::getInstance()->getText('copyright');
$copyright = strip_tags($copyright);
$head_tag->addTag('meta', array('name' => 'copyright', 'content' => $copyright));
}
// favicon
if (file_exists(_BASEPATH . '/images/favicon.png')) {
// regular, single size favicon
$icon_files = array('16x16' => _BASEPATH . '/images/favicon.png');
} else {
if (file_exists(_BASEPATH . '/images/favicon')) {
$icon_sizes = array(16, 32, 64);
$icon_files = array();
foreach ($icon_sizes as $size) {
$file_name = _BASEPATH . '/images/favicon/' . $size . '.png';
if (file_exists($file_name)) {
$icon_files[$size . 'x' . $size] = $file_name;
}
}
} else {
$icon_files = array('16x16' => _BASEPATH . '/images/default_icon/16.png', '32x32' => _BASEPATH . '/images/default_icon/32.png', '64x64' => _BASEPATH . '/images/default_icon/64.png');
}
}
foreach ($icon_files as $sizes => $icon) {
$head_tag->addTag('link', array('rel' => 'icon', 'type' => 'image/png', 'sizes' => $sizes, 'href' => url_GetFromFilePath($icon)));
}
// add default styles and script if they exists
$collection->includeScript(collection::JQUERY);
if ($section != 'backend') {
$styles = array();
$less_style = null;
// prepare list of files without extensions
if (_DESKTOP_VERSION) {
$styles = array('/styles/common.css', '/styles/main.css', '/styles/header.css', '/styles/content.css', '/styles/footer.css');
$less_style = '/styles/main.less';
} else {
$styles = array('/styles/common.css', '/styles/main.css', '/styles/header_mobile.css', '/styles/content_mobile.css', '/styles/footer_mobile.css');
//.........这里部分代码省略.........
示例4: parse
/**
* Parse loaded template
*
* @param integer $level Current level of parsing
* @param array $tags Leave blank, used for recursion
* @param boolean $parent_block If parent tag is block element
*/
public function parse($tags = array())
{
global $section, $action, $language, $template_path, $system_template_path;
if (!$this->active && empty($tags)) {
return;
}
// get language handler for later
$language_handler = MainLanguageHandler::getInstance();
// take the tag list for parsing
$tag_array = empty($tags) ? $this->engine->document->tagChildren : $tags;
// start parsing tags
$count = count($tag_array);
for ($i = 0; $i < $count; $i++) {
$tag = $tag_array[$i];
// if tag has eval set
if (isset($tag->tagAttrs['cms:eval']) || isset($tag->tagAttrs['eval'])) {
// get evaluation values
if (isset($tag->tagAttrs['eval'])) {
$value = $tag->tagAttrs['eval'];
} else {
$value = $tag->tagAttrs['cms:eval'];
}
$eval_params = explode(',', $value);
foreach ($eval_params as $param) {
// prepare module includes for evaluation
$settings = array();
if (!is_null($this->module)) {
$settings = $this->module->settings;
}
$params = $this->params;
$to_eval = $tag->tagAttrs[$param];
$tag->tagAttrs[$param] = eval('global $section, $action, $language, $language_rtl, $language_handler; return ' . $to_eval . ';');
}
// unset param
unset($tag->tagAttrs['cms:eval']);
}
if (isset($tag->tagAttrs['cms:optional'])) {
// get evaluation values
$optional_params = explode(',', $tag->tagAttrs['cms:optional']);
foreach ($optional_params as $param) {
// prepare module includes for evaluation
$settings = array();
if (!is_null($this->module)) {
$settings = $this->module->settings;
}
$params = $this->params;
$to_eval = $tag->tagAttrs[$param];
$value = eval('global $section, $action, $language, $language_rtl, $language_handler; return ' . $to_eval . ';');
if ($value == false) {
unset($tag->tagAttrs[$param]);
} else {
$tag->tagAttrs[$param] = $value;
}
}
// unset param
unset($tag->tagAttrs['cms:optional']);
}
// implement tooltip
if (isset($tag->tagAttrs['cms:tooltip'])) {
if (!is_null($this->module)) {
$value = $this->module->getLanguageConstant($tag->tagAttrs['cms:tooltip']);
} else {
$value = $language_handler->getText($tag->tagAttrs['cms:tooltip']);
}
$tag->tagAttrs['data-tooltip'] = $value;
unset($tag->tagAttrs['cms:tooltip']);
}
// implement constants
if (isset($tag->tagAttrs['cms:constant'])) {
$params = explode(',', $tag->tagAttrs['cms:constant']);
if (count($params) > 0) {
foreach ($params as $param) {
if (!is_null($this->module)) {
$tag->tagAttrs[$param] = $this->module->getLanguageConstant($tag->tagAttrs[$param]);
} else {
$tag->tagAttrs[$param] = $language_handler->getText($tag->tagAttrs[$param]);
}
}
}
unset($tag->tagAttrs['cms:constant']);
}
// check if specified tag shouldn't be cached
$skip_cache = false;
if (isset($tag->tagAttrs['skip_cache'])) {
// unset param
unset($tag->tagAttrs['skip_cache']);
// get cache handler
$cache = CacheHandler::getInstance();
// only if current URL is being cached, we start dirty area
if ($cache->isCaching()) {
$cache->startDirtyArea();
$skip_cache = true;
// reconstruct template for cache,
//.........这里部分代码省略.........
示例5: includeScripts
/**
* Include buyer information and checkout form scripts.
*
* @param array $tag_params
* @param array $children
*/
public function includeScripts($tag_params, $children)
{
if (!class_exists('head_tag')) {
return;
}
$head_tag = head_tag::getInstance();
$collection = collection::getInstance();
$collection->includeScript(collection::DIALOG);
$collection->includeScript(collection::PAGE_CONTROL);
$head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/checkout.js'), 'type' => 'text/javascript'));
}