Skip to content

Instantly share code, notes, and snippets.

@zenith6
zenith6 / ItemSearchWithClass.php
Last active January 3, 2016 16:29
API_ItemSearch の検索結果に商品規格も含めるように拡張したAPIです。 data/downloads/api 以下に配置して下さい。
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@zenith6
zenith6 / charset.patch
Created February 1, 2014 03:46
EC-CUBEに対して、DB接続の文字エンコーディングをDSNで指定するパッチです。
Index: data/class/db/SC_DB_DBFactory.php
===================================================================
--- data/class/db/SC_DB_DBFactory.php (リビジョン 23329)
+++ data/class/db/SC_DB_DBFactory.php (作業コピー)
@@ -70,7 +70,8 @@
'protocol' => 'tcp',
'hostspec' => DB_SERVER,
'port' => DB_PORT,
- 'database' => DB_NAME
+ 'database' => DB_NAME,
@zenith6
zenith6 / SC_CheckError.patch
Created February 14, 2014 10:48
EC-CUBEの SC_CheckError::FILE_NAME_CHECK_BY_NOUPLOAD() を修正するパッチです。
Index: data/class/SC_CheckError.php
===================================================================
--- data/class/SC_CheckError.php (リビジョン 23348)
+++ data/class/SC_CheckError.php (作業コピー)
@@ -851,7 +851,7 @@
return;
}
$this->createParam($value);
- if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[[:alnum:]_\.-]+$/i", $this->arrParam[$value[1]]) || preg_match('/[\\]/' ,$this->arrParam[$value[1]])) {
+ if (strlen($this->arrParam[$value[1]]) > 0 && preg_match("/[^[:alnum:]_.\\-]/", $this->arrParam[$value[1]])) {
@zenith6
zenith6 / SC_CheckError.patch
Created February 14, 2014 11:04
EC-CUBEの SC_CheckError::FILE_NAME_CHECK_BY_NOUPLOAD() を修正するパッチです。
Index: data/class/SC_CheckError.php
===================================================================
--- data/class/SC_CheckError.php (リビジョン 23289)
+++ data/class/SC_CheckError.php (作業コピー)
@@ -851,7 +851,7 @@
return;
}
$this->createParam($value);
- if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[[:alnum:]_\.-]+$/i", $this->arrParam[$value[1]]) || preg_match('/[\\]/' ,$this->arrParam[$value[1]])) {
+ if (strlen($this->arrParam[$value[1]]) > 0 && preg_match("/[^[:alnum:]_.\\-]/", $this->arrParam[$value[1]])) {
Index: data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php
===================================================================
--- data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php (revision 23350)
+++ data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php (working copy)
@@ -232,31 +232,33 @@
$cntInsert = 0;
$img_cnt = 0;
- $fp = $this->openZipCsv();
- while (!feof($fp)) {
Index: data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php
===================================================================
--- data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php (revision 23350)
+++ data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php (working copy)
@@ -233,19 +233,28 @@
$img_cnt = 0;
$fp = $this->openZipCsv();
+ $begin = microtime(true);
+ $bulk_size = 100; # バルクインサート件数
@zenith6
zenith6 / eccube-mysqli.patch
Created March 21, 2014 04:59
EC-CUBE 2.13-dev に MySQL 改良版拡張モジュールへの対応を追加するパッチです。https://svn.ec-cube.net/open/branches/version-2_13-dev/?p=23352 に対して適用して下さい。
Index: data/class/db/SC_DB_DBFactory.php
===================================================================
--- data/class/db/SC_DB_DBFactory.php (revision 23352)
+++ data/class/db/SC_DB_DBFactory.php (working copy)
@@ -40,6 +40,7 @@
{
switch ($db_type) {
case 'mysql':
+ case 'mysqli':
return new SC_DB_DBFactory_MYSQL();
@zenith6
zenith6 / eccube_product_class_edit_form.patch
Last active August 29, 2015 13:58
EC-CUBE の「商品管理>商品登録(商品規格)」の編集項目の表示順を変更するパッチです。登録済みの項目が先頭に来るようになります。
Index: data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php
===================================================================
--- data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php (リビジョン 23289)
+++ data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php (作業コピー)
@@ -512,6 +512,11 @@
}
}
+ // 登録済みの規格を先頭に並べる。
+ $del_flags = array_map(function ($class) { return (int)$class['del_flg']; }, $arrMergeProductsClass);
@zenith6
zenith6 / aigis_fix.js
Last active August 29, 2015 14:01
千年戦争アイギス ユーザースクリプト
// ==UserScript==
// @name 千年戦争アイギス
// @namespace http://kilauea.bbspink.com/test/read.cgi/mobpink/
// @version 0.2
// @description Chrome extension にしたい。
// @match http://www.dmm.co.jp/netgame/social/-/gadgets/=/app_id=156462/
// @copyright 2014+, zenith
// ==/UserScript==
(function ($) {
@zenith6
zenith6 / drupal_commerce_quantity.php
Created January 20, 2015 13:53
Drupal Commerce 注文データから項目を取得する
<?php
$order = /* order object */;
$wrapper = entity_metadata_wrapper('commerce_order', $order);
$items = [];
foreach ($wrapper->commerce_line_items as $line_item) {
$items[] = [
'type' => $line_item->type->value(), # Product type machine name