Skip to content

Instantly share code, notes, and snippets.

View onesword0618's full-sized avatar
🐏
Working Night

Kenichi Inoue onesword0618

🐏
Working Night
View GitHub Profile
@onesword0618
onesword0618 / function_get_footer.php
Last active March 16, 2019 00:25
WPの関数:get_footer()
@onesword0618
onesword0618 / function_do_action.php
Last active March 16, 2019 00:56
WPの関数:do_action()
// add_action() で登録されたアクションフックを実行します。
// この関数が記述されているところがアクションフックを実行している箇所ともいえる
<?php
// $tag 必須 実行したいアクションフック名
// $arg 任意 第一引数で実行するアクションフックにわたすパラメタ 省略すると空が渡る
function do_action( $tag, $arg = '' ) {
// グローバル変数
// $wp_filter フィルターとアクションをすべて格納
// $wp_actions アクションが呼び出された回数
// $wp_current_filter 現在呼び出されているフィルターフックまたはアクションフックの名前を取得
@onesword0618
onesword0618 / function_language_attributes.php
Created March 17, 2019 14:24
WPの関数:language_attributes()
<? php
// 言語属性を取得
function language_attributes( $doctype = 'html' ) {
// ドキュメントタイプを出力(言語)
// 対象範囲が限定なら直接書いたほうがサーバにアクセスしない分早く出力できそうかも
echo get_language_attributes( $doctype );
}
@onesword0618
onesword0618 / function_get_language_attributes.php
Last active March 17, 2019 14:56
WPの関数:get_language_attributes()
<? php
// 言語属性の取得
function get_language_attributes( $doctype = 'html' ) {
$attributes = array();
 // is_rtl() ロケールが RTL (Right To Left: アラビア語やヘブライ語のように右から左へ記述する言語) であるか否かをチェックする関数
if ( function_exists( 'is_rtl' ) && is_rtl() ) {
$attributes[] = 'dir="rtl"';
}
// get_bloginfo( 'language' ) はこの関数が呼ばれた時にそのときの言語を返却する
@onesword0618
onesword0618 / function_get_bloginfo.php
Created March 18, 2019 14:46
WPの関数:get_bloginfo()
<? php
// 初期値
// $show:'', $filter: 'raw'
function get_bloginfo( $show = '', $filter = 'raw' ) {
 // 第一引数に指定した文字列をもとに実行する箇所を決める
switch ( $show ) {
// 非推奨
case 'home': // DEPRECATED
// 非推奨
 case 'siteurl': // DEPRECATED
@onesword0618
onesword0618 / function__deprecated_argument.php
Created March 18, 2019 15:00
WPの関数:_deprecated_argument()
<? php
function _deprecated_argument( $function, $version, $message = null ) {
/**
* Fires when a deprecated argument is called.
*
* @since 3.0.0
*
* @param string $function The function that was called.
* @param string $message A message regarding the change.
package diary;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.time.LocalDate;
public class Diary {
enum Date {
@onesword0618
onesword0618 / Test.java
Created April 10, 2019 15:22
手直し
package nikki2;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.logging.Logger;
@onesword0618
onesword0618 / AutoLogin.js
Created June 1, 2019 23:45
自動ログインを行うブックマークレット
javascript:(function(){ document.getElementById("account").value="loginName";document.getElementById("password").value="loginpassword";})();
@onesword0618
onesword0618 / property.gs
Last active August 14, 2019 03:28
設定情報を登録する
/*
key-value形式で管理する設定情報を扱うクラス
全てのユーザーがアクセスできるプロパティストアを扱う
*/
function Property () {
// クラス内使いまわすためにPropertiesService.getScriptProperties()の呼び出し結果を保存
this.service = PropertiesService.getScriptProperties()
/*
設定情報を設定する関数