Plugin Directory

Changeset 962770


Ignore:
Timestamp:
08/08/2014 10:36:53 PM (12 years ago)
Author:
adaldesign
Message:

localized strings with ( and e_( functions)
added text domain
updated to version 1.2

Location:
search-index-page-content/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • search-index-page-content/trunk/readme.txt

    r953044 r962770  
    6161== Changelog ==
    6262
     63= 1.2 =
     64* Added Localization and .pot file to enable translations
     65
    6366= 1.1 =
    6467* Bug fix of scrollTo
  • search-index-page-content/trunk/search-index-page-content.php

    r953045 r962770  
    22/*
    33Plugin Name: Search & Index Page Content
     4Text Domain: search-index-page-content
    45Plugin URI: http://adaldesign.com/2013/09/search-and-index-page-content/
    56Description: Help visitors browse the content of very big pages by providing on-page search and contextual links to jump to the content they are interested in. This plugin allows you to save the trouble of creating anchor links by providing shortcodes and widgets that can be placed on any post or page.
    6 Version: 1.1
     7Version: 1.2
    78Author: ADALDESIGN
    89Author URI: http://adaldesign.com
     
    8283        parent::__construct(
    8384            'sipc_links_widget', // Base ID
    84             'Search & Index Page Content', // Name
    85             array( 'description' => __( 'Creates links to headers of a page for easy navigation.', 'text_domain' ), ) // Args
     85            __('Search & Index Page Content', 'search-index-page-content'),
     86            array( 'description' => __( 'Creates links to headers of a page for easy navigation.', 'search-index-page-content' ), ) // Args
    8687        );
    8788    }
     
    9192     */
    9293    public function widget( $args, $instance ) {
    93         if ( isset( $instance[ 'show_search' ] ) ) { $show_search = $instance[ 'show_search' ]; } else { $show_search = __( 'on', 'text_domain' ); }
    94         if ( isset( $instance[ 'search_title' ] ) ) { $search_title = $instance[ 'search_title' ]; } else { $search_title = __( 'Search this page', 'text_domain' ); }
    95         if ( isset( $instance[ 'show_index' ] ) ) { $show_index = $instance[ 'show_index' ]; } else { $show_index = __( 'on', 'text_domain' ); }
    96         if ( isset( $instance[ 'index_title' ] ) ) { $index_title = $instance[ 'index_title' ]; } else { $index_title = __( 'Page Contents', 'text_domain' ); }
     94        if ( isset( $instance[ 'show_search' ] ) ) { $show_search = $instance[ 'show_search' ]; } else { $show_search = __( 'on', 'search-index-page-content' ); }
     95        if ( isset( $instance[ 'search_title' ] ) ) { $search_title = $instance[ 'search_title' ]; } else { $search_title = __( 'Search this page', 'search-index-page-content' ); }
     96        if ( isset( $instance[ 'show_index' ] ) ) { $show_index = $instance[ 'show_index' ]; } else { $show_index = __( 'on', 'search-index-page-content' ); }
     97        if ( isset( $instance[ 'index_title' ] ) ) { $index_title = $instance[ 'index_title' ]; } else { $index_title = __( 'Page Contents', 'search-index-page-content' ); }
    9798
    9899        if ( has_shortcode(get_the_content(), 'SIPC_Content') ) {
     
    100101           
    101102            if ( $show_search == 'on' )
    102                 echo '<input type="text" id="sipc-search" placeholder="'. $search_title .'" /> <button type="button" id="sipc-button">Search</button><br /><br />';
     103                echo '<input type="text" id="sipc-search" placeholder="'. $search_title .'" />
     104                      <button type="button" id="sipc-button">' . __('Search', 'search-index-page-content') . '</button><br /><br />';
    103105           
    104106            if ( $show_index == 'on' ) {
     
    114116     */
    115117    public function form( $instance ) {
    116         if ( isset( $instance[ 'show_search' ] ) ) { $show_search = $instance[ 'show_search' ]; } else { $show_search = __( 'on', 'text_domain' ); }
    117         if ( isset( $instance[ 'search_title' ] ) ) { $search_title = $instance[ 'search_title' ]; } else { $search_title = __( 'Search this page', 'text_domain' ); }
    118         if ( isset( $instance[ 'show_index' ] ) ) { $show_index = $instance[ 'show_index' ]; } else { $show_index = __( 'on', 'text_domain' ); }
    119         if ( isset( $instance[ 'index_title' ] ) ) { $index_title = $instance[ 'index_title' ]; } else { $index_title = __( 'Page Contents', 'text_domain' ); }
     118        if ( isset( $instance[ 'show_search' ] ) ) { $show_search = $instance[ 'show_search' ]; } else { $show_search = __( 'on', 'search-index-page-content' ); }
     119        if ( isset( $instance[ 'search_title' ] ) ) { $search_title = $instance[ 'search_title' ]; } else { $search_title = __( 'Search this page', 'search-index-page-content' ); }
     120        if ( isset( $instance[ 'show_index' ] ) ) { $show_index = $instance[ 'show_index' ]; } else { $show_index = __( 'on', 'search-index-page-content' ); }
     121        if ( isset( $instance[ 'index_title' ] ) ) { $index_title = $instance[ 'index_title' ]; } else { $index_title = __( 'Page Contents', 'search-index-page-content' ); }
    120122        ?>
    121123       
     
    126128                    name="<?php echo $this->get_field_name( 'show_search' ); ?>"
    127129                    type="checkbox" <?php echo $checked = ($show_search == "on") ? "checked" : ""; ?> />
    128                 <?php _e( 'Show search field?' ); ?>
     130                <?php _e( 'Show search field?', 'search-index-page-content' ); ?>
    129131            </label>
    130132        </p>
    131133        <p>
    132             <label for="<?php echo $this->get_field_id( 'search_title' ); ?>"><?php _e( 'Search field placeholder text:' ); ?></label>
     134            <label for="<?php echo $this->get_field_id( 'search_title' ); ?>"><?php _e( 'Search field placeholder text:', 'search-index-page-content' ); ?></label>
    133135            <input class="widefat"
    134136                id="<?php echo $this->get_field_id( 'search_title' ); ?>"
     
    145147                    name="<?php echo $this->get_field_name( 'show_index' ); ?>"
    146148                    type="checkbox" <?php echo $checked = ($show_index == "on") ? "checked" : ""; ?> />
    147                 <?php _e( 'Show contents index links?' ); ?>
     149                <?php _e( 'Show contents index links?', 'search-index-page-content' ); ?>
    148150            </label>
    149151        </p>
    150152        <p>
    151             <label for="<?php echo $this->get_field_id( 'index_title' ); ?>"><?php _e( 'Index links title:' ); ?></label>
     153            <label for="<?php echo $this->get_field_id( 'index_title' ); ?>"><?php _e( 'Index links title:', 'search-index-page-content' ); ?></label>
    152154            <input class="widefat"
    153155                id="<?php echo $this->get_field_id( 'index_title' ); ?>"
     
    156158        </p>
    157159        <p>
    158             <br />INSTRUCTIONS: This widget will only appear on pages or posts when you surround the content to index or search with the shortcode as such:
    159             <br /><em>[SIPC_Content]This content will be searchable and/or indexed[/SIPC_Content]</em>
     160            <br /><strong><?php _e( 'INSTRUCTIONS', 'search-index-page-content'); ?></strong><br />
     161            <?php _e( 'This widget will only appear on pages or posts when you surround the content to index or search with the shortcode as such:', 'search-index-page-content'); ?>
     162            <br /><br /><em>[SIPC_Content]<?php _e( 'This content will be searchable and/or indexed', 'search-index-page-content' ); ?>[/SIPC_Content]</em><br />
    160163        </p>
    161164        <?php
     
    262265add_action( 'wp_footer', 'sipc_inline_scripts' );
    263266
     267
     268
     269/*  --------------------
     270 *  Localize Plugin for Translations
     271 *  -------------------- */
     272 
     273function ap_action_init() {
     274    load_plugin_textdomain('search-index-page-content', false, basename( dirname( __FILE__ ) ) . '/languages' );
     275}
     276
     277// Add actions
     278add_action('init', 'ap_action_init');
     279
    264280?>
Note: See TracChangeset for help on using the changeset viewer.