/** * @param array $config * @return Extension */ public function extensionFromConfig(array $config) { $extension = new Extension(); $extension->setName(array_get($config, 'name')); $extension->setHandle(array_get($config, 'handle')); $asset = $this->assetList->getAsset('javascript', array_get($config, 'src')); if (!$asset) { $handle = array_get($config, 'handle'); throw new \RuntimeException("Could not build extension \"{$handle}\", invalid extension asset."); } else { $extension->setExtensionAsset($asset); } $view = new View(array_get($config, 'view')); $extension->setView($view); $assets = (array) array_get($config, 'assets'); foreach ($assets as $handle => $asset_config) { $asset_config = (array) $asset_config; foreach ($asset_config as $type) { if ($asset = $this->assetList->getAsset($type, $handle)) { $extension->addAsset($asset); } else { $handle = array_get($config, 'handle'); throw new \RuntimeException("Could not build extension \"{$handle}\", invalid asset."); } } } return $extension; }
public function register() { $obj = $this->app; $this->app->bindShared('editor/image/extension/factory', function () use($obj) { return new ExtensionFactory(AssetList::getInstance()); }); $this->app->bind('editor/image', function () { $editor = new ImageEditor(); return $editor; }); $this->app->bindShared('editor/image/core', function () use($obj) { /** @var ImageEditor $editor */ $editor = $obj->make('editor/image'); /** @var ExtensionFactory $factory */ $factory = $obj->make('editor/image/extension/factory'); /** @var Repository $config */ $config = $obj['config']; $extension_config = $config->get('imageeditor.extensions'); foreach ($extension_config as $config) { $extension = $factory->extensionFromConfig($config); $editor->addExtension(array_get($config, 'type'), $extension); } return $editor; }); }
public function setup($controller) { // register assets $al = \Concrete\Core\Asset\AssetList::getInstance(); $al->register('javascript', 'payment_method_invoice', 'src/Payment/Method/Invoice/invoice.js', array(), 'razor'); $controller->requireAsset('javascript', 'payment_method_invoice'); }
public function on_start() { $al = AssetList::getInstance(); $al->register('javascript', 'dropzone', 'js/dropzone.js', ['position' => \Concrete\Core\Asset\Asset::ASSET_POSITION_FOOTER], $this->pkgHandle); $al->register('css', 'dropzone', 'css/dropzone.css', ['position' => \Concrete\Core\Asset\Asset::ASSET_POSITION_FOOTER], $this->pkgHandle); $al->register('css', 'multifile', 'css/multifile.css', ['position' => \Concrete\Core\Asset\Asset::ASSET_POSITION_FOOTER], $this->pkgHandle); $al->registerGroup('dropzone', [['javascript', 'dropzone'], ['css', 'dropzone'], ['css', 'multifile']]); Route::register('/attribute_multi_file/upload/{tempKey}', '\\Concrete\\Package\\AttributeMultiFile\\Src\\Uploader::upload'); }
public function setup($controller) { // register assets $al = \Concrete\Core\Asset\AssetList::getInstance(); $al->register('javascript', 'payment_method_stripe', 'src/Payment/Method/Stripe/stripe.js', array(), 'razor'); $al->register('javascript', 'stripe_api', 'https://js.stripe.com/v2/', array('local' => false), 'razor'); $controller->requireAsset('javascript', 'stripe_api'); $controller->requireAsset('javascript', 'payment_method_stripe'); }
public function registerViewAssets($outputContent = '') { $al = \Concrete\Core\Asset\AssetList::getInstance(); $this->requireAsset('javascript', 'jquery'); $this->requireAsset('responsive-slides'); $al->register('javascript', 'responsiveslides', 'blocks/image_slider/responsiveslides.js'); $this->requireAsset('javascript', 'blocks/image_slider/responsiveslides'); $al->register('css', 'responsiveslides', 'blocks/image_slider/responsiveslides.css'); $this->requireAsset('css', 'blocks/image_slider/responsiveslides'); }
public function on_start() { $al = AssetList::getInstance(); $al->register('javascript', 'highlightjs', 'js/highlight.js', array('version' => '9.0.0'), 'code_snippet'); $al->register('css', 'highlightjs', 'css/' . h($this->theme), array('version' => '9.0.0'), 'code_snippet'); $al->register('javascript', 'highlightjsinit', 'js/init_highlight.js', array('minify' => true, 'combine' => true), 'code_snippet'); $al->registerGroup('highlightjs', array(array('css', 'highlightjs'), array('javascript', 'highlightjs'), array('javascript', 'highlightjsinit'))); $al->register('javascript', 'typeaheadjs', 'js/typeahead.js', array('version' => '0.11.1'), 'code_snippet'); $al->registerGroup('typeaheadjs', array(array('javascript', 'typeaheadjs'))); }
public function on_start() { $category = Page::getByID(Page::getCurrentPage()->getCollectionParentID())->getCollectionID(); $db = Loader::db(); $display = $db->GetRow("select * from btWebliForums where cID = ?", $category); if (!$display) { $display = $db->GetRow("select * from btWebliForums where cID = ?", 0); } $this->set('display', $display); if ($display['share_this']) { $al = \Concrete\Core\Asset\AssetList::getInstance(); $al->register('javascript', 'share-this', $display['share_this_script']); $this->requireAsset('javascript', 'share-this'); } }
public function on_start() { $this->user = new User(); $this->db = Loader::db(); $al = \Concrete\Core\Asset\AssetList::getInstance(); /* $al->register( 'javascript', 'mediaelement', 'blocks/audio/mediaelement/mediaelement-and-player.min.js' ); */ $al->register('css', 'case', '../application/blocks/case_manager/case.css'); $al->register('css', 'tabs', '../application/blocks/case_manager/tab-content/template1/tabcontent.css'); $al->register('javascript', 'tabs_script', '../application/blocks/case_manager/tab-content/tabcontent.js'); $al->register('css', 'simplelightbox', '../application/blocks/case_manager/simplelightbox/simplelightbox.min.css'); $al->register('javascript', 'simplelightbox_script', '../application/blocks/case_manager/simplelightbox/simple-lightbox.min.js'); //time picker $al->register('css', 'timepicker', '../application/blocks/case_manager/timepicker/timepicker-ui.min.css'); $al->register('javascript', 'timepicker_script', '../application/blocks/case_manager/timepicker/timepicker-ui.min.js'); }
public function on_start() { $pkg = Package::getByHandle($this->pkgHandle); $this->add_events(); $cart = Cart::getCurrentCart(); $shop = Page::getByPath('/shop'); define('SHOP_CID', $shop->getCollectionID()); $terms = Page::getByPath('/terms'); define('TERMS_CID', $terms->getCollectionID()); // add scripts $al = \Concrete\Core\Asset\AssetList::getInstance(); $al->register('javascript', 'razor_js', 'assets/js/razor.js', array(), 'razor'); $al->register('javascript', 'razor_cart', 'assets/js/cart.js', array(), 'razor'); $al->register('javascript', 'razor_checkout', 'assets/js/checkout.js', array(), 'razor'); $al->register('javascript', 'razor_product_composer', 'assets/js/product_composer.js', array(), 'razor'); $al->register('javascript', 'fs_stepper_js', 'assets/stepper/jquery.fs.stepper.js', array(), 'razor'); $al->register('javascript', 'jquery_validate', 'http://cdn.jsdelivr.net/jquery.validation/1.13.1/jquery.validate.js', array('local' => false), 'razor'); $al->register('css', 'razor_checkout', 'assets/css/checkout.css', array(), 'razor'); $al->register('css', 'razor_cart', 'assets/css/cart.css', array(), 'razor'); $al->register('css', 'razor_product_composer', 'assets/css/product_composer.css', array(), 'razor'); $al->register('css', 'fs_stepper_css', 'assets/stepper/jquery.fs.stepper.css', array(), 'razor'); $al->register('css', 'razor_css', 'assets/css/razor.css', array(), 'razor'); }
die(1); } define('DIR_REL', $cms['app_relative_path']); /** * ---------------------------------------------------------------------------- * Setup file cache directories. Has to come after we define services * because we use the file service. * ---------------------------------------------------------------------------- */ $cms->setupFilesystem(); /** * ---------------------------------------------------------------------------- * Registries for theme paths, assets, routes and file types. * ---------------------------------------------------------------------------- */ $asset_list = AssetList::getInstance(); $asset_list->registerMultiple($config->get('app.assets', array())); $asset_list->registerGroupMultiple($config->get('app.asset_groups', array())); Route::registerMultiple($config->get('app.routes')); Route::setThemesByRoutes($config->get('app.theme_paths', array())); $type_list = TypeList::getInstance(); $type_list->defineMultiple($config->get('app.file_types', array())); $type_list->defineImporterAttributeMultiple($config->get('app.importer_attributes', array())); /** * ---------------------------------------------------------------------------- * If we are running through the command line, we don't proceed any further * ---------------------------------------------------------------------------- */ if ($cms->isRunThroughCommandLineInterface()) { return $cms; }
/** * @param Repository $config */ private function initializeAssets(Repository $config) { $asset_list = AssetList::getInstance(); $asset_list->registerMultiple($config->get('app.assets', array())); $asset_list->registerGroupMultiple($config->get('app.asset_groups', array())); }
public function on_start() { \Core::bind('migration/batch/page/validator', function ($app, $batch) { if (isset($batch[0])) { $v = new Validator($batch[0]); $v->registerTask(new ValidateAttributesTask()); $v->registerTask(new ValidatePageTemplatesTask()); $v->registerTask(new ValidatePageTypesTask()); $v->registerTask(new ValidateUsersTask()); $v->registerTask(new ValidateBlocksTask()); $v->registerTask(new ValidateAreasTask()); return $v; } }); \Core::bindShared('migration/batch/validator', function () { $v = new BatchValidator(); $v->registerTask(new ValidateBatchRecordsTask()); return $v; }); \Core::bind('migration/batch/block/validator', function ($app, $batch) { if (isset($batch[0])) { $v = new CollectionValidator($batch[0]); $v->registerTask(new ValidateBlockTypesTask()); $v->registerTask(new ValidateReferencedContentItemsTask()); return $v; } }); \Core::bindShared('migration/manager/mapping', function ($app) { return new Manager($app); }); \Core::bindShared('migration/manager/transforms', function ($app) { return new \PortlandLabs\Concrete5\MigrationTool\Batch\ContentTransformer\Manager($app); }); \Core::bindShared('migration/manager/import/attribute/value', function ($app) { return new AttributeValueManager($app); }); \Core::bindShared('migration/manager/import/attribute/key', function ($app) { return new AttributeKeyManager($app); }); \Core::bindShared('migration/manager/import/attribute/category', function ($app) { return new AttributeCategoryManager($app); }); \Core::bindShared('migration/manager/import/permission/access_entity', function ($app) { return new AccessEntityManager($app); }); \Core::bindShared('migration/manager/import/page_type/publish_target', function ($app) { return new PublishTargetManager($app); }); \Core::bindShared('migration/manager/import/cif_block', function ($app) { return new CIFBlockManager($app); }); \Core::bindShared('migration/manager/import/wordpress_block', function ($app) { return new WordpressBlockManager($app); }); \Core::bindShared('migration/manager/importer/parser', function ($app) { return new ParserManager($app); }); \Core::bindShared('migration/manager/importer/cif', function ($app) { return new CIFImportManager($app); }); \Core::bindShared('migration/manager/importer/wordpress', function ($app) { return new WordpressImportManager($app); }); \Core::bindShared('migration/manager/publisher', function ($app) { return new PublisherManager($app); }); \Core::bindShared('migration/manager/publisher/block', function ($app) { return new BlockPublisherManager($app); }); \Core::bind('migration/import/value_inspector', function ($app, $args) { if (isset($args[0])) { $inspector = $app->make('import/value_inspector'); $inspector->registerInspectionRoutine(new BatchPageRoutine($args[0])); return $inspector; } }); \Core::bindShared('migration/manager/exporters', function ($app) { return new ExporterItemTypeManager($app); }); $al = AssetList::getInstance(); $al->register('javascript', 'fancytree', 'assets/jquery.fancytree/dist/jquery.fancytree-all.min.js', array('minify' => false, 'combine' => false), $this); $al->register('css', 'fancytree/skin/bootstrap', 'assets/jquery.fancytree/dist/skin-bootstrap/ui.fancytree.min.css', array('minify' => false, 'combine' => false), $this); $al->register('javascript', 'migration/batch-table-tree', 'assets/migration/BatchTableTree.js', array(), $this); $al->register('css', 'migration/batch-table-tree', 'assets/migration/BatchTableTree.css', array(), $this); $al->registerGroup('migration/view-batch', array(array('javascript', 'jquery'), array('javascript', 'jquery/ui'), array('javascript', 'fancytree'), array('javascript', 'migration/batch-table-tree'), array('css', 'fancytree/skin/bootstrap'), array('css', 'migration/batch-table-tree'))); }
/** * Returns only assets that are required but that aren't also in the providedAssetGroup. */ public function getRequiredAssetsToOutput() { $required = $this->requiredAssetGroup->getAssetPointers(); $assetPointers = array_filter($required, array('\\Concrete\\Core\\Http\\ResponseAssetGroup', 'filterProvidedAssets')); $assets = array(); $al = AssetList::getInstance(); foreach ($assetPointers as $ap) { $asset = $ap->getAsset(); if ($asset instanceof Asset) { $assets[] = $asset; } } // also include any hard-passed $assets into the group. This is rare but it's used for handle-less // assets like layout css $assets = array_merge($this->requiredAssetGroup->getAssets(), $assets); return $assets; }
/** * Register the assets that the package provides. * * @return void */ protected function registerAssets() { // Items must go in the header to prevent 'twitches' onload. $al = AssetList::getInstance(); /* * Nice Scroll */ $al->register('javascript', 'jquery-nicescroll/js', 'assets/jquery.nicescroll/dist/jquery.nicescroll.min.js', array('version' => '3.6.6', 'position' => Asset::ASSET_POSITION_HEADER, 'minify' => true, 'combine' => true), $this); /* * Bootstraper */ $al->register('javascript', 'jquery-nicescroll/bootstraper', 'assets/smooth-scrolling.js', array('version' => '0.9.0', 'position' => Asset::ASSET_POSITION_HEADER, 'minify' => true, 'combine' => true), $this); $al->registerGroup('smooth-scrolling', array(array('javascript', 'jquery-nicescroll/js'), array('javascript', 'jquery-nicescroll/bootstraper'))); }
public function on_start() { $al = \Concrete\Core\Asset\AssetList::getInstance(); $al->register('css', 'horizon', 'blocks/horizon/style_horizon.css', array('version' => '1.0', 'minify' => false, 'combine' => true)); $al->registerGroup('horizon', array(array('css', 'horizon'))); }
/** * @param string $assetGroupHandle * @return \Concrete\Core\Asset\AssetGroup */ public function getAssetGroup($assetGroupHandle) { return parent::getAssetGroup($assetGroupHandle); }