Skip to content

Instantly share code, notes, and snippets.

View onocom's full-sized avatar

Ono Takashi onocom

View GitHub Profile
@onocom
onocom / WP-contactform7_recipient_overwrite.php
Last active January 15, 2023 14:50
コンタクトフォーム7でフォームの送信先を動的に変更したい機会があり、無理やり書き換えることを試みた。
<?php
define( "O_SYSTEM_CRYPT_KEY" , "OrehaJaian!Gakidaisho!OiNobitaButtobasuzo!" ); // 暗号化キー
define( "REPLACE_MAIL_ADDRESS" , "[email protected]" ); // 置換対象となるメールアドレス
// コンタクトフォーム7にhiddenフィールドを追加
add_filter( 'wpcf7_form_hidden_fields', 'oc_wpcf7_form_hidden_fields');
function oc_wpcf7_form_hidden_fields( $hidden ) {
$email = "[email protected]"; // 送信したいアドレスをhiddenフィールドに暗号化して設定しておく
$cript_mail = openssl_encrypt($email, 'AES-128-ECB', O_SYSTEM_CRYPT_KEY);
<?php
// 同一投稿者のページングを実現する
$args = array(
'posts_per_page' => 1,
'orderby' => 'date',
'post_type' => 'post',
'post_parent' => "",
'author' => get_the_author_meta('ID'),
'post_status' => 'publish',
'suppress_filters' => true,
@onocom
onocom / PHP-is_access_from_japan.php
Created December 1, 2015 06:07
日本からのアクセスと海外からのアクセスの判定をしたかったので作った関数。判定の部分、もっと厳密にしてあげたほうがいいのかしら。
<?php
/**
* 日本からのアクセスかを判断する
*/
function is_access_from_japan(){
if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) || empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
return false; // よくわからなければ海外からのアクセスとして判定する
}
@onocom
onocom / Gulp-install.txt
Created January 6, 2016 01:15
Gulp勉強メモ
// Gulpを使うためのメモ
// NODE JS インストール
https://nodejs.org/en/
// Gulpインストール
npm install -g gulp
// NPM
npm init
@onocom
onocom / GIT-howto.txt
Last active January 6, 2016 02:34
Gitの基本的な使い方めも
// Git使い方メモ
// @see http://www.backlog.jp/git-guide/intro/intro1_1.html
// version check
git --version
// settings ---------------------------------------------------------
C:\Users\XXXXX\.ssh> ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa): C:\Users\XXXXX\.ssh\id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\XXXXX\.ssh\id_rsa.
Your public key has been saved in C:\Users\XXXXX\.ssh\id_rsa.pub.
http://matome.naver.jp/odai/2136491451473222801
http://www.slideshare.net/kotas/git-15276118
http://www.slideshare.net/matsukaz/git-28304397
@onocom
onocom / ref-spam-list.txt
Created January 12, 2016 05:16
アクセス解析リファラスパムアドレス一覧
// 対応方法: http://analyze.siraberu.info/post-732/
с.новым.годом.рф
share-buttons.xyz
traffic2cash.xyz
website-stealer.nufaq.com
website-stealer-warning.hdmoviecamera.net
w3javascript.com
build-a-better-business.2your.site
topseoservices.co
<?php
add_filter( 'is_lightning_extend_loop', 'oc_is_extend_loop');
function oc_is_extend_loop() {
return true;
}
add_action( 'lightning_extend_loop', 'oc_extend_loop');
function oc_extend_loop() {
// loop
}
@onocom
onocom / form_validation_lang.php
Last active February 10, 2016 08:24
CodeIgniter 3.0のバリデーションメッセージ日本語ファイル(間違いがあれば教えてくださいm(_ _)m)
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
*