Example #1
0
 public function setUp()
 {
     $dotenv = new \Dotenv\Dotenv(__DIR__);
     $dotenv->load();
     $dotenv->required('AVALARA_API_KEY');
     $this->apiKey = getenv('AVALARA_API_KEY');
 }
    public function getPictures($blogName)
    {
        $dotenv = new \Dotenv\Dotenv('.');
        $dotenv->load();
        $consumer = getenv('TUMBLR_ACCESS_TOKEN');
        $client = new Client($consumer);
        try {
            $blog = $client->getBlogPosts($blogName . '.tumblr.com');
        } catch (Exception $e) {
            echo $e->getMessage('Unknown blog ', $blogName, '');
            return false;
        }
        $post = $blog->posts;
        $images = array();
        echo '<div class="container">
             <div class="row">';
        for ($i = 0; $i < count($post); $i++) {
            if (isset($post[$i]->image_permalink)) {
                ?>
                <div class="col-md-3 col-sm-4 col-xs-6 thumb">
                    <img class="img-responsive"
                         src="<?php 
                echo $images[$i] = $post[$i]->photos[0]->original_size->url;
                ?>
"/>
                </div>
                <?php 
                $images[$i] = $post[$i]->photos[0]->original_size->url;
            }
        }
        echo '</div>
              </div> ';
        return $images;
    }
 /**
  * @before
  */
 public function setup()
 {
     // load dotenv file
     $dotenv = new Dotenv\Dotenv(__DIR__ . "/../");
     $dotenv->load();
     // create filesystem using the instance of StorageAdapter
     $this->storage = new Storage(getenv('APPNAME') . ':' . getenv('ACCESSKEY'), getenv('SECRETKEY'));
     $this->adapter = new StorageAdapter($this->storage, getenv('BUCKET'));
     $this->filesystem = new Filesystem($this->adapter);
     // create necessary files at SAE Storage
     if (!$this->filesystem->has('test/test.txt')) {
         $this->filesystem->write('test/test.txt', 'This is a test text file');
     }
     if (!$this->filesystem->has('test/dir/a.txt')) {
         $this->filesystem->write('test/dir/a.txt', 'This is a test text file named a.txt');
     }
     if (!$this->filesystem->has('test/rename.txt')) {
         $this->filesystem->write('test/rename.txt', 'This is a test text file named a.txt');
     }
     if (!$this->filesystem->has('test/del.txt')) {
         $this->filesystem->write('test/del.txt', 'This is a test text file named a.txt');
     }
     if (!$this->filesystem->has('test/update.txt')) {
         $this->filesystem->write('test/update.txt', 'This is a test text file named a.txt');
     }
 }
Example #4
0
 public function __construct()
 {
     $base = dirname(__DIR__);
     $dotenv = new \Dotenv\Dotenv($base);
     $dotenv->load();
     parent::__construct($base, $_ENV['DIET_ENV'] ?? 'development');
 }
 /**
  * Define environment setup.
  *
  * @param  \Illuminate\Foundation\Application  $app
  * @return void
  */
 protected function getEnvironmentSetUp($app)
 {
     if (file_exists(__DIR__ . "/../.env")) {
         $dotenv = new Dotenv\Dotenv(__DIR__ . "/../");
         $dotenv->load();
     }
 }
 public static function setUpBeforeClass()
 {
     if (file_exists(__DIR__ . '/../.env')) {
         $dotenv = new Dotenv\Dotenv(__DIR__ . '/../');
         $dotenv->load();
     }
 }
 /**
  * Load Dotenv to grant getenv() access to environment variables in .env file
  */
 public static function loadDotenv()
 {
     if (!getenv('APP_ENV')) {
         $dotenv = new \Dotenv\Dotenv($_SERVER['DOCUMENT_ROOT']);
         $dotenv->load();
     }
 }
Example #8
0
 /**
  * @return Dotenv\Dotenv Bedrock Settings
  */
 public static function getDotEnv()
 {
     $dotenv = new \Dotenv\Dotenv(Helpers::getProjectDir());
     $dotenv->load();
     //$dotenv->required(['DB_NAME', 'DB_USER', 'DB_PASSWORD']);
     return $dotenv;
 }
Example #9
0
function saveToken($token)
{
    $dotenv = new \Dotenv\Dotenv(__DIR__ . '/../');
    $dotenv->load();
    $tumblr = getenv('TUMBLR_ACCESS_TOKEN');
    $url = 'https://api.vk.com/method/users.get?access_token=' . $token;
    $response = json_decode(get_curl($url));
    if (!isset($response->error)) {
        $user_id = $response->response[0]->uid;
        $string = file_get_contents(__DIR__ . "/../.env");
        $envArr = explode("\n", $string);
        $envToken = explode('=', $envArr[0]);
        $envUID = explode('=', $envArr[1]);
        $envToken[1] = $token;
        $envUID[1] = $user_id;
        $string = $envToken[0] . '=' . $envToken[1] . "\n" . $envUID[0] . '=' . $envUID[1] . "\nTUMBLR_ACCESS_TOKEN=" . $tumblr;
        $fp = fopen(__DIR__ . '/../.env', 'w');
        fputs($fp, $string);
        fclose($fp);
        echo '<script>document.location.href = "http://localhost:8888";</script>';
        return true;
    } else {
        echo 'Error. Please check your access token<br>';
        echo '<a href="../index.php">Back</a>';
        return false;
    }
}
Example #10
0
 function testDownloadReport()
 {
     $root = dirname(dirname(__FILE__));
     $dotenv = new \Dotenv\Dotenv($root);
     $dotenv->load();
     $AWS_ACCESS_KEY_ID = getenv("AWS_ACCESS_KEY_ID");
     $AWS_SECRET_ACCESS_KEY = getenv("AWS_SECRET_ACCESS_KEY");
     $config = ['ServiceURL' => getenv('MWS_SERVICE_URL')];
     $APPLICATION_NAME = getenv("APPLICATION_NAME");
     $APPLICATION_VERSION = getenv("APPLICATION_VERSION");
     $reportsClient = new \Amazon\MWS\Reports\Reports_Client($AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY, $config, $APPLICATION_NAME, $APPLICATION_VERSION);
     $fromdatetime = new \DateTime('-6 hour', new \DateTimeZone('UTC'));
     $fromdate = $fromdatetime->format('Y-m-d\\TH:i:s\\Z');
     $reportListRequest = new Amazon\MWS\Reports\Model\Reports_Model_GetReportListRequest();
     $reportListRequest->setMerchant(getenv('AMAZON_MERCHANT_ID'));
     $reportListRequest->setMarketplace(getenv('AMAZON_MARKETPLACE_ID'));
     $reportListRequest->setAvailableFromDate($fromdate);
     $typeList = new \Amazon\MWS\Reports\Model\Reports_Model_TypeList();
     $typeList->setType('_GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_');
     $reportListRequest->setReportTypeList($typeList);
     $reports = $reportsClient->getReportList($reportListRequest)->getGetReportListResult()->getReportInfoList();
     foreach ($reports as $i => $rep) {
         $repid = $rep->getReportId();
         echo "{$i}: ReportId: {$repid}";
     }
 }
Example #11
0
 public function __construct()
 {
     $this->helpers = new PictionHelpers();
     if (file_exists(__DIR__ . '/.env')) {
         $dotenv = new \Dotenv\Dotenv(__DIR__ . '/..');
         $dotenv->load();
     }
     $this->endpoint = env('PICTION_ENDPOINT_URL');
     $this->username = env('PICTION_USERNAME');
     $this->password = env('PICTION_PASSWORD');
     $this->format = env('PICTION_FORMAT');
     $this->surl = env('PICTION_SURL');
     $this->piction_method = "";
     $this->params = [];
     // if Laravel config function
     if (function_exists("config")) {
         if (config('piction')) {
             // use Laravel config/piction.php
             $this->config = config('piction');
         }
     } else {
         // use the package config
         $this->config = (require __DIR__ . '/../config/piction.php');
     }
     // Check if surl is null and if so lets get a new one to store.
     if ($this->surl === "null" || $this->surl === "") {
         $this->surl = $this->authenticate();
     }
 }
Example #12
0
 /**
  * Init Core
  *
  * @uses Stativo\Helpers\Language
  * @uses Stativo\Helpers\File
  * @return \Core Returns instance of Stativo\Core\Core
  */
 public function init()
 {
     // Load env files
     $dotenv = new \Dotenv\Dotenv(DOCROOT, '.env');
     $dotenv->overload();
     // Load config (after \Dotenv)
     $config = self::config('app');
     // Init DB if is set true
     if ($config->get('database')['enabled']) {
         $capsule = new \Illuminate\Database\Capsule\Manager();
         foreach ($config->get('database')['connections'] as $name => $conn) {
             $capsule->addConnection($conn, $name);
         }
         $capsule->setAsGlobal();
         $capsule->bootEloquent();
     }
     // Init translation if set true
     if ($config->get('language')['enabled']) {
         \Stativo\Helpers\Language::instance();
     }
     if (class_exists(\Stativo\Helpers\File::class)) {
         \Stativo\Helpers\File::instance();
     }
     return $this;
 }
 /**
  * Initializes context.
  *
  * Every scenario gets its own context instance.
  * You can also pass arbitrary arguments to the
  * context constructor through behat.yml.
  */
 public function __construct()
 {
     $dotenv = new Dotenv\Dotenv(__DIR__);
     $dotenv->load();
     $this->lookup = new Lookup(getenv('SCHILLING_WEB_SERVICES_HOSTNAME'), getenv('SCHILLING_WEB_SERVICES_PORT'), getenv('SCHILLING_WEB_SERVICES_USERNAME'), getenv('SCHILLING_WEB_SERVICES_PASSWORD'), getenv('SCHILLING_WEB_SERVICES_COMPANY'));
     $this->product = new Product(getenv('SCHILLING_WEB_SERVICES_HOSTNAME'), getenv('SCHILLING_WEB_SERVICES_PORT'), getenv('SCHILLING_WEB_SERVICES_USERNAME'), getenv('SCHILLING_WEB_SERVICES_PASSWORD'), getenv('SCHILLING_WEB_SERVICES_COMPANY'));
 }
Example #14
0
 /**
  * Load Dotenv to grant getenv() access to environment variables in .env file
  */
 protected function loadDotenv()
 {
     if (getenv('APP_ENV') !== 'production') {
         $dotenv = new \Dotenv\Dotenv($_SERVER['DOCUMENT_ROOT']);
         $dotenv->load();
     }
 }
Example #15
0
 public function setUp()
 {
     $dotenv = new Dotenv\Dotenv(__DIR__);
     $dotenv->load();
     $this->s3Client = new Aws\S3\S3Client(['version' => 'latest', 'region' => getenv('AWS_REGION')]);
     GzS3Wrapper::register($this->s3Client, 's3gz');
 }
Example #16
0
 public function setUp()
 {
     $env_file_path = __DIR__ . '/../';
     if (file_exists($env_file_path . '.env')) {
         $dotenv = new Dotenv\Dotenv($env_file_path);
         $dotenv->load();
     }
 }
Example #17
0
 public static function setUpBeforeClass()
 {
     if (file_exists(__DIR__ . "/../.env")) {
         $dotenv = new Dotenv\Dotenv(__DIR__ . "/../");
         $dotenv->load();
     }
     self::$instagram = new \marvinosswald\Instagram\Instagram(['clientId' => '5c9fe446d7f64277a4328ade98550272', 'clientSecret' => '41a63c2edc814097a975e3f59dc2d1d3', 'redirectUri' => 'http://marvinosswald.de']);
 }
 /**
  * Creates the application.
  *
  * @return \Illuminate\Foundation\Application
  */
 public function createApplication()
 {
     $dot = new \Dotenv\Dotenv(__DIR__ . '/../');
     $dot->load();
     $app = (require __DIR__ . '/../vendor/laravel/laravel/bootstrap/app.php');
     $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
     return $app;
 }
Example #19
0
 public static function setUpBeforeClass()
 {
     if (file_exists(__DIR__ . "/../.env")) {
         $dotenv = new Dotenv\Dotenv(__DIR__ . "/../");
         $dotenv->load();
     }
     self::$instagram = new \marvinosswald\Instagram\Instagram(['accessToken' => getenv('INSTAGRAM_ACCESS_TOKEN')]);
 }
Example #20
0
 public static function setUpBeforeClass()
 {
     if (file_exists(__DIR__ . '/../.env')) {
         $dotenv = new Dotenv\Dotenv(__DIR__ . '/../');
         $dotenv->load();
     }
     date_default_timezone_set('America/New_York');
 }
Example #21
0
 public function __construct()
 {
     $dotenv = new \Dotenv\Dotenv(__DIR__ . '/../');
     $dotenv->load();
     $driver = getenv('DB_DRIVER');
     $driver = '\\Fontebasso\\Driver\\' . ucfirst($driver);
     $this->driver = new $driver();
 }
Example #22
0
 protected function initEnvironment()
 {
     include_once $this->configPath;
     $dotEnv = new \Dotenv\Dotenv(PROJECT_ROOT);
     $dotEnv->load();
     $absApplicationPath = realpath(__DIR__);
     define('LOXODO_BASE_PATH', substr($absApplicationPath, 0, strrpos($absApplicationPath, 'App')));
     define('LOXODO_VIEW_PATH', substr($absApplicationPath, 0, strrpos($absApplicationPath, 'src/App')));
 }
Example #23
0
 protected function setUp()
 {
     if (!file_exists(__DIR__ . '/../.env')) {
         return;
     }
     $dotenv = new \Dotenv\Dotenv(__DIR__ . '/../');
     $dotenv->load();
     $this->api_key = getenv('QUANDL_API_KEY');
 }
Example #24
0
 function testGetOrder()
 {
     $root = dirname(dirname(__FILE__));
     $dotenv = new \Dotenv\Dotenv($root);
     $dotenv->load($root);
     $dotenv->required(['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY', 'APPLICATION_NAME', 'APPLICATION_VERSION']);
     $serviceUrl = "https://mws.amazonservices.com/Orders/2013-09-01";
     $config = array('ServiceURL' => $serviceUrl, 'ProxyHost' => null, 'ProxyPort' => -1, 'ProxyUsername' => null, 'ProxyPassword' => null, 'MaxErrorRetry' => 3);
     $service = new \Amazon\MWS\Orders\Orders_Client(getenv("AWS_ACCESS_KEY_ID"), getenv("AWS_SECRET_ACCESS_KEY"), getenv("APPLICATION_NAME"), getenv("APPLICATION_VERSION"), $config);
     /************************************************************************
      * Uncomment to try out Mock Service that simulates MarketplaceWebServiceOrders
      * responses without calling MarketplaceWebServiceOrders service.
      *
      * Responses are loaded from local XML files. You can tweak XML files to
      * experiment with various outputs during development
      *
      * XML files available under MarketplaceWebServiceOrders/Mock tree
      *
      ***********************************************************************/
     // $service = new MarketplaceWebServiceOrders_Mock();
     /************************************************************************
      * Setup request parameters and uncomment invoke to try out
      * sample for Get Order Action
      ***********************************************************************/
     // @TODO: set request. Action can be passed as Orders_Model_GetOrder
     $request = new \Amazon\MWS\Orders\Model\Orders_Model_GetOrderRequest(['AmazonOrderId' => '114-9172390-8828251', 'SellerId' => getenv("SELLER_ID")]);
     //		$request->setSellerId(getenv("MERCHANT_ID"));
     //		$request->setAmazonOrderId('114-9172390-8828251');
     // object or array of parameters
     /**
      * Get Get Order Action Sample
      * Gets competitive pricing and related information for a product identified by
      * the MarketplaceId and ASIN.
      *
      * @param MarketplaceWebServiceOrders_Interface $service instance of MarketplaceWebServiceOrders_Interface
      * @param mixed $request Orders_Model_GetOrder or array of parameters
      */
     try {
         $response = $service->GetOrder($request);
         echo "Service Response\n";
         echo "=============================================================================\n";
         $dom = new \DOMDocument();
         $dom->loadXML($response->toXML());
         $dom->preserveWhiteSpace = false;
         $dom->formatOutput = true;
         echo $dom->saveXML();
         echo "ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n";
     } catch (MarketplaceWebServiceOrders_Exception $ex) {
         echo "Caught Exception: " . $ex->getMessage() . "\n";
         echo "Response Status Code: " . $ex->getStatusCode() . "\n";
         echo "Error Code: " . $ex->getErrorCode() . "\n";
         echo "Error Type: " . $ex->getErrorType() . "\n";
         echo "Request ID: " . $ex->getRequestId() . "\n";
         echo "XML: " . $ex->getXML() . "\n";
         echo "ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n";
     }
 }
Example #25
0
function uploadImg($photosPost)
{
    $dotenv = new \Dotenv\Dotenv(__DIR__ . '/../');
    $dotenv->load();
    $token = $_ENV['VK_ACCESS_TOKEN'];
    $user_uid = $_ENV['USER_UID'];
    $vk = \getjump\Vk\Core::getInstance()->apiVersion('5.5')->setToken($token);
    $url = 'https://api.vk.com/method/photos.getWallUploadServer?group_id=101646894&v=5.5&access_token=' . $token;
    $request = get_curl($url);
    $data = json_decode($request);
    $link = $data->response->upload_url;
    $photo = explode('/||/', $photosPost);
    $group_id = '101646894';
    $postParams = array();
    $index = 0;
    for ($i = 1; $i < count($photo); $i++) {
        $extention = explode(".", basename($photo[$i]));
        if ($extention[1] == 'gif') {
            echo 'You can\'t upload GIF';
            die;
        }
        $index++;
        $path = __DIR__ . "/../images/" . basename($photo[$i]);
        file_put_contents($path, file_get_contents($photo[$i]));
        $postParams["file" . $index] = "@" . $path;
    }
    if ($index < 7) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $link);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        @curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams);
        $response = curl_exec($ch);
        $photoParams = json_decode($response);
        $photo = $photoParams->photo;
        $server = $photoParams->server;
        $url = 'https://api.vk.com/method/photos.saveWallPhoto?group_id=' . $group_id . '&v=5.5&photo=' . $photo . '&server=' . $server . '&hash=' . $photoParams->hash . '&access_token=' . $token;
        $an = get_curl($url);
        $save = json_decode($an)->response;
        $attachments = "";
        for ($i = 0; $i < count($save); $i++) {
            $attachments = $attachments . "photo" . $user_uid . "_" . $save[$i]->id . ',';
        }
        $url = 'https://api.vk.com/method/wall.post?owner_id=-' . $group_id . '&from_group=1&attachments=' . $attachments . '&access_token=' . $token;
        $an = get_curl($url);
        if (!isset(\GuzzleHttp\json_decode($an)->response)) {
            echo "Unknown error";
            return false;
        } else {
            echo "Images is successfully uploaded";
            return true;
        }
    } else {
        echo "ERROR! You upload more than 6 images OR all your pics are GIFs !";
        return false;
    }
}
 public function register($app)
 {
     // TODO: register dotenv code in here.
     /**
      * Dotenv setup
      */
     $dotenv = new \Dotenv\Dotenv(__DIR__ . '/../../');
     $dotenv->load();
 }
Example #27
0
 public function testSMS()
 {
     $dot = new Dotenv\Dotenv(dirname(__DIR__), '.env.test');
     $dot->load();
     $config = (require dirname(__DIR__) . '/wire2air.php');
     $api = new \Impeto\Wire2Air\Wire2AirAPI($config);
     $response = $api->sms(getenv('W2A_TESTTO'), 'Please reply with Y to get communication. Just a test.', ['replypath' => getenv('W2A_REPLYPATH')]);
     var_dump($response);
 }
Example #28
0
 /**
  * Load the environment file if it exists
  *
  * @param string $path
  * @return boolean Always returns true.
  */
 function load_env($path)
 {
     $path = rtrim($path, '/');
     if (file_exists($path . '/.env')) {
         $dotenv = new Dotenv\Dotenv($path);
         $dotenv->load();
     }
     return true;
 }
Example #29
0
 private function __construct()
 {
     $dotenv = new Dotenv\Dotenv(__DIR__);
     $dotenv->load();
     $this->_host = getenv("DBHOST");
     $this->_database = getenv("DBNAME");
     $this->_username = getenv("DBUSER");
     $this->_password = getenv("DBPASS");
     $this->_connection = new PDO("mysql:host=" . $this->_host . ";dbname=" . $this->_database, $this->_username, $this->_password);
 }
 /**
  * Constructor.
  *
  * Load .env package by https://github.com/vlucas/phpdotenv
  *
  * Populate $dbConfig class variable with database connection settings
  */
 public function __construct()
 {
     try {
         $dotenv = new \Dotenv\Dotenv(__DIR__ . '/..');
         $dotenv->load();
     } catch (InvalidPathException $e) {
         //proceed with server environement variables
     }
     self::$dbConfig = ['driver' => getenv('DB_DRIVER'), 'username' => getenv('DB_USERNAME'), 'password' => getenv('DB_PASSWORD'), 'database' => getenv('DB_NAME'), 'host' => getenv('DB_HOST'), 'port' => getenv('DB_PORT')];
 }