Changeset 1319782
- Timestamp:
- 01/02/2016 06:00:24 AM (10 years ago)
- Location:
- thunder-port/trunk
- Files:
-
- 2 edited
-
simple_html_dom.php (modified) (1 diff)
-
thunder_port.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
thunder-port/trunk/simple_html_dom.php
r1319770 r1319782 70 70 // get html dom from file 71 71 // $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1. 72 function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)73 {74 // We DO force the tags to be terminated.75 $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);76 // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done.77 // $contents = file_get_contents($url, $use_include_path, $context, $offset);78 $contents = wp_remote_get($url);79 $contents = wp_remote_retrieve_body( $contents );72 // function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) 73 // { 74 // // We DO force the tags to be terminated. 75 // $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText); 76 // // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done. 77 // // $contents = file_get_contents($url, $use_include_path, $context, $offset); 78 // $contents = wp_remote_get($url); 79 // $contents = wp_remote_retrieve_body( $contents ); 80 80 81 // Paperg - use our own mechanism for getting the contents as we want to control the timeout.82 //$contents = retrieve_url_contents($url);83 if (empty($contents) || strlen($contents) > MAX_FILE_SIZE)84 {85 return false;86 }87 // The second parameter can force the selectors to all be lowercase.88 $dom->load($contents, $lowercase, $stripRN);89 return $dom;90 }81 // // Paperg - use our own mechanism for getting the contents as we want to control the timeout. 82 // //$contents = retrieve_url_contents($url); 83 // if (empty($contents) || strlen($contents) > MAX_FILE_SIZE) 84 // { 85 // return false; 86 // } 87 // // The second parameter can force the selectors to all be lowercase. 88 // $dom->load($contents, $lowercase, $stripRN); 89 // return $dom; 90 // } 91 91 92 92 // get html dom from string -
thunder-port/trunk/thunder_port.php
r1319752 r1319782 14 14 add_action( 'admin_init', 'thunderport_settings_init' ); 15 15 16 function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) 17 { 18 // We DO force the tags to be terminated. 19 $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText); 20 // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done. 21 // $contents = file_get_contents($url, $use_include_path, $context, $offset); 22 $contents = wp_remote_get($url); 23 $contents = wp_remote_retrieve_body( $contents ); 24 25 // Paperg - use our own mechanism for getting the contents as we want to control the timeout. 26 //$contents = retrieve_url_contents($url); 27 if (empty($contents) || strlen($contents) > MAX_FILE_SIZE) 28 { 29 return false; 30 } 31 // The second parameter can force the selectors to all be lowercase. 32 $dom->load($contents, $lowercase, $stripRN); 33 return $dom; 34 } 35 16 36 function thunderport_add_admin_menu( ) { 17 37 … … 112 132 $list = wp_remote_get(plugin_dir_path( __FILE__ ) . "list/allplugins.json"); 113 133 $list = wp_remote_retrieve_body( $list ); 114 134 115 135 $return = json_decode($list); 116 136 // 2. using database
Note: See TracChangeset
for help on using the changeset viewer.