Support » Plugin: Pardot » Pardot API Class – Protected instead of Private

  • Resolved fatbeehive

    (@fatbeehive)


    Thank you for an excellent plugin. Can you please change Pardot_API::_get_url() to protected rather than private?

    Extending this class to for instance connect to prospects or other aspects of Pardot API that aren’t covered by your plugin are restricted by this.

    Ie,
    private function _get_url( $item_type, $args = array() ) {

    Please change to
    protected function _get_url( $item_type, $args = array() ) {

    We understand that extending the plugin, any updates that occur we need to ensure our methods are still compatible with your API class.

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Note that as ‘_get_url()’ calls ‘_get_version()’, can you please make both protected instead

    Plugin Author Cliff Seal

    (@cliffseal)

    We’ll consider this for a future release—thanks!

    Sounds good thank you!

    I suppose an alternative if you really want to keep that locked down is to add filters before the request.

    So in https://plugins.trac.wordpress.org/browser/pardot/trunk/includes/pardot-api-class.php#L430 this:

    
    $http_response = wp_remote_request(
            $this->_get_url( $item_type, $args ),
            array_merge( array(
                    'timeout'       => '30',
                    'redirection'   => '5',
                    'method'        => 'POST',
                    'blocking'      => true,
                    'compress'      => false,
                    'decompress'    => true,
                    'sslverify'     => false,
                    'body'          => $args
            ), $args )
    );
    

    Could become this:

    
    $url = $this->_get_url( $item_type, $args );
    $args = array_merge( array(
            'timeout'       => '30',
            'redirection'   => '5',
            'method'        => 'POST',
            'blocking'      => true,
            'compress'      => false,
            'decompress'    => true,
            'sslverify'     => false,
            'body'          => $args
    ), $args );
    $url = apply_filters( 'pardot_api_request_url', $url, $item_type );
    $args = apply_filters( 'pardot_api_request_args', $args, $item_type );
    $http_response = wp_remote_request( $url, $args );
    
    ....
    
    $response = apply_filters( 'pardot_api_request_url', $response, $item_type );
    

    Happy to submit that as a patch if it’s easier for you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pardot API Class – Protected instead of Private’ is closed to new replies.