Пример #1
0
 /**
  * @todo Implement testFire().
  */
 public function testFire()
 {
     $observer = new EventsTestObserver();
     $this->object->extend('fire', $observer, 'invoke', null);
     $this->object->fire('dontfire', array('a' => 1, 'b' => 2));
     $this->assertEquals(0, $observer->invoked);
     $this->object->fire('fire', array('a' => 18, 'b' => 81));
     $this->assertEquals(1, $observer->invoked);
     $this->assertEquals(81, $observer->lastArgs['b']);
 }
Пример #2
0
 public function on_start()
 {
     Events::extend('on_file_add', function ($f, $fv) {
         $setless_fs = FileSet::getByName('Setless');
         $setless_fs->addFileToSet($f);
     });
     Events::extend('on_file_added_to_set', function ($fID, $fv) {
         $setless_fs = FileSet::getByName('Setless');
         $file = File::getByID($fID);
         $file_sets = $file->getFileSets();
         $file_set_ids = array();
         foreach ($file_sets as $file_set) {
             $file_set_ids[] = $file_set->fsID;
         }
         // If file is in multiple sets and setless is one of them, remove from setless
         if (count($file_set_ids) >= 2 && in_array($setless_fs->fsID, $file_set_ids)) {
             $setless_fs->removeFileFromSet($file);
         }
     });
     Events::extend('on_file_removed_from_set', function ($fID, $fv) {
         $setless_fs = FileSet::getByName('Setless');
         $file = File::getByID($fID);
         $file_sets = $file->getFileSets();
         // If file is no longer in any sets, add to setless
         if (count($file_sets) == 0) {
             $setless_fs->addFileToSet($file);
         }
     });
 }
Пример #3
0
 public function on_start()
 {
     Loader::helper('ms_route', 'multisite');
     if (!User::isLoggedIn()) {
         Events::extend('on_before_render', 'MsRouter', 'render', 'packages/' . $this->pkgHandle . '/models/ms_router.php');
     }
 }
Пример #4
0
 public function on_start()
 {
     Events::extend('on_page_output', function ($content) {
         $m = Loader::helper('miser', 'miser');
         return $m->optimise($content);
     });
 }
Пример #5
0
 public function on_start()
 {
     define('DIRNAME_IMAGES_LANGUAGES', 'flags');
     if (!defined('MULTILINGUAL_FLAGS_WIDTH')) {
         /** Width of multilingual flags.
          * @var int
          */
         define('MULTILINGUAL_FLAGS_WIDTH', 16);
     }
     if (!defined('MULTILINGUAL_FLAGS_HEIGHT')) {
         /** Height of multilingual flags.
          * @var int
          */
         define('MULTILINGUAL_FLAGS_HEIGHT', 16);
     }
     // checks to see if the user should be redirected to the default language home page instead of the / home page.
     Events::extend('on_start', 'DefaultLanguageHelper', 'checkDefaultLanguage', 'packages/' . $this->pkgHandle . '/helpers/default_language.php');
     // adds the site translation files to the translation library so strings wrapped in t('') will be translated
     Events::extend('on_start', 'DefaultLanguageHelper', 'setupSiteInterfaceLocalization', 'packages/' . $this->pkgHandle . '/helpers/default_language.php');
     // Ensure's the language tags are set in the header
     //Events::extend('on_start', 'TranslatedPagesHelper', 'addMetaTags', 'packages/' . $this->pkgHandle . '/helpers/translated_pages.php');
     Events::extend('on_page_get_icon', 'InterfaceFlagHelper', 'getDashboardSitemapIconSRC', 'packages/' . $this->pkgHandle . '/helpers/interface/flag.php');
     Events::extend('on_page_delete', 'MultilingualSection', 'assignDelete', 'packages/' . $this->pkgHandle . '/models/section.php');
     Events::extend('on_page_duplicate', 'MultilingualSection', 'assignDuplicate', 'packages/' . $this->pkgHandle . '/models/section.php');
     Events::extend('on_page_add', 'MultilingualSection', 'assignAdd', 'packages/' . $this->pkgHandle . '/models/section.php');
     Events::extend('on_page_move', 'MultilingualSection', 'assignMove', 'packages/' . $this->pkgHandle . '/models/section.php');
     if (defined('MULTILINGUAL_ADD_ALTERNATE_HREFLANG') && MULTILINGUAL_ADD_ALTERNATE_HREFLANG) {
         Events::extend('on_page_view', __CLASS__, 'addAlternateHrefLang', __FILE__);
     }
     // add the header menu item
     $ihm = Loader::helper('concrete/interface/menu');
     Loader::model('section', 'multilingual');
     $uh = Loader::helper('concrete/urls');
     $ihm->addPageHeaderMenuItem('multilingual', false, 'right', array('dialog-title' => t('Multilingual Pages'), 'href' => $uh->getToolsUrl('switch_language_for_page', 'multilingual'), 'dialog-on-open' => "\$(\\'#ccm-page-edit-nav-multilingual\\').removeClass(\\'ccm-nav-loading\\')", 'dialog-width' => '400', 'dialog-height' => "300", 'dialog-modal' => "false", 'class' => 'dialog-launch'), 'multilingual');
 }
Пример #6
0
 public function on_start()
 {
     // Minifier enabled, start the process
     $uh = Loader::helper("concrete/urls");
     define('MINCO_TOOL_URL', $uh->getToolsUrl('min', $this->pkgHandle));
     define('MINCO_LISTS_FILE', DIR_CONFIG_SITE . '/' . $this->pkgHandle . '.php');
     define('MINCO_MINIFY_LIB_DIR', DIR_PACKAGES . '/mainio_minco/' . DIRNAME_LIBRARIES . '/3rdparty/minify-2.1.5/min/lib');
     // Minifier requires this one because of its internal inclusions
     set_include_path(MINCO_MINIFY_LIB_DIR . PATH_SEPARATOR . get_include_path());
     if (!defined('DIR_TMP')) {
         define('DIR_TMP', Loader::helper('file')->getTemporaryDirectory());
     }
     if (!defined('MINCO_RESOURCES_SAVE_DIR')) {
         define('MINCO_RESOURCES_SAVE_DIR', DIR_TMP);
     }
     if (!defined('MINCO_RESOURCES_SAVE_DIR_REL')) {
         define('MINCO_RESOURCES_SAVE_DIR_REL', str_replace(DIR_BASE, DIR_REL, MINCO_RESOURCES_SAVE_DIR));
     }
     if (!defined('MINCO_USE_CDN_RESOURCES')) {
         define('MINCO_USE_CDN_RESOURCES', true);
     }
     if (!defined('MINCO_BYPASS_CACHE')) {
         define('MINCO_BYPASS_CACHE', false);
     }
     if (!defined('MINCO_CLIENT_CACHE')) {
         if (MINCO_BYPASS_CACHE) {
             define('MINCO_CLIENT_CACHE', false);
         } else {
             define('MINCO_CLIENT_CACHE', true);
         }
     }
     if (!defined('MINCO_MINIFY_HTML')) {
         define('MINCO_MINIFY_HTML', false);
     }
     if (!defined('MINCO_MINIFY_INLINE')) {
         if (MINCO_MINIFY_HTML) {
             define('MINCO_MINIFY_INLINE', false);
         } else {
             define('MINCO_MINIFY_INLINE', true);
         }
     }
     if (!defined('MINICO_REPLACE_CSS_IMG_PATHS')) {
         define('MINICO_REPLACE_CSS_IMG_PATHS', false);
     }
     // To enable users calling the block start and end functions
     // inside the templates
     Loader::library("minco_block", "mainio_minco");
     Loader::library('minco', 'mainio_minco');
     $req = Request::get();
     if (MINCO_MINIFY_HTML && strpos($req->getRequestPath(), "dashboard") === false) {
         // Bind events to minify output HTML
         Events::extend('on_before_render', get_class(), 'min_html_start', DIR_PACKAGES . '/' . $this->pkgHandle . '/controller.php');
         Events::extend('on_render_complete', get_class(), 'min_html_end', DIR_PACKAGES . '/' . $this->pkgHandle . '/controller.php');
     }
 }
Пример #7
0
 public function on_start()
 {
     Loader::helper('https_handling', 'handle_https');
     Events::extend('on_before_render', 'HttpsHandlingHelper', 'handleRequest');
 }
 public function on_start()
 {
     Events::extend('on_page_view', 'ImageCropperPackage', 'on_page_view', 'packages/image_cropper/controller.php');
 }
Пример #9
0
<?php

Events::extendPageType('walk', 'on_page_update');
// Setup user when created
Events::extend('on_user_add', '\\JanesWalk\\Models\\Users\\WalkLeader', 'setupUserJoinInfo', 'models/users/WalkLeader.php');
Пример #10
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
Events::extend('on_start', 'FSENLocalization', 'setupInterfaceLocalization4Request', 'models/fsen_localization.php');
Events::extend('on_before_render', 'FSENLocalization', 'setupInterfaceLocalization4Page', 'models/fsen_localization.php');