Changeset 1772290
- Timestamp:
- 11/21/2017 12:38:31 PM (8 years ago)
- Location:
- internal-links-generator/trunk
- Files:
-
- 2 edited
-
internal-links-generator.php (modified) (1 diff)
-
settings.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
internal-links-generator/trunk/internal-links-generator.php
r1772120 r1772290 4 4 Plugin URI: https://makong.kiev.ua/plugins/internal-links-generator/ 5 5 Description: Simple way to automatically link a certain word or phrase in your post/page/custom content to a URL you specify. 6 Version: 3. 46 Version: 3.5 7 7 Author: Makong 8 8 Author URI: http://makong.kiev.ua/ -
internal-links-generator/trunk/settings.php
r1772141 r1772290 771 771 else return $row->id; 772 772 } 773 774 public function ilgen_check_entry($column, $value, $type, $pid){ 775 776 if( $rows = $this->wpdb->get_results( $this->wpdb->prepare( 777 "SELECT `{$type}` FROM `{$this->wpdb->prefix}internalinks` " . 778 "WHERE `{$column}` = '%s'", $value 779 )) ){ 780 foreach($rows as $row){ 781 if(in_array($pid, (array)unserialize($row->{$type}))){ 782 return true; 783 } 784 } 785 } 786 return false; 787 } 773 788 774 789 public function ilgen_insert_keyword($keyword, $target = '', $limit = 1, $tag = '', $id = null, $count = null){ … … 900 915 if($p->post_content && preg_match_all("/{$this->urlPattern}/siU", $p->post_content, $matches, PREG_SET_ORDER)){ 901 916 foreach($matches as $match){ 902 if(strpos($match[0], 'class="ilgen"')) continue; 903 if(preg_match('/<\s?(img|div|span)[^>]+\>/siU', $match[3], $unmatch)) continue; 904 if(preg_match('/^#.*/', $match[2], $unmatch)) continue; 917 918 if( ( preg_match('/<\s?(img|div|span)[^>]+\>/siU', $match[3], $unmatch) ) || 919 ( preg_match('/^#.*/', $match[2], $unmatch) ) || 920 ( strpos($match[0], 'class="ilgen"') && $this->ilgen_check_entry('target', esc_url_raw($match[2]), 'posts', $p->ID) ) 921 ) continue; 922 905 923 $data['posts'][$p->ID . $this->termDelimiter . $post_type][] = array(esc_url_raw($match[2]), sanitize_text_field($match[3])); 906 924 } … … 918 936 if($t->description && preg_match_all("/{$this->urlPattern}/siU", $t->description, $matches, PREG_SET_ORDER)){ 919 937 foreach($matches as $match){ 920 if(strpos($match[0], 'class="ilgen"')) continue; 921 if(preg_match('/<\s?(img|div|span)[^>]+\>/siU', $match[3], $unmatch)) continue; 922 if(preg_match('/^#.*/', $match[2], $unmatch)) continue; 938 939 if( ( preg_match('/<\s?(img|div|span)[^>]+\>/siU', $match[3], $unmatch) ) || 940 ( preg_match('/^#.*/', $match[2], $unmatch) ) || 941 ( strpos($match[0], 'class="ilgen"') && $this->ilgen_check_entry('target', esc_url_raw($match[2]), 'terms', $t->term_id . $this->termDelimiter . $t->taxonomy) ) 942 ) continue; 943 923 944 $data['terms'][$t->term_id . $this->termDelimiter . $t->taxonomy][] = array(esc_url_raw($match[2]), sanitize_text_field($match[3])); 924 945 }
Note: See TracChangeset
for help on using the changeset viewer.