Skip to content

Instantly share code, notes, and snippets.

View katzueno's full-sized avatar

Katz Ueno katzueno

View GitHub Profile
@katzueno
katzueno / 1.original.concrete.php
Created June 1, 2023 06:14
Basic logging configuration
<?php
// Logging setting based on Concrete CMS 8.5.12
return [
/*
* ------------------------------------------------------------------------
* Logging settings
* ------------------------------------------------------------------------
*/
'log' => [
/*

ConcreteCMS TIPS サンプルコード

ConcreteCMS TIPS のサンプルコードです。

動画はこちらからご覧いただけます。 https://youtu.be/bIPE_50tjpE

@katzueno
katzueno / concrete.php
Created May 14, 2021 12:25
concrete5 の sitemap.xml を別のファイル名で保存する方法
<?php
// appliction/config/concrete.php
return [
'sitemap_xml' => [
'file' => 'sitemap2.xml',
],
];
@katzueno
katzueno / controller.php
Created April 30, 2021 12:40
How to add jquery to Block Controller
<?php
class Controller extends BlockController
{
// 省略
public function on_start()
{
// https://documentation.concrete5.org/developers/assets/registering-an-asset
$al = AssetList::getInstance();
$al->register('javascript', 'jquery', 'js/jquery.js');
<?php
namespace Application\Controller\SinglePage;
use Concrete\Controller\SinglePage\Login as CoreLogin;
class Login extends CoreLogin
{
public function view($type = null, $element = 'form')
{
$key=$this->request->query->get('key');
@katzueno
katzueno / bulk_change_page_template.php
Created January 9, 2021 09:24 — forked from hissy/bulk_change_page_template.php
#concrete5 c5:exec command to bulk change page type & template
<?php
/**
* Usage:
* concrete/bin/concrete5 c5:exec bulk_change_page_template.php old_page_template_handle /parent-page-path new_page_template_handle
*/
$filterPageTemplateHandle = $args[0];
$filterPagePath = $args[1];
$changePageTemplateHandle = $args[2];
@katzueno
katzueno / aws-s3-mass-undelete.sh
Created September 23, 2020 06:27 — forked from crazycodr/aws-s3-mass-undelete.sh
Batch restore deleted s3 objects by accident
# Set the bucket name and date limit that you want to scan for...
#
# For example, if you deleted everything at 9'ish, set the DATE_LIMIT for a
# few minutes before to ensure you find only the stuff you deleted by error
#
BUCKET_NAME="..."
DATE_LIMIT="0000-00-00T00:00:00.000Z"
aws s3api list-object-versions --bucket "${BUCKET_NAME}" > objects.json
cat objects.json | jq --arg DATE_LIMIT "${DATE_LIMIT}" '[ .DeleteMarkers[] | select(.LastModified > $DATE_LIMIT and .IsLatest) | { file: .Key, version: .VersionId } ]' > markers-to-delete.json
@katzueno
katzueno / app.php
Last active May 13, 2020 06:08
concrete5 Environment switch according to host name
<?php
// /application/bootstrap/app.php
Route::register('/ccm/request_test', function() {
header("Pragma: no-cache");
echo '<dl>';
?><dt>Application environment:</dt><dd><?php echo ($this->app->environment()) ? $this->app->environment() : 'default'; ?></dd><?php
$request = \Concrete\Core\Http\Request::getInstance();
?><dt>Client IP:</dt><dd><?php echo $request->getClientIp(); ?></dd><?php
?><dt>Host:</dt><dd><?php echo $request->getHost(); ?></dd><?php
?><dt>Port:</dt><dd><?php echo $request->getPort(); ?></dd><?php
@katzueno
katzueno / BasicThumbnailer.php
Last active October 12, 2018 12:04
src/Entity/File/Version.php & src/File/Image/BasicThumbnailer.php
<?php
namespace Concrete\Core\File\Image;
use Concrete\Core\Application\ApplicationAwareInterface;
use Concrete\Core\Application\ApplicationAwareTrait;
use Concrete\Core\Entity\File\File;
use Concrete\Core\Entity\File\StorageLocation\StorageLocation;
use Concrete\Core\File\Image\Thumbnail\ThumbnailerInterface;
use Concrete\Core\File\Image\Thumbnail\Type\CustomThumbnail;
use Concrete\Core\File\StorageLocation\Configuration\LocalConfiguration;
<?php
namespace Application\Block\Form;
use Concrete\Core\Block\BlockController;
use Core;
use Database;
use User;
use Page;
use UserInfo;