WordPress.org

Ready to get started?Download WordPress

Forums

WordPress HTTPS (SSL)
Empty variables causing strict php errors (1 post)

  1. danieliser
    Member
    Posted 1 year ago #

    Not sure if this is the write answer as i didnt really look at how this function was being used just at fixing the error but something like this should work

    public static function fromString( $string ) {
    		$url = new WordPressHTTPS_Url;
    		@preg_match_all('/((http|https):\/\/[^\'"]+)[\'"\)]?/i', $string, $url_parts);
    		if ( isset($url_parts[1][0]) ) {
    			if ( $url_parts = parse_url( $url_parts[1][0] ) ) {
    				$url->setScheme(@ !empty($url_parts['scheme']) ? $url_parts['scheme'] : NULL);
    				$url->setUser(@ !empty($url_parts['user']) ? $url_parts['user'] : NULL);
    				$url->setPass(@ !empty($url_parts['pass']) ? $url_parts['pass'] : NULL);
    				$url->setHost(@ !empty($url_parts['host']) ? $url_parts['host'] : NULL);
    				$url->setPort(@ !empty($url_parts['port']) ? $url_parts['port'] : NULL);
    				$url->setPath(@ !empty($url_parts['path']) ? $url_parts['path'] : NULL);
    				$url->setQuery(@ !empty($url_parts['query']) ? $url_parts['query'] : NULL);
    				$url->setFragment(@ !empty($url_parts['fragment']) ? $url_parts['fragment'] : NULL);
    				return $url;
    			}
    		} else {
    			 return false;
    		}
    		return $url;
    	}

    That function is in lib\WordPressHTTPS\Url.php

    Fixes the Undefined index: errors

    http://wordpress.org/plugins/wordpress-https/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.