WordPress.org

Plugin Directory

Changeset 767862


Ignore:
Timestamp:
09/06/13 11:24:58 (7 months ago)
Author:
Strictly Software
Message:

Fixed some bugs, added some new features and explained about future versions and how to obtain them and all the cool new features they will have.

Location:
strictly-autotags/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • strictly-autotags/trunk/readme.txt

    r742250 r767862  
    66Requires at least: 2.0.2                     
    77Tested up to: 3.4.2 
    8 Stable tag: 2.8.4 
     8Stable tag: 2.8.5 
    99 
    1010Strictly AutoTags is a plugin that automatically adds the most relevant tags to posts. 
     
    194194* Try to fix unknown issue that I cannot replicate which people are saying is changing their links/href/src tags. If there is a problem I can only imagine it to be in the storage array which holds these values to prevent tagging by mistake. I am unsetting the array before and after storing/replacing to see if that will help. 
    195195* Also wrapping the init of the class in a static class so that if the object is loaded multiple times there is only a singleton not multiple instances. This might help as well. 
     196 
     197= 2.8.5 = 
     198* Updated storage array to store content between important content, bold, strong, headers and links etc. So they don't get tagged inside e.g put bolded words inside an existing h4 etc. 
     199* Changed storage array to run "RETURN" twice to handle nested code because of previous change e.g <a href="##STORED##"><img src="##STORED##"></a> 
     200* Fixed bug that wasn't showing the correct value for the minimum number of tags that a post must have before deeplinking to their tag page in admin. 
     201* Fixed bug in admin to allow noise words to have dots in them e.g for links like youtube.com 
     202* Added more default noise words to the list 
     203* Cleaned code that wasn't needed anymore due to changes with the way I handle href/src/title/alt attributes to prevent nested tagging 
     204* Removed unneccessary regular expressions which are not needed now. 
     205* Added details about all the sexy new features for version 2.8.5 which is donate and deliver only! 
  • strictly-autotags/trunk/strictlyautotagfuncs.php

    r742250 r767862  
    3434         
    3535        // put your IP here 
    36         if($ip == "86.4.248.185"){ 
     36        if($ip == "861.14.48.15"){ 
    3737            return false; 
    3838        }else{ 
  • strictly-autotags/trunk/strictlyautotags.class.php

    r742250 r767862  
    33/** 
    44 * Plugin Name: Strictly Auto Tags 
    5  * Version: 2.8.4 
     5 * Version: 2.8.5 
    66 * Plugin URI: http://www.strictly-software.com/plugins/strictly-auto-tags/ 
    77 * Description: This plugin automatically detects tags to place against posts using existing tags as well as a simple formula that detects common tag formats such as Acronyms, names and countries. Whereas other smart tag plugins only detect a single occurance of a tag within a post this plugin will search for the most used tags within the content so that only the most relevant tags get added. 
     
    2626    * @var string 
    2727    */ 
    28     protected $version = "2.8.4"; 
     28    protected $version = "2.8.5"; 
    2929 
    3030    /** 
     
    108108    * @var string 
    109109    */ 
    110     protected $defaultnoisewords = "about|after|a|all|also|an|and|another|any|are|as|at|be|because|been|before|being|between|both|but|by|came|can|come|could|did|do|each|even|for|from|further|furthermore|get|got|had|has|have|he|her|here|hi|him|himself|how|however|i|if|in|indeed|into|is|its|just|like|made|many|may|me|might|more|moreover|most|much|must|my|never|not|now|of|on|only|or|other|our|out|over|put|said|same|see|she|should|since|some|still|such|take|than|that|the|their|them|then|there|therefore|these|they|this|those|through|thus|to|too|under|up|very|was|way|we|well|were|what|when|where|which|while|will|why|with|would|you|your";  
     110    protected $defaultnoisewords = "about|after|a|all|also|an|and|another|any|are|as|at|be|because|been|before|being|between|both|but|by|came|can|come|could|did|do|does|each|even|for|from|further|furthermore|get|gets|got|had|has|have|he|her|here|hi|him|himself|how|hows|however|i|if|in|indeed|into|is|its|just|like|made|many|may|me|might|more|moreover|most|much|must|my|never|no|not|now|of|on|only|or|other|our|out|over|put|puts|says|said|same|see|she|should|since|some|still|such|take|than|that|the|their|them|then|there|theres|therefore|these|they|this|those|through|thus|to|too|under|up|very|was|way|we|well|were|what|when|where|which|while|will|why|with|would|you|your";  
    111111 
    112112 
     
    345345                                            AND  c.count >= %d 
    346346                                        );",$this->minpoststotaglink); 
    347  
    348             // AND slug in('ron-paul','cia','fbi','newt-gingrich') 
     347             
    349348 
    350349            ShowDebugAutoTag($sql); 
     
    417416                    ShowDebugAutoTag("SQL is $sql"); 
    418417 
    419                     /* 
    420                     // resave content 
    421                     // from what I read all params should be unsanitized so that wordpress can run a prepare itself 
    422                     $r = $wpdb->update( 
    423                       'posts', 
    424                       array( 'post_content' => $newcontent ), 
    425                       array( 'id' => $object->ID ) 
    426                     ); 
    427  
    428                     ShowDebugAutoTag("should have been updated rows = " . $r); 
    429                     */ 
    430418 
    431419                    $r = $wpdb->query($sql); 
     
    557545                // instead of doing negative lookaheads and entering a world of doom match and then clean    
    558546                // easier to do a positive match than a negative especially with nested matches 
    559  
    560                 $regex = "@\b(" . preg_quote($tag) . ")\b@"; 
     547                // might want to tag words with dots in e.g msnbc.com 
     548                $regex = "@\b(" . preg_quote($tag) . ")(\s|\.\s|$)@"; 
    561549 
    562550                ShowDebugAutoTag("regex is $regex"); 
     
    564552                // wrap tags in strong and keep the formatting e.g dont upper case if the tag is lowercase as it might be inside 
    565553                // an href or src which might screw it up 
    566                 $content = preg_replace($regex,"<strong class='StrictlyAutoTagBold'>$1</strong>",$content); 
    567  
    568                  
    569  
    570                 // remove bold tags that have been put inside attributes e.g <a href="http://www.<strong>MSNBC</strong>.com">    
    571                 // this can be a bit of killer on large pieces of content so if its causing problems then turn auto bold off 
    572                 // anything that has to do negative lookaheads can kill webservers (see my blog for details) but its a lot better 
    573                 // for me to match first (by bolding) and then clean up by looping through attributes and stripping than trying 
    574                 // to do it all in one negative lookahead regex. I've tried tightening it up and extending the timeout. 
    575                 $content = preg_replace_callback("@(\w+)(=['\"][^'\"]*?)(<strong class='StrictlyAutoTagBold'>)([\s\S]+?)(</strong>)([^'\"]*['\"][/> ])@", 
    576                             create_function( 
    577                             '$matches',          
    578                             '$res = preg_replace("@<strong class=\'StrictlyAutoTagBold\'>@","",$matches[0] );                
    579                             $res = preg_replace("@</?strong>@","",$res );                    
    580                             return $res;') 
    581                         ,$content); 
    582                  
    583                  
    584                  
    585  
    586                 // remove any tags that are now in strong that are also inside other "bold" tags 
    587                 $content = preg_replace("@(<(h[1-6]|strong|b|em|i|a)[^>]*>[^<]*?)(<strong class='StrictlyAutoTagBold'>" .  preg_quote($tag) . "<\/strong>)(.*?<\/?\\2>)@i","$1{$tag}$4",$content); 
    588  
    589                  
     554                $content = preg_replace($regex,"<strong class='StrictlyAutoTagBold'>$1</strong>$2",$content); 
     555             
    590556 
    591557            } 
     
    622588        ShowDebugAutoTag($this->deeplinkarray); 
    623589 
    624         set_time_limit(200); 
     590        set_time_limit(0); 
    625591 
    626592        $no =  count($this->deeplinkarray); 
     
    674640                ShowDebugAutoTag("tag = " . $tag->name . " and slug = " . $tag->slug); 
    675641 
    676                 // we skip any that are nested in tagged links already 
     642                // we skip any that are nested in tagged links already - shouldnt be anymore with storage! 
    677643                $testreg = "@<a class=\"StrictlyAutoTagAnchor\"[^>]+?>[^<]*?" . preg_quote($tag->name) . "[^<]*?</a>@"; 
    678644 
     
    729695 
    730696                        ShowDebugAutoTag("1 len is now " . strlen($content)); 
    731  
    732                         // remove anchor tags that have been put inside attributes e.g <a href="http://www.<a href="http://www.mysite.com/tags/MNSBC">MSNBC</a>>MSNBC</a>.com">  
    733                         // this can be a bit of killer on large pieces of content so if its causing problems then turn deeplinking off 
    734                         // anything that has to do negative lookaheads can kill webservers (see my blog for details) but its a lot better 
    735                         // for me to match first (by linking) and then clean up by looping through attributes and stripping than trying 
    736                         // to do it all in one negative lookahead regex. I've tried tightening it up and extending the timeout. 
    737                         $content = preg_replace_callback("@(\w+)(=['\"][^'\"]*?)(<a class=\"StrictlyAutoTagAnchor\" [^>]+?>)([\s\S]+?)(</a>)([^'\"]*['\"][/> ])@", 
    738                                     create_function( 
    739                                     '$matches',                  
    740                                     '$res = preg_replace("@<a [^>]+?>[\s\S]+?</a>@","",$matches[0] ); 
    741                                     return $res;') 
    742                                 ,$content); 
    743697                         
    744                         ShowDebugAutoTag("2 after nested remove len is now " . strlen($content)); 
    745  
    746                         // remove any anchor tags that are now in other anchors 
    747                         $content = preg_replace("@(<(a)[^>]*>[^<]*?)(<a class=\"StrictlyAutoTagAnchor\"[^>]+?>" .  preg_quote($tag->name) . "<\/a>)(.*?<\/?\\2>)@i","$1{$tag->name}$4",$content); 
    748  
    749                         ShowDebugAutoTag("3 after nested anchor remove len is now " . strlen($content)); 
    750  
    751698                    }                    
    752699                } 
     
    755702            } 
    756703 
    757             ShowDebugAutoTag("after put ##Q## placeholders back len is now " . strlen($content)); 
     704            //ShowDebugAutoTag("after put ##Q## placeholders back len is now " . strlen($content)); 
    758705 
    759706        } 
     
    818765            } 
    819766 
    820             ShowDebugAutoTag($href); 
     767            ShowDebugAutoTag("store <strong><h4> etc"); 
     768 
     769            // store stuff already in <a> <strong> <h4> etc 
     770            preg_match_all("@(<(h[1-6]|strong|a|b|i|em).*?>)([\s\S]*?)(<\/\\2>)@i",$content,$matches,PREG_SET_ORDER); 
     771             
     772            if($matches) 
     773            { 
     774                ShowDebugAutoTag("got matches"); 
     775 
     776                foreach($matches as $match) 
     777                { 
     778                    $word = $match[0]; 
     779 
     780                    ShowDebugAutoTag("store TAG $word"); 
     781 
     782                    $this->storage[] = $word; 
     783 
     784                    $content = str_replace($word, "##M".$x."##", $content); 
     785                    $x++; 
     786                } 
     787            } 
     788 
     789 
     790            ShowDebugAutoTag($this->storage); 
    821791 
    822792        }else{ 
     
    838808                    $x++; 
    839809 
    840                     ShowDebugAutoTag("now content = $content"); 
     810                    //ShowDebugAutoTag("now content = $content"); 
     811                } 
     812 
     813                $x = 0; 
     814                foreach($this->storage as $match) 
     815                { 
     816                     
     817                    ShowDebugAutoTag("put $match back in ##M".$x."##"); 
     818             
     819 
     820                    $content = str_replace( "##M".$x."##",$match, $content); 
     821                    $x++; 
     822 
     823                    //ShowDebugAutoTag("now content = $content"); 
    841824                } 
    842825            } 
     
    22692252                $noisewords = strtolower($noisewords); 
    22702253 
    2271                 // make sure the noise words don't start or end with pipes 
    2272                 if( preg_match("@^([-a-z'0-9 ]+\|[-a-z'0-9 ]*)+$@i",$noisewords)){ 
     2254                // make sure the noise words don't start or end with pipes               
     2255                if( preg_match("@^([-a-z'0-9. ]+\|[-a-z'0-9. ]*)+$@i",$noisewords)){ 
    22732256                    $options['noisewords']  = $noisewords; 
    22742257 
     
    22982281                $noisewords_case_sensitive = $noisewords_case_sensitive; 
    22992282 
    2300                 // make sure the noise words don't start or end with pipes 
    2301                 if( preg_match("@^([-a-z'0-9 ]+\|[-a-z'0-9 ]*)+$@i",$noisewords_case_sensitive)){ 
     2283                // make sure the noise words don't start or end with pipes               
     2284                if( preg_match("@^([-a-z'0-9. ]+\|[-a-z'0-9. ]*)+$@i",$noisewords_case_sensitive)){ 
    23022285                    $options['noisewords_case_sensitive']   = $noisewords_case_sensitive; 
    23032286 
     
    24522435        } 
    24532436 
     2437        echo "<p><strong>Important Notice about Strictly AutoTags 2.8.6</strong></p><p>As I haven't been getting enough donations to make this plugin worthwhile (apart from my own use) I have decided to <strong>only make future versions available to people who donate &pound;40 (or above). The donation button is at the bottom of this form.</strong></p><p>Version 2.8.6 is out already and in use on my own sites and some of the features include the following:</p><p><ul><li>Ability to set a minimum character length a tag must have before being used as a tag.</li><li>New functions to allow for the tagging of words like al-Qaeda or 1,000 Guineas (as 1000 Guineas).</li><li>The ability to use a basic markup format to match certain words but tag another. For example <strong>[Snowden,NSA,PRISM]=[Police State]</strong> would allow the system to match the words Snowden, Prism or NSA <strong>but</strong> add the tag Police State to the article.</li><li>The ability to convert plain text hrefs and urls into real anchors e.g www.msnbc.com would become a real clickable link.</li></ul></p><p>New features will be added in future including text spinning and other HTML reformatting but from now on versions of this plugin will only be available to people who donate <strong>at least &pound;40 only!</strong></p>"; 
     2438 
    24542439        echo    '<p>'.__('Strictly AutoTags is designed to do one thing and one thing only - automatically add relevant tags to your posts.', 'strictlyautotags').'</p>'; 
    24552440 
     
    24742459                echo '<p>'. sprintf(__('Strictly AutoTags has automatically generated <strong>%s tags</strong> since installation on %s.', 'strictlyautotags'),number_format($tagged),$installdate).'</p>'; 
    24752460            } 
    2476  
    2477             $rnd = (rand()%10); 
    2478  
    2479             if($rnd == 1 || $rnd == 3){ 
    2480  
    2481                 echo  __('<p><strong>How much is your time worth?</strong></p><p>Time is money as the famous saying goes and this plugin must be worth at least a small percentage of the time it has saved you. Why not show your appreciation for this plugin which just keeps getting better by making <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=6427652" title="Make a donation">a small donation to help cover my development time?</a>. </p>','strictlyautotags') ; 
    2482  
    2483             }else if(($rnd == 4 || $rnd == 8)  && $tagged > 500){ 
    2484  
    2485                 echo  __('<p>Plugin developers like myself spend a large portion of their free time to make great code only to give it away for free to people like you. In no other industry does this happen. Can you imagine a builder offering to build an extension on your house for free in the hope that you &quot;might pay him&quot; or hire him later for another job? This is what Wordpress developers do when they give their plugins away for free. If you appreciate our work and want to help us continue to work in this industry 
    2486                 then please consider <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=6427652" title="Make a donation">making a donation</a> to help cover my development time. <strong>Any amount no matter how small would be appreciated.</strong> Thanks for your support. . </p>','strictlyautotags') ; 
    2487  
    2488             }else if(($rnd == 0 || $rnd == 2) && $tagged > 1000){ 
    2489  
    2490                 $n = floor($tagged / 1000); 
    2491  
    2492                 echo sprintf(__('<p><strong>This plugin has saved over %d thousand tags for your site!</strong></p><p>This must be worth at least a small donation to show your appreciation. Remember all donations help me to continue to offer plugins like Strictly AutoTags, <a href="http://wordpress.org/extend/plugins/strictly-tweetbot/">Strictly Tweetbot</a>, <a href="http://wordpress.org/extend/plugins/strictly-google-sitemap/">Strictly Google Sitemap</a> and <a href="http://wordpress.org/extend/plugins/strictly-system-check/">Strictly System Check</a> for free! You can show your support for my development by making <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=6427652" title="Make a donation">a donation.</a> Any amount would be appreciated even if its just pennies or cents!</p>','strictlyautotags'),$n); 
    2493             }else{ 
    2494              
    2495                  
    2496                 echo '<p>' . __('<strong>Support Strictly Software Wordpress Plugin Development by:</strong>','strictlyautotags') . '</p> 
    2497                      <ul id="supportstrictly"> 
    2498                         <li><a href="http://www.strictly-software.com/plugins/strictly-auto-tags">Linking to the plugin from your own site or blog so that other people can find out about it.</a></li> 
    2499                         <li><a href="http://wordpress.org/extend/plugins/strictly-autotags/">Give the plugin a good rating on Wordpress.org or other websites that discuss Wordpress plugins.</a></li>   
    2500                         <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=6427652">Pleaae make a donation on PayPal. Any amount no matter how small is appreciated!</a></li> 
    2501                      </ul>'; 
    2502             }            
     2461             
    25032462        }            
    2504         else 
    2505         { 
    2506          
    2507              
    2508             echo '<p>' . __('<strong>You can help Strictly Software Wordpress Plugin Development by:</strong>','strictlyautotags') . '</p> 
    2509                  <ul id="supportstrictly"> 
    2510                     <li><a href="http://www.strictly-software.com/plugins/strictly-auto-tags">Linking to the plugin from your own site or blog so that other people can find out about it. If you think this plugin is great then please tell the world about it.</a></li> 
    2511                     <li><a href="http://wordpress.org/extend/plugins/strictly-autotags/">Give the plugin a good rating on Wordpress.org so that other users download and use it.</a></li>    
    2512                     <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=6427652">Please make a donation on PayPal. I have spent considerable time developing this plugin for your free use and a donation would show your appreciation for my hard work and allow me to keep on updating this valuable tool with great new features.</a></li> 
    2513                  </ul>'; 
    2514         }    
    2515          
    2516         echo '<p>'.__('Please remember that this plugin has been developed for the <strong>English language</strong> and will only work with standard English characters e.g A-Z. If you have any problems with the plugin please check that it is not due to UTF-8 characters within the articles you are trying to auto tag.', 'strictlyautotags').'</p> 
     2463         
     2464         
     2465        echo '<p><strong>About Strictly AutoTags</strong></p><p>'.__('Please remember that this plugin has been developed for the <strong>English language</strong> and will only work with standard English characters e.g A-Z. If you have any problems with the plugin please check that it is not due to UTF-8 characters within the articles you are trying to auto tag.', 'strictlyautotags').'</p> 
    25172466                <ul><li>'.__('Enable Auto Discovery to find new tags.', 'strictlyautotags').'</li> 
    25182467                <li>'.__('Suitable words such as Acronyms, Names, Countries and other important keywords will then be identified within the post.', 'strictlyautotags').'</li> 
     
    26582607        echo    '<div class="tagopt"> 
    26592608                <label for="strictlyautotags-minpoststotaglink">'.__('Min no of Tags within a Post to deeplink to.','strictlyautotags').'</label> 
    2660                 <input type="text" name="strictlyautotags-minpoststotaglink" id="strictlyautotags-minpoststotaglink" value="' . esc_attr($options['maxtagstolink']) . '" /> 
    2661                 <span class="notes">'.__('Set the minimum number of tags tbat a post must have before deeplinking to their tag page.', 'strictlyautotags').'</span> 
     2609                <input type="text" name="strictlyautotags-minpoststotaglink" id="strictlyautotags-minpoststotaglink" value="' . esc_attr($options['minpoststotaglink']) . '" /> 
     2610                <span class="notes">'.__('Set the minimum number of tags that a post must have before deeplinking to their tag page.', 'strictlyautotags').'</span> 
    26622611                </div>'; 
    26632612 
     
    27172666                    <ul> 
    27182667                        <li><a href="http://www.strictly-software.com/plugins/strictly-google-sitemap">'.__('Strictly Google Sitemap','strictlyautotags').'</a> 
    2719                             <p>'.__('Strictly Google Sitemap is a feature rich Wordpress plugin built for sites requiring high performance. Not only does it use a tiny number of database queries compared to other plugins it uses less memory and was designed specifically for under performing or low spec systems. As well as offering all the features of other sitemap plugins it brings all those missing features such as sitemap index files, XML validation, scheduled builds, configuration analysis and SEO reports.','strictlyautotags').'</p> 
     2668                            <p>'.__('Strictly AutoTags 2.8.6 is a sexy new version of this plugin that is only available to people who donate me &pound;40 to my PayPal account. Due to the lack of donations I have received so far I am keeping this new version for people who really want it. Not only does it offer the ability to use equivalent words for tags e.g match <strong>Snowden,NSA,GCHQ</strong> and tag the word <strong>Internet Privacy</strong>, but it has new functions to match words like al-Qaeda or 1,000 Guineas, convert plain text links into real anchors, set a minimum character length a tag must have to be used and also handles the new data-blah attributes to prevent nested tags. If you want it just donate me &pound;40 and I will email you the source code!','strictlyautotags').'</p> 
    27202669                        </li> 
    27212670                        <li><a href="http://wordpress.org/extend/plugins/strictly-tweetbot/">'.__('Strictly Tweetbot','strictlyautotags').'</a> 
Note: See TracChangeset for help on using the changeset viewer.