Plugin Directory

Changeset 504345


Ignore:
Timestamp:
02/13/2012 03:23:50 PM (14 years ago)
Author:
anubisthejackle
Message:

Added functionality to allow you to forgo auto more tag on Pages.

Location:
auto-more-tag
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • auto-more-tag/trunk/auto-more-options-page.php

    r470073 r504345  
    112112                </select>
    113113            </div>
     114            <div>
     115                <label for="tw_auto_more_tag[set_pages]">Set More Tag On Pages?</label>
     116                <select id="tw_auto_more_tag[set_pages]" name="tw_auto_more_tag[set_pages]">
     117                    <option value="0" <?php echo (!isset($options['set_pages']) || $options['set_pages'] == false) ? 'selected="SELECTED" ' : null;?>/>No
     118                    <option value="1" <?php echo (isset($options['set_pages']) && $options['set_pages'] == true) ? 'selected="SELECTED" ' : null;?>/>Yes
     119                </select>
     120            </div>
    114121            <p class="submit">
    115122                <input type="submit" class="button-primary" value="<?php _e('Update Auto More Tag Settings'); ?>" />
  • auto-more-tag/trunk/auto-more.php

    r495757 r504345  
    66Author: Travis Weston
    77Author URI: http://travisweston.com/
    8 Version: 3.0
     8Version: 3.1
    99*/
    1010
     
    4444
    4545        public static function addTag($data, $arr = array()){
    46 
     46            global $post;
    4747            $options = get_option('tw_auto_more_tag');
    48                    
     48
     49            if($post->post_type != 'post' && $options['set_pages'] != true){
     50                $data = str_replace('<!--more-->', '', $data);
     51                return $data;
     52            }
    4953            $length = $options['quantity'];
    5054            $breakOn = $options['break'];
     
    124128            }
    125129
    126             $start = trim(substr($data, 0, $insertSpot));
    127             $end = trim(substr($data, $insertSpot));
    128 
    129             if(strlen($start) > 0 && strlen($end) > 0)
     130            $start = substr($data, 0, $insertSpot);
     131            $end = substr($data, $insertSpot);
     132
     133            if(strlen(trim($start)) > 0 && strlen(trim($end)) > 0)
    130134                $data = $start.'<!--more-->'.$end;
    131135
     
    160164            }
    161165
    162             $start = trim(substr($data, 0, $insertSpot));
    163             $end = trim(substr($data, $insertSpot));
    164 
    165             if(strlen($start) > 0 && strlen($end) > 0)
     166            $start = substr($data, 0, $insertSpot);
     167            $end = substr($data, $insertSpot);
     168
     169            if(strlen(trim($start)) > 0 && strlen(trim($end)) > 0)
    166170                $data = $start.'<!--more-->'.$end;
    167171
     
    203207            }
    204208           
    205             $start = trim(substr($data, 0, $insertSpot));
    206             $end = trim(substr($data, $insertSpot));
    207 
    208             if(strlen($start) > 0 && strlen($end) > 0)
     209            $start = substr($data, 0, $insertSpot);
     210            $end = substr($data, $insertSpot);
     211
     212            if(strlen(trim($start)) > 0 && strlen(trim($end)) > 0)
    209213                $data = $start.'<!--more-->'.$end;         
    210214           
  • auto-more-tag/trunk/readme.txt

    r495759 r504345  
    55Requires at least: 3.2.1
    66Tested up to: 3.4
    7 Stable tag: 3.0
     7Stable tag: 3.1
    88
    99Allows you to add a More tag to your post automatically upon publication.
     
    3434
    3535== Changelog ==
     36= 3.1 =
     37Added functionality to allow you to forgo the auto more tag on Pages.
     38
    3639= 3.0 =
    3740Improved intelligent placement, fixing glitch with HTML. Placement is now based on plaintext, and not HTML content. Added capabilities to place by word count.
Note: See TracChangeset for help on using the changeset viewer.