This repository was archived by the owner on Dec 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathmain.php
61 lines (52 loc) · 1.81 KB
/
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* PHP to C# Converter
* Converts the entire Facebook Ads SDK to C# classes in our code
*
* This program is meant to be run via the CLI interface but should work fine with
* a web-server as it doesn't use the stdin() method (yet).
*
* @author Luke Paris (Paradoxis) <luke@paradoxis.nl>
* @copyright (c) 2016 | Searchresult Performancemarketing
*/
// Define the converter constants as configuration
define("__SDK_CONVERTER__", true);
define("__DEBUG__", false);
// Include Facebook autoloader and API class
// Download these from the official Facebook Ads SDK page
// @see https://github.com/facebook/facebook-php-ads-sdk
require_once(__DIR__."/../../lib/FacebookAds/Api.php");
require_once(__DIR__."/../../lib/FacebookAds/autoload.php");
// Include classes
require_once(__DIR__."/SdkConverter/AbstractClassReader.php");
require_once(__DIR__."/SdkConverter/Object/MethodReader.php");
require_once(__DIR__."/SdkConverter/Object/ClassReader.php");
require_once(__DIR__."/SdkConverter/Fields/ClassReader.php");
require_once(__DIR__."/SdkConverter/Values/ClassReader.php");
require_once(__DIR__."/SdkConverter/Converter.php");
/**
* Gets standard input from the user
* PHP CLI input like a boss
* @return string
*/
function stdin() {
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
return trim($line);
}
/**
* Main entry point of the application
* @return void
*/
function main() {
/** Initialize the facebook ads API #dat hack */
/** @noinspection PhpUndefinedNamespaceInspection */
/** @noinspection PhpUndefinedClassInspection */
\FacebookAds\Api::init("", "", "");
// Generate a new instance of the converter and compile all classes
$converter = new \SdkConverter\Converter();
$converter->compile();
}
// Everything is initialized
// Awesome, run this baby
main();