Changeset 1095868
- Timestamp:
- 02/21/2015 01:51:21 PM (10 years ago)
- 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 4 4 Plugin URI: https://wordpress.org/plugins/wp-advertize-it/ 5 5 Description: A plugin to place adsense blocks on your site 6 Version: 0.9. 66 Version: 0.9.7 7 7 Author: Henri Benoit 8 8 Author URI: http://benohead.com -
wp-advertize-it/tags/0.9.7/classes/wp-advertize-it.php
r1072033 r1095868 24 24 * Plugin version 25 25 */ 26 const VERSION = '0.9. 6';26 const VERSION = '0.9.7'; 27 27 /** 28 28 * Prefix used to identify things related to this plugin … … 635 635 636 636 $content = str_replace('</P>', '</p>', $content); 637 $cleaned_content = $this->get_cleaned_content($content); 638 637 639 $char_count = $this->get_character_count($content); 638 640 $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)); 640 647 641 648 $options = $this->modules['WPAI_Settings']->settings['options']; … … 710 717 $index = 0; 711 718 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); 714 722 $content = substr_replace($content, $middle_of_post, $index, 0); 723 $cleaned_content = $this->get_cleaned_content($content); 715 724 } else if (is_page() 716 725 && $middle_of_page_block != "" … … 723 732 $index = 0; 724 733 for ($i = 0; $i < $middle_paragraph; $i++) { 725 $index = strpos($c ontent, '</p>', $index) + 4;734 $index = strpos($cleaned_content, '</p>', $index) + 4; 726 735 } 727 736 $content = substr_replace($content, $middle_of_page, $index, 0); 737 $cleaned_content = $this->get_cleaned_content($content); 728 738 } 729 739 if (is_single() … … 736 746 $index = 0; 737 747 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); 740 751 $content = substr_replace($content, $before_last_post_paragraph, $index, 0); 752 $cleaned_content = $this->get_cleaned_content($content); 753 error_log("content=".$content); 741 754 } else if (is_page() 742 755 && $before_last_page_paragraph_block != "" … … 748 761 $index = 0; 749 762 for ($i = 0; $i < $paragraph_count - 1; $i++) { 750 $index = strpos($c ontent, '</p>', $index) + 4;763 $index = strpos($cleaned_content, '</p>', $index) + 4; 751 764 } 752 765 $content = substr_replace($content, $before_last_page_paragraph, $index, 0); 766 $cleaned_content = $this->get_cleaned_content($content); 753 767 } 754 768 if (is_single() … … 761 775 $index = 0; 762 776 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); 765 780 $content = substr_replace($content, $after_first_post_paragraph, $index, 0); 766 781 } else if (is_page() … … 775 790 $index = strpos($content, '</p>', $index) + 4; 776 791 } 777 $content = substr_replace($c ontent, $after_first_page_paragraph, $index, 0);792 $content = substr_replace($cleaned_content, $after_first_page_paragraph, $index, 0); 778 793 } 779 794 if (is_single()) { … … 945 960 return true; 946 961 } 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 } 947 1033 } 948 1034 ; // end WordPress_Advertize_It -
wp-advertize-it/tags/0.9.7/readme.txt
r1095844 r1095868 4 4 Tags: 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 5 5 Requires at least: 3.0.1 6 Tested up to: 4.1 7 Stable tag: 0.9. 66 Tested up to: 4.1.1 7 Stable tag: 0.9.7 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 115 115 == Changelog == 116 116 117 = 0.9.7 = 118 119 * paragraphs in blockquote, pre or code tags are now ignored. 120 117 121 = 0.9.6 = 118 122 -
wp-advertize-it/trunk/bootstrap.php
r1072033 r1095868 4 4 Plugin URI: https://wordpress.org/plugins/wp-advertize-it/ 5 5 Description: A plugin to place adsense blocks on your site 6 Version: 0.9. 66 Version: 0.9.7 7 7 Author: Henri Benoit 8 8 Author URI: http://benohead.com -
wp-advertize-it/trunk/classes/wp-advertize-it.php
r1072033 r1095868 24 24 * Plugin version 25 25 */ 26 const VERSION = '0.9. 6';26 const VERSION = '0.9.7'; 27 27 /** 28 28 * Prefix used to identify things related to this plugin … … 635 635 636 636 $content = str_replace('</P>', '</p>', $content); 637 $cleaned_content = $this->get_cleaned_content($content); 638 637 639 $char_count = $this->get_character_count($content); 638 640 $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)); 640 647 641 648 $options = $this->modules['WPAI_Settings']->settings['options']; … … 710 717 $index = 0; 711 718 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); 714 722 $content = substr_replace($content, $middle_of_post, $index, 0); 723 $cleaned_content = $this->get_cleaned_content($content); 715 724 } else if (is_page() 716 725 && $middle_of_page_block != "" … … 723 732 $index = 0; 724 733 for ($i = 0; $i < $middle_paragraph; $i++) { 725 $index = strpos($c ontent, '</p>', $index) + 4;734 $index = strpos($cleaned_content, '</p>', $index) + 4; 726 735 } 727 736 $content = substr_replace($content, $middle_of_page, $index, 0); 737 $cleaned_content = $this->get_cleaned_content($content); 728 738 } 729 739 if (is_single() … … 736 746 $index = 0; 737 747 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); 740 751 $content = substr_replace($content, $before_last_post_paragraph, $index, 0); 752 $cleaned_content = $this->get_cleaned_content($content); 753 error_log("content=".$content); 741 754 } else if (is_page() 742 755 && $before_last_page_paragraph_block != "" … … 748 761 $index = 0; 749 762 for ($i = 0; $i < $paragraph_count - 1; $i++) { 750 $index = strpos($c ontent, '</p>', $index) + 4;763 $index = strpos($cleaned_content, '</p>', $index) + 4; 751 764 } 752 765 $content = substr_replace($content, $before_last_page_paragraph, $index, 0); 766 $cleaned_content = $this->get_cleaned_content($content); 753 767 } 754 768 if (is_single() … … 761 775 $index = 0; 762 776 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); 765 780 $content = substr_replace($content, $after_first_post_paragraph, $index, 0); 766 781 } else if (is_page() … … 775 790 $index = strpos($content, '</p>', $index) + 4; 776 791 } 777 $content = substr_replace($c ontent, $after_first_page_paragraph, $index, 0);792 $content = substr_replace($cleaned_content, $after_first_page_paragraph, $index, 0); 778 793 } 779 794 if (is_single()) { … … 945 960 return true; 946 961 } 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 } 947 1033 } 948 1034 ; // end WordPress_Advertize_It -
wp-advertize-it/trunk/readme.txt
r1072033 r1095868 4 4 Tags: 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 5 5 Requires at least: 3.0.1 6 Tested up to: 4.1 7 Stable tag: 0.9. 66 Tested up to: 4.1.1 7 Stable tag: 0.9.7 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 115 115 == Changelog == 116 116 117 = 0.9.7 = 118 119 * paragraphs in blockquote, pre or code tags are now ignored. 120 117 121 = 0.9.6 = 118 122
Note: See TracChangeset
for help on using the changeset viewer.