Plugin Directory

Changeset 1167880


Ignore:
Timestamp:
05/26/2015 06:11:18 PM (11 years ago)
Author:
mainehost
Message:

Updating 1.3.1

Location:
seo-enforcer
Files:
3 edited
4 copied

Legend:

Unmodified
Added
Removed
  • seo-enforcer/tags/1.3.1/readme.txt

    r1167792 r1167880  
    44Requires at least: 3.9
    55Tested up to: 4.2.2
    6 Stable tag: 1.3.0
     6Stable tag: 1.3.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3737
    3838== Changelog ==
     39
     40= 1.3.1 =
     41
     42Released: May 26th, 2015
     43
     44* **Bug Fixes**
     45
     46    * Fixed a potential bug with new installs of SEO Enforcer throwing an unserialization error.
    3947
    4048= 1.3.0 =
  • seo-enforcer/tags/1.3.1/seoe.php

    r1167792 r1167880  
    77    Author: Maine Hosting Solutions
    88    Author URI: http://mainehost.com/
    9     Version: 1.3.0
     9    Version: 1.3.1
    1010*/
    1111
     
    113113         */
    114114        function check_screen() {
    115             $settings = unserialize(get_option('seoe_settings'));
     115            $settings = get_option('seoe_settings');
     116
     117            if($settings) $settings = unserialize($settings);
     118
    116119            $notice_types = array('post','edit-tags','toplevel_page_shopp-products','catalog_page_shopp-categories');
    117120            $screen = get_current_screen();
     
    187190            }
    188191            else {
    189                 $settings = unserialize(get_option('seoe_settings'));
    190 
     192                $settings = get_option('seoe_settings');
     193
     194                if($settings) $settings = unserialize($settings);
    191195                if($settings['seoe_title']) add_filter('wpseo_title', array($this,'title_check'), 99);
    192196                if($settings['seoe_desc']) add_filter('wpseo_metadesc', array($this,'desc_check'), 99);
     
    265269        function title_check($title) {
    266270            global $post;
    267             $settings = unserialize(get_option('seoe_settings'));
     271            $settings = get_option('seoe_settings');
     272
     273            if($settings) $settings = unserialize($settings);
    268274
    269275            if($settings['seoe_title']) {
     
    303309        function desc_check($desc) {
    304310            global $post;           
    305             $settings = unserialize(get_option('seoe_settings'));
     311            $settings = get_option('seoe_settings');
     312
     313            if($settings) $settings = unserialize($settings);
    306314
    307315            if($settings['seoe_desc']) {
     
    343351            global $post;
    344352
    345             $settings = unserialize(get_option('seoe_settings'));
    346 
    347             if($ex = $settings['seoe_h1_ex']) {
    348                 $ex = array_map('trim', explode(',', $ex));
    349 
    350                 if(is_home()) {
    351                     if(!in_array('blog', $ex)) $proceed = 1;
    352                     else $procedd = 0;
    353                 }
    354                 else {
    355                     if(!in_array($post->ID, $ex)) $proceed = 1;
    356                     else $proceed = 0;
    357                 }
    358             }
    359             else {
    360                 $proceed = 1;
    361             }
    362             if($proceed) {
    363                 $content = $this->content_clean($content);             
    364             }
    365             if($settings['seoe_img']) {
    366                 $doc = new DOMDocument('1.0','UTF-8');
    367                 @$doc->loadHTML(utf8_decode($content));
    368 
    369                 foreach($doc->getElementsByTagName('img') as $img) {
    370                     if($img->getAttribute('alt') && !$img->getAttribute('title')) {
    371                         $title = $doc->createAttribute('title');
    372                         $title->value = htmlentities($img->getAttribute('alt'));
    373                         $img->appendChild($title);
    374                     }
    375                     elseif(!$img->getAttribute('alt') && $img->getAttribute('title')) {
    376                         $alt = $doc->createAttribute('alt');
    377                         $alt->value = htmlentities($img->getAttribute('title'));
    378                         $img->appendChild($alt);
    379                     }
    380                     else { # No alt or title
    381                         $src = $img->getAttribute('src');
    382                         $info = pathinfo($src);
    383                         $img_name = $info['filename'];
    384                         $use_value = preg_replace('/[^A-Za-z0-9 ]/',' ', $img_name);
    385                         $use_value = htmlentities($use_value);
    386 
    387                         $alt = $doc->createAttribute('alt');
    388                         $alt->value = $use_value;
    389                         $img->appendChild($alt);
    390 
    391                         $title = $doc->createAttribute('title');
    392                         $title->value = $use_value;
    393                         $img->appendChild($title);
    394                     }
    395                 }
    396 
    397                 $html = preg_replace('/^<!DOCTYPE.+?>/','', $doc->saveHTML());
    398                 $html = str_replace(array('<html>','</html>','<body>','</body>'), array('','','',''), $html);
    399                 return $html;
     353            $settings = get_option('seoe_settings');
     354
     355            if($settings) {
     356                $settings = unserialize($settings);
     357
     358                if($ex = $settings['seoe_h1_ex']) {
     359                    $ex = array_map('trim', explode(',', $ex));
     360
     361                    if(is_home()) {
     362                        if(!in_array('blog', $ex)) $proceed = 1;
     363                        else $procedd = 0;
     364                    }
     365                    else {
     366                        if(!in_array($post->ID, $ex)) $proceed = 1;
     367                        else $proceed = 0;
     368                    }
     369                }
     370                else {
     371                    $proceed = 1;
     372                }
     373                if($proceed) {
     374                    $content = $this->content_clean($content);             
     375                }
     376                if($settings['seoe_img']) {
     377                    $doc = new DOMDocument('1.0','UTF-8');
     378                    @$doc->loadHTML(utf8_decode($content));
     379
     380                    foreach($doc->getElementsByTagName('img') as $img) {
     381                        if($img->getAttribute('alt') && !$img->getAttribute('title')) {
     382                            $title = $doc->createAttribute('title');
     383                            $title->value = htmlentities($img->getAttribute('alt'));
     384                            $img->appendChild($title);
     385                        }
     386                        elseif(!$img->getAttribute('alt') && $img->getAttribute('title')) {
     387                            $alt = $doc->createAttribute('alt');
     388                            $alt->value = htmlentities($img->getAttribute('title'));
     389                            $img->appendChild($alt);
     390                        }
     391                        else { # No alt or title
     392                            $src = $img->getAttribute('src');
     393                            $info = pathinfo($src);
     394                            $img_name = $info['filename'];
     395                            $use_value = preg_replace('/[^A-Za-z0-9 ]/',' ', $img_name);
     396                            $use_value = htmlentities($use_value);
     397
     398                            $alt = $doc->createAttribute('alt');
     399                            $alt->value = $use_value;
     400                            $img->appendChild($alt);
     401
     402                            $title = $doc->createAttribute('title');
     403                            $title->value = $use_value;
     404                            $img->appendChild($title);
     405                        }
     406                    }
     407
     408                    $html = preg_replace('/^<!DOCTYPE.+?>/','', $doc->saveHTML());
     409                    $html = str_replace(array('<html>','</html>','<body>','</body>'), array('','','',''), $html);
     410                    return $html;
     411                }
    400412            }
    401413            else {
  • seo-enforcer/tags/1.3.1/seoe_admin.php

    r1167792 r1167880  
    88        function options() {
    99            $image_path = plugins_url('images/', __FILE__);
    10             $settings = unserialize(get_option('seoe_settings'));
     10            $settings = get_option('seoe_settings');
     11
     12            if($settings) $settings = unserialize($settings);
    1113            extract($settings);
    1214
  • seo-enforcer/trunk/readme.txt

    r1167792 r1167880  
    44Requires at least: 3.9
    55Tested up to: 4.2.2
    6 Stable tag: 1.3.0
     6Stable tag: 1.3.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3737
    3838== Changelog ==
     39
     40= 1.3.1 =
     41
     42Released: May 26th, 2015
     43
     44* **Bug Fixes**
     45
     46    * Fixed a potential bug with new installs of SEO Enforcer throwing an unserialization error.
    3947
    4048= 1.3.0 =
  • seo-enforcer/trunk/seoe.php

    r1167792 r1167880  
    77    Author: Maine Hosting Solutions
    88    Author URI: http://mainehost.com/
    9     Version: 1.3.0
     9    Version: 1.3.1
    1010*/
    1111
     
    113113         */
    114114        function check_screen() {
    115             $settings = unserialize(get_option('seoe_settings'));
     115            $settings = get_option('seoe_settings');
     116
     117            if($settings) $settings = unserialize($settings);
     118
    116119            $notice_types = array('post','edit-tags','toplevel_page_shopp-products','catalog_page_shopp-categories');
    117120            $screen = get_current_screen();
     
    187190            }
    188191            else {
    189                 $settings = unserialize(get_option('seoe_settings'));
    190 
     192                $settings = get_option('seoe_settings');
     193
     194                if($settings) $settings = unserialize($settings);
    191195                if($settings['seoe_title']) add_filter('wpseo_title', array($this,'title_check'), 99);
    192196                if($settings['seoe_desc']) add_filter('wpseo_metadesc', array($this,'desc_check'), 99);
     
    265269        function title_check($title) {
    266270            global $post;
    267             $settings = unserialize(get_option('seoe_settings'));
     271            $settings = get_option('seoe_settings');
     272
     273            if($settings) $settings = unserialize($settings);
    268274
    269275            if($settings['seoe_title']) {
     
    303309        function desc_check($desc) {
    304310            global $post;           
    305             $settings = unserialize(get_option('seoe_settings'));
     311            $settings = get_option('seoe_settings');
     312
     313            if($settings) $settings = unserialize($settings);
    306314
    307315            if($settings['seoe_desc']) {
     
    343351            global $post;
    344352
    345             $settings = unserialize(get_option('seoe_settings'));
    346 
    347             if($ex = $settings['seoe_h1_ex']) {
    348                 $ex = array_map('trim', explode(',', $ex));
    349 
    350                 if(is_home()) {
    351                     if(!in_array('blog', $ex)) $proceed = 1;
    352                     else $procedd = 0;
    353                 }
    354                 else {
    355                     if(!in_array($post->ID, $ex)) $proceed = 1;
    356                     else $proceed = 0;
    357                 }
    358             }
    359             else {
    360                 $proceed = 1;
    361             }
    362             if($proceed) {
    363                 $content = $this->content_clean($content);             
    364             }
    365             if($settings['seoe_img']) {
    366                 $doc = new DOMDocument('1.0','UTF-8');
    367                 @$doc->loadHTML(utf8_decode($content));
    368 
    369                 foreach($doc->getElementsByTagName('img') as $img) {
    370                     if($img->getAttribute('alt') && !$img->getAttribute('title')) {
    371                         $title = $doc->createAttribute('title');
    372                         $title->value = htmlentities($img->getAttribute('alt'));
    373                         $img->appendChild($title);
    374                     }
    375                     elseif(!$img->getAttribute('alt') && $img->getAttribute('title')) {
    376                         $alt = $doc->createAttribute('alt');
    377                         $alt->value = htmlentities($img->getAttribute('title'));
    378                         $img->appendChild($alt);
    379                     }
    380                     else { # No alt or title
    381                         $src = $img->getAttribute('src');
    382                         $info = pathinfo($src);
    383                         $img_name = $info['filename'];
    384                         $use_value = preg_replace('/[^A-Za-z0-9 ]/',' ', $img_name);
    385                         $use_value = htmlentities($use_value);
    386 
    387                         $alt = $doc->createAttribute('alt');
    388                         $alt->value = $use_value;
    389                         $img->appendChild($alt);
    390 
    391                         $title = $doc->createAttribute('title');
    392                         $title->value = $use_value;
    393                         $img->appendChild($title);
    394                     }
    395                 }
    396 
    397                 $html = preg_replace('/^<!DOCTYPE.+?>/','', $doc->saveHTML());
    398                 $html = str_replace(array('<html>','</html>','<body>','</body>'), array('','','',''), $html);
    399                 return $html;
     353            $settings = get_option('seoe_settings');
     354
     355            if($settings) {
     356                $settings = unserialize($settings);
     357
     358                if($ex = $settings['seoe_h1_ex']) {
     359                    $ex = array_map('trim', explode(',', $ex));
     360
     361                    if(is_home()) {
     362                        if(!in_array('blog', $ex)) $proceed = 1;
     363                        else $procedd = 0;
     364                    }
     365                    else {
     366                        if(!in_array($post->ID, $ex)) $proceed = 1;
     367                        else $proceed = 0;
     368                    }
     369                }
     370                else {
     371                    $proceed = 1;
     372                }
     373                if($proceed) {
     374                    $content = $this->content_clean($content);             
     375                }
     376                if($settings['seoe_img']) {
     377                    $doc = new DOMDocument('1.0','UTF-8');
     378                    @$doc->loadHTML(utf8_decode($content));
     379
     380                    foreach($doc->getElementsByTagName('img') as $img) {
     381                        if($img->getAttribute('alt') && !$img->getAttribute('title')) {
     382                            $title = $doc->createAttribute('title');
     383                            $title->value = htmlentities($img->getAttribute('alt'));
     384                            $img->appendChild($title);
     385                        }
     386                        elseif(!$img->getAttribute('alt') && $img->getAttribute('title')) {
     387                            $alt = $doc->createAttribute('alt');
     388                            $alt->value = htmlentities($img->getAttribute('title'));
     389                            $img->appendChild($alt);
     390                        }
     391                        else { # No alt or title
     392                            $src = $img->getAttribute('src');
     393                            $info = pathinfo($src);
     394                            $img_name = $info['filename'];
     395                            $use_value = preg_replace('/[^A-Za-z0-9 ]/',' ', $img_name);
     396                            $use_value = htmlentities($use_value);
     397
     398                            $alt = $doc->createAttribute('alt');
     399                            $alt->value = $use_value;
     400                            $img->appendChild($alt);
     401
     402                            $title = $doc->createAttribute('title');
     403                            $title->value = $use_value;
     404                            $img->appendChild($title);
     405                        }
     406                    }
     407
     408                    $html = preg_replace('/^<!DOCTYPE.+?>/','', $doc->saveHTML());
     409                    $html = str_replace(array('<html>','</html>','<body>','</body>'), array('','','',''), $html);
     410                    return $html;
     411                }
    400412            }
    401413            else {
  • seo-enforcer/trunk/seoe_admin.php

    r1167792 r1167880  
    88        function options() {
    99            $image_path = plugins_url('images/', __FILE__);
    10             $settings = unserialize(get_option('seoe_settings'));
     10            $settings = get_option('seoe_settings');
     11
     12            if($settings) $settings = unserialize($settings);
    1113            extract($settings);
    1214
Note: See TracChangeset for help on using the changeset viewer.