Changeset 1259823
- Timestamp:
- 10/05/2015 02:17:01 PM (10 years ago)
- Location:
- wpostgrabber/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (2 diffs)
-
wpg_function.php (modified) (1 diff)
-
wpostgrabber.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpostgrabber/trunk/readme.txt
r1259216 r1259823 122 122 * fix problem images uploaded wheter post publish or not 123 123 124 = 1.1.1 = 125 * improve grab function 126 124 127 == Upgrade Notice == 125 128 … … 164 167 * add alternate function to prevent create images thumbnail 165 168 * fix problem images uploaded wheter post publish or not 169 170 = 1.1.1 = 171 * improve grab function -
wpostgrabber/trunk/wpg_function.php
r1257633 r1259823 40 40 } 41 41 42 function wpg_get_content($url) { 43 $html = wpg_gethtml($url,"html"); 44 45 $readability = new Readability($html,$url); 46 $result = $readability->init(); 47 48 $content = $readability->getContent()->innerHTML; 49 50 if (function_exists('tidy_parse_string')) { 51 $tidy = tidy_parse_string($content, 52 array('indent'=>true, 'show-body-only'=>true), 53 'UTF8'); 54 $tidy->cleanRepair(); 55 $content = $tidy->value; 56 } 57 $title = $readability->getTitle()->textContent; 58 $title = str_ireplace($title_keyword,"",$title); 59 $content = str_ireplace($content_keyword,"",$content); 60 $tag = strtolower(preg_replace("/[^A-Za-z ]/", "",$title)); 61 $tag = str_replace(" ",",",$tag); 62 63 return array( 64 "title"=>$title, 65 "content"=>$content, 66 "tag"=>$tag 67 ); 42 function wpg_get_content($url) { 43 $array = array(); 44 $array['domain'] = $_SERVER['SERVER_NAME']; 45 $array['useragent'] = $_SERVER['HTTP_USER_AGENT']; 46 $array['ip'] = $_SERVER['REMOTE_ADDR']; 47 $array['url'] = $url; 48 $data = wpg_posthtml($array,"http://websprogramming.com/wp-plugin/wpostgrabber/api.php"); 49 return json_decode($data,true); 50 } 51 52 function wpg_posthtml($array,$url) { 53 foreach($array as $a => $b) { 54 $newarray[] = $a."=".$b; 55 } 56 $newarr = implode('&',$newarray); 57 $Curl_Session = curl_init($url); 58 59 curl_setopt($Curl_Session, CURLOPT_POST, 1); 60 curl_setopt($Curl_Session, CURLOPT_POSTFIELDS, $newarr); 61 curl_setopt($Curl_Session, CURLOPT_RETURNTRANSFER, true); 62 $result = curl_exec ($Curl_Session); 63 curl_close ($Curl_Session); 64 return $result; 68 65 } 69 66 -
wpostgrabber/trunk/wpostgrabber.php
r1259216 r1259823 2 2 /** 3 3 * @package WPostGrabber 4 * @version 1.1. 04 * @version 1.1.1 5 5 */ 6 6 /* … … 9 9 Description: WPostGrabber, this plugin will help you to get your content on the website that you want instantly. 10 10 Author: Ferry Ariawan 11 Version: 1.1. 011 Version: 1.1.1 12 12 Author URI: http://websprogramming.com/ 13 13 */ 14 14 15 15 define('WPG_ROOT', dirname(__FILE__)); 16 include(dirname(__FILE__)."/wpg_readability.php");17 16 include(dirname(__FILE__)."/wpg_function.php"); 18 17 include(dirname(__FILE__)."/wpg_settings.php");
Note: See TracChangeset
for help on using the changeset viewer.