403Webshell
Server IP : 52.25.153.185  /  Your IP : 216.73.217.131
Web Server : Apache
System : Linux ip-172-26-6-158 5.10.0-35-cloud-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User : daemon ( 1)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /bitnami/wordpress/wp-content/plugins/fluentformpro/src/Integrations/Pipedrive/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /bitnami/wordpress/wp-content/plugins/fluentformpro/src/Integrations/Pipedrive/PipedriveApi.php
<?php

namespace FluentFormPro\Integrations\Pipedrive;

class PipedriveApi
{
    protected $apiToken = null;
    protected $apiUrl = 'https://api.pipedrive.com/v1/';

    public function __construct($api_Token = null) {
        $this->apiToken = $api_Token;
    }

    private function getApiUrl($resource)
    {
        $parameters = [];

        $parameters['api_token']   = $this->apiToken;

        $paramString = http_build_query($parameters);

        return $this->apiUrl . $resource . '?' . $paramString;
    }

    public function auth_test()
    {
        return  $this->make_request('leads', [], 'GET');
    }

    public function make_request($resource, $data, $method = 'GET')
    {
        $requestApi = $this->getApiUrl($resource);

        $args =  array(
            'headers' => array(
                'Content-Type'  => 'application/json'
            )
        );

        if ($method == 'GET') {
            $response = wp_remote_get($requestApi, $args);
        } else if ($method == 'POST') {
            $args['body'] = json_encode($data);
            $response = wp_remote_post($requestApi, $args);
        } else {
            return (new \WP_Error(423, 'Request method could not be found'));
        }

        /* If WP_Error, die. Otherwise, return decoded JSON. */
        if (is_wp_error($response)) {
            return (new \WP_Error(423, $response->get_error_message()));
        }

        return json_decode($response['body'], true);
    }

    public function getFields($serviceId){
        return $this->make_request($serviceId, [], 'GET');
    }

    public function getUsers(){
        return $this->make_request('users', [], 'GET');
    }
    public function getPerson() {
        return $this->make_request('persons', [], 'GET');
    }
    public function getOrganizations(){
        return $this->make_request('organizations', [], 'GET');
    }
    public function getCurrencies(){
        return $this->make_request('currencies', [], 'GET');
    }

    public function insertServiceData($service_name, $data)
    {
        $response = $this->make_request($service_name, $data, 'POST');

        if ($response['success']) {
            return $response;
        }

        $err_msg = 'Something goes wrong!';

        if (is_wp_error($response)) {
            $err_msg = $response->get_error_message();
        }

        if (!$response['success']) {
            $err_msg = $response['error'] . ' - '. $response['error_info'];
        }

        return new \WP_Error('error', $err_msg);
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit