Plugin Directory

Changeset 1111787


Ignore:
Timestamp:
03/13/2015 09:44:27 AM (11 years ago)
Author:
BBKP
Message:

tagging version 1.0

Location:
tags-manager/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tags-manager/trunk/google-tags.php

    r1103118 r1111787  
    2424        'manage_options',
    2525        'google_tags',
    26         'my_google_tags'
    27    
    28    
     26        'my_google_tags'       
    2927    );
    3028}
     
    3735<div class="wrap">
    3836<h2>Tags Manager by Googles</h2>
    39 <h3>Google WebMasterToolのタグ, Google Analyticsのトラッキングレコード, Googleリマーケティングのタグ設定</h3>
     37<h3>Set Up of Google WebMasterTool, Google Analytics and Google Remarketing </h3>
    4038<form id="google-tags" method="post" action="">
    4139   
    4240    <?php wp_nonce_field( 'google-tabs-nonce-key', 'google-tags' );  ?>
    4341   
    44     <p><?php echo esc_html(__( 'Googleウェブマスターツールのタグ', 'google-tags' )); ?>:
     42    <p><?php echo esc_html(__( 'Google Webmastertool is here', 'google-tags' )); ?>:
    4543    <input type="text" name="google-webmaster-tool" value="<?php echo esc_attr(stripslashes(get_option('google-webmaster-tool'))); ?>" size="105"/></p>
    4644
    47     <p><?php echo esc_html(__( 'Googleアナリティクスのタグ', 'google-tags' )); ?>:</p>
     45    <p><?php echo esc_html(__( 'Google Analytics is here', 'google-tags' )); ?>:</p>
    4846    <textarea cols="40" rows="6" name="google-analytics"><?php echo esc_textarea(stripslashes(get_option('google-analytics'))); ?></textarea>
    4947   
    50     <p><?php echo esc_html(__( 'Googleリマーケティングのタグ', 'google-tags' )); ?>:</p>
     48    <p><?php echo esc_html(__( 'Google Remarketing is here', 'google-tags' )); ?>:</p>
    5149    <textarea cols="40" rows="6" name="google-remarketing"><?php echo esc_textarea(stripslashes(get_option('google-remarketing'))); ?></textarea>
    5250   
    5351   
    54     <p><input type="submit" value="<?php echo esc_attr(__( '保存する!', 'google_tags' ));?>" class="button button-primary button-large"></p>
     52    <p><input type="submit" value="<?php echo esc_attr(__( 'Submit', 'google_tags' ));?>" class="button button-primary button-large"></p>
    5553   
    5654</form>
     
    6361
    6462function google_tags_admin_init() {
     63
     64    $e = new WP_Error();
    6565   
    6666    if(isset($_POST['google-tags']) && $_POST['google-tags']) {
    67         if (check_admin_referer( 'google-tabs-nonce-key', 'google-tags' ) ){
     67                if (check_admin_referer( 'google-tabs-nonce-key', 'google-tags' ) ){
    6868           
    6969            if( isset($_POST['google-webmaster-tool']) && $_POST['google-webmaster-tool']) {
    70                 update_option( 'google-webmaster-tool', trim( $_POST['google-webmaster-tool'] ) );
     70                update_option( 'google-webmaster-tool', trim( $_POST['google-webmaster-tool'] ) ); 
     71                //アラート
     72                $e->add( 'update', 'Post the Webmaster tag.', 'my_google_tags' );
     73                set_transient( 'my_google_tags_notice', $e->get_error_messages(), 5 );
     74       
    7175   
    7276            } else {
    7377               
    74                 update_option( 'google-webmaster-tool', '' );   
     78                update_option( 'google-webmaster-tool', '');   
     79               
    7580            }
    7681           
    7782            if( isset($_POST['google-analytics']) && $_POST['google-analytics']) {
    7883                update_option( 'google-analytics', trim( $_POST['google-analytics'] ) );
     84                //アラート
     85                $e->add( 'update', 'Post the Analytics tag.', 'my_google_tags' );
     86                set_transient( 'my_google_tags_notice', $e->get_error_messages(), 5 );
    7987   
    8088            } else {
     
    8593            if( isset($_POST['google-remarketing']) && $_POST['google-remarketing']) {
    8694                update_option( 'google-remarketing', trim( $_POST['google-remarketing'] ) );
     95                //アラート
     96                $e->add( 'update', 'Post the Remarketing tag.', 'my_google_tags' );
     97                set_transient( 'my_google_tags_notice', $e->get_error_messages(), 5 );
    8798   
    8899            } else {
     
    94105            wp_safe_redirect( menu_page_url( 'google-tags', false ));
    95106           
     107           
     108           
    96109            }
     110   
    97111    }
    98    
     112       
    99113}
    100114
     
    110124        echo $webmaster. "\n";
    111125    }
     126
    112127
    113128}
     
    138153
    139154
     155//エラー処理
     156add_action('admin_notices', 'google_tags_notices');
     157
     158function google_tags_notices() {
     159
     160?>
     161    <?php if ( $messages = get_transient( 'my_google_tags_notice' ) ): ?>
     162    <div class="updated">
     163        <ul>
     164            <?php foreach( $messages as $message ): ?>
     165                <li><?php echo esc_html( $message ); ?></li>
     166            <?php endforeach; ?>
     167
     168       
     169        </ul>
     170    </div>
     171    <?php endif; ?>
     172   
     173<?php   
     174}
    140175
    141176
     
    143178
    144179
     180
     181
     182
  • tags-manager/trunk/readme.txt

    r1103118 r1111787  
    22Contributors: Junya Higashiyama
    33Tags: Google analytics, Google webmastertool, Google Adwords remarketing
    4 Requires at least: 0.3
    5 Tested up to: 4.0.1
    6 Stable tag: tags/0.3
     4Requires at least: 0.1
     5Tested up to: 4.1.1
     6Stable tag: tags/1.0
    77License: GPLv2 or later
    88License URI: http://bibunkaplan.com
     
    2828
    2929== Changelog ==
     30= 1.0=
     31* Show the post message and changing langauage from Japanese to English.
    3032= 0.3=
    3133* change details.
Note: See TracChangeset for help on using the changeset viewer.