Plugin Directory

Changeset 1095868


Ignore:
Timestamp:
02/21/2015 01:51:21 PM (10 years ago)
Author:
benohead
Message:

tagging version 0.9.7

Location:
wp-advertize-it
Files:
1 added
4 edited
14 copied

Legend:

Unmodified
Added
Removed
  • wp-advertize-it/tags/0.9.7/bootstrap.php

    r1095844 r1095868  
    44Plugin URI:  https://wordpress.org/plugins/wp-advertize-it/
    55Description: A plugin to place adsense blocks on your site
    6 Version:     0.9.6
     6Version:     0.9.7
    77Author:      Henri Benoit
    88Author URI:  http://benohead.com
  • wp-advertize-it/tags/0.9.7/classes/wp-advertize-it.php

    r1072033 r1095868  
    2424         * Plugin version
    2525         */
    26         const VERSION = '0.9.6';
     26        const VERSION = '0.9.7';
    2727        /**
    2828         * Prefix used to identify things related to this plugin
     
    635635
    636636            $content = str_replace('</P>', '</p>', $content);
     637            $cleaned_content = $this->get_cleaned_content($content);
     638
    637639            $char_count = $this->get_character_count($content);
    638640            $word_count = $this->get_word_count($content);
    639             $paragraph_count = $this->get_paragraph_count($content);
     641            $paragraph_count = $this->get_paragraph_count($cleaned_content);
     642
     643            error_log("paragraph_count=".$paragraph_count);
     644            error_log("cleaned_content=".$cleaned_content);
     645            error_log("cleaned_content length=".strlen($cleaned_content));
     646            error_log("content length=".strlen($content));
    640647
    641648            $options = $this->modules['WPAI_Settings']->settings['options'];
     
    710717                $index = 0;
    711718                for ($i = 0; $i < $middle_paragraph; $i++) {
    712                     $index = strpos($content, '</p>', $index) + 4;
    713                 }
     719                    $index = strpos($cleaned_content, '</p>', $index) + 4;
     720                }
     721                error_log("middle_paragraph index=".$index);
    714722                $content = substr_replace($content, $middle_of_post, $index, 0);
     723                $cleaned_content = $this->get_cleaned_content($content);
    715724            } else if (is_page()
    716725                && $middle_of_page_block != ""
     
    723732                $index = 0;
    724733                for ($i = 0; $i < $middle_paragraph; $i++) {
    725                     $index = strpos($content, '</p>', $index) + 4;
     734                    $index = strpos($cleaned_content, '</p>', $index) + 4;
    726735                }
    727736                $content = substr_replace($content, $middle_of_page, $index, 0);
     737                $cleaned_content = $this->get_cleaned_content($content);
    728738            }
    729739            if (is_single()
     
    736746                $index = 0;
    737747                for ($i = 0; $i < $paragraph_count - 1; $i++) {
    738                     $index = strpos($content, '</p>', $index) + 4;
    739                 }
     748                    $index = strpos($cleaned_content, '</p>', $index) + 4;
     749                }
     750                error_log("before_last_post_paragraph index=".$index);
    740751                $content = substr_replace($content, $before_last_post_paragraph, $index, 0);
     752                $cleaned_content = $this->get_cleaned_content($content);
     753                error_log("content=".$content);
    741754            } else if (is_page()
    742755                && $before_last_page_paragraph_block != ""
     
    748761                $index = 0;
    749762                for ($i = 0; $i < $paragraph_count - 1; $i++) {
    750                     $index = strpos($content, '</p>', $index) + 4;
     763                    $index = strpos($cleaned_content, '</p>', $index) + 4;
    751764                }
    752765                $content = substr_replace($content, $before_last_page_paragraph, $index, 0);
     766                $cleaned_content = $this->get_cleaned_content($content);
    753767            }
    754768            if (is_single()
     
    761775                $index = 0;
    762776                for ($i = 0; $i < 1; $i++) {
    763                     $index = strpos($content, '</p>', $index) + 4;
    764                 }
     777                    $index = strpos($cleaned_content, '</p>', $index) + 4;
     778                }
     779                error_log("after_first_post_paragraph index=".$index);
    765780                $content = substr_replace($content, $after_first_post_paragraph, $index, 0);
    766781            } else if (is_page()
     
    775790                    $index = strpos($content, '</p>', $index) + 4;
    776791                }
    777                 $content = substr_replace($content, $after_first_page_paragraph, $index, 0);
     792                $content = substr_replace($cleaned_content, $after_first_page_paragraph, $index, 0);
    778793            }
    779794            if (is_single()) {
     
    945960            return true;
    946961        }
     962
     963        private function get_cleaned_content($content)
     964        {
     965            $new_content = $content;
     966
     967            $new_content = $this->censor_blockquote($new_content);
     968            $new_content = $this->censor_pre($new_content);
     969            $new_content = $this->censor_code($new_content);
     970
     971            return $new_content;
     972        }
     973
     974        /**
     975         * @param $content
     976         * @return mixed|string
     977         */
     978        private function censor_blockquote($content)
     979        {
     980            $array = preg_split("/<blockquote>/", $content);
     981            $new_content = array_shift($array);
     982            foreach ($array as $string) {
     983                $new_content .= "<blockquote>";
     984                $array2 = preg_split(",</blockquote>,", $string);
     985                $new_content .= preg_replace("/./", " ", array_shift($array2));
     986                $new_content .= "</blockquote>";
     987                if (!empty($array2)) {
     988                    $new_content .= $array2[0];
     989                }
     990            }
     991            return $new_content;
     992        }
     993
     994        /**
     995         * @param $content
     996         * @return mixed|string
     997         */
     998        private function censor_pre($content)
     999        {
     1000            $array = preg_split("/<pre>/", $content);
     1001            $new_content = array_shift($array);
     1002            foreach ($array as $string) {
     1003                $new_content .= "<pre>";
     1004                $array2 = preg_split(",</pre>,", $string);
     1005                $new_content .= preg_replace("/./", " ", array_shift($array2));
     1006                $new_content .= "</pre>";
     1007                if (!empty($array2)) {
     1008                    $new_content .= $array2[0];
     1009                }
     1010            }
     1011            return $new_content;
     1012        }
     1013
     1014        /**
     1015         * @param $content
     1016         * @return mixed|string
     1017         */
     1018        private function censor_code($content)
     1019        {
     1020            $array = preg_split("/<code>/", $content);
     1021            $new_content = array_shift($array);
     1022            foreach ($array as $string) {
     1023                $new_content .= "<code>";
     1024                $array2 = preg_split(",</code>,", $string);
     1025                $new_content .= preg_replace("/./", " ", array_shift($array2));
     1026                $new_content .= "</code>";
     1027                if (!empty($array2)) {
     1028                    $new_content .= $array2[0];
     1029                }
     1030            }
     1031            return $new_content;
     1032        }
    9471033    }
    9481034    ; // end WordPress_Advertize_It
  • wp-advertize-it/tags/0.9.7/readme.txt

    r1095844 r1095868  
    44Tags: ad, ad banner, ad block, ads, ads display, ads in widgets, ads on website, ads plugin, adsense, adsense plugin, advertisement, advertisements, advertiser, advertising, Goggle AdSense, google ads, google adsense, insert ads, insert ads automatically, insert Google ads, publisher, widget
    55Requires at least: 3.0.1
    6 Tested up to: 4.1
    7 Stable tag: 0.9.6
     6Tested up to: 4.1.1
     7Stable tag: 0.9.7
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    115115== Changelog ==
    116116
     117= 0.9.7 =
     118
     119* paragraphs in blockquote, pre or code tags are now ignored.
     120
    117121= 0.9.6 =
    118122
  • wp-advertize-it/trunk/bootstrap.php

    r1072033 r1095868  
    44Plugin URI:  https://wordpress.org/plugins/wp-advertize-it/
    55Description: A plugin to place adsense blocks on your site
    6 Version:     0.9.6
     6Version:     0.9.7
    77Author:      Henri Benoit
    88Author URI:  http://benohead.com
  • wp-advertize-it/trunk/classes/wp-advertize-it.php

    r1072033 r1095868  
    2424         * Plugin version
    2525         */
    26         const VERSION = '0.9.6';
     26        const VERSION = '0.9.7';
    2727        /**
    2828         * Prefix used to identify things related to this plugin
     
    635635
    636636            $content = str_replace('</P>', '</p>', $content);
     637            $cleaned_content = $this->get_cleaned_content($content);
     638
    637639            $char_count = $this->get_character_count($content);
    638640            $word_count = $this->get_word_count($content);
    639             $paragraph_count = $this->get_paragraph_count($content);
     641            $paragraph_count = $this->get_paragraph_count($cleaned_content);
     642
     643            error_log("paragraph_count=".$paragraph_count);
     644            error_log("cleaned_content=".$cleaned_content);
     645            error_log("cleaned_content length=".strlen($cleaned_content));
     646            error_log("content length=".strlen($content));
    640647
    641648            $options = $this->modules['WPAI_Settings']->settings['options'];
     
    710717                $index = 0;
    711718                for ($i = 0; $i < $middle_paragraph; $i++) {
    712                     $index = strpos($content, '</p>', $index) + 4;
    713                 }
     719                    $index = strpos($cleaned_content, '</p>', $index) + 4;
     720                }
     721                error_log("middle_paragraph index=".$index);
    714722                $content = substr_replace($content, $middle_of_post, $index, 0);
     723                $cleaned_content = $this->get_cleaned_content($content);
    715724            } else if (is_page()
    716725                && $middle_of_page_block != ""
     
    723732                $index = 0;
    724733                for ($i = 0; $i < $middle_paragraph; $i++) {
    725                     $index = strpos($content, '</p>', $index) + 4;
     734                    $index = strpos($cleaned_content, '</p>', $index) + 4;
    726735                }
    727736                $content = substr_replace($content, $middle_of_page, $index, 0);
     737                $cleaned_content = $this->get_cleaned_content($content);
    728738            }
    729739            if (is_single()
     
    736746                $index = 0;
    737747                for ($i = 0; $i < $paragraph_count - 1; $i++) {
    738                     $index = strpos($content, '</p>', $index) + 4;
    739                 }
     748                    $index = strpos($cleaned_content, '</p>', $index) + 4;
     749                }
     750                error_log("before_last_post_paragraph index=".$index);
    740751                $content = substr_replace($content, $before_last_post_paragraph, $index, 0);
     752                $cleaned_content = $this->get_cleaned_content($content);
     753                error_log("content=".$content);
    741754            } else if (is_page()
    742755                && $before_last_page_paragraph_block != ""
     
    748761                $index = 0;
    749762                for ($i = 0; $i < $paragraph_count - 1; $i++) {
    750                     $index = strpos($content, '</p>', $index) + 4;
     763                    $index = strpos($cleaned_content, '</p>', $index) + 4;
    751764                }
    752765                $content = substr_replace($content, $before_last_page_paragraph, $index, 0);
     766                $cleaned_content = $this->get_cleaned_content($content);
    753767            }
    754768            if (is_single()
     
    761775                $index = 0;
    762776                for ($i = 0; $i < 1; $i++) {
    763                     $index = strpos($content, '</p>', $index) + 4;
    764                 }
     777                    $index = strpos($cleaned_content, '</p>', $index) + 4;
     778                }
     779                error_log("after_first_post_paragraph index=".$index);
    765780                $content = substr_replace($content, $after_first_post_paragraph, $index, 0);
    766781            } else if (is_page()
     
    775790                    $index = strpos($content, '</p>', $index) + 4;
    776791                }
    777                 $content = substr_replace($content, $after_first_page_paragraph, $index, 0);
     792                $content = substr_replace($cleaned_content, $after_first_page_paragraph, $index, 0);
    778793            }
    779794            if (is_single()) {
     
    945960            return true;
    946961        }
     962
     963        private function get_cleaned_content($content)
     964        {
     965            $new_content = $content;
     966
     967            $new_content = $this->censor_blockquote($new_content);
     968            $new_content = $this->censor_pre($new_content);
     969            $new_content = $this->censor_code($new_content);
     970
     971            return $new_content;
     972        }
     973
     974        /**
     975         * @param $content
     976         * @return mixed|string
     977         */
     978        private function censor_blockquote($content)
     979        {
     980            $array = preg_split("/<blockquote>/", $content);
     981            $new_content = array_shift($array);
     982            foreach ($array as $string) {
     983                $new_content .= "<blockquote>";
     984                $array2 = preg_split(",</blockquote>,", $string);
     985                $new_content .= preg_replace("/./", " ", array_shift($array2));
     986                $new_content .= "</blockquote>";
     987                if (!empty($array2)) {
     988                    $new_content .= $array2[0];
     989                }
     990            }
     991            return $new_content;
     992        }
     993
     994        /**
     995         * @param $content
     996         * @return mixed|string
     997         */
     998        private function censor_pre($content)
     999        {
     1000            $array = preg_split("/<pre>/", $content);
     1001            $new_content = array_shift($array);
     1002            foreach ($array as $string) {
     1003                $new_content .= "<pre>";
     1004                $array2 = preg_split(",</pre>,", $string);
     1005                $new_content .= preg_replace("/./", " ", array_shift($array2));
     1006                $new_content .= "</pre>";
     1007                if (!empty($array2)) {
     1008                    $new_content .= $array2[0];
     1009                }
     1010            }
     1011            return $new_content;
     1012        }
     1013
     1014        /**
     1015         * @param $content
     1016         * @return mixed|string
     1017         */
     1018        private function censor_code($content)
     1019        {
     1020            $array = preg_split("/<code>/", $content);
     1021            $new_content = array_shift($array);
     1022            foreach ($array as $string) {
     1023                $new_content .= "<code>";
     1024                $array2 = preg_split(",</code>,", $string);
     1025                $new_content .= preg_replace("/./", " ", array_shift($array2));
     1026                $new_content .= "</code>";
     1027                if (!empty($array2)) {
     1028                    $new_content .= $array2[0];
     1029                }
     1030            }
     1031            return $new_content;
     1032        }
    9471033    }
    9481034    ; // end WordPress_Advertize_It
  • wp-advertize-it/trunk/readme.txt

    r1072033 r1095868  
    44Tags: ad, ad banner, ad block, ads, ads display, ads in widgets, ads on website, ads plugin, adsense, adsense plugin, advertisement, advertisements, advertiser, advertising, Goggle AdSense, google ads, google adsense, insert ads, insert ads automatically, insert Google ads, publisher, widget
    55Requires at least: 3.0.1
    6 Tested up to: 4.1
    7 Stable tag: 0.9.6
     6Tested up to: 4.1.1
     7Stable tag: 0.9.7
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    115115== Changelog ==
    116116
     117= 0.9.7 =
     118
     119* paragraphs in blockquote, pre or code tags are now ignored.
     120
    117121= 0.9.6 =
    118122
Note: See TracChangeset for help on using the changeset viewer.