first commit
This commit is contained in:
111
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/clean_account.php
vendored
Normal file
111
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/clean_account.php
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
* form for use in connection with the web services and APIs provided by
|
||||
* Facebook.
|
||||
*
|
||||
* As with any software that integrates with the Facebook platform, your use
|
||||
* of this software is subject to the Facebook Developer Principles and
|
||||
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
||||
* shall be included in all copies or substantial portions of the software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
use FacebookAds\Api;
|
||||
use FacebookAds\Cursor;
|
||||
use FacebookAds\Object\AbstractCrudObject;
|
||||
use FacebookAds\Object\AdAccount;
|
||||
use FacebookAds\Logger\CurlLogger;
|
||||
use FacebookAdsTest\Bootstrap\IntegrationBootstrap;
|
||||
|
||||
chdir(__DIR__);
|
||||
|
||||
/** @var IntegrationBootstrap $bootstrap */
|
||||
if (in_array('--docsmith-bootstrap', $_SERVER['argv'])) {
|
||||
$bootstrap = require_once __DIR__.'/../docsmith/init_integration.php';
|
||||
} else {
|
||||
$bootstrap = require_once __DIR__.'/../test/init_integration.php';
|
||||
}
|
||||
|
||||
$config = $bootstrap->getConfig();
|
||||
|
||||
Api::init($config->appId, $config->appSecret, $config->accessToken);
|
||||
|
||||
if (in_array('--dump', $_SERVER['argv'])) {
|
||||
Api::instance()->setLogger(new CurlLogger(STDERR));
|
||||
}
|
||||
|
||||
$get_class_name = function($object) {
|
||||
return (new ReflectionClass($object))->getShortName();
|
||||
};
|
||||
|
||||
$delete_object = function(AbstractCrudObject $object) use ($get_class_name) {
|
||||
echo sprintf(
|
||||
' > Deleting %s %d',
|
||||
$get_class_name($object),
|
||||
$object->{AbstractCrudObject::FIELD_ID}).PHP_EOL;
|
||||
|
||||
try {
|
||||
$object->deleteSelf();
|
||||
} catch (Exception $e) {
|
||||
echo sprintf(" > Deletion failed with %s: %s",
|
||||
$get_class_name($e),
|
||||
$e->getMessage()).PHP_EOL;
|
||||
}
|
||||
};
|
||||
|
||||
$clean_edge = function($cursor_provider) use ($get_class_name, $delete_object) {
|
||||
try {
|
||||
$cursor = call_user_func($cursor_provider);
|
||||
if (!$cursor instanceof Cursor) {
|
||||
throw new ErrorException(sprintf(
|
||||
"Provider returned instance of %s",
|
||||
$get_class_name($cursor)));
|
||||
}
|
||||
$cursor->setUseImplicitFetch(true);
|
||||
foreach ($cursor as $object) {
|
||||
if (!$object instanceof AbstractCrudObject) {
|
||||
throw new ErrorException(sprintf(
|
||||
"Provider returned instance of %s, not a CRUD object",
|
||||
$get_class_name($object)));
|
||||
}
|
||||
|
||||
$trait = 'FacebookAds\Object\Traits\CannotDelete';
|
||||
if (in_array($trait, (new ReflectionClass($object))->getTraitNames())) {
|
||||
break;
|
||||
}
|
||||
$delete_object($object);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo sprintf(" > Edge iteration failed with %s: %s",
|
||||
$get_class_name($e),
|
||||
$e->getMessage()).PHP_EOL;
|
||||
}
|
||||
};
|
||||
|
||||
$account = new AdAccount($config->accountId);
|
||||
$reflection = new ReflectionClass($account);
|
||||
|
||||
foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
|
||||
if (
|
||||
strncasecmp($method->getName(), 'get', 3) !== 0
|
||||
|| preg_match('/@return\s+Cursor/', $method->getDocComment()) !== 1
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo sprintf(' > Fetching AdAccount::%s', $method->getName()).PHP_EOL;
|
||||
$clean_edge($method->getClosure($account));
|
||||
}
|
||||
112
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/create_phar.php
vendored
Normal file
112
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/create_phar.php
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
* form for use in connection with the web services and APIs provided by
|
||||
* Facebook.
|
||||
*
|
||||
* As with any software that integrates with the Facebook platform, your use
|
||||
* of this software is subject to the Facebook Developer Principles and
|
||||
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
||||
* shall be included in all copies or substantial portions of the software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace FacebookAdsBin;
|
||||
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
chdir(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR);
|
||||
|
||||
require_once 'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
|
||||
|
||||
// Options
|
||||
$include_autoloader = !in_array('--no-autoloader', $_SERVER['argv']);
|
||||
$compress_gzip = !in_array('--no-gzip', $_SERVER['argv']);
|
||||
|
||||
$alias = 'facebook-php-ads-sdk.phar';
|
||||
$build_dir = '.'.DIRECTORY_SEPARATOR.'builds'.DIRECTORY_SEPARATOR;
|
||||
$out = $build_dir.$alias;
|
||||
|
||||
if (!is_dir($build_dir)) {
|
||||
mkdir($build_dir);
|
||||
} else if (file_exists($out)) {
|
||||
unlink($out);
|
||||
}
|
||||
|
||||
$phar = new \Phar($out, 0, $alias);
|
||||
$phar->setSignatureAlgorithm(\Phar::SHA1);
|
||||
if ($compress_gzip) {
|
||||
$phar->compressFiles(\Phar::GZ);
|
||||
}
|
||||
$phar->startBuffering();
|
||||
$phar->addFile('LICENSE');
|
||||
|
||||
$finder = (new Finder())->files()
|
||||
->ignoreVCS(true)
|
||||
->name('*.php')
|
||||
->in('src');
|
||||
|
||||
foreach ($finder->getIterator() as $file) {
|
||||
$phar->addFile($file);
|
||||
}
|
||||
|
||||
$stub = <<<'EOF'
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
* form for use in connection with the web services and APIs provided by
|
||||
* Facebook.
|
||||
*
|
||||
* As with any software that integrates with the Facebook platform, your use
|
||||
* of this software is subject to the Facebook Developer Principles and
|
||||
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
||||
* shall be included in all copies or substantial portions of the software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
Phar::mapPhar('%s');
|
||||
|
||||
if (%d) {
|
||||
spl_autoload_register(function($class) {
|
||||
$prefix = 'FacebookAds\\';
|
||||
$base_dir = 'phar://%s/src/FacebookAds/';
|
||||
$len = strlen($prefix);
|
||||
if (strncmp($prefix, $class, $len) !== 0) {
|
||||
return;
|
||||
}
|
||||
$relative_class = substr($class, $len);
|
||||
$file = $base_dir.str_replace(
|
||||
'\\', DIRECTORY_SEPARATOR, $relative_class).'.php';
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
__HALT_COMPILER();
|
||||
EOF;
|
||||
|
||||
|
||||
$phar->setStub(sprintf($stub, $alias, $include_autoloader ? 1 : 0, $alias));
|
||||
$phar->stopBuffering();
|
||||
68
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/docsmith.php
vendored
Normal file
68
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/docsmith.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
* form for use in connection with the web services and APIs provided by
|
||||
* Facebook.
|
||||
*
|
||||
* As with any software that integrates with the Facebook platform, your use
|
||||
* of this software is subject to the Facebook Developer Principles and
|
||||
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
||||
* shall be included in all copies or substantial portions of the software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
use FacebookAdsTest\Bootstrap;
|
||||
use FacebookAdsDocsmith\Runner;
|
||||
use FacebookAdsDocsmith\Runner\ActionsEnum;
|
||||
use FacebookAdsDocsmith\Runner\OptionsEnum;
|
||||
use FacebookAdsTest\Bootstrap\IntegrationBootstrap;
|
||||
|
||||
$relative_path = getcwd();
|
||||
chdir(__DIR__);
|
||||
|
||||
/** @var IntegrationBootstrap $bootstrap */
|
||||
$bootstrap = require_once __DIR__.'/../docsmith/init_auto.php';
|
||||
|
||||
if ($argc < 3) {
|
||||
Runner::throwInvalidUsage("Insufficient number of arguments");
|
||||
}
|
||||
|
||||
$action = $argv[1];
|
||||
if (!ActionsEnum::getInstance()->isValidValue($action)) {
|
||||
Runner::throwInvalidUsage("Unknown action {$action}");
|
||||
}
|
||||
|
||||
$doc_path = $argv[2][0] == '/'
|
||||
? $argv[2]
|
||||
: realpath($relative_path.'/'.$argv[2]);
|
||||
|
||||
if (!file_exists($doc_path)) {
|
||||
Runner::throwInvalidUsage("Can't open {$doc_path} for reading");
|
||||
}
|
||||
|
||||
$opts = array_splice($argv, 3);
|
||||
$options = new ArrayObject(
|
||||
array_fill_keys(OptionsEnum::getInstance()->getValues(), false));
|
||||
|
||||
foreach ($opts as $opt) {
|
||||
$opt = substr($opt, 1);
|
||||
if (OptionsEnum::getInstance()->isValidValue($opt)) {
|
||||
$options->offsetSet($opt, true);
|
||||
}
|
||||
}
|
||||
|
||||
$runner = new Runner($doc_path, $action, $options);
|
||||
|
||||
exit($runner->run());
|
||||
34
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/get_version.php
vendored
Normal file
34
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/get_version.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
* form for use in connection with the web services and APIs provided by
|
||||
* Facebook.
|
||||
*
|
||||
* As with any software that integrates with the Facebook platform, your use
|
||||
* of this software is subject to the Facebook Developer Principles and
|
||||
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
||||
* shall be included in all copies or substantial portions of the software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
use \FacebookAdsDocsmith\Bootstrap\IntegrationBootstrap;
|
||||
use FacebookAds\Api;
|
||||
|
||||
chdir(__DIR__);
|
||||
|
||||
/** @var IntegrationBootstrap $bootstrap */
|
||||
$bootstrap = require_once __DIR__.'/../docsmith/init_stub.php';
|
||||
|
||||
echo sprintf('v%s', Api::init('', '', '')->getDefaultGraphVersion()).PHP_EOL;
|
||||
Reference in New Issue
Block a user