library/Publisher.php
public function publish_update($topic_urls, $http_function = false)
    {
        if (! isset($topic_urls)) {
            throw new InvalidArgumentException('Please specify a topic url');
        }

        // check that we're working with an array
        if (! is_array($topic_urls)) {
            $topic_urls = [$topic_urls];
        }

        // set the mode to publish
        $post_string = 'hub.mode=publish';
        // loop through each topic url
        foreach ($topic_urls as $topic_url) {

            // lightweight check that we're actually working w/ a valid url
            if (! preg_match('|^https?://|i', $topic_url)) {
                throw new InvalidArgumentException('The specified topic url does not appear to be valid: ' . $topic_url);
            }

            // append the topic url parameters
            $post_string .= '&hub.url=' . urlencode($topic_url);
        }

        // make the http post request and return true/false
        // easy to over-write to use your own http function
        if ($http_function) {
            return $http_function($this->hub_url, $post_string);
        }

        return $this->http_post($this->hub_url, $post_string);
    }
public function publish_update($topic_urls, $http_function = false)
    {
        if (! isset($topic_urls)) {
            throw new InvalidArgumentException('Please specify a topic url');
        }

        // check that we're working with an array
        if (! is_array($topic_urls)) {
            $topic_urls = [$topic_urls];
        }

        // set the mode to publish
        $post_string = 'hub.mode=publish';
        // loop through each topic url
        foreach ($topic_urls as $topic_url) {

            // lightweight check that we're actually working w/ a valid url
            if (! preg_match('|^https?://|i', $topic_url)) {
                throw new InvalidArgumentException('The specified topic url does not appear to be valid: ' . $topic_url);
            }

            // append the topic url parameters
            $post_string .= '&hub.url=' . urlencode($topic_url);
        }

        // make the http post request and return true/false
        // easy to over-write to use your own http function
        if ($http_function) {
            return $http_function($this->hub_url, $post_string);
        }

        return $this->http_post($this->hub_url, $post_string);
    }
public function publish_update ( $ topic_urls , $ http_function = false ) { if ( ! isset ( $ topic_urls ) ) { throw new InvalidArgumentException ( 'Please specify a topic url' ) ; } // check that we're working with an array if ( ! is_array ( $ topic_urls ) ) { $ topic_urls = [ $ topic_urls ] ; } // set the mode to publish $ post_string = 'hub.mode=publish' ; // loop through each topic url foreach ( $ topic_urls as $ topic_url ) { // lightweight check that we're actually working w/ a valid url if ( ! preg_match ( '|^https?://|i' , $ topic_url ) ) { throw new InvalidArgumentException ( 'The specified topic url does not appear to be valid: ' . $ topic_url ) ; } // append the topic url parameters $ post_string .= '&hub.url=' . urlencode ( $ topic_url ) ; } // make the http post request and return true/false // easy to over-write to use your own http function if ( $ http_function ) { return $ http_function ( $ this -> hub_url , $ post_string ) ; } return $ this -> http_post ( $ this -> hub_url , $ post_string ) ; }
Accepts either a single url or an array of urls.

@param string|array $topic_urls
@param callable     $http_function

@return mixed
Accepts either a single url or an array of urls .