This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Get archives markup. | |
| * Customize wp-includes/general-template.php -> wp_get_archives | |
| * @param string|array $args Optional. Override defaults. | |
| * @return string|null String when retrieving, null when displaying. | |
| */ | |
| function shintotsushin_wp_get_archives( $args = '' ) { | |
| global $wp_query; | |
| global $wpdb; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 中央配置用オフセット取得 | |
| * | |
| * target要素をparent要素の中央へ配置するために | |
| * CSSのtop, leftプロパティへ設定すべき値を取得します。 | |
| * | |
| * @method getOffset | |
| * @public | |
| * @param {jQuery} target 中央配置するjQueryオブジェクトです。 | |
| * @param {jQuery} parent 親のjQueryオブジェクトです。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| QUnit.module( "getOffsetのテスト" ); | |
| QUnit.test( "jQueryオブジェクトを渡したとき親要素の中央へ配置するためのオフセット値を返す ", function ( assert ) { | |
| var target, parent; | |
| target = $( '<div style="width: 100px; height: 100px">' ); | |
| parent = $( '<div style="width: 200px; height: 300px">' ); | |
| target.appendTo( parent ); | |
| parent.appendTo( $( 'body' ) ); | |
| var point = InfoTown.Center.getOffset( target, parent ); | |
| assert.ok( point.x == "50", "Passed!" ); | |
| assert.ok( point.y == "100", "Passed!" ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * オフセット設定 | |
| * | |
| * @method | |
| * @private | |
| * @param {jQuery} elem オフセットを設定する要素です。 | |
| * @param {Object} initial 要素の初期の大きさです。 | |
| * @param {Int} initial.width 初期の幅です。 | |
| * @param {Int} initial.height 初期の高さです。 | |
| * @returns {Function} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // シンプルなスライドショー | |
| // photo-main メイン画像コンテナ | |
| // photo-thumb サムネイルコンテナ | |
| $('#photo-thumb a').click(function() { | |
| $('#photo-main img').hide(); | |
| var path = $(this).attr('href'); | |
| var img = new Image(); | |
| img.src = path; | |
| // 画像をスムーズに切り替えるために一度removeしてからappendする。 | |
| $('#photo-main img').remove(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // クロージャーは呼び出し元が関数の変数名解決の環境を保持する。 | |
| // そのためクロージャーは呼び出し元から参照できる必要がある。 | |
| // 参照の可能性がないものはガーベージコレクションされる。 | |
| // クロージャーではない単なる関数 | |
| // 呼び出し元に何も帰らないので | |
| // hogeを抜けた時点で変数var, incはガーベージコレクションされる | |
| function hoge() { | |
| var count = 0; | |
| function inc() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h3>外部ブログ表示</h3> | |
| <?php // Get RSS Feed(s) | |
| include_once(ABSPATH . WPINC . '/rss.php'); | |
| $rss = fetch_rss('フィードのパス'); | |
| $maxitems = 5; | |
| $items = array_slice($rss->items, 0, $maxitems); | |
| ?> | |
| <ul> | |
| <?php if (empty($items)) : ?> | |
| <li>投稿はありません。</li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getOffset(inner, outer) { | |
| // オフセット | |
| var offsetX = Math.ceil(($(outer).width() - $(inner).width()) / 2); | |
| var offsetY = Math.ceil(($(outer).height - $(inner).height()) / 2); | |
| var offset = { | |
| x: offsetX, | |
| y: offsetY | |
| }; | |
| return offset; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $value = htmlspecialchars($_GET["test"]); | |
| header("Content-Type: text/html; charset=UTF-8"); | |
| echo $value; | |
| ?> |
OlderNewer