/** * Routes for content types * * @param string $alias * @return void */ public static function contentType($alias) { CroogoRouter::connect('/' . $alias, array('controller' => 'nodes', 'action' => 'index', 'type' => $alias)); CroogoRouter::connect('/' . $alias . '/archives/*', array('controller' => 'nodes', 'action' => 'index', 'type' => $alias)); CroogoRouter::connect('/' . $alias . '/:slug', array('controller' => 'nodes', 'action' => 'view', 'type' => $alias)); CroogoRouter::connect('/' . $alias . '/term/:slug/*', array('controller' => 'nodes', 'action' => 'term', 'type' => $alias)); }
/** * testHomeRoute */ public function testHomeRoute() { $promoted = array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'promoted'); $result = CroogoRouter::connect('/', $promoted); $translateLoaded = CakePlugin::loaded('Translate'); $expected = $translateLoaded ? 2 : 1; $this->assertEquals($expected, count($result)); $this->assertNotEmpty($result[0]); $this->assertInstanceOf('CakeRoute', $result[0]); $reversed = Router::parse('/'); $this->assertEquals($promoted, array_intersect_key($promoted, $reversed)); // another route $index = array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'index'); $result = CroogoRouter::connect('/nodes', $index); $expected = $translateLoaded ? 4 : 2; $this->assertEquals($expected, count($result)); $reversed = Router::parse('/'); $this->assertEquals($promoted, array_intersect_key($promoted, $reversed)); $terms = array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'terms'); $result = CroogoRouter::connect('/', $terms); $expected = $translateLoaded ? 6 : 3; $this->assertEquals($expected, count($result)); // override '/' route Router::promote(); $reversed = Router::parse('/'); $this->assertEquals($terms, array_intersect_key($terms, $reversed)); }
<?php /** * 5Twenty Studios * Twitter Login * * This plugin is designed to make it possible for your users to login through twitter. * We aplogize, but this is an unsupported plugin. Feel free to contribute. * * @package Twitter Login * @subpackage Croogo * @author Jonathon Byrd <*****@*****.**> * @license http://www.opensource.org/licenses/mit-license.php The MIT License * @link http://www.5twentystudios.com * @repository https://github.com/Jonathonbyrd/Croogo-Twitter-Login */ CroogoRouter::connect('/twitterlogin/callback', array('plugin' => 'twitterlogin', 'controller' => 'twitterlogin', 'action' => 'callback')); CroogoRouter::connect('/twitterlogin/authorize', array('plugin' => 'twitterlogin', 'controller' => 'twitterlogin', 'action' => 'authorize')); CroogoRouter::connect('/twitterlogin/laststep', array('plugin' => 'twitterlogin', 'controller' => 'twitterlogin', 'action' => 'laststep')); CroogoRouter::connect('/twitterlogin/tweetit', array('plugin' => 'twitterlogin', 'controller' => 'twitterlogin', 'action' => 'tweetit')); CroogoRouter::connect('/twitterlogin/favorite', array('plugin' => 'twitterlogin', 'controller' => 'twitterlogin', 'action' => 'favorite')); //CroogoRouter::connect('admin/twitterlogin/update', array('admin' => true, 'plugin' => 'twitterlogin', 'controller' => 'twitterlogin', 'action' => 'update'));
/** * Setup Site.home_url * * @return void */ public static function routes() { $homeUrl = Configure::read('Site.home_url'); if ($homeUrl && strpos($homeUrl, ':') !== false) { $converter = new StringConverter(); $url = $converter->linkStringToArray($homeUrl); CroogoRouter::connect('/', $url, array(), array('promote' => true)); } CakePlugin::routes(); }
<?php CroogoRouter::connect('/admin', Configure::read('Croogo.dashboardUrl'));
<?php //Router::parseExtensions('xml'); CroogoRouter::connect('/sitemaps.xml', array('plugin' => 'sitemaps', 'controller' => 'sitemaps', 'action' => 'index'));
CroogoRouter::plugins(); Router::parseExtensions('json', 'rss'); // Installer if (!file_exists(CONFIGS . 'settings.yml')) { CroogoRouter::connect('/', array('plugin' => 'install', 'controller' => 'install')); } // Basic CroogoRouter::connect('/', array('controller' => 'nodes', 'action' => 'promoted')); CroogoRouter::connect('/promoted/*', array('controller' => 'nodes', 'action' => 'promoted')); CroogoRouter::connect('/admin', array('admin' => true, 'controller' => 'settings', 'action' => 'dashboard')); CroogoRouter::connect('/search/*', array('controller' => 'nodes', 'action' => 'search')); // Blog CroogoRouter::connect('/blog', array('controller' => 'nodes', 'action' => 'index', 'type' => 'blog')); CroogoRouter::connect('/blog/archives/*', array('controller' => 'nodes', 'action' => 'index', 'type' => 'blog')); CroogoRouter::connect('/blog/:slug', array('controller' => 'nodes', 'action' => 'view', 'type' => 'blog')); CroogoRouter::connect('/blog/term/:slug/*', array('controller' => 'nodes', 'action' => 'term', 'type' => 'blog')); // Node CroogoRouter::connect('/node', array('controller' => 'nodes', 'action' => 'index', 'type' => 'node')); CroogoRouter::connect('/node/archives/*', array('controller' => 'nodes', 'action' => 'index', 'type' => 'node')); CroogoRouter::connect('/node/:slug', array('controller' => 'nodes', 'action' => 'view', 'type' => 'node')); CroogoRouter::connect('/node/term/:slug/*', array('controller' => 'nodes', 'action' => 'term', 'type' => 'node')); // Page CroogoRouter::connect('/about', array('controller' => 'nodes', 'action' => 'view', 'type' => 'page', 'slug' => 'about')); CroogoRouter::connect('/page/:slug', array('controller' => 'nodes', 'action' => 'view', 'type' => 'page')); // Users CroogoRouter::connect('/register', array('controller' => 'users', 'action' => 'add')); CroogoRouter::connect('/user/:username', array('controller' => 'users', 'action' => 'view'), array('pass' => array('username'))); // Contact CroogoRouter::connect('/contact', array('controller' => 'contacts', 'action' => 'view', 'contact'));
<?php CroogoRouter::connect('/mail-list/*', array('plugin' => 'mail_chimp', 'controller' => 'mail_lists', 'action' => 'view'), ['pass' => ['alias']]);
<?php CroogoRouter::connect('/page/:slug/:revision', array('controller' => 'revisions', 'plugin' => 'revisions', 'action' => 'view', 'type' => 'page'));
<?php # ROTAS ENCURTADAS /** * Rastreamento via plugin rastreamento * RastreamentoController::rss e RastreamentoController::view * encurtando url */ CroogoRouter::connect('/rastrear/:action/:codigo', array('plugin' => 'rastreamento', 'controller' => 'rastreamentos'), array('pass' => array('codigo'))); /** * Rastreamento via plugin rastreamento * RastreamentoController::webservice * encurtando url */ CroogoRouter::connect('/webservice/:codigo', array('plugin' => 'rastreamento', 'controller' => 'rastreamentos', 'action' => 'webservice'), array('pass' => array('codigo'))); CroogoRouter::connect('/webservice/:codigo/:formato', array('plugin' => 'rastreamento', 'controller' => 'rastreamentos', 'action' => 'webservice'), array('pass' => array('codigo', 'formato')));
<?php // Contact CroogoRouter::connect('/contact/*', array('plugin' => 'contacts', 'controller' => 'contacts', 'action' => 'view'));
<?php CroogoRouter::connect('/fl/:dimension/:filename', array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'displayFile', 'admin' => false), array('pass' => array('filename', 'dimension'))); CroogoRouter::connect('/view/:node/:id', array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'viewFile', 'admin' => false), array('pass' => array('node', 'id'))); CroogoRouter::connect('/admin/Multiattach/settings', array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'settings', 'admin' => true)); CroogoRouter::connect('/admin/Multiattach/add/:node', array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'add', 'admin' => true), array('pass' => array('node'))); CroogoRouter::connect('/admin/Multiattach/add_web/:node', array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'add_web', 'admin' => true), array('pass' => array('node'))); CroogoRouter::connect('/admin/Multiattach/deleteFile/:attachment', array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'deleteFile', 'admin' => true), array('pass' => array('attachment'))); CroogoRouter::connect('/admin/Multiattach/AjaxGetAttachmentJson/:node', array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'AjaxGetAttachmentJson', 'admin' => true), array('pass' => array('node'))); CroogoRouter::connect('/admin/Multiattach/AjaxKillAttachmentJson/:attachment/:node', array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'AjaxKillAttachmentJson', 'admin' => true), array('pass' => array('attachment', 'node'))); CroogoRouter::connect('/admin/Multiattach/PostFieldAttachmentJson', array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'PostFieldAttachmentJson', 'admin' => true)); CroogoRouter::connect('/admin/Multiattach/AjaxOrderAttachmentJson/:node/*', array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'AjaxOrderAttachmentJson', 'admin' => true), array('pass' => array('node'))); CroogoRouter::connect('/Multiattach/getLatest/node:node_id/type:node_type/l:length/f:filter', array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'getLatest', 'admin' => false), array('named' => array('node_id', 'node_type', 'length', 'filter')));
<?php CroogoRouter::connect('/admin/dashboards', array('admin' => true, 'plugin' => 'dashboards', 'controller' => 'dashboards_dashboards', 'action' => 'dashboard')); CroogoRouter::connect('/admin/dashboards/:action/*', array('admin' => true, 'plugin' => 'dashboards', 'controller' => 'dashboards_dashboards'), array('action' => '[a-zA-Z0-9_-]+'));
<?php CroogoRouter::contentType('product'); CroogoRouter::connect('/panel', array('panel' => true, 'plugin' => 'webshop', 'controller' => 'customers', 'action' => 'dashboard'));
<?php CroogoRouter::connect('/example/route/here', array('plugin' => 'example', 'controller' => 'example', 'action' => 'index'));
* Link demo calculo frete da estrutura * WordPress */ CroogoRouter::connect('/calculo/frete.html', array('controller' => 'produtos', 'action' => 'frete')); /** * Corrige links de versões antigas como a estrutura * WordPress */ CroogoRouter::connect('/calcular-frete/*', array('controller' => 'urls', 'action' => 'url')); // Botao calculo frete antigo CroogoRouter::connect('/frete/*', array('controller' => 'produtos', 'action' => 'frete')); /** * BOTOES * no WordPress existia uma estrutura na raiz * onde havia o diretório botoes na raiz */ CroogoRouter::connect('/botoes/*', array('controller' => 'urls', 'action' => 'botoes')); /** * Rastreamento * Corrige links de versões antigas como a estrutura * WordPress */ //CroogoRouter::connect( '/rastreamento/rastrear-pedido.html', array( 'controller' => 'codigos', 'action' => 'add' ) ); /** * API Rest */ //Router::mapResources( 'Produtos', array('prefix' => '/api/') ); Router::mapResources('Produtos'); Router::mapResources('Codigos'); Router::mapResources('Avisos'); Router::parseExtensions('xml', 'html', 'pdf');
<?php CroogoRouter::connect('/gallery', array('plugin' => 'gallery', 'controller' => 'albums', 'action' => 'index')); CroogoRouter::connect('/gallery/albums', array('plugin' => 'gallery', 'controller' => 'albums', 'action' => 'index')); CroogoRouter::connect('/gallery/album/:slug', array('plugin' => 'gallery', 'controller' => 'albums', 'action' => 'view'), array('pass' => array('slug')));
<?php CroogoRouter::connect('/panel/invoices', array('panel' => true, 'plugin' => 'webshop_invoices', 'controller' => 'invoices', 'action' => 'index')); CroogoRouter::connect('/panel/invoices/:action/*', array('panel' => true, 'plugin' => 'webshop_invoices', 'controller' => 'invoices'));
<?php CroogoRouter::mapResources('Users.Users', array('prefix' => '/:api/:prefix/')); Router::connect('/:api/:prefix/users/lookup', array('plugin' => 'users', 'controller' => 'users', 'action' => 'lookup'), array('routeClass' => 'ApiRoute')); // Users CroogoRouter::connect('/register', array('plugin' => 'users', 'controller' => 'users', 'action' => 'add')); CroogoRouter::connect('/user/:username', array('plugin' => 'users', 'controller' => 'users', 'action' => 'view'), array('pass' => array('username')));
/** * test updateAllNodesPaths */ public function testUpdateAllNodesPaths() { $this->Node->id = 1; $result = $this->Node->saveField('path', 'invalid one'); $this->assertTrue((bool) $result); CroogoRouter::connect('/blog/:slug', array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'view', 'type' => 'blog')); Router::promote(); $result = $this->Node->updateAllNodesPaths(); $this->assertTrue($result); $this->Node->type = 'blog'; $node = $this->Node->findById(1); $this->assertEquals('/blog/hello-world', $node['Node']['path']); }
<?php CroogoRouter::connect('/cform/submit', array('plugin' => 'cforms', 'controller' => 'cforms', 'action' => 'submit'));
<?php CroogoRouter::mapResources('Nodes.Nodes', array('prefix' => '/:api/:prefix/')); Router::connect('/:api/:prefix/nodes/lookup', array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'lookup'), array('routeClass' => 'ApiRoute')); // Basic CroogoRouter::connect('/', array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'promoted')); CroogoRouter::connect('/promoted/*', array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'promoted')); CroogoRouter::connect('/search/*', array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'search')); // Content types CroogoRouter::contentType('blog'); CroogoRouter::contentType('node'); if (Configure::read('Croogo.installed')) { CroogoRouter::routableContentTypes(); } // Page CroogoRouter::connect('/about', array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'view', 'type' => 'page', 'slug' => 'about')); CroogoRouter::connect('/page/:slug', array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'view', 'type' => 'page'));
<?php CroogoRouter::connect('/admin', array('admin' => true, 'plugin' => 'settings', 'controller' => 'settings', 'action' => 'dashboard'));