Skip to content

Instantly share code, notes, and snippets.

💭
😄

Takuro Hishikawa hissy

💭
😄
Block or report user

Report or block hissy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hissy
hissy / userinfo.php
Created Aug 1, 2014
[concrete5] add expiry time to user registration validation hash (~5.6.x)
View userinfo.php
<?php
defined('C5_EXECUTE') or die("Access Denied.");
class UserInfo extends Concrete5_Model_UserInfo {
public static function getByValidationHash($uHash, $unredeemedHashesOnly = true, $passtimestamp = 604800) {
$uDateGenerated = time() - $passtimestamp;
$db = Loader::db();
@hissy
hissy / gist:998062e126322e11e3b3
Last active Aug 29, 2015
[WordPress] 次の営業日を取得する
View gist:998062e126322e11e3b3
<?php
$holidays = array('08-13', '08-14', '08-15'); // 休日の定義
$weekend = array('Sun', 'Sat'); // 土日の定義
$date = new DateTime(); // 現在時刻の取得
$dateList = array(); // 日付を格納する空の配列を定義
$i = 0;
while ($i < 7) { // 直近7日間を取得
$date->add(DateInterval::createFromDateString('1 day')); // 1日送る
@hissy
hissy / gist:3739da85b8e2761aae28
Created Aug 18, 2014
フォームの回答から抽選するスクリプト、toolsに設置
View gist:3739da85b8e2761aae28
<?php
defined('C5_EXECUTE') or die("Access Denied.");
// Formブロックをロード
Loader::block('form');
// ヘルパーのロード
$valn = Loader::helper('validation/numbers');
// フォームの結果を見れる権限があるかのチェック
@hissy
hissy / site.php
Last active Aug 29, 2015
[concrete5] Force SSL when user is logged in
View site.php
<?php
// Add below codes into config/site.php
// If User is logged in
if (isset($_SESSION['uID']) && $_SESSION['uID'] > 0 && isset($_SESSION['uName']) && $_SESSION['uName'] != '') {
define('BASE_URL', 'https://example.com');
} else {
define('BASE_URL', 'http://example.com');
}
View rscsv-addon-usecomma.php
<?php
/*
Plugin Name: Really Simple CSV Importer add-on: Comma
Version: 0.1
*/
class rscsvimporter_comma {
// singleton instance
private static $instance;
@hissy
hissy / site_post.php
Last active Aug 29, 2015
concrete5で、特定のディレクトリだけ英語サイトにする(Internationalizationアドオンを使わない簡易版)(〜5.6.x)
View site_post.php
<?php
// config/site_post.php
defined('C5_EXECUTE') or die("Access Denied.");
$req = Request::get();
$reqPath = $req->getRequestPath();
if ( strpos($reqPath, 'en/') !== false ) {
Localization::changeLocale('en_US');
}
@hissy
hissy / gist:72827af7d2893450cb95
Last active Aug 29, 2015
#concrete5 オートナビテンプレートで第1階層だけulから外れるパターン
View gist:72827af7d2893450cb95
<?php defined('C5_EXECUTE') or die("Access Denied.");
$navItems = $controller->getNavItems();
?>
<div class="menu">
<?php
// サブメニューが開いているかどうかのフラグ
$subMenuIsOpen = false;
@hissy
hissy / gist:7e690f20f2cb2f440c10
Created Dec 18, 2014
#concrete5 #autonav "Exclude from breadcrumb" attribute
View gist:7e690f20f2cb2f440c10
<?php defined('C5_EXECUTE') or die("Access Denied.");
$navItems = $controller->getNavItems(true);
echo '<ul class="clearfix">'; //opens the top-level menu
foreach ($navItems as $ni) {
echo '<li>'; //opens a nav item
@hissy
hissy / app.php
Last active Aug 29, 2015
#concrete5 #5.7 How to generate Global Areas for each language section, for multilingual site.
View app.php
<?php
// application/config/app.php
return array(
'aliases' => array(
'GlobalArea' => '\Application\Src\Area\GlobalArea'
)
);
@hissy
hissy / backlog-deploy.php
Created Jan 4, 2015
Automated git deployments from Backlog
View backlog-deploy.php
<?php
// Original: http://jonathannicol.com/blog/2013/11/19/automated-git-deployments-from-bitbucket/
$repo_dir = '/home/<username>/<repo-name>.git';
$web_root_dir = '/home/<username>/public_html';
// Full path to git binary is required if git is not in your PHP user's path. Otherwise just use 'git'.
$git_bin_path = 'git';
$update = false;
You can’t perform that action at this time.