Skip to content

Instantly share code, notes, and snippets.

💭
😄

Takuro Hishikawa hissy

💭
😄
View GitHub Profile
@hissy
hissy / database.php
Created May 18, 2020
#concrete5 set sql_mode from config file
View database.php
<?php
/**
* How to set sql_mode from database.php
* It will help to solve the error like "SQLSTATE[42000]: Syntax error or access violation:
* 1055 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column
* 'concrete5.cv.cvPublishDate' which is not functionally dependent on columns in GROUP BY clause;
* this is incompatible with sql_mode=only_full_group_by"
*/
@hissy
hissy / ManualNavPublisher.php
Last active May 1, 2020
[concrete5][V8][MigrationTool] Example of creating custom publisher
View ManualNavPublisher.php
<?php
// application/src/Concrete/MigrationTool/Publisher/Block/ManualNavPublisher.php
namespace Application\Concrete\MigrationTool\Publisher\Block;
use Concrete\Core\Block\Block;
use Concrete\Core\Page\Page;
use PortlandLabs\Concrete5\MigrationTool\Entity\Import\Batch;
use PortlandLabs\Concrete5\MigrationTool\Entity\Import\BlockValue\BlockValue;
use PortlandLabs\Concrete5\MigrationTool\Publisher\Block\PublisherInterface;
View gist:ebb1d317f9abc190b901
"post_title","post_type","lat","lng"
"Map","post",35.710115,139.810203
@hissy
hissy / rscsvimporter-debug.php
Last active Apr 6, 2020
Really Simple CSV Importer Debugger add-on
View rscsvimporter-debug.php
<?php
/*
Plugin Name: Really Simple CSV Importer Debugger add-on
Description: Enables to dry-run-testing with Really Simple CSV Importer. When this add-on plugin activated, csv data will not imported, just displayed on dashboard.
Author: Takuro Hishikawa
Version: 0.2
*/
class rscsvimporter_debug {
// singleton instance
@hissy
hissy / nav-menu-exporter-importer.php
Last active Mar 22, 2020
[WordPress Plugin] Nav Menu Exporter and Importer / Export and Import nav menus. Requires WordPress Importer plugin.
View nav-menu-exporter-importer.php
<?php
/*
Plugin Name: Nav Menu Exporter and Importer
Description: Export and Import nav menus. Requires WordPress Importer plugin
Author: hissy, megumi themes
Version: 0.1
Text Domain: nav-menu-exporter-importer
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
@hissy
hissy / single_page.php
Last active Feb 4, 2020
How to use Bootstrap Tabs in concrete5 dashboard
View single_page.php
<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Single Page Name'), false, false, false, false, false, false); ?>
<div class="ccm-pane-body">
<?php
// Tab setting using array
$tabs = array(
// array('tab-id', 'Tag Label', true=active)
array('tab-1', 'Tab 1', true),
array('tab-2', 'Tab 2'),
@hissy
hissy / valet.app.php
Last active Jan 16, 2020
#concrete5 config file for local environment
View valet.app.php
<?php
/**
* Set default value for curl option
*/
return [
'http_client' => [
'connecttimeout' => 30,
],
];
@hissy
hissy / gist:6103177
Last active Nov 15, 2019
[WordPress] どうしても固定ページテンプレートでページ送り付きのアーカイブが作りたいのよと言う場合
View gist:6103177
<?php
/**
* Template Name: Archive Page */
?>
<?php
$paged = (int) get_query_var('paged');
$args = array(
'posts_per_page' => 3,
'paged' => $paged,
@hissy
hissy / really-simple-csv-importer-addon.php
Created Feb 25, 2015
[Really Simple CSV Importer] Example: import image from url to custom field
View really-simple-csv-importer-addon.php
<?php
/*
Plugin Name: Get Remote Image to Custom Field
*/
add_filter('really_simple_csv_importer_post_saved', function($post)
{
if (is_object($post)) {
// Get the meta data of which key is "image"
$image = $post->image;
@hissy
hissy / output.md
Last active Oct 31, 2019
#concrete5 Complete usage and output of Date Helper to localize date time format
View output.md
$dh = Core::make('helper/date');
Code en_US ja_JP it_IT ru_RU zh_CN
echo $dh->formatDateTime($date); 10/31/19, 5:06 PM 2019/10/31 17:06 31/10/19, 17:06 31.10.2019, 17:06 2019/10/31 下午5:06
echo $dh->formatDateTime($date, true); Oct 31, 2019, 5:06 PM 2019/10/31 17:06 31 ott 2019, 17:06 31 окт. 2019 г., 17:06 2019年10月31日 下午5:06
echo $dh->formatDateTime($date, false, true); 10/31/19, 5:06:38 PM 2019/10/31 17:06:38 31/10/19, 17:06:38 31.10.2019, 17:06:38 2019/10/31 下午5:06:38
echo $dh->formatDateTime($date, true, true); Oct 31, 2019, 5:06:38 PM 2019/10/31 17:06:38 31 ott 2019, 17:06:38 31 окт. 2019 г., 17:06:38 2019年10月31日 下午5:06:38
You can’t perform that action at this time.