/** * Read configured Translate.models and hook the appropriate behaviors */ public static function translateModels() { $path = 'admin:true/plugin:translate/controller:translate/action:index/:id/'; foreach (Configure::read('Translate.models') as $model => $config) { Croogo::hookBehavior($model, 'Translate.CroogoTranslate', $config); Croogo::hookAdminRowAction(Inflector::pluralize($model) . '/admin_index', __d('croogo', 'Translate'), array($path . $model => array('title' => false, 'options' => array('icon' => 'translate', 'data-title' => __d('croogo', 'Translate'))))); } }
/** * onBootstrapComplete */ public function onBootstrapComplete($event) { if (CakePlugin::loaded('Comments')) { App::uses('Comment', 'Comments.Model'); Croogo::hookBehavior('Node', 'Comments.Commentable'); Croogo::hookComponent('Nodes', 'Comments.Comments'); Croogo::hookModelProperty('Comment', 'belongsTo', array('Node' => array('className' => 'Nodes.Node', 'foreignKey' => 'foreign_key', 'counterCache' => true, 'counterScope' => array('Comment.model' => 'Node', 'Comment.status' => Comment::STATUS_APPROVED)))); } if (CakePlugin::loaded('Taxonomy')) { Croogo::hookBehavior('Node', 'Taxonomy.Taxonomizable'); } if (CakePlugin::loaded('Meta')) { Croogo::hookBehavior('Node', 'Meta.Meta'); } }
<?php Croogo::hookRoutes('Multiattach'); Croogo::hookComponent('Nodes', 'Multiattach.Multiattaches'); Croogo::hookBehavior('Node', 'Multiattach.Multiattach', array()); //Croogo::hookAdminTab('Nodes/admin_add', 'Attachments', 'Multiattach.admin_tab_node'); Croogo::hookAdminTab('Nodes/admin_edit', 'Attachments', 'Multiattach.admin_tab_node'); CroogoNav::add('settings.children.multiattach', array('title' => __('Multiattach'), 'url' => array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'settings'), 'access' => array('admin')));
<?php Croogo::hookBehavior('Order', 'Suppliers.SuppliersOrderMonitor');
<?php Croogo::hookBehavior('Product', 'WebshopShoppingCart.CartItem'); Croogo::hookBehavior('Order', 'WebshopShoppingCart.CartOrder'); CroogoNav::add('node-menu-product', 'add-to-cart-old', array('icon' => array('comments', 'large'), 'title' => __d('webshop', 'Add to cart (old)'), 'url' => array('plugin' => 'webshop_shopping_cart', 'controller' => 'shopping_cart', 'action' => 'add_product', '_id'))); CroogoNav::add('node-menu-product', 'add-to-cart', array('icon' => array('comments', 'large'), 'title' => __d('webshop', 'Add to cart'), 'url' => array('plugin' => 'webshop_shopping_cart', 'controller' => 'shopping_basket_items', 'action' => 'add', '_id')));
<?php Configure::load('SimpleCaptcha.simple_captcha'); Croogo::hookBehavior('User', 'SimpleCaptcha.Captcha'); Croogo::hookHelper('Users', 'SimpleCaptcha.Captcha'); Croogo::hookComponent('*', 'SimpleCaptcha.Captcha');
<?php CroogoCache::config('switcher_default', array_merge(Configure::read('Cache.defaultConfig'), array('duration' => '+10 minutes'))); Croogo::hookBehavior('Node', 'Switcher.Switcher'); Croogo::hookComponent('*', 'Switcher.Switcher'); Croogo::hookHelper('*', 'Switcher.Switcher'); Croogo::hookAdminTab('Nodes/admin_edit', 'Switcher', 'switcher.admin_tab_node'); Croogo::hookAdminTab('Nodes/admin_add', 'Switcher', 'switcher.admin_tab_node'); CroogoNav::add('extensions.children.switcher', array('title' => 'Switcher', 'url' => '#', 'children' => array('paths' => array('title' => 'Paths', 'url' => array('admin' => true, 'plugin' => 'switcher', 'controller' => 'switcher_paths', 'action' => 'index'), 'weight' => 10), 'nodes' => array('title' => 'Nodes', 'url' => array('admin' => true, 'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'index'), 'weight' => 20))));
<?php /** * Routes * * Revisions_routes.php will be loaded in main app/config/routes.php file. */ Croogo::hookRoutes('Revisions'); /** * Behavior * * This plugin's Revisions behavior will be attached whenever Node model is loaded. */ Croogo::hookBehavior('Node', 'Revisions.Revisions', array()); /** * Component * * This plugin's Revisions component will be loaded in ALL controllers. */ Croogo::hookComponent('*', 'Revisions.Revisions'); /** * Helper * * This plugin's Revisions helper will be loaded via NodesController. */ Croogo::hookHelper('Nodes', 'Revisions.Revisions'); /** * Admin menu (navigation) * * This plugin's admin_menu element will be rendered in admin panel under Extensions menu. */
<?php CroogoNav::add('webshop-customer-dashboard', 'users', array('title' => __d('webshop_customer_users', 'Users'), 'url' => array('prefix' => 'panel', 'plugin' => 'webshop_customer_users', 'controller' => 'customer_users', 'action' => 'index'))); Croogo::hookBehavior('Customer', 'WebshopCustomerUsers.CustomerWithUsers'); Croogo::hookComponent('*', 'WebshopCustomerUsers.CustomerUsers'); Croogo::mergeConfig('Webshop.customer_access_providers', array('CustomerUsers' => array('provider' => 'WebshopCustomerUsers.CustomerUser')));
<?php Croogo::hookBehavior('Node', 'Sites.SiteFilter', array('relationship' => array('hasAndBelongsToMany' => array('Site' => array('className' => 'Sites.Site', 'with' => 'Sites.SitesNode', 'foreignKey' => 'node_id', 'associationForeignKey' => 'site_id', 'unique' => 'keepExisting'))))); Croogo::hookBehavior('Block', 'Sites.SiteFilter', array('relationship' => array('hasAndBelongsToMany' => array('Site' => array('className' => 'Sites.Site', 'with' => 'Sites.SitesBlock', 'foreignKey' => 'block_id', 'associationForeignKey' => 'site_id', 'unique' => 'keepExisting', 'joinTable' => 'sites_blocks'))))); Croogo::hookBehavior('Link', 'Sites.SiteFilter', array('relationship' => array('hasAndBelongsToMany' => array('Site' => array('className' => 'Sites.Site', 'with' => 'Sites.SitesLink', 'foreignKey' => 'link_id', 'associationForeignKey' => 'site_id', 'unique' => 'keepExisting', 'joinTable' => 'sites_links'))))); if (Configure::read('Cakeforum.name') !== false) { Croogo::hookBehavior('ForumCategory', 'Sites.SiteFilter', array('relationship' => array('hasAndBelongsToMany' => array('Site' => array('className' => 'Sites.Site', 'with' => 'Sites.SitesForumCategory', 'foreignKey' => 'forum_category_id', 'associationForeignKey' => 'site_id'))))); Croogo::hookComponent('ForumCategories', 'Sites.SiteFilter'); } Croogo::hookComponent('*', array('Sites.Multisite' => array('priority' => 5))); Croogo::hookHelper('*', 'Sites.Sites'); // uncomment this line to use absolute url for menu links // alternatively, you can hook this helper later via other plugins // Croogo::hookHelper('*', 'Sites.SitesMenus'); Croogo::hookAdminTab('Nodes/admin_add', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Nodes/admin_edit', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Attachments/admin_add', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Attachments/admin_edit', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Blocks/admin_add', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Blocks/admin_edit', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Links/admin_add', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Links/admin_edit', 'Sites', 'sites.sites_selection'); $cacheConfig = Cache::config('_cake_model_'); $cacheConfig = Hash::merge($cacheConfig['settings'], array('prefix' => 'sites_', 'path' => CACHE . 'queries', 'duration' => '+1 hour')); Cache::config('sites', $cacheConfig); require 'admin_menu.php';
<?php $cacheConfig = array_merge(Configure::read('Cache.defaultConfig'), array('groups' => array('seo_lite'))); CroogoCache::config('seo_lite', $cacheConfig); Configure::write('Seolite.keys', array('meta_keywords' => array('label' => __d('seolite', 'Keywords')), 'meta_description' => array('label' => __d('seolite', 'Description')), 'rel_canonical' => array('label' => __d('seolite', 'Canonical Page')))); Croogo::hookHelper('*', 'Seolite.SeoLite'); $queryString = env('REQUEST_URI'); if (strpos($queryString, 'admin') === false) { return; } /* * stuff for /admin routes only */ Croogo::hookBehavior('Node', 'Seolite.SeoCustomFields', array('priority' => 1)); $title = 'SeoLite'; $element = 'Seolite.admin/meta'; $options = array('elementData' => array('field' => 'body')); Croogo::hookAdminTab('Nodes/admin_add', $title, $element, $options); Croogo::hookAdminTab('Nodes/admin_edit', $title, $element, $options); $options['elementData']['field'] = 'description'; Croogo::hookAdminTab('SeoLiteUrls/admin_add', $title, $element, $options); Croogo::hookAdminTab('SeoLiteUrls/admin_edit', $title, $element, $options); CroogoNav::add('sidebar', 'extensions.children.seo_lite', array('title' => 'SeoLite', 'url' => 'javascript:void(0)', 'children' => array('urls' => array('title' => __d('seo_lite', 'Meta by URL'), 'url' => array('admin' => true, 'plugin' => 'seolite', 'controller' => 'seo_lite_urls', 'action' => 'index')))));
<?php /** * Configuration * */ Configure::write('Translate.models', array('Node' => array('fields' => array('title' => 'titleTranslation', 'excerpt' => 'excerptTranslation', 'body' => 'bodyTranslation'), 'translateModel' => 'Nodes.Node'), 'Block' => array('fields' => array('title' => 'titleTranslation', 'body' => 'bodyTranslation'), 'translateModel' => 'Blocks.Block'), 'Link' => array('fields' => array('title' => 'titleTranslation', 'description' => 'descriptionTranslation'), 'translateModel' => 'Menus.Link'))); /** * Do not edit below this line unless you know what you are doing. * */ foreach (Configure::read('Translate.models') as $translateModel => $config) { Croogo::hookBehavior($translateModel, 'Translate.CroogoTranslate', $config); Croogo::hookAdminRowAction(Inflector::pluralize($translateModel) . '/admin_index', 'Translate', 'plugin:translate/controller:translate/action:index/:id/' . $translateModel); }
<?php Croogo::hookBehavior('Node', 'PingService.PingService');
<?php $auditModels = Configure::read('Audit.models'); if ($auditModels) { $models = (array) json_decode($auditModels, true); foreach ($models as $model) { list(, $model) = explode('.', $model, 2); Croogo::hookBehavior($model, 'Audit.Auditable'); } }
<?php CroogoNav::add('sidebar', 'webshop.children.invoices', array('title' => __d('webshop_invoices', 'Invoices'), 'url' => array('admin' => true, 'plugin' => 'webshop_invoices', 'controller' => 'invoices', 'action' => 'index'))); CroogoNav::add('webshop-customer-dashboard', 'invoices', array('title' => __d('webshop_invoices', 'Invoices'), 'url' => array('prefix' => 'panel', 'plugin' => 'webshop_invoices', 'controller' => 'invoices', 'action' => 'index'))); Croogo::hookBehavior('Order', 'WebshopInvoices.InvoiceTemplate'); Croogo::hookHelper('*', 'WebshopInvoices.Invoices');
<?php Croogo::hookBehavior('Node', 'CustomFields.CustomFieldHolder'); Croogo::hookAdminTab('Nodes/admin_add', __d('custom_fields', 'Custom fields'), 'CustomFields.tab_custom_fields'); Croogo::hookAdminTab('Nodes/admin_edit', __d('custom_fields', 'Custom fields'), 'CustomFields.tab_custom_fields');
spl_autoload_register(function ($class) { $defaultPath = CakePlugin::path('Assets') . 'Vendor' . DS . 'Gaufrette' . DS . 'src' . DS; $base = Configure::read('Assets.GaufretteLib'); if (empty($base)) { $base = $defaultPath; } $class = str_replace('\\', DS, $class); if (file_exists($base . $class . '.php')) { include $base . $class . '.php'; } }); Configure::write('Wysiwyg.attachmentBrowseUrl', array('plugin' => 'assets', 'controller' => 'assets_attachments', 'action' => 'browse')); Configure::write('Wysiwyg.uploadsPath', ''); Croogo::mergeConfig('Wysiwyg.actions', array('AssetsAttachments/admin_browse')); App::uses('StorageManager', 'Assets.Lib'); StorageManager::config('LocalAttachment', array('description' => 'Local Attachment', 'adapterOptions' => array(WWW_ROOT . 'assets', true), 'adapterClass' => '\\Gaufrette\\Adapter\\Local', 'class' => '\\Gaufrette\\Filesystem')); StorageManager::config('LegacyLocalAttachment', array('description' => 'Local Attachment (Legacy)', 'adapterOptions' => array(WWW_ROOT . 'uploads', true), 'adapterClass' => '\\Gaufrette\\Adapter\\Local', 'class' => '\\Gaufrette\\Filesystem')); // TODO: make this configurable via backend $actions = array('Nodes/admin_edit', 'Blocks/admin_edit', 'Types/admin_edit'); $tabTitle = __d('assets', 'Assets'); foreach ($actions as $action) { list($controller, ) = explode('/', $action); Croogo::hookAdminTab($action, $tabTitle, 'Assets.admin/asset_list'); Croogo::hookHelper($controller, 'Assets.AssetsAdmin'); } // TODO: make this configurable via backend $models = array('Block', 'Node', 'Type'); foreach ($models as $model) { Croogo::hookBehavior($model, 'Assets.LinkedAssets', array('priority' => 9)); } Croogo::hookHelper('*', 'Assets.AssetsFilter');
<?php Croogo::hookHelper('*', 'Megamenu.Megamenu'); Croogo::hookBehavior('Link', 'Params');
<?php CroogoNav::add('sidebar', 'pltfrm', array('title' => __d('pltfrm', 'Pltfrm'), 'url' => '#', 'weight' => 40, 'children' => array('hosts' => array('title' => __d('pltfrm', 'Hosts'), 'url' => array('plugin' => 'pltfrm', 'controller' => 'webhosting_hosts', 'action' => 'index'), 'weight' => 40)))); Croogo::hookHelper('Nodes', 'Pltfrm.WebhostingProducts'); Croogo::hookBehavior('Node', 'Pltfrm.WebhostingProduct'); Croogo::hookBehavior('Product', 'Pltfrm.WebhostingProduct'); App::build(array('WebhostingProvider' => array('%s' . 'WebhostingProvider' . DS)), App::REGISTER);
<?php /** * Configuration * */ Configure::write('Translate.models', array('Node' => array('title' => 'titleTranslation', 'excerpt' => 'excerptTranslation', 'body' => 'bodyTranslation'), 'Block' => array('title' => 'titleTranslation', 'body' => 'bodyTranslation'), 'Link' => array('title' => 'titleTranslation', 'description' => 'descriptionTranslation'))); /** * Do not edit below this line unless you know what you are doing. * */ foreach (Configure::read('Translate.models') as $translateModel => $fields) { Croogo::hookBehavior($translateModel, 'CroogoTranslate', $fields); Croogo::hookAdminRowAction(Inflector::pluralize($translateModel) . '/admin_index', 'Translate', 'plugin:translate/controller:translate/action:index/:id/' . $translateModel); }
<?php /** * Routes * * example_routes.php will be loaded in main app/config/routes.php file. */ Croogo::hookRoutes('Example'); /** * Behavior * * This plugin's Example behavior will be attached whenever Node model is loaded. */ Croogo::hookBehavior('Node', 'Example.Example', array()); /** * Component * * This plugin's Example component will be loaded in ALL controllers. */ Croogo::hookComponent('*', 'Example.Example'); /** * Helper * * This plugin's Example helper will be loaded via NodesController. */ Croogo::hookHelper('Nodes', 'Example.Example'); /** * Admin menu (navigation) * * This plugin's admin_menu element will be rendered in admin panel under Extensions menu. */
<?php $tmp_conf = Configure::read('Nodeattachment'); $conf = array('thumbDir' => APP . 'plugins' . DS . 'nodeattachment' . DS . 'webroot' . DS . 'img' . DS . 'tn', 'iconDir' => APP . 'plugins' . DS . 'nodeattachment' . DS . 'webroot' . DS . 'img', 'flvDir' => APP . 'plugins' . DS . 'nodeattachment' . DS . 'webroot' . DS . 'flv', 'thumbExt' => 'png'); Configure::write('Nodeattachment', Set::merge($tmp_conf, $conf)); Configure::write('Nodeattachment.thumbnailExt', 'png'); Croogo::hookBehavior('Node', 'Nodeattachment.Nodeattachment'); Croogo::hookHelper('*', 'Image2.Image2'); Croogo::hookHelper('*', 'Nodeattachment.Nodeattachment'); Croogo::hookAdminTab('Nodes/admin_edit', 'Attachments', 'nodeattachment.admin_tab_node'); Croogo::hookAdminMenu('Nodeattachment');
<?php if (Configure::read('Site.acl_plugin') == 'Acl') { // activate AclFilter component only until after a succesful install if (file_exists(APP . 'Config' . DS . 'settings.json')) { Croogo::hookComponent('*', 'Acl.AclFilter'); Croogo::hookComponent('*', array('CroogoAccess' => array('className' => 'Acl.AclAccess'))); } Croogo::hookBehavior('User', 'Acl.UserAro'); Croogo::hookBehavior('Role', 'Acl.RoleAro'); Cache::config('permissions', array('duration' => '+1 hour', 'path' => CACHE . 'queries' . DS, 'engine' => Configure::read('Cache.defaultEngine'), 'prefix' => Configure::read('Cache.defaultPrefix'), 'groups' => array('acl'))); }
<?php //region Menu's CroogoNav::add('sidebar', 'webshop', array('title' => __d('webshop', 'Webshop'), 'url' => '#', 'weight' => 30, 'children' => array('customers' => array('title' => __d('webshop', 'Customers'), 'url' => array('plugin' => 'webshop', 'controller' => 'customers', 'action' => 'index')), 'products' => array('title' => __d('webshop', 'Products'), 'url' => array('plugin' => 'webshop', 'controller' => 'products', 'action' => 'index')), 'Configuration groups' => array('title' => __d('webshop', 'Configuration groups'), 'url' => array('plugin' => 'webshop', 'controller' => 'configuration_groups', 'action0' => 'index')), 'Configuration options' => array('title' => __d('webshop', 'Configuration options'), 'url' => array('plugin' => 'webshop', 'controller' => 'configuration_options', 'action' => 'index')), 'configuration' => array('title' => __d('webshop', 'Configuration'), 'url' => '#')))); CroogoNav::add('sidebar', 'settings.children.webshop', array('title' => __d('webshop', 'Webshop'), 'url' => '#')); CroogoNav::add('webshop-dashboard-address_details-actions', 'edit', array('title' => __d('webshop', 'Edit'), 'url' => array('controller' => 'address_details', 'action' => 'edit', '_id'), 'htmlAttributes' => array('class' => 'btn-primary'))); CroogoNav::add('webshop-dashboard-customer_contacts-actions', 'edit', array('title' => __d('webshop', 'Edit'), 'url' => array('controller' => 'customer_contacts', 'action' => 'edit', '_id'), 'htmlAttributes' => array('class' => 'btn-primary'))); //endregion //region Helpers Croogo::hookHelper('*', 'Webshop.Product'); Croogo::hookHelper('*', 'Webshop.ConfigurationOption'); Croogo::hookHelper('*', 'Webshop.Webshop'); //endregion //region Behaviors Croogo::hookBehavior('Node', 'Webshop.Product'); //endregion //region Components Croogo::hookComponent('*', 'Webshop.CustomerAccess'); //endregion Configure::write('Webshop.customer_access_providers', array()); Croogo::mergeConfig('Translate.models.ConfigurationOption', array('fields' => array('name' => 'nameTranslation'), 'translateModel' => 'Webshop.ConfigurationOption')); //region Panel prefix setup Croogo::mergeConfig('Routing.prefixes', array('panel')); Router::reload(); //endregion //region Admin panels //region Admin tabs Croogo::hookAdminTab('Products/admin_edit', 'Configuration implementation', 'Pltfrm.admin/node_webhosting_product_tab'); //endregion //region Admin hooks Croogo::hookAdminBox('Products/admin_edit', 'Configuration group', 'Webshop.admin/product/box_configuration_group_selector');