Plugin Directory

Changeset 1855480


Ignore:
Timestamp:
04/10/2018 01:59:41 AM (8 years ago)
Author:
amg26
Message:

added in open tabs in new window back

Location:
seo-image-alt-tags/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • seo-image-alt-tags/trunk/classes/class-sit-scripts.php

    r1650354 r1855480  
    44
    55class ScriptHandler {
    6 /**
    7 * Enqueue scripts
    8 */
     6    /**
     7     * Enqueue scripts
     8     */
    99
    1010
    11 public function __construct() {
    12     add_action('wp_footer', array($this,'sit_scripts'),5);
    13 }
    14 public function sit_scripts() { ?>
     11    public function __construct() {
     12        add_action( 'wp_footer', [ $this, 'sit_scripts' ], 5 );
     13    }
    1514
    16     <?php
     15    public function sit_scripts() { ?>
    1716
    18     global $sit_settings;
    19     $sit_settings = (array) get_option('sit_settings');
    20     $key = 'disable_clientside_script';
    21     $name = $_SERVER['SERVER_NAME'];
    22     //var_dump($name);
    23      //var_dump($sit_settings[$key]);//$var = get_option('wc_bom_option'); ?>
     17        <?php
    2418
    25         <?php if (is_null($sit_settings[$key])) ://$ke//if (is_null($sit_settings[$key])) { echo 'is_null';?>
    26         <script type="text/javascript">
    27            
    28             //jQuery(document).ready(function($) {
    29             jQuery(document).ready(function($){
    30                 var count = 0;
    31                 var pathname = window.location.pathname; // Returns path only
    32                 var url = window.location.href;
    33                 var pdf;
     19        global $sit_settings;
     20        $sit_settings = (array) get_option( 'sit_settings' );
     21        $key          = 'disable_clientside_script';
     22        $name         = $_SERVER['SERVER_NAME'];
     23        //var_dump($name);
     24        //var_dump($sit_settings[$key]);//$var = get_option('wc_bom_option'); ?>
    3425
    35                 $("a").each(function() {
     26        <?php if ( null === $sit_settings[ $key ] ) ://$ke//if (is_null($sit_settings[$key])) { echo 'is_null';?>
     27            <script type="text/javascript">
    3628
    37            
     29                //jQuery(document).ready(function($) {
     30                jQuery(document).ready(function ($) {
     31                    var count = 0;
     32                    var pathname = window.location.pathname; // Returns path only
     33                    var url = window.location.href;
     34                    var pdf;
    3835
    39                     if ( ( $(this).attr('href') != '#' ) && ( $(this).attr('href') != null ) ) {
    40 
    41                         var url =  $(this).attr('href');
    42 
    43                         <?php $key2 = 'enable_pdf_ext';
    44 
    45                         if (!(is_null($sit_settings[$key2]))): ?>
    46 
    47                             var pos = url.indexOf('.pdf');
    48                             //console.log(pos);
    49                             if (pos !== -1) {
    50                                 $(this).attr('target', '_blank');
    51                             }
    52 
    53                        
    54                         <?php endif;
    55 
    56                         $key3 = 'enable_seo_links';
    57 
    58                         if (!(is_null($sit_settings[$key3]))): ?>
    59 
    60                             var host = window.location.host;
    61                             var pos = url.indexOf(host);
    62                             //console.log(host);
    63                             if (pos === -1) {
    64                                 $(this).attr('target', '_blank');
    65                             }
    66                            
    67                         <?php endif; ?>
    68                            
    69                     }
    70 
    71                 }); //each
    72 
    73                
    74                 <?php $key4 = 'dab_af';
    75 
    76                 if (!(is_null($sit_settings[$key4]))) : ?>
    77                     if ($.browser.chrome) {
    78                     //autcomplete_false();
    79 
    80                         $("input").each(function() {
    81                            
    82                             $(this).attr('autocomplete', 'false'); //FALSE AS OF 2015
    83 
    84                         }); // .each
    85 
    86                         $("form").each(function() {
    87                            
    88                             $(this).attr('autocomplete', 'false'); //FALSE AS OF 2015
    89 
    90                         }); // .each
    91 
    92                     } else {
    93 
    94                         $("input").each(function() {
    95 
    96                             $(this).attr('autocomplete', 'off');
     36                    $("a").each(function () {
    9737
    9838
    99                         }); // .each
     39                        if (($(this).attr('href') !== '#') && ($(this).attr('href') != null)) {
    10040
    101                         $("form").each(function() {
     41                            var url = $(this).attr('href');
    10242
    103                             $(this).attr('autocomplete', 'off');
     43                            <?php $key2 = 'enable_pdf_ext';
    10444
    105                         }); // .each
     45                            if (! ( null === $sit_settings[ $key2 ] )): ?>
    10646
    107                     } // end if
    108                 <?php endif; ?>
     47                            var pos = url.indexOf('.pdf');
     48                            //console.log(pos);
     49                            if (pos !== -1) {
     50                                $(this).attr('target', '_blank');
     51                            }
    10952
    110                 });
    11153
    112             </script>
     54                            <?php endif;
    11355
    114     <?php endif;
     56                            $key3 = 'enable_seo_links';
     57
     58                            if (! ( null === $sit_settings[ $key3 ] )): ?>
     59
     60                            var host = window.location.host;
     61                            var pos = url.indexOf(host);
     62                            //console.log(host);
     63                            if (pos === -1) {
     64                                $(this).attr('target', '_blank');
     65                            }
     66
     67                            <?php endif; ?>
     68
     69                        }
     70
     71                    }); //each
     72
     73
     74                });
     75
     76            </script>
     77
     78        <?php endif;
    11579    }
    11680}
     81
    11782$ss = new ScriptHandler();
  • seo-image-alt-tags/trunk/classes/class-sit-settings.php

    r1844418 r1855480  
    55
    66}
    7 
    87/**
    98 * PLUGIN SETTINGS PAGE
     
    1413     */
    1514    public $sit_settings;
    16 
    1715    /**
    1816     * Start up
    1917     */
    20     public function __construct() {
    21         add_action( 'admin_menu', [ $this, 'add_sit_menu_page' ] );
    22         add_action( 'admin_init', [ $this, 'page_init' ] );
    23 
    24     }
    25 
     18    public function __construct()
     19    {
     20        add_action( 'admin_menu', array( $this, 'add_sit_menu_page' ) );
     21        add_action( 'admin_init', array( $this, 'page_init' ) );
     22
     23    }
    2624    /**
    2725     * Add options page
     
    3533            'manage_options',
    3634            'seo-image-tags',
    37             [ $this, 'create_sit_menu_page' ]//,
     35            array( $this, 'create_sit_menu_page' )//,
    3836        );
    3937    }
     
    7371            'sit_settings_group', // Option group
    7472            'sit_settings', // Option name
    75             [ $this, 'sanitize' ] // Sanitize
     73            array( $this, 'sanitize' ) // Sanitize
    7674        );
    7775
     
    7977            'sit_settings_section', // ID
    8078            '', // Title
    81             [ $this, 'sit_info' ], // Callback
     79            array( $this, 'sit_info' ), // Callback
    8280            'sit-options-admin' // Page
    8381        );
     
    8684            'sit_option', // ID
    8785            '', // Title
    88             [ $this, 'sit_option_callback' ], // Callback
     86            array( $this, 'sit_option_callback' ), // Callback
    8987            'sit-options-admin', // Page
    9088            'sit_settings_section' // Section
     
    9290
    9391    }
    94 
    9592    /**
    9693     * Sanitize each setting field as needed
     
    9996     */
    10097    public function sanitize( $input ) {
    101         $new_input = [];
    102         if ( isset( $input['sit_settings'] ) ) {
     98        $new_input = array();
     99        if( isset( $input['sit_settings'] ) )
    103100            $new_input['sit_settings'] = absint( $input['sit_settings'] );
    104         }
    105101
    106102        return $input;
     
    110106    public function sit_info() {
    111107
    112         $sit_settings = get_option( 'sit_settings' );
    113 
    114         if ( $sit_settings['update'] == true ) {
    115 
    116             $count = [];
    117             $count = batch_update_image_tags( true );
     108        if ($this->sit_settings['update']) {
     109
     110            $count = array();
     111            $count = batch_update_image_tags(true);
    118112
    119113            echo '<div id="setting-error-settings_updated" class="updated settings-error notice is-dismissible"><p>';
    120114
    121             foreach ( $count as $key => $value ) {
    122                 echo '<strong>' . $key . ':</strong>&nbsp;' . $value . '<br>';
     115            foreach( $count as $key => $value ) {
     116                echo '<strong>'.$key.':</strong>&nbsp;'.$value.'<br>';
    123117            }
    124             update_option( $sit_settings['update'], true );
     118            update_option($sit_settings['update'], '');
    125119            echo '</p></div>';
    126120
    127         } elseif ( $sit_settings['delete'] ) {
    128             $count = [];
    129             $count = batch_update_image_tags( false );
     121        } elseif ($this->sit_settings['delete']) {
     122            $count = array();
     123            $count = batch_update_image_tags(false);
    130124            echo '<div id="setting-error-settings_updated" class="updated settings-error notice is-dismissible"><p>';
    131125
    132             foreach ( $count as $key => $value ) {
    133                 echo '<strong>' . $key . ':</strong>&nbsp;' . $value . '<br>';
     126            foreach( $count as $key => $value ) {
     127                echo '<strong>'.$key.':</strong>&nbsp;'.$value.'<br>';
    134128            }
    135             update_option( $sit_settings['delete'], true );
     129            update_option($sit_settings['delete'], '');
    136130
    137131            echo '</p></div>';
     
    168162                        <fieldset><?php $key = 'update'; ?>
    169163
    170                             <input class="button button-primary" id='sit_settings[<?php echo $key; ?>]'
    171                                    name="sit_settings[<?php echo $key; ?>]" type="submit" value="Update Empty Tags"/>
     164                            <input class="button button-primary" id='sit_settings[<?php echo $key; ?>]' name="sit_settings[<?php echo $key; ?>]" type="submit" value="Update Tags"  />
    172165
    173166
    174167                            <?php $key = 'delete'; ?>
    175168                            &nbsp;
    176                             <input class="button-secondary delete" id='sit_settings[<?php echo $key; ?>]'
    177                                    name="sit_settings[<?php echo $key; ?>]" type="submit" value="Delete All Tags"/>
     169                            <input class="button-secondary delete" id='sit_settings[<?php echo $key; ?>]' name="sit_settings[<?php echo $key; ?>]" type="submit" value="Delete Tags"  />
    178170
    179171                        </fieldset>
     
    183175
    184176                <tr>
    185                     <th> <?php submit_button( 'Save Settings' ); ?></th>
     177                    <th scope="row">
     178                        Link Targetting
     179                    </th>
     180                    <td>
     181                        <fieldset><?php $key = 'enable_seo_links'; ?>
     182                            <label for="sit_settings[<?php echo $key; ?>]">
     183                                <input id='sit_settings[<?php echo $key; ?>]' name="sit_settings[<?php echo $key; ?>]" type="checkbox" value="1" <?php checked(1, $sit_settings[$key], true ); ?> />
     184                                Open external links in new tab.
     185                            </label>
     186                        </fieldset>
     187                        <fieldset><?php $key = 'enable_pdf_ext'; ?>
     188
     189                            <label for="sit_settings[<?php echo $key; ?>]">
     190                                <input id='sit_settings[<?php echo $key; ?>]' name="sit_settings[<?php echo $key; ?>]" type="checkbox" value="1" <?php checked(1, $sit_settings[$key], true ); ?> />
     191                                Open internal PDFs in a new tab.
     192                            </label>
     193
     194                        </fieldset>
     195
     196
     197
     198                    </td>
     199                </tr>
     200
     201                <tr>
     202                    <th> <?php submit_button('Save Settings'); ?></th>
    186203
    187204                </tr>
     
    198215}
    199216
    200 if ( is_admin() ) {
     217if( is_admin() )
    201218    $sit = new SitSettings();
    202 }
    203 
    204 
     219
     220
  • seo-image-alt-tags/trunk/readme.txt

    r1844577 r1855480  
    44Donate link: andrewgunn.org
    55Requires at least: 3.0
    6 Tested up to: 4.9.4
    7 Stable tag: 3.3
     6Tested up to: 4.9.5
     7Stable tag: 3.3.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • seo-image-alt-tags/trunk/seo-image-alt-tags.php

    r1844418 r1855480  
    99 * Description: THIS WILL SAVE YOU HOURS. Alt tags are dynamically generated and saved to the database automatically any time an image is uploaded, and improves your SEO score by optimizing image data.
    1010
    11  * Version: 3.3
     11 * Version: 3.3.1
    1212 *
    1313 * Author: Andrew M. Gunn
     
    3131include_once( 'classes/class-sit-settings.php' );
    3232
    33 //include_once ('classes/class-sit-scripts.php');
     33include_once ('classes/class-sit-scripts.php');
    3434
    3535add_filter( 'plugin_action_links', 'sit_settings_link', 10, 5 );
Note: See TracChangeset for help on using the changeset viewer.