Skip to content

Instantly share code, notes, and snippets.

Takuro Hishikawa hissy

View GitHub Profile
hissy / export.xml
Created Apr 15, 2019
An xml file of example Users&Groups for Migration tool #concrete5
View export.xml
<?xml version="1.0" encoding="UTF-8"?>
<concrete5-cif version="1.0">
<group name="Administrators" description="" path="/Administrators" package=""/>
<group name="Editors" description="" path="/Editors" package=""/>
<group name="Approvers" description="" path="/Approvers" package=""/>
<user username="editor" email="" language="ja_JP">
hissy / MultilingualPageUrlResolver.php
Last active Jan 30, 2019
[concrete5] MultilingualPageUrlResolver: Get localized page path from original page path
View MultilingualPageUrlResolver.php
// application/src/Concrete/Url/MultilingualPageUrlResolver.php
namespace Application\Concrete\Url;
use Concrete\Core\Application\ApplicationAwareInterface;
use Concrete\Core\Application\ApplicationAwareTrait;
use Concrete\Core\Multilingual\Page\Section\Section;
use Concrete\Core\Page\Page;
use Concrete\Core\Url\Resolver\PageUrlResolver;
use Concrete\Core\Url\Resolver\UrlResolverInterface;
hissy / app.php
Last active Jan 2, 2019
[concrete5] [Debug tool] Tooltip to display block detail
View app.php
// application/bootstrap/app.php
$dh = $app->make('helper/concrete/dashboard');
$director = $app->make('director');
$director->addListener('on_before_render', function ($event) use ($dh) {
/** @var \Concrete\Core\View\View $view */
$view = $event->getArgument('view');
$page = \Concrete\Core\Page\Page::getCurrentPage();
$p = new \Concrete\Core\Permission\Checker($page);
hissy /
Last active Dec 19, 2018
[concrete5] [v8] Bulk mapping pages between multilingual sitemaps from command line

What this script does?

  1. Get all pages in original multilingual section
  2. Get a page in destination multilingual section that has same collection path
  3. Make a relation
  4. Go to next page

How to use

hissy / filter_by_date.php
Last active Dec 6, 2018
#concrete5 #v8 An example of the custom template of page list: filter by date time attribute
View filter_by_date.php
defined('C5_EXECUTE') or die("Access Denied.");
/** @var \Concrete\Core\Page\PageList $list */
// Start Date is earlier than tomorrow
$tomorrow = \Carbon\Carbon::tomorrow();
$list->filterByAttribute('start_date', $tomorrow->format('Y-m-d'), '<');
// End Date is later than today
$today = \Carbon\Carbon::today();
$list->filterByAttribute('end_date', $today->format('Y-m-d'), '>=');
hissy /
Last active Sep 16, 2018
[concrete5] How to fix "failed to open stream" error when you delete doctrine proxies directory

How to fix "failed to open stream" error when you delete doctrine proxies directory

Whoops\Exception\ErrorException thrown with message "require(/path/to/concrete5/application/config/doctrine/proxies/__CG__ConcreteCoreEntityExpressEntity.php): failed to open stream: No such file or directory"

Enable "Doctrine Dev mode" manually

Add application/config/concrete.php file (or modify it) like below:

hissy / ConcreteMailerHandler.php
Last active Jul 24, 2018
[concrete5] [v8]Add logging handler
View ConcreteMailerHandler.php
namespace Application\Logging\Handler;
use Concrete\Core\Logging\Logger;
use Concrete\Core\Mail\Service;
use Concrete\Core\Support\Facade\Application;
use Monolog\Handler\MailHandler;
class ConcreteMailerHandler extends MailHandler
hissy / StatusCodeCheck.php
Created Jun 26, 2018
#concrete5 Status Code Check Command
View StatusCodeCheck.php
// application/src/Console/Command/StatusCodeCheck.php
namespace Application\Console\Command;
use Concrete\Core\Console\Command;
use Concrete\Core\Database\Connection\Connection;
use Concrete\Core\Http\Client\Client;
use Concrete\Core\Page\Page;
use Concrete\Core\Support\Facade\Application;
use Concrete\Core\Url\Url;
hissy / Entry.php
Last active Jun 5, 2018
#concrete5 SmartFormat RSS (An example to customize Zend Feed with Extension)
View Entry.php
// application/src/Feed/Writer/Extension/SmartNews/Entry.php
namespace Application\Src\Feed\Writer\Extension\SmartNews;
use Zend\Feed\Exception\InvalidArgumentException;
use Zend\Feed\Uri;
use Zend\Feed\Writer\Exception\BadMethodCallException;
use Zend\Stdlib\StringUtils;
use Zend\Stdlib\StringWrapper\StringWrapperInterface;
hissy / example.sql
Created May 22, 2018
#concrete5 #mysql count how many workflow request completed between range of dates
View example.sql
select count(wp.wpID)
from WorkflowProgress wp
where wp.wpIsCompleted
and wp.wpCurrentStatus = 30
and wp.wpCategoryID = 1
and wp.wfID = 2
and wp.wpDateLastAction >= "2017-05-01 00:00:00"
and wp.wpDateLastAction < "2017-06-01 00:00:00"
You can’t perform that action at this time.