Changeset 352827
- Timestamp:
- 02/28/2011 03:15:22 AM (15 years ago)
- Location:
- auto-post-images-api/trunk
- Files:
-
- 2 edited
-
auto-post-images.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
auto-post-images-api/trunk/auto-post-images.php
r352804 r352827 3 3 Plugin Name: Auto Post Images (API) 4 4 Plugin URI: http://www.karthikeyankarunanidhi.com 5 Version: 3.1. 15 Version: 3.1.2 6 6 Author: <a href="http://www.karthikeyankarunanidhi.com">Karthikeyan Karunanidhi</a> 7 7 Description: Automatically adds images to posts without having to edit the post. … … 1527 1527 1528 1528 $iHtmlLen = strlen($sContent); 1529 $iTextLen = strlen(strip_tags($sContent)); 1530 $iNewLen = $iHtmlLen - $iTextLen; 1531 $iLength += $iNewLen; 1532 1533 $sContent = substr($sContent,0,$iLength); 1529 if ($iHtmlLen > $iLength) { 1530 1531 $iCount = 0; 1532 for($i = 0; $i < $iHtmlLen && $iCount < $iLength; $i++) { 1533 1534 if($sContent[$i] == '<') { 1535 1536 $bSkip = TRUE; 1537 1538 } else if($sContent[$i] == '>') { 1539 1540 $bSkip = FALSE; 1541 1542 } else { 1543 1544 if ($bSkip === FALSE) { 1545 1546 $iCount++; 1547 } 1548 } 1549 } 1550 } else { 1551 1552 $i = $iLength; 1553 } 1554 1555 $sContent = $this->closetags(substr($sContent,0,$i)); 1534 1556 1535 1557 } else { … … 1547 1569 } 1548 1570 } 1571 1572 function closetags ( $html ) { 1573 1574 //put all opened tags into an array 1575 // 1576 preg_match_all ( "#<([a-z]+)( .*)?(?!/)>#iU", $html, $result ); 1577 1578 $openedtags = $result[1]; 1579 1580 //put all closed tags into an array 1581 // 1582 preg_match_all ( "#</([a-z]+)>#iU", $html, $result ); 1583 $closedtags = $result[1]; 1584 $len_opened = count ( $openedtags ); 1585 1586 //all tags are closed 1587 // 1588 if( count ( $closedtags ) == $len_opened ) { 1589 1590 return $html; 1591 } 1592 1593 $openedtags = array_reverse ( $openedtags ); 1594 1595 //close tags 1596 // 1597 for( $i = 0; $i < $len_opened; $i++ ) { 1598 1599 if ( !in_array ( $openedtags[$i], $closedtags ) ) { 1600 1601 $html .= "</" . $openedtags[$i] . ">"; 1602 } else { 1603 1604 unset ( $closedtags[array_search ( $openedtags[$i], $closedtags)] ); 1605 } 1606 } 1607 1608 return $html; 1609 } 1610 1549 1611 1550 1612 } // End Class KKAutoPostImages -
auto-post-images-api/trunk/readme.txt
r352806 r352827 6 6 Tested on: 2.6.2, 2.7, 2.7.1, 2.8.4,2.8.6,2.9,3.0,3.0.1,3.0.3,3.1 7 7 Tested up to: 3.1 8 Stable tag: 3.1. 18 Stable tag: 3.1.2 9 9 10 10 Automatically insert images to posts without having to edit the post. Supports renaming images for search engine optimization (SEO). … … 130 130 == Changelog == 131 131 132 = 3.1 132 = 3.1.2 = 133 * On Sunday, February 27, 2011 134 * Bug fix: The length of the excerpt of not correct when strip tags was set to NO 135 * Bug fix: Added function to close any open html tags in the excerpt so that the excerpt is valid html 136 137 138 = 3.1.1 = 139 * On Sunday, February 27, 2011 140 * Bug fix: The excerpt function was not being called if the post did not have images. 141 142 = 3.1 = 133 143 * On Sunday, February 27, 2011 134 144 * Adding excerpt functionality. … … 219 229 == Upgrade Notice == 220 230 221 = 3.1. 1=222 Enhancement: Adding excerpt functionality . Adding tabs to option page so that the setting page is more user friendly.231 = 3.1.2 = 232 Enhancement: Adding excerpt functionality with support for generating excerpt of the required length after stripping out all html tags or retain html tags and generate excerpt of (roughly) the required length while still excluding html tags from the total length of the excerpt and also closing open html tags so that the html excerpt is valid html. Adding tabs to option page so that the setting page is more user friendly.
Note: See TracChangeset
for help on using the changeset viewer.