Plugin Directory

Changeset 1319784


Ignore:
Timestamp:
01/02/2016 06:03:02 AM (10 years ago)
Author:
vividlteam
Message:

fix bug

Location:
thunder-port/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • thunder-port/trunk/simple_html_dom.php

    r1319782 r1319784  
    7070// get html dom from file
    7171// $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 );
     72function 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 );
    8080           
    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}
    9191
    9292// get html dom from string
  • thunder-port/trunk/thunder_port.php

    r1319782 r1319784  
    1414add_action( 'admin_init', 'thunderport_settings_init' );
    1515
    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 }
    3516
    3617function thunderport_add_admin_menu(  ) {
Note: See TracChangeset for help on using the changeset viewer.