Passed
Pull Request — master (#195)
by Jonathan
03:37
created
vendor/developerforce/force.com-toolkit-for-php/unit_test/runTest.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 
7 7
 // Define path to application directory
8 8
 defined('APP_PATH')
9
-    || define('APP_PATH', realpath(dirname(__FILE__)));
9
+	|| define('APP_PATH', realpath(dirname(__FILE__)));
10 10
 defined('LIB_PATH')
11
-    || define('LIB_PATH', realpath(dirname(__FILE__) . '/Lib'));
11
+	|| define('LIB_PATH', realpath(dirname(__FILE__) . '/Lib'));
12 12
     
13 13
 define('SOAP_BASEDIR', realpath(dirname(__FILE__) . '/..'));
14 14
 
15 15
 set_include_path(implode(PATH_SEPARATOR, array(
16
-    LIB_PATH,
17
-    SOAP_BASEDIR,
18
-    get_include_path(),
16
+	LIB_PATH,
17
+	SOAP_BASEDIR,
18
+	get_include_path(),
19 19
 )));
20 20
 
21 21
 function __autoload($className) {
22
-    $fullclasspath = "";
23
-    // get separated directories
24
-    $pathchunks=explode("_",$className);
22
+	$fullclasspath = "";
23
+	// get separated directories
24
+	$pathchunks=explode("_",$className);
25 25
 
26
-    //re-build path without last item
27
-    for($i=0; $i<(count($pathchunks)-1); $i++) {
28
-	    $fullclasspath .= $pathchunks[$i].'/';
29
-    }
26
+	//re-build path without last item
27
+	for($i=0; $i<(count($pathchunks)-1); $i++) {
28
+		$fullclasspath .= $pathchunks[$i].'/';
29
+	}
30 30
 
31 31
 //    require_once realpath(APP_PATH . '/' . $fullclasspath . $className . '.php');
32
-    require_once realpath(APP_PATH . '/' . $fullclasspath . '/' . substr($className, (strrpos($className, '_') + 1)) . '.php');
32
+	require_once realpath(APP_PATH . '/' . $fullclasspath . '/' . substr($className, (strrpos($className, '_') + 1)) . '.php');
33 33
 }
34 34
 
35 35
 $type = (int)$_GET['type'];
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@
 block discarded – undo
21 21
 function __autoload($className) {
22 22
     $fullclasspath = "";
23 23
     // get separated directories
24
-    $pathchunks=explode("_",$className);
24
+    $pathchunks = explode("_", $className);
25 25
 
26 26
     //re-build path without last item
27
-    for($i=0; $i<(count($pathchunks)-1); $i++) {
28
-	    $fullclasspath .= $pathchunks[$i].'/';
27
+    for ($i = 0; $i < (count($pathchunks) - 1); $i++) {
28
+	    $fullclasspath .= $pathchunks[$i] . '/';
29 29
     }
30 30
 
31 31
 //    require_once realpath(APP_PATH . '/' . $fullclasspath . $className . '.php');
32 32
     require_once realpath(APP_PATH . '/' . $fullclasspath . '/' . substr($className, (strrpos($className, '_') + 1)) . '.php');
33 33
 }
34 34
 
35
-$type = (int)$_GET['type'];
35
+$type = (int) $_GET['type'];
36 36
 $target = $_GET['target'];
37 37
 $testFactory = new Lib_Test_TestFactory(SOAP_BASEDIR, APP_PATH . '/test.log');
38 38
 $testFactory->run($type, $target);
Please login to merge, or discard this patch.
vendor/composer/autoload_static.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -6,47 +6,47 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInit9c397e0930797621ed4c4fa10b188a3a
8 8
 {
9
-    public static $files = array (
10
-        '712263cd6b22ec9ea795d59ae1ebda80' => __DIR__ . '/..' . '/prospress/action-scheduler/action-scheduler.php',
11
-    );
9
+	public static $files = array (
10
+		'712263cd6b22ec9ea795d59ae1ebda80' => __DIR__ . '/..' . '/prospress/action-scheduler/action-scheduler.php',
11
+	);
12 12
 
13
-    public static $classMap = array (
14
-        'AllowFieldTruncationHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
15
-        'AssignmentRuleHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
16
-        'CallOptions' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
17
-        'Email' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
18
-        'EmailHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
19
-        'LocaleOptions' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
20
-        'LoginScopeHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
21
-        'MassEmailMessage' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
22
-        'MruHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
23
-        'PackageVersion' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
24
-        'PackageVersionHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
25
-        'ProcessRequest' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
26
-        'ProcessSubmitRequest' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
27
-        'ProcessWorkitemRequest' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
28
-        'ProxySettings' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/ProxySettings.php',
29
-        'QueryOptions' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
30
-        'QueryResult' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
31
-        'SObject' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
32
-        'SforceBaseClient' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
33
-        'SforceCustomField' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetaObject.php',
34
-        'SforceCustomObject' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetaObject.php',
35
-        'SforceEnterpriseClient' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEnterpriseClient.php',
36
-        'SforceMetadataClient' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetadataClient.php',
37
-        'SforcePartnerClient' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php',
38
-        'SforceSearchResult' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
39
-        'SforceSoapClient' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php',
40
-        'SingleEmailMessage' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
41
-        'UserTerritoryDeleteHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
42
-        'WP_Logging' => __DIR__ . '/..' . '/pippinsplugins/wp-logging/WP_Logging.php',
43
-    );
13
+	public static $classMap = array (
14
+		'AllowFieldTruncationHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
15
+		'AssignmentRuleHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
16
+		'CallOptions' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
17
+		'Email' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
18
+		'EmailHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
19
+		'LocaleOptions' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
20
+		'LoginScopeHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
21
+		'MassEmailMessage' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
22
+		'MruHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
23
+		'PackageVersion' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
24
+		'PackageVersionHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
25
+		'ProcessRequest' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
26
+		'ProcessSubmitRequest' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
27
+		'ProcessWorkitemRequest' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
28
+		'ProxySettings' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/ProxySettings.php',
29
+		'QueryOptions' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
30
+		'QueryResult' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
31
+		'SObject' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
32
+		'SforceBaseClient' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
33
+		'SforceCustomField' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetaObject.php',
34
+		'SforceCustomObject' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetaObject.php',
35
+		'SforceEnterpriseClient' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEnterpriseClient.php',
36
+		'SforceMetadataClient' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetadataClient.php',
37
+		'SforcePartnerClient' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php',
38
+		'SforceSearchResult' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
39
+		'SforceSoapClient' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php',
40
+		'SingleEmailMessage' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
41
+		'UserTerritoryDeleteHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
42
+		'WP_Logging' => __DIR__ . '/..' . '/pippinsplugins/wp-logging/WP_Logging.php',
43
+	);
44 44
 
45
-    public static function getInitializer(ClassLoader $loader)
46
-    {
47
-        return \Closure::bind(function () use ($loader) {
48
-            $loader->classMap = ComposerStaticInit9c397e0930797621ed4c4fa10b188a3a::$classMap;
45
+	public static function getInitializer(ClassLoader $loader)
46
+	{
47
+		return \Closure::bind(function () use ($loader) {
48
+			$loader->classMap = ComposerStaticInit9c397e0930797621ed4c4fa10b188a3a::$classMap;
49 49
 
50
-        }, null, ClassLoader::class);
51
-    }
50
+		}, null, ClassLoader::class);
51
+	}
52 52
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@  discard block
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInit9c397e0930797621ed4c4fa10b188a3a
8 8
 {
9
-    public static $files = array (
9
+    public static $files = array(
10 10
         '712263cd6b22ec9ea795d59ae1ebda80' => __DIR__ . '/..' . '/prospress/action-scheduler/action-scheduler.php',
11 11
     );
12 12
 
13
-    public static $classMap = array (
13
+    public static $classMap = array(
14 14
         'AllowFieldTruncationHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
15 15
         'AssignmentRuleHeader' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
16 16
         'CallOptions' => __DIR__ . '/..' . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
     public static function getInitializer(ClassLoader $loader)
46 46
     {
47
-        return \Closure::bind(function () use ($loader) {
47
+        return \Closure::bind(function() use ($loader) {
48 48
             $loader->classMap = ComposerStaticInit9c397e0930797621ed4c4fa10b188a3a::$classMap;
49 49
 
50 50
         }, null, ClassLoader::class);
Please login to merge, or discard this patch.
vendor/composer/autoload_files.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = dirname($vendorDir);
7 7
 
8 8
 return array(
9
-    '712263cd6b22ec9ea795d59ae1ebda80' => $vendorDir . '/prospress/action-scheduler/action-scheduler.php',
9
+	'712263cd6b22ec9ea795d59ae1ebda80' => $vendorDir . '/prospress/action-scheduler/action-scheduler.php',
10 10
 );
Please login to merge, or discard this patch.
vendor/composer/autoload_real.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -4,67 +4,67 @@
 block discarded – undo
4 4
 
5 5
 class ComposerAutoloaderInit9c397e0930797621ed4c4fa10b188a3a
6 6
 {
7
-    private static $loader;
7
+	private static $loader;
8 8
 
9
-    public static function loadClassLoader($class)
10
-    {
11
-        if ('Composer\Autoload\ClassLoader' === $class) {
12
-            require __DIR__ . '/ClassLoader.php';
13
-        }
14
-    }
9
+	public static function loadClassLoader($class)
10
+	{
11
+		if ('Composer\Autoload\ClassLoader' === $class) {
12
+			require __DIR__ . '/ClassLoader.php';
13
+		}
14
+	}
15 15
 
16
-    public static function getLoader()
17
-    {
18
-        if (null !== self::$loader) {
19
-            return self::$loader;
20
-        }
16
+	public static function getLoader()
17
+	{
18
+		if (null !== self::$loader) {
19
+			return self::$loader;
20
+		}
21 21
 
22
-        spl_autoload_register(array('ComposerAutoloaderInit9c397e0930797621ed4c4fa10b188a3a', 'loadClassLoader'), true, true);
23
-        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
-        spl_autoload_unregister(array('ComposerAutoloaderInit9c397e0930797621ed4c4fa10b188a3a', 'loadClassLoader'));
22
+		spl_autoload_register(array('ComposerAutoloaderInit9c397e0930797621ed4c4fa10b188a3a', 'loadClassLoader'), true, true);
23
+		self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+		spl_autoload_unregister(array('ComposerAutoloaderInit9c397e0930797621ed4c4fa10b188a3a', 'loadClassLoader'));
25 25
 
26
-        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
-        if ($useStaticLoader) {
28
-            require_once __DIR__ . '/autoload_static.php';
26
+		$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
+		if ($useStaticLoader) {
28
+			require_once __DIR__ . '/autoload_static.php';
29 29
 
30
-            call_user_func(\Composer\Autoload\ComposerStaticInit9c397e0930797621ed4c4fa10b188a3a::getInitializer($loader));
31
-        } else {
32
-            $map = require __DIR__ . '/autoload_namespaces.php';
33
-            foreach ($map as $namespace => $path) {
34
-                $loader->set($namespace, $path);
35
-            }
30
+			call_user_func(\Composer\Autoload\ComposerStaticInit9c397e0930797621ed4c4fa10b188a3a::getInitializer($loader));
31
+		} else {
32
+			$map = require __DIR__ . '/autoload_namespaces.php';
33
+			foreach ($map as $namespace => $path) {
34
+				$loader->set($namespace, $path);
35
+			}
36 36
 
37
-            $map = require __DIR__ . '/autoload_psr4.php';
38
-            foreach ($map as $namespace => $path) {
39
-                $loader->setPsr4($namespace, $path);
40
-            }
37
+			$map = require __DIR__ . '/autoload_psr4.php';
38
+			foreach ($map as $namespace => $path) {
39
+				$loader->setPsr4($namespace, $path);
40
+			}
41 41
 
42
-            $classMap = require __DIR__ . '/autoload_classmap.php';
43
-            if ($classMap) {
44
-                $loader->addClassMap($classMap);
45
-            }
46
-        }
42
+			$classMap = require __DIR__ . '/autoload_classmap.php';
43
+			if ($classMap) {
44
+				$loader->addClassMap($classMap);
45
+			}
46
+		}
47 47
 
48
-        $loader->register(true);
48
+		$loader->register(true);
49 49
 
50
-        if ($useStaticLoader) {
51
-            $includeFiles = Composer\Autoload\ComposerStaticInit9c397e0930797621ed4c4fa10b188a3a::$files;
52
-        } else {
53
-            $includeFiles = require __DIR__ . '/autoload_files.php';
54
-        }
55
-        foreach ($includeFiles as $fileIdentifier => $file) {
56
-            composerRequire9c397e0930797621ed4c4fa10b188a3a($fileIdentifier, $file);
57
-        }
50
+		if ($useStaticLoader) {
51
+			$includeFiles = Composer\Autoload\ComposerStaticInit9c397e0930797621ed4c4fa10b188a3a::$files;
52
+		} else {
53
+			$includeFiles = require __DIR__ . '/autoload_files.php';
54
+		}
55
+		foreach ($includeFiles as $fileIdentifier => $file) {
56
+			composerRequire9c397e0930797621ed4c4fa10b188a3a($fileIdentifier, $file);
57
+		}
58 58
 
59
-        return $loader;
60
-    }
59
+		return $loader;
60
+	}
61 61
 }
62 62
 
63 63
 function composerRequire9c397e0930797621ed4c4fa10b188a3a($fileIdentifier, $file)
64 64
 {
65
-    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
-        require $file;
65
+	if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
+		require $file;
67 67
 
68
-        $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
69
-    }
68
+		$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
69
+	}
70 70
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24 24
         spl_autoload_unregister(array('ComposerAutoloaderInit9c397e0930797621ed4c4fa10b188a3a', 'loadClassLoader'));
25 25
 
26
-        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
26
+        $useStaticLoader = PHP_VERSION_ID >= 50600 && ! defined('HHVM_VERSION') && ( ! function_exists('zend_loader_file_encoded') || ! zend_loader_file_encoded());
27 27
         if ($useStaticLoader) {
28 28
             require_once __DIR__ . '/autoload_static.php';
29 29
 
Please login to merge, or discard this patch.
vendor/composer/ClassLoader.php 2 patches
Indentation   +391 added lines, -391 removed lines patch added patch discarded remove patch
@@ -42,396 +42,396 @@  discard block
 block discarded – undo
42 42
  */
43 43
 class ClassLoader
44 44
 {
45
-    // PSR-4
46
-    private $prefixLengthsPsr4 = array();
47
-    private $prefixDirsPsr4 = array();
48
-    private $fallbackDirsPsr4 = array();
49
-
50
-    // PSR-0
51
-    private $prefixesPsr0 = array();
52
-    private $fallbackDirsPsr0 = array();
53
-
54
-    private $useIncludePath = false;
55
-    private $classMap = array();
56
-    private $classMapAuthoritative = false;
57
-    private $missingClasses = array();
58
-    private $apcuPrefix;
59
-
60
-    public function getPrefixes()
61
-    {
62
-        if (!empty($this->prefixesPsr0)) {
63
-            return call_user_func_array('array_merge', $this->prefixesPsr0);
64
-        }
65
-
66
-        return array();
67
-    }
68
-
69
-    public function getPrefixesPsr4()
70
-    {
71
-        return $this->prefixDirsPsr4;
72
-    }
73
-
74
-    public function getFallbackDirs()
75
-    {
76
-        return $this->fallbackDirsPsr0;
77
-    }
78
-
79
-    public function getFallbackDirsPsr4()
80
-    {
81
-        return $this->fallbackDirsPsr4;
82
-    }
83
-
84
-    public function getClassMap()
85
-    {
86
-        return $this->classMap;
87
-    }
88
-
89
-    /**
90
-     * @param array $classMap Class to filename map
91
-     */
92
-    public function addClassMap(array $classMap)
93
-    {
94
-        if ($this->classMap) {
95
-            $this->classMap = array_merge($this->classMap, $classMap);
96
-        } else {
97
-            $this->classMap = $classMap;
98
-        }
99
-    }
100
-
101
-    /**
102
-     * Registers a set of PSR-0 directories for a given prefix, either
103
-     * appending or prepending to the ones previously set for this prefix.
104
-     *
105
-     * @param string       $prefix  The prefix
106
-     * @param array|string $paths   The PSR-0 root directories
107
-     * @param bool         $prepend Whether to prepend the directories
108
-     */
109
-    public function add($prefix, $paths, $prepend = false)
110
-    {
111
-        if (!$prefix) {
112
-            if ($prepend) {
113
-                $this->fallbackDirsPsr0 = array_merge(
114
-                    (array) $paths,
115
-                    $this->fallbackDirsPsr0
116
-                );
117
-            } else {
118
-                $this->fallbackDirsPsr0 = array_merge(
119
-                    $this->fallbackDirsPsr0,
120
-                    (array) $paths
121
-                );
122
-            }
123
-
124
-            return;
125
-        }
126
-
127
-        $first = $prefix[0];
128
-        if (!isset($this->prefixesPsr0[$first][$prefix])) {
129
-            $this->prefixesPsr0[$first][$prefix] = (array) $paths;
130
-
131
-            return;
132
-        }
133
-        if ($prepend) {
134
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
135
-                (array) $paths,
136
-                $this->prefixesPsr0[$first][$prefix]
137
-            );
138
-        } else {
139
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
140
-                $this->prefixesPsr0[$first][$prefix],
141
-                (array) $paths
142
-            );
143
-        }
144
-    }
145
-
146
-    /**
147
-     * Registers a set of PSR-4 directories for a given namespace, either
148
-     * appending or prepending to the ones previously set for this namespace.
149
-     *
150
-     * @param string       $prefix  The prefix/namespace, with trailing '\\'
151
-     * @param array|string $paths   The PSR-4 base directories
152
-     * @param bool         $prepend Whether to prepend the directories
153
-     *
154
-     * @throws \InvalidArgumentException
155
-     */
156
-    public function addPsr4($prefix, $paths, $prepend = false)
157
-    {
158
-        if (!$prefix) {
159
-            // Register directories for the root namespace.
160
-            if ($prepend) {
161
-                $this->fallbackDirsPsr4 = array_merge(
162
-                    (array) $paths,
163
-                    $this->fallbackDirsPsr4
164
-                );
165
-            } else {
166
-                $this->fallbackDirsPsr4 = array_merge(
167
-                    $this->fallbackDirsPsr4,
168
-                    (array) $paths
169
-                );
170
-            }
171
-        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
172
-            // Register directories for a new namespace.
173
-            $length = strlen($prefix);
174
-            if ('\\' !== $prefix[$length - 1]) {
175
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176
-            }
177
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
179
-        } elseif ($prepend) {
180
-            // Prepend directories for an already registered namespace.
181
-            $this->prefixDirsPsr4[$prefix] = array_merge(
182
-                (array) $paths,
183
-                $this->prefixDirsPsr4[$prefix]
184
-            );
185
-        } else {
186
-            // Append directories for an already registered namespace.
187
-            $this->prefixDirsPsr4[$prefix] = array_merge(
188
-                $this->prefixDirsPsr4[$prefix],
189
-                (array) $paths
190
-            );
191
-        }
192
-    }
193
-
194
-    /**
195
-     * Registers a set of PSR-0 directories for a given prefix,
196
-     * replacing any others previously set for this prefix.
197
-     *
198
-     * @param string       $prefix The prefix
199
-     * @param array|string $paths  The PSR-0 base directories
200
-     */
201
-    public function set($prefix, $paths)
202
-    {
203
-        if (!$prefix) {
204
-            $this->fallbackDirsPsr0 = (array) $paths;
205
-        } else {
206
-            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
207
-        }
208
-    }
209
-
210
-    /**
211
-     * Registers a set of PSR-4 directories for a given namespace,
212
-     * replacing any others previously set for this namespace.
213
-     *
214
-     * @param string       $prefix The prefix/namespace, with trailing '\\'
215
-     * @param array|string $paths  The PSR-4 base directories
216
-     *
217
-     * @throws \InvalidArgumentException
218
-     */
219
-    public function setPsr4($prefix, $paths)
220
-    {
221
-        if (!$prefix) {
222
-            $this->fallbackDirsPsr4 = (array) $paths;
223
-        } else {
224
-            $length = strlen($prefix);
225
-            if ('\\' !== $prefix[$length - 1]) {
226
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227
-            }
228
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
230
-        }
231
-    }
232
-
233
-    /**
234
-     * Turns on searching the include path for class files.
235
-     *
236
-     * @param bool $useIncludePath
237
-     */
238
-    public function setUseIncludePath($useIncludePath)
239
-    {
240
-        $this->useIncludePath = $useIncludePath;
241
-    }
242
-
243
-    /**
244
-     * Can be used to check if the autoloader uses the include path to check
245
-     * for classes.
246
-     *
247
-     * @return bool
248
-     */
249
-    public function getUseIncludePath()
250
-    {
251
-        return $this->useIncludePath;
252
-    }
253
-
254
-    /**
255
-     * Turns off searching the prefix and fallback directories for classes
256
-     * that have not been registered with the class map.
257
-     *
258
-     * @param bool $classMapAuthoritative
259
-     */
260
-    public function setClassMapAuthoritative($classMapAuthoritative)
261
-    {
262
-        $this->classMapAuthoritative = $classMapAuthoritative;
263
-    }
264
-
265
-    /**
266
-     * Should class lookup fail if not found in the current class map?
267
-     *
268
-     * @return bool
269
-     */
270
-    public function isClassMapAuthoritative()
271
-    {
272
-        return $this->classMapAuthoritative;
273
-    }
274
-
275
-    /**
276
-     * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
-     *
278
-     * @param string|null $apcuPrefix
279
-     */
280
-    public function setApcuPrefix($apcuPrefix)
281
-    {
282
-        $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283
-    }
284
-
285
-    /**
286
-     * The APCu prefix in use, or null if APCu caching is not enabled.
287
-     *
288
-     * @return string|null
289
-     */
290
-    public function getApcuPrefix()
291
-    {
292
-        return $this->apcuPrefix;
293
-    }
294
-
295
-    /**
296
-     * Registers this instance as an autoloader.
297
-     *
298
-     * @param bool $prepend Whether to prepend the autoloader or not
299
-     */
300
-    public function register($prepend = false)
301
-    {
302
-        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303
-    }
304
-
305
-    /**
306
-     * Unregisters this instance as an autoloader.
307
-     */
308
-    public function unregister()
309
-    {
310
-        spl_autoload_unregister(array($this, 'loadClass'));
311
-    }
312
-
313
-    /**
314
-     * Loads the given class or interface.
315
-     *
316
-     * @param  string    $class The name of the class
317
-     * @return bool|null True if loaded, null otherwise
318
-     */
319
-    public function loadClass($class)
320
-    {
321
-        if ($file = $this->findFile($class)) {
322
-            includeFile($file);
323
-
324
-            return true;
325
-        }
326
-    }
327
-
328
-    /**
329
-     * Finds the path to the file where the class is defined.
330
-     *
331
-     * @param string $class The name of the class
332
-     *
333
-     * @return string|false The path if found, false otherwise
334
-     */
335
-    public function findFile($class)
336
-    {
337
-        // class map lookup
338
-        if (isset($this->classMap[$class])) {
339
-            return $this->classMap[$class];
340
-        }
341
-        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
-            return false;
343
-        }
344
-        if (null !== $this->apcuPrefix) {
345
-            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
-            if ($hit) {
347
-                return $file;
348
-            }
349
-        }
350
-
351
-        $file = $this->findFileWithExtension($class, '.php');
352
-
353
-        // Search for Hack files if we are running on HHVM
354
-        if (false === $file && defined('HHVM_VERSION')) {
355
-            $file = $this->findFileWithExtension($class, '.hh');
356
-        }
357
-
358
-        if (null !== $this->apcuPrefix) {
359
-            apcu_add($this->apcuPrefix.$class, $file);
360
-        }
361
-
362
-        if (false === $file) {
363
-            // Remember that this class does not exist.
364
-            $this->missingClasses[$class] = true;
365
-        }
366
-
367
-        return $file;
368
-    }
369
-
370
-    private function findFileWithExtension($class, $ext)
371
-    {
372
-        // PSR-4 lookup
373
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374
-
375
-        $first = $class[0];
376
-        if (isset($this->prefixLengthsPsr4[$first])) {
377
-            $subPath = $class;
378
-            while (false !== $lastPos = strrpos($subPath, '\\')) {
379
-                $subPath = substr($subPath, 0, $lastPos);
380
-                $search = $subPath . '\\';
381
-                if (isset($this->prefixDirsPsr4[$search])) {
382
-                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
-                    foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
-                        if (file_exists($file = $dir . $pathEnd)) {
385
-                            return $file;
386
-                        }
387
-                    }
388
-                }
389
-            }
390
-        }
391
-
392
-        // PSR-4 fallback dirs
393
-        foreach ($this->fallbackDirsPsr4 as $dir) {
394
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
395
-                return $file;
396
-            }
397
-        }
398
-
399
-        // PSR-0 lookup
400
-        if (false !== $pos = strrpos($class, '\\')) {
401
-            // namespaced class name
402
-            $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
403
-                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404
-        } else {
405
-            // PEAR-like class name
406
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
407
-        }
408
-
409
-        if (isset($this->prefixesPsr0[$first])) {
410
-            foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411
-                if (0 === strpos($class, $prefix)) {
412
-                    foreach ($dirs as $dir) {
413
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
414
-                            return $file;
415
-                        }
416
-                    }
417
-                }
418
-            }
419
-        }
420
-
421
-        // PSR-0 fallback dirs
422
-        foreach ($this->fallbackDirsPsr0 as $dir) {
423
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
424
-                return $file;
425
-            }
426
-        }
427
-
428
-        // PSR-0 include paths.
429
-        if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430
-            return $file;
431
-        }
432
-
433
-        return false;
434
-    }
45
+	// PSR-4
46
+	private $prefixLengthsPsr4 = array();
47
+	private $prefixDirsPsr4 = array();
48
+	private $fallbackDirsPsr4 = array();
49
+
50
+	// PSR-0
51
+	private $prefixesPsr0 = array();
52
+	private $fallbackDirsPsr0 = array();
53
+
54
+	private $useIncludePath = false;
55
+	private $classMap = array();
56
+	private $classMapAuthoritative = false;
57
+	private $missingClasses = array();
58
+	private $apcuPrefix;
59
+
60
+	public function getPrefixes()
61
+	{
62
+		if (!empty($this->prefixesPsr0)) {
63
+			return call_user_func_array('array_merge', $this->prefixesPsr0);
64
+		}
65
+
66
+		return array();
67
+	}
68
+
69
+	public function getPrefixesPsr4()
70
+	{
71
+		return $this->prefixDirsPsr4;
72
+	}
73
+
74
+	public function getFallbackDirs()
75
+	{
76
+		return $this->fallbackDirsPsr0;
77
+	}
78
+
79
+	public function getFallbackDirsPsr4()
80
+	{
81
+		return $this->fallbackDirsPsr4;
82
+	}
83
+
84
+	public function getClassMap()
85
+	{
86
+		return $this->classMap;
87
+	}
88
+
89
+	/**
90
+	 * @param array $classMap Class to filename map
91
+	 */
92
+	public function addClassMap(array $classMap)
93
+	{
94
+		if ($this->classMap) {
95
+			$this->classMap = array_merge($this->classMap, $classMap);
96
+		} else {
97
+			$this->classMap = $classMap;
98
+		}
99
+	}
100
+
101
+	/**
102
+	 * Registers a set of PSR-0 directories for a given prefix, either
103
+	 * appending or prepending to the ones previously set for this prefix.
104
+	 *
105
+	 * @param string       $prefix  The prefix
106
+	 * @param array|string $paths   The PSR-0 root directories
107
+	 * @param bool         $prepend Whether to prepend the directories
108
+	 */
109
+	public function add($prefix, $paths, $prepend = false)
110
+	{
111
+		if (!$prefix) {
112
+			if ($prepend) {
113
+				$this->fallbackDirsPsr0 = array_merge(
114
+					(array) $paths,
115
+					$this->fallbackDirsPsr0
116
+				);
117
+			} else {
118
+				$this->fallbackDirsPsr0 = array_merge(
119
+					$this->fallbackDirsPsr0,
120
+					(array) $paths
121
+				);
122
+			}
123
+
124
+			return;
125
+		}
126
+
127
+		$first = $prefix[0];
128
+		if (!isset($this->prefixesPsr0[$first][$prefix])) {
129
+			$this->prefixesPsr0[$first][$prefix] = (array) $paths;
130
+
131
+			return;
132
+		}
133
+		if ($prepend) {
134
+			$this->prefixesPsr0[$first][$prefix] = array_merge(
135
+				(array) $paths,
136
+				$this->prefixesPsr0[$first][$prefix]
137
+			);
138
+		} else {
139
+			$this->prefixesPsr0[$first][$prefix] = array_merge(
140
+				$this->prefixesPsr0[$first][$prefix],
141
+				(array) $paths
142
+			);
143
+		}
144
+	}
145
+
146
+	/**
147
+	 * Registers a set of PSR-4 directories for a given namespace, either
148
+	 * appending or prepending to the ones previously set for this namespace.
149
+	 *
150
+	 * @param string       $prefix  The prefix/namespace, with trailing '\\'
151
+	 * @param array|string $paths   The PSR-4 base directories
152
+	 * @param bool         $prepend Whether to prepend the directories
153
+	 *
154
+	 * @throws \InvalidArgumentException
155
+	 */
156
+	public function addPsr4($prefix, $paths, $prepend = false)
157
+	{
158
+		if (!$prefix) {
159
+			// Register directories for the root namespace.
160
+			if ($prepend) {
161
+				$this->fallbackDirsPsr4 = array_merge(
162
+					(array) $paths,
163
+					$this->fallbackDirsPsr4
164
+				);
165
+			} else {
166
+				$this->fallbackDirsPsr4 = array_merge(
167
+					$this->fallbackDirsPsr4,
168
+					(array) $paths
169
+				);
170
+			}
171
+		} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
172
+			// Register directories for a new namespace.
173
+			$length = strlen($prefix);
174
+			if ('\\' !== $prefix[$length - 1]) {
175
+				throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176
+			}
177
+			$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178
+			$this->prefixDirsPsr4[$prefix] = (array) $paths;
179
+		} elseif ($prepend) {
180
+			// Prepend directories for an already registered namespace.
181
+			$this->prefixDirsPsr4[$prefix] = array_merge(
182
+				(array) $paths,
183
+				$this->prefixDirsPsr4[$prefix]
184
+			);
185
+		} else {
186
+			// Append directories for an already registered namespace.
187
+			$this->prefixDirsPsr4[$prefix] = array_merge(
188
+				$this->prefixDirsPsr4[$prefix],
189
+				(array) $paths
190
+			);
191
+		}
192
+	}
193
+
194
+	/**
195
+	 * Registers a set of PSR-0 directories for a given prefix,
196
+	 * replacing any others previously set for this prefix.
197
+	 *
198
+	 * @param string       $prefix The prefix
199
+	 * @param array|string $paths  The PSR-0 base directories
200
+	 */
201
+	public function set($prefix, $paths)
202
+	{
203
+		if (!$prefix) {
204
+			$this->fallbackDirsPsr0 = (array) $paths;
205
+		} else {
206
+			$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
207
+		}
208
+	}
209
+
210
+	/**
211
+	 * Registers a set of PSR-4 directories for a given namespace,
212
+	 * replacing any others previously set for this namespace.
213
+	 *
214
+	 * @param string       $prefix The prefix/namespace, with trailing '\\'
215
+	 * @param array|string $paths  The PSR-4 base directories
216
+	 *
217
+	 * @throws \InvalidArgumentException
218
+	 */
219
+	public function setPsr4($prefix, $paths)
220
+	{
221
+		if (!$prefix) {
222
+			$this->fallbackDirsPsr4 = (array) $paths;
223
+		} else {
224
+			$length = strlen($prefix);
225
+			if ('\\' !== $prefix[$length - 1]) {
226
+				throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227
+			}
228
+			$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229
+			$this->prefixDirsPsr4[$prefix] = (array) $paths;
230
+		}
231
+	}
232
+
233
+	/**
234
+	 * Turns on searching the include path for class files.
235
+	 *
236
+	 * @param bool $useIncludePath
237
+	 */
238
+	public function setUseIncludePath($useIncludePath)
239
+	{
240
+		$this->useIncludePath = $useIncludePath;
241
+	}
242
+
243
+	/**
244
+	 * Can be used to check if the autoloader uses the include path to check
245
+	 * for classes.
246
+	 *
247
+	 * @return bool
248
+	 */
249
+	public function getUseIncludePath()
250
+	{
251
+		return $this->useIncludePath;
252
+	}
253
+
254
+	/**
255
+	 * Turns off searching the prefix and fallback directories for classes
256
+	 * that have not been registered with the class map.
257
+	 *
258
+	 * @param bool $classMapAuthoritative
259
+	 */
260
+	public function setClassMapAuthoritative($classMapAuthoritative)
261
+	{
262
+		$this->classMapAuthoritative = $classMapAuthoritative;
263
+	}
264
+
265
+	/**
266
+	 * Should class lookup fail if not found in the current class map?
267
+	 *
268
+	 * @return bool
269
+	 */
270
+	public function isClassMapAuthoritative()
271
+	{
272
+		return $this->classMapAuthoritative;
273
+	}
274
+
275
+	/**
276
+	 * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
+	 *
278
+	 * @param string|null $apcuPrefix
279
+	 */
280
+	public function setApcuPrefix($apcuPrefix)
281
+	{
282
+		$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283
+	}
284
+
285
+	/**
286
+	 * The APCu prefix in use, or null if APCu caching is not enabled.
287
+	 *
288
+	 * @return string|null
289
+	 */
290
+	public function getApcuPrefix()
291
+	{
292
+		return $this->apcuPrefix;
293
+	}
294
+
295
+	/**
296
+	 * Registers this instance as an autoloader.
297
+	 *
298
+	 * @param bool $prepend Whether to prepend the autoloader or not
299
+	 */
300
+	public function register($prepend = false)
301
+	{
302
+		spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303
+	}
304
+
305
+	/**
306
+	 * Unregisters this instance as an autoloader.
307
+	 */
308
+	public function unregister()
309
+	{
310
+		spl_autoload_unregister(array($this, 'loadClass'));
311
+	}
312
+
313
+	/**
314
+	 * Loads the given class or interface.
315
+	 *
316
+	 * @param  string    $class The name of the class
317
+	 * @return bool|null True if loaded, null otherwise
318
+	 */
319
+	public function loadClass($class)
320
+	{
321
+		if ($file = $this->findFile($class)) {
322
+			includeFile($file);
323
+
324
+			return true;
325
+		}
326
+	}
327
+
328
+	/**
329
+	 * Finds the path to the file where the class is defined.
330
+	 *
331
+	 * @param string $class The name of the class
332
+	 *
333
+	 * @return string|false The path if found, false otherwise
334
+	 */
335
+	public function findFile($class)
336
+	{
337
+		// class map lookup
338
+		if (isset($this->classMap[$class])) {
339
+			return $this->classMap[$class];
340
+		}
341
+		if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
+			return false;
343
+		}
344
+		if (null !== $this->apcuPrefix) {
345
+			$file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
+			if ($hit) {
347
+				return $file;
348
+			}
349
+		}
350
+
351
+		$file = $this->findFileWithExtension($class, '.php');
352
+
353
+		// Search for Hack files if we are running on HHVM
354
+		if (false === $file && defined('HHVM_VERSION')) {
355
+			$file = $this->findFileWithExtension($class, '.hh');
356
+		}
357
+
358
+		if (null !== $this->apcuPrefix) {
359
+			apcu_add($this->apcuPrefix.$class, $file);
360
+		}
361
+
362
+		if (false === $file) {
363
+			// Remember that this class does not exist.
364
+			$this->missingClasses[$class] = true;
365
+		}
366
+
367
+		return $file;
368
+	}
369
+
370
+	private function findFileWithExtension($class, $ext)
371
+	{
372
+		// PSR-4 lookup
373
+		$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374
+
375
+		$first = $class[0];
376
+		if (isset($this->prefixLengthsPsr4[$first])) {
377
+			$subPath = $class;
378
+			while (false !== $lastPos = strrpos($subPath, '\\')) {
379
+				$subPath = substr($subPath, 0, $lastPos);
380
+				$search = $subPath . '\\';
381
+				if (isset($this->prefixDirsPsr4[$search])) {
382
+					$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
+					foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+						if (file_exists($file = $dir . $pathEnd)) {
385
+							return $file;
386
+						}
387
+					}
388
+				}
389
+			}
390
+		}
391
+
392
+		// PSR-4 fallback dirs
393
+		foreach ($this->fallbackDirsPsr4 as $dir) {
394
+			if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
395
+				return $file;
396
+			}
397
+		}
398
+
399
+		// PSR-0 lookup
400
+		if (false !== $pos = strrpos($class, '\\')) {
401
+			// namespaced class name
402
+			$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
403
+				. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404
+		} else {
405
+			// PEAR-like class name
406
+			$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
407
+		}
408
+
409
+		if (isset($this->prefixesPsr0[$first])) {
410
+			foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411
+				if (0 === strpos($class, $prefix)) {
412
+					foreach ($dirs as $dir) {
413
+						if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
414
+							return $file;
415
+						}
416
+					}
417
+				}
418
+			}
419
+		}
420
+
421
+		// PSR-0 fallback dirs
422
+		foreach ($this->fallbackDirsPsr0 as $dir) {
423
+			if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
424
+				return $file;
425
+			}
426
+		}
427
+
428
+		// PSR-0 include paths.
429
+		if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430
+			return $file;
431
+		}
432
+
433
+		return false;
434
+	}
435 435
 }
436 436
 
437 437
 /**
@@ -441,5 +441,5 @@  discard block
 block discarded – undo
441 441
  */
442 442
 function includeFile($file)
443 443
 {
444
-    include $file;
444
+	include $file;
445 445
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
     public function getPrefixes()
61 61
     {
62
-        if (!empty($this->prefixesPsr0)) {
62
+        if ( ! empty($this->prefixesPsr0)) {
63 63
             return call_user_func_array('array_merge', $this->prefixesPsr0);
64 64
         }
65 65
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function add($prefix, $paths, $prepend = false)
110 110
     {
111
-        if (!$prefix) {
111
+        if ( ! $prefix) {
112 112
             if ($prepend) {
113 113
                 $this->fallbackDirsPsr0 = array_merge(
114 114
                     (array) $paths,
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         }
126 126
 
127 127
         $first = $prefix[0];
128
-        if (!isset($this->prefixesPsr0[$first][$prefix])) {
128
+        if ( ! isset($this->prefixesPsr0[$first][$prefix])) {
129 129
             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
130 130
 
131 131
             return;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      */
156 156
     public function addPsr4($prefix, $paths, $prepend = false)
157 157
     {
158
-        if (!$prefix) {
158
+        if ( ! $prefix) {
159 159
             // Register directories for the root namespace.
160 160
             if ($prepend) {
161 161
                 $this->fallbackDirsPsr4 = array_merge(
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                     (array) $paths
169 169
                 );
170 170
             }
171
-        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
171
+        } elseif ( ! isset($this->prefixDirsPsr4[$prefix])) {
172 172
             // Register directories for a new namespace.
173 173
             $length = strlen($prefix);
174 174
             if ('\\' !== $prefix[$length - 1]) {
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function set($prefix, $paths)
202 202
     {
203
-        if (!$prefix) {
203
+        if ( ! $prefix) {
204 204
             $this->fallbackDirsPsr0 = (array) $paths;
205 205
         } else {
206 206
             $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      */
219 219
     public function setPsr4($prefix, $paths)
220 220
     {
221
-        if (!$prefix) {
221
+        if ( ! $prefix) {
222 222
             $this->fallbackDirsPsr4 = (array) $paths;
223 223
         } else {
224 224
             $length = strlen($prefix);
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             return false;
343 343
         }
344 344
         if (null !== $this->apcuPrefix) {
345
-            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
345
+            $file = apcu_fetch($this->apcuPrefix . $class, $hit);
346 346
             if ($hit) {
347 347
                 return $file;
348 348
             }
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
         }
357 357
 
358 358
         if (null !== $this->apcuPrefix) {
359
-            apcu_add($this->apcuPrefix.$class, $file);
359
+            apcu_add($this->apcuPrefix . $class, $file);
360 360
         }
361 361
 
362 362
         if (false === $file) {
Please login to merge, or discard this patch.
vendor/composer/autoload_classmap.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -6,33 +6,33 @@
 block discarded – undo
6 6
 $baseDir = dirname($vendorDir);
7 7
 
8 8
 return array(
9
-    'AllowFieldTruncationHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
10
-    'AssignmentRuleHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
11
-    'CallOptions' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
12
-    'Email' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
13
-    'EmailHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
14
-    'LocaleOptions' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
15
-    'LoginScopeHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
16
-    'MassEmailMessage' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
17
-    'MruHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
18
-    'PackageVersion' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
19
-    'PackageVersionHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
20
-    'ProcessRequest' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
21
-    'ProcessSubmitRequest' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
22
-    'ProcessWorkitemRequest' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
23
-    'ProxySettings' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/ProxySettings.php',
24
-    'QueryOptions' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
25
-    'QueryResult' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
26
-    'SObject' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
27
-    'SforceBaseClient' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
28
-    'SforceCustomField' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetaObject.php',
29
-    'SforceCustomObject' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetaObject.php',
30
-    'SforceEnterpriseClient' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEnterpriseClient.php',
31
-    'SforceMetadataClient' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetadataClient.php',
32
-    'SforcePartnerClient' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php',
33
-    'SforceSearchResult' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
34
-    'SforceSoapClient' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php',
35
-    'SingleEmailMessage' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
36
-    'UserTerritoryDeleteHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
37
-    'WP_Logging' => $vendorDir . '/pippinsplugins/wp-logging/WP_Logging.php',
9
+	'AllowFieldTruncationHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
10
+	'AssignmentRuleHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
11
+	'CallOptions' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
12
+	'Email' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
13
+	'EmailHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
14
+	'LocaleOptions' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
15
+	'LoginScopeHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
16
+	'MassEmailMessage' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
17
+	'MruHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
18
+	'PackageVersion' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
19
+	'PackageVersionHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
20
+	'ProcessRequest' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
21
+	'ProcessSubmitRequest' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
22
+	'ProcessWorkitemRequest' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceProcessRequest.php',
23
+	'ProxySettings' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/ProxySettings.php',
24
+	'QueryOptions' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
25
+	'QueryResult' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
26
+	'SObject' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
27
+	'SforceBaseClient' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
28
+	'SforceCustomField' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetaObject.php',
29
+	'SforceCustomObject' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetaObject.php',
30
+	'SforceEnterpriseClient' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEnterpriseClient.php',
31
+	'SforceMetadataClient' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceMetadataClient.php',
32
+	'SforcePartnerClient' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php',
33
+	'SforceSearchResult' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceBaseClient.php',
34
+	'SforceSoapClient' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php',
35
+	'SingleEmailMessage' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceEmail.php',
36
+	'UserTerritoryDeleteHeader' => $vendorDir . '/developerforce/force.com-toolkit-for-php/soapclient/SforceHeaderOptions.php',
37
+	'WP_Logging' => $vendorDir . '/pippinsplugins/wp-logging/WP_Logging.php',
38 38
 );
Please login to merge, or discard this patch.
templates/admin/fieldmaps-add-edit-clone.php 1 patch
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -1,35 +1,35 @@  discard block
 block discarded – undo
1
-<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" class="fieldmap">
2
-	<input type="hidden" name="redirect_url_error" value="<?php echo esc_url( $error_url ); ?>" />
3
-	<input type="hidden" name="redirect_url_success" value="<?php echo esc_url( $success_url ); ?>" />
4
-	<?php if ( isset( $transient ) ) { ?>
5
-	<input type="hidden" name="transient" value="<?php echo esc_html( $transient ); ?>" />
1
+<form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" class="fieldmap">
2
+	<input type="hidden" name="redirect_url_error" value="<?php echo esc_url($error_url); ?>" />
3
+	<input type="hidden" name="redirect_url_success" value="<?php echo esc_url($success_url); ?>" />
4
+	<?php if (isset($transient)) { ?>
5
+	<input type="hidden" name="transient" value="<?php echo esc_html($transient); ?>" />
6 6
 	<?php } ?>
7 7
 	<input type="hidden" name="action" value="post_fieldmap" >
8
-	<input type="hidden" name="method" value="<?php echo esc_attr( $method ); ?>" />
9
-	<?php if ( 'edit' === $method ) { ?>
10
-	<input type="hidden" name="id" value="<?php echo absint( $map['id'] ); ?>" />
8
+	<input type="hidden" name="method" value="<?php echo esc_attr($method); ?>" />
9
+	<?php if ('edit' === $method) { ?>
10
+	<input type="hidden" name="id" value="<?php echo absint($map['id']); ?>" />
11 11
 	<?php } ?>
12 12
 	<div class="fieldmap_label">
13
-		<label for="label"><?php echo esc_html__( 'Label', 'object-sync-for-salesforce' ); ?>: </label>
14
-		<input type="text" id="label" name="label" required value="<?php echo isset( $label ) ? esc_html( $label ) : ''; ?>" />
13
+		<label for="label"><?php echo esc_html__('Label', 'object-sync-for-salesforce'); ?>: </label>
14
+		<input type="text" id="label" name="label" required value="<?php echo isset($label) ? esc_html($label) : ''; ?>" />
15 15
 	</div>
16 16
 	<fieldset class="wordpress_side">
17 17
 		<div class="wordpress_object">
18
-			<label for="wordpress_object"><?php echo esc_html__( 'WordPress Object', 'object-sync-for-salesforce' ); ?>: </label>
18
+			<label for="wordpress_object"><?php echo esc_html__('WordPress Object', 'object-sync-for-salesforce'); ?>: </label>
19 19
 			<select id="wordpress_object" name="wordpress_object" required>
20
-				<option value="">- <?php echo esc_html__( 'Select object type', 'object-sync-for-salesforce' ); ?> -</option>
20
+				<option value="">- <?php echo esc_html__('Select object type', 'object-sync-for-salesforce'); ?> -</option>
21 21
 				<?php
22 22
 				$wordpress_objects = $this->wordpress->wordpress_objects;
23
-				foreach ( $wordpress_objects as $object ) {
24
-					if ( isset( $wordpress_object ) && $wordpress_object === $object ) {
23
+				foreach ($wordpress_objects as $object) {
24
+					if (isset($wordpress_object) && $wordpress_object === $object) {
25 25
 						$selected = ' selected';
26 26
 					} else {
27 27
 						$selected = '';
28 28
 					}
29
-					echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
30
-						esc_html( $object ),
31
-						esc_attr( $selected ),
32
-						esc_html( $object )
29
+					echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
30
+						esc_html($object),
31
+						esc_attr($selected),
32
+						esc_html($object)
33 33
 					);
34 34
 				}
35 35
 				?>
@@ -38,31 +38,31 @@  discard block
 block discarded – undo
38 38
 	</fieldset>
39 39
 	<fieldset class="salesforce_side">
40 40
 		<div class="salesforce_object">
41
-			<label for="salesforce_object"><?php echo esc_html__( 'Salesforce Object', 'object-sync-for-salesforce' ); ?>: </label>
41
+			<label for="salesforce_object"><?php echo esc_html__('Salesforce Object', 'object-sync-for-salesforce'); ?>: </label>
42 42
 			<div class="spinner"></div>
43 43
 			<select id="salesforce_object" name="salesforce_object" required>
44
-				<option value="">- <?php echo esc_html__( 'Select object type', 'object-sync-for-salesforce' ); ?> -</option>
44
+				<option value="">- <?php echo esc_html__('Select object type', 'object-sync-for-salesforce'); ?> -</option>
45 45
 				<?php
46 46
 				$sfapi          = $this->salesforce['sfapi'];
47
-				$object_filters = maybe_unserialize( get_option( 'salesforce_api_object_filters' ), array() );
47
+				$object_filters = maybe_unserialize(get_option('salesforce_api_object_filters'), array());
48 48
 				$conditions     = array();
49
-				if ( is_array( $object_filters ) && in_array( 'updateable', $object_filters, true ) ) {
49
+				if (is_array($object_filters) && in_array('updateable', $object_filters, true)) {
50 50
 					$conditions['updateable'] = true;
51 51
 				}
52
-				if ( is_array( $object_filters ) && in_array( 'triggerable', $object_filters, true ) ) {
52
+				if (is_array($object_filters) && in_array('triggerable', $object_filters, true)) {
53 53
 					$conditions['triggerable'] = true;
54 54
 				}
55
-				$salesforce_objects = $sfapi->objects( $conditions );
56
-				foreach ( $salesforce_objects as $object ) {
57
-					if ( isset( $salesforce_object ) && $salesforce_object === $object['name'] ) {
55
+				$salesforce_objects = $sfapi->objects($conditions);
56
+				foreach ($salesforce_objects as $object) {
57
+					if (isset($salesforce_object) && $salesforce_object === $object['name']) {
58 58
 						$selected = ' selected';
59 59
 					} else {
60 60
 						$selected = '';
61 61
 					}
62
-					echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
63
-						esc_html( $object['name'] ),
64
-						esc_attr( $selected ),
65
-						esc_html( $object['label'] )
62
+					echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
63
+						esc_html($object['name']),
64
+						esc_attr($selected),
65
+						esc_html($object['label'])
66 66
 					);
67 67
 				}
68 68
 				?>
@@ -70,30 +70,30 @@  discard block
 block discarded – undo
70 70
 		</div>
71 71
 		<div class="salesforce_record_types_allowed">
72 72
 			<?php
73
-			if ( isset( $salesforce_record_types_allowed ) ) :
73
+			if (isset($salesforce_record_types_allowed)) :
74 74
 				$record_types = $this->get_salesforce_object_description(
75 75
 					array(
76 76
 						'salesforce_object' => $salesforce_object,
77 77
 						'include'           => 'recordTypeInfos',
78 78
 					)
79 79
 				);
80
-				if ( isset( $record_types['recordTypeInfos'] ) ) :
80
+				if (isset($record_types['recordTypeInfos'])) :
81 81
 					?>
82
-					<label for="salesforce_record_types_allowed"><?php echo __( 'Allowed Record Types', 'object-sync-for-salesforce' ); ?>:</label>
82
+					<label for="salesforce_record_types_allowed"><?php echo __('Allowed Record Types', 'object-sync-for-salesforce'); ?>:</label>
83 83
 					<div class="checkboxes">
84
-					<?php foreach ( $record_types['recordTypeInfos'] as $key => $value ) : ?>
84
+					<?php foreach ($record_types['recordTypeInfos'] as $key => $value) : ?>
85 85
 						<?php
86
-						if ( in_array( $key, $salesforce_record_types_allowed, true ) ) {
86
+						if (in_array($key, $salesforce_record_types_allowed, true)) {
87 87
 							$checked = ' checked';
88 88
 						} else {
89 89
 							$checked = '';
90 90
 						}
91
-						echo sprintf( '<label><input type="checkbox" class="form-checkbox" value="%1$s" name="%2$s" id="%3$s"%4$s>%5$s</label>',
92
-							esc_html( $key ),
93
-							esc_attr( 'salesforce_record_types_allowed[' . $key . ']' ),
94
-							esc_attr( 'salesforce_record_types_allowed-' . $key ),
95
-							esc_html( $checked ),
96
-							esc_html( $value )
91
+						echo sprintf('<label><input type="checkbox" class="form-checkbox" value="%1$s" name="%2$s" id="%3$s"%4$s>%5$s</label>',
92
+							esc_html($key),
93
+							esc_attr('salesforce_record_types_allowed[' . $key . ']'),
94
+							esc_attr('salesforce_record_types_allowed-' . $key),
95
+							esc_html($checked),
96
+							esc_html($value)
97 97
 						);
98 98
 						?>
99 99
 					<?php endforeach; ?>
@@ -103,29 +103,29 @@  discard block
 block discarded – undo
103 103
 		</div>
104 104
 		<div class="salesforce_record_type_default">
105 105
 			<?php
106
-			if ( isset( $salesforce_record_type_default ) ) :
106
+			if (isset($salesforce_record_type_default)) :
107 107
 				$record_types = $this->get_salesforce_object_description(
108 108
 					array(
109 109
 						'salesforce_object' => $salesforce_object,
110 110
 						'include'           => 'recordTypeInfos',
111 111
 					)
112 112
 				);
113
-				if ( isset( $record_types['recordTypeInfos'] ) ) :
113
+				if (isset($record_types['recordTypeInfos'])) :
114 114
 					?>
115
-					<label for="salesforce_record_type_default"><?php echo __( 'Default Record Type', 'object-sync-for-salesforce' ); ?>:</label>
116
-					<select id="salesforce_record_type_default" name="salesforce_record_type_default" required><option value="">- <?php echo __( 'Select record type', 'object-sync-for-salesforce' ); ?> -</option>
115
+					<label for="salesforce_record_type_default"><?php echo __('Default Record Type', 'object-sync-for-salesforce'); ?>:</label>
116
+					<select id="salesforce_record_type_default" name="salesforce_record_type_default" required><option value="">- <?php echo __('Select record type', 'object-sync-for-salesforce'); ?> -</option>
117 117
 					<?php
118
-					foreach ( $record_types['recordTypeInfos'] as $key => $value ) :
119
-						if ( isset( $salesforce_record_type_default ) && $salesforce_record_type_default === $key ) {
118
+					foreach ($record_types['recordTypeInfos'] as $key => $value) :
119
+						if (isset($salesforce_record_type_default) && $salesforce_record_type_default === $key) {
120 120
 							$selected = ' selected';
121 121
 						} else {
122 122
 							$selected = '';
123 123
 						}
124
-						if ( ! isset( $salesforce_record_types_allowed ) || in_array( $key, $salesforce_record_types_allowed, true ) ) {
125
-							echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
126
-								esc_attr( $key ),
127
-								esc_attr( $selected ),
128
-								esc_html( $value )
124
+						if ( ! isset($salesforce_record_types_allowed) || in_array($key, $salesforce_record_types_allowed, true)) {
125
+							echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
126
+								esc_attr($key),
127
+								esc_attr($selected),
128
+								esc_html($value)
129 129
 							);
130 130
 						}
131 131
 					endforeach;
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 			?>
138 138
 		</div>
139 139
 		<div class="pull_trigger_field">
140
-			<?php if ( isset( $pull_trigger_field ) ) : ?>
141
-				<label for="pull_trigger_field"><?php echo __( 'Date field to trigger pull', 'object-sync-for-salesforce' ); ?>:</label>
140
+			<?php if (isset($pull_trigger_field)) : ?>
141
+				<label for="pull_trigger_field"><?php echo __('Date field to trigger pull', 'object-sync-for-salesforce'); ?>:</label>
142 142
 				<?php
143 143
 				$object_fields = $this->get_salesforce_object_fields(
144 144
 					array(
@@ -149,35 +149,35 @@  discard block
 block discarded – undo
149 149
 				?>
150 150
 				<select name="pull_trigger_field" id="pull_trigger_field">
151 151
 				<?php
152
-				foreach ( $object_fields as $key => $value ) {
153
-					if ( $pull_trigger_field === $value['name'] ) {
152
+				foreach ($object_fields as $key => $value) {
153
+					if ($pull_trigger_field === $value['name']) {
154 154
 						$selected = ' selected';
155 155
 					} else {
156 156
 						$selected = '';
157 157
 					}
158
-					echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
159
-						esc_attr( $value['name'] ),
160
-						esc_attr( $selected ),
161
-						esc_html( $value['label'] )
158
+					echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
159
+						esc_attr($value['name']),
160
+						esc_attr($selected),
161
+						esc_html($value['label'])
162 162
 					);
163 163
 				}
164 164
 				?>
165 165
 				</select>
166
-				<p class="description"><?php echo esc_html__( 'When the plugin checks for data to bring from Salesforce into WordPress, it will use the selected field to determine what relevant changes have occurred in Salesforce.', 'object-sync-for-salesforce' ); ?></p>
166
+				<p class="description"><?php echo esc_html__('When the plugin checks for data to bring from Salesforce into WordPress, it will use the selected field to determine what relevant changes have occurred in Salesforce.', 'object-sync-for-salesforce'); ?></p>
167 167
 			<?php endif; ?>
168 168
 		</div>
169 169
 	</fieldset>
170 170
 	<fieldset class="fields">
171
-		<legend><?php echo esc_html__( 'Fieldmap', 'object-sync-for-salesforce' ); ?></legend>
171
+		<legend><?php echo esc_html__('Fieldmap', 'object-sync-for-salesforce'); ?></legend>
172 172
 		<table class="wp-list-table widefat striped fields">
173 173
 			<thead>
174 174
 				<tr>
175
-					<th class="column-wordpress_field"><?php echo esc_html__( 'WordPress Field', 'object-sync-for-salesforce' ); ?></th>
176
-					<th class="column-salesforce_field"><?php echo esc_html__( 'Salesforce Field', 'object-sync-for-salesforce' ); ?></th>
177
-					<th class="column-is_prematch"><?php echo esc_html__( 'Prematch', 'object-sync-for-salesforce' ); ?></th>
178
-					<th class="column-is_key"><?php echo esc_html__( 'Salesforce Key', 'object-sync-for-salesforce' ); ?></th>
179
-					<th class="column-direction"><?php echo esc_html__( 'Direction', 'object-sync-for-salesforce' ); ?></th>
180
-					<th class="column-is_delete"><?php echo esc_html__( 'Delete', 'object-sync-for-salesforce' ); ?></th>
175
+					<th class="column-wordpress_field"><?php echo esc_html__('WordPress Field', 'object-sync-for-salesforce'); ?></th>
176
+					<th class="column-salesforce_field"><?php echo esc_html__('Salesforce Field', 'object-sync-for-salesforce'); ?></th>
177
+					<th class="column-is_prematch"><?php echo esc_html__('Prematch', 'object-sync-for-salesforce'); ?></th>
178
+					<th class="column-is_key"><?php echo esc_html__('Salesforce Key', 'object-sync-for-salesforce'); ?></th>
179
+					<th class="column-direction"><?php echo esc_html__('Direction', 'object-sync-for-salesforce'); ?></th>
180
+					<th class="column-is_delete"><?php echo esc_html__('Delete', 'object-sync-for-salesforce'); ?></th>
181 181
 				</tr>
182 182
 			</thead>
183 183
 			<tfoot>
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 						<p><small>
187 187
 							<?php
188 188
 							// translators: the placeholders refer to: 1) the cache clear link, 2) the cache clear link text
189
-							echo sprintf( '<strong>' . esc_html__( 'Note:', 'object-sync-for-salesforce' ) . '</strong>' . esc_html__( ' to map a custom meta field (such as wp_postmeta, wp_usermeta, wp_termmeta, etc.), WordPress must have at least one value for that field. If you add a new meta field and want to map it, make sure to add a value for it and ', 'object-sync-for-salesforce' ) . '<a href="%1$s" id="clear-sfwp-cache">%2$s</a>' . esc_html__( ' to see the field listed here', 'object-sync-for-salesforce' ),
190
-								esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=clear_cache' ) ),
191
-								esc_html__( 'clear the plugin cache', 'object-sync-for-salesforce' )
189
+							echo sprintf('<strong>' . esc_html__('Note:', 'object-sync-for-salesforce') . '</strong>' . esc_html__(' to map a custom meta field (such as wp_postmeta, wp_usermeta, wp_termmeta, etc.), WordPress must have at least one value for that field. If you add a new meta field and want to map it, make sure to add a value for it and ', 'object-sync-for-salesforce') . '<a href="%1$s" id="clear-sfwp-cache">%2$s</a>' . esc_html__(' to see the field listed here', 'object-sync-for-salesforce'),
190
+								esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=clear_cache')),
191
+								esc_html__('clear the plugin cache', 'object-sync-for-salesforce')
192 192
 							);
193 193
 							?>
194 194
 						</small></p>
@@ -197,26 +197,26 @@  discard block
 block discarded – undo
197 197
 			</tfoot>
198 198
 			<tbody>
199 199
 				<?php
200
-				if ( isset( $fieldmap_fields ) && null !== $fieldmap_fields && is_array( $fieldmap_fields ) ) {
201
-					foreach ( $fieldmap_fields as $key => $value ) {
202
-						$key = md5( $key . time() );
200
+				if (isset($fieldmap_fields) && null !== $fieldmap_fields && is_array($fieldmap_fields)) {
201
+					foreach ($fieldmap_fields as $key => $value) {
202
+						$key = md5($key . time());
203 203
 				?>
204 204
 				<tr>
205 205
 					<td class="column-wordpress_field">
206
-						<select name="wordpress_field[<?php echo esc_attr( $key ); ?>]" id="wordpress_field-<?php echo esc_attr( $key ); ?>">
207
-							<option value="">- <?php echo esc_html__( 'Select WordPress field', 'object-sync-for-salesforce' ); ?> -</option>
206
+						<select name="wordpress_field[<?php echo esc_attr($key); ?>]" id="wordpress_field-<?php echo esc_attr($key); ?>">
207
+							<option value="">- <?php echo esc_html__('Select WordPress field', 'object-sync-for-salesforce'); ?> -</option>
208 208
 							<?php
209
-							$wordpress_fields = $this->get_wordpress_object_fields( $wordpress_object );
210
-							foreach ( $wordpress_fields as $wordpress_field ) {
211
-								if ( isset( $value['wordpress_field']['label'] ) && $value['wordpress_field']['label'] === $wordpress_field['key'] ) {
209
+							$wordpress_fields = $this->get_wordpress_object_fields($wordpress_object);
210
+							foreach ($wordpress_fields as $wordpress_field) {
211
+								if (isset($value['wordpress_field']['label']) && $value['wordpress_field']['label'] === $wordpress_field['key']) {
212 212
 									$selected = ' selected';
213 213
 								} else {
214 214
 									$selected = '';
215 215
 								}
216
-								echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
217
-									esc_attr( $wordpress_field['key'] ),
218
-									esc_attr( $selected ),
219
-									esc_html( $wordpress_field['key'] )
216
+								echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
217
+									esc_attr($wordpress_field['key']),
218
+									esc_attr($selected),
219
+									esc_html($wordpress_field['key'])
220 220
 								);
221 221
 							}
222 222
 							?>
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 
225 225
 					</td>
226 226
 					<td class="column-salesforce_field">
227
-						<select name="salesforce_field[<?php echo esc_attr( $key ); ?>]" id="salesforce_field-<?php echo esc_attr( $key ); ?>">
228
-							<option value="">- <?php echo esc_html__( 'Select Salesforce field', 'object-sync-for-salesforce' ); ?> -</option>
227
+						<select name="salesforce_field[<?php echo esc_attr($key); ?>]" id="salesforce_field-<?php echo esc_attr($key); ?>">
228
+							<option value="">- <?php echo esc_html__('Select Salesforce field', 'object-sync-for-salesforce'); ?> -</option>
229 229
 							<?php
230 230
 							$salesforce_fields = $this->get_salesforce_object_fields(
231 231
 								array(
@@ -233,25 +233,25 @@  discard block
 block discarded – undo
233 233
 								)
234 234
 							);
235 235
 							// allow for api name or field label to be the display value in the <select>
236
-							$display_value = get_option( $this->option_prefix . 'salesforce_field_display_value', 'field_label' );
237
-							foreach ( $salesforce_fields as $salesforce_field ) {
238
-								if ( isset( $value['salesforce_field']['name'] ) && $value['salesforce_field']['name'] === $salesforce_field['name'] ) {
236
+							$display_value = get_option($this->option_prefix . 'salesforce_field_display_value', 'field_label');
237
+							foreach ($salesforce_fields as $salesforce_field) {
238
+								if (isset($value['salesforce_field']['name']) && $value['salesforce_field']['name'] === $salesforce_field['name']) {
239 239
 									$selected = ' selected';
240
-								} elseif ( isset( $value['salesforce_field']['label'] ) && $value['salesforce_field']['label'] === $salesforce_field['name'] ) {
240
+								} elseif (isset($value['salesforce_field']['label']) && $value['salesforce_field']['label'] === $salesforce_field['name']) {
241 241
 									// this conditional is for versions up to 1.1.2, but i think it's fine to leave it for now. if we remove it, people's fieldmaps will not show correctly in the admin.
242 242
 									$selected = ' selected';
243 243
 								} else {
244 244
 									$selected = '';
245 245
 								}
246 246
 
247
-								if ( 'api_name' === $display_value ) {
247
+								if ('api_name' === $display_value) {
248 248
 									$salesforce_field['label'] = $salesforce_field['name'];
249 249
 								}
250 250
 
251
-								echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
252
-									esc_attr( $salesforce_field['name'] ),
253
-									esc_attr( $selected ),
254
-									esc_html( $salesforce_field['label'] )
251
+								echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
252
+									esc_attr($salesforce_field['name']),
253
+									esc_attr($selected),
254
+									esc_html($salesforce_field['label'])
255 255
 								);
256 256
 							}
257 257
 							?>
@@ -260,32 +260,32 @@  discard block
 block discarded – undo
260 260
 					</td>
261 261
 					<td class="column-is_prematch">
262 262
 						<?php
263
-						if ( isset( $value['is_prematch'] ) && '1' === $value['is_prematch'] ) {
263
+						if (isset($value['is_prematch']) && '1' === $value['is_prematch']) {
264 264
 							$checked = ' checked';
265 265
 						} else {
266 266
 							$checked = '';
267 267
 						}
268 268
 						?>
269
-						<input type="checkbox" name="is_prematch[<?php echo esc_attr( $key ); ?>]" id="is_prematch-<?php echo esc_attr( $key ); ?>" value="1" <?php echo esc_attr( $checked ); ?> title="<?php echo esc_html__( 'This pair should be checked for existing matches in Salesforce before adding', 'object-sync-for-salesforce' ); ?>" />
269
+						<input type="checkbox" name="is_prematch[<?php echo esc_attr($key); ?>]" id="is_prematch-<?php echo esc_attr($key); ?>" value="1" <?php echo esc_attr($checked); ?> title="<?php echo esc_html__('This pair should be checked for existing matches in Salesforce before adding', 'object-sync-for-salesforce'); ?>" />
270 270
 					</td>
271 271
 					<td class="column-is_key">
272 272
 						<?php
273
-						if ( isset( $value['is_key'] ) && '1' === $value['is_key'] ) {
273
+						if (isset($value['is_key']) && '1' === $value['is_key']) {
274 274
 							$checked = ' checked';
275 275
 						} else {
276 276
 							$checked = '';
277 277
 						}
278 278
 						?>
279
-						<input type="checkbox" name="is_key[<?php echo esc_attr( $key ); ?>]" id="is_key-<?php echo esc_attr( $key ); ?>" value="1" <?php echo esc_attr( $checked ); ?> title="<?php echo esc_html__( 'This Salesforce field is an External ID in Salesforce', 'object-sync-for-salesforce' ); ?>" />
279
+						<input type="checkbox" name="is_key[<?php echo esc_attr($key); ?>]" id="is_key-<?php echo esc_attr($key); ?>" value="1" <?php echo esc_attr($checked); ?> title="<?php echo esc_html__('This Salesforce field is an External ID in Salesforce', 'object-sync-for-salesforce'); ?>" />
280 280
 					</td>
281 281
 					<td class="column-direction">
282 282
 						<?php
283
-						if ( isset( $value['direction'] ) ) {
284
-							if ( 'sf_wp' === $value['direction'] ) {
283
+						if (isset($value['direction'])) {
284
+							if ('sf_wp' === $value['direction']) {
285 285
 								$checked_sf_wp = ' checked';
286 286
 								$checked_wp_sf = '';
287 287
 								$checked_sync  = '';
288
-							} elseif ( 'wp_sf' === $value['direction'] ) {
288
+							} elseif ('wp_sf' === $value['direction']) {
289 289
 								$checked_sf_wp = '';
290 290
 								$checked_wp_sf = ' checked';
291 291
 								$checked_sync  = '';
@@ -301,29 +301,29 @@  discard block
 block discarded – undo
301 301
 						}
302 302
 						?>
303 303
 						<div class="radios">
304
-							<label><input type="radio" value="sf_wp" name="direction[<?php echo esc_attr( $key ); ?>]" id="direction-<?php echo esc_attr( $key ); ?>-sf-wp" <?php echo esc_attr( $checked_sf_wp ); ?> required> <?php echo esc_html__( 'Salesforce to WordPress', 'object-sync-for-salesforce' ); ?></label>
305
-							<label><input type="radio" value="wp_sf" name="direction[<?php echo esc_attr( $key ); ?>]" id="direction-<?php echo esc_attr( $key ); ?>-wp-sf" <?php echo esc_attr( $checked_wp_sf ); ?> required> <?php echo esc_html__( 'WordPress to Salesforce', 'object-sync-for-salesforce' ); ?></label>
306
-							<label><input type="radio" value="sync" name="direction[<?php echo esc_attr( $key ); ?>]" id="direction-<?php echo esc_attr( $key ); ?>-sync" <?php echo esc_attr( $checked_sync ); ?> required> <?php echo esc_html__( 'Sync', 'object-sync-for-salesforce' ); ?></label>
304
+							<label><input type="radio" value="sf_wp" name="direction[<?php echo esc_attr($key); ?>]" id="direction-<?php echo esc_attr($key); ?>-sf-wp" <?php echo esc_attr($checked_sf_wp); ?> required> <?php echo esc_html__('Salesforce to WordPress', 'object-sync-for-salesforce'); ?></label>
305
+							<label><input type="radio" value="wp_sf" name="direction[<?php echo esc_attr($key); ?>]" id="direction-<?php echo esc_attr($key); ?>-wp-sf" <?php echo esc_attr($checked_wp_sf); ?> required> <?php echo esc_html__('WordPress to Salesforce', 'object-sync-for-salesforce'); ?></label>
306
+							<label><input type="radio" value="sync" name="direction[<?php echo esc_attr($key); ?>]" id="direction-<?php echo esc_attr($key); ?>-sync" <?php echo esc_attr($checked_sync); ?> required> <?php echo esc_html__('Sync', 'object-sync-for-salesforce'); ?></label>
307 307
 						</div>
308 308
 					</td>
309 309
 					<td class="column-is_delete">
310
-						<input type="checkbox" name="is_delete[<?php echo esc_attr( $key ); ?>]" id="is_delete-<?php echo esc_attr( $key ); ?>" value="1" />
310
+						<input type="checkbox" name="is_delete[<?php echo esc_attr($key); ?>]" id="is_delete-<?php echo esc_attr($key); ?>" value="1" />
311 311
 					</td>
312 312
 				</tr>
313 313
 				<?php
314 314
 					} // End foreach().
315
-				} elseif ( isset( $wordpress_object ) && isset( $salesforce_object ) ) {
315
+				} elseif (isset($wordpress_object) && isset($salesforce_object)) {
316 316
 				?>
317 317
 				<tr>
318 318
 					<td class="column-wordpress_field">
319 319
 						<select name="wordpress_field[0]" id="wordpress_field-0">
320
-							<option value="">- <?php echo esc_html__( 'Select WordPress field', 'object-sync-for-salesforce' ); ?> -</option>
320
+							<option value="">- <?php echo esc_html__('Select WordPress field', 'object-sync-for-salesforce'); ?> -</option>
321 321
 							<?php
322
-							$wordpress_fields = $this->get_wordpress_object_fields( $wordpress_object );
323
-							foreach ( $wordpress_fields as $wordpress_field ) {
324
-								echo sprintf( '<option value="%1$s">%2$s</option>',
325
-									esc_attr( $wordpress_field['key'] ),
326
-									esc_html( $wordpress_field['key'] )
322
+							$wordpress_fields = $this->get_wordpress_object_fields($wordpress_object);
323
+							foreach ($wordpress_fields as $wordpress_field) {
324
+								echo sprintf('<option value="%1$s">%2$s</option>',
325
+									esc_attr($wordpress_field['key']),
326
+									esc_html($wordpress_field['key'])
327 327
 								);
328 328
 							}
329 329
 							?>
@@ -331,17 +331,17 @@  discard block
 block discarded – undo
331 331
 					</td>
332 332
 					<td class="column-salesforce_field">
333 333
 						<select name="salesforce_field[0]" id="salesforce_field-0">
334
-							<option value="">- <?php echo esc_html__( 'Select Salesforce field', 'object-sync-for-salesforce' ); ?> -</option>
334
+							<option value="">- <?php echo esc_html__('Select Salesforce field', 'object-sync-for-salesforce'); ?> -</option>
335 335
 							<?php
336 336
 							$salesforce_fields = $this->get_salesforce_object_fields(
337 337
 								array(
338 338
 									'salesforce_object' => $salesforce_object,
339 339
 								)
340 340
 							);
341
-							foreach ( $salesforce_fields as $salesforce_field ) {
342
-								echo sprintf( '<option value="%1$s">%2$s</option>',
343
-									esc_attr( $salesforce_field['name'] ),
344
-									esc_html( $salesforce_field['label'] )
341
+							foreach ($salesforce_fields as $salesforce_field) {
342
+								echo sprintf('<option value="%1$s">%2$s</option>',
343
+									esc_attr($salesforce_field['name']),
344
+									esc_html($salesforce_field['label'])
345 345
 								);
346 346
 							}
347 347
 							?>
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
 					</td>
356 356
 					<td class="column-direction">
357 357
 						<div class="radios">
358
-							<label><input type="radio" value="sf_wp" name="direction[0]" id="direction-0-sf-wp" required> <?php echo esc_html__( 'Salesforce to WordPress', 'object-sync-for-salesforce' ); ?></label>
359
-							<label><input type="radio" value="wp_sf" name="direction[0]" id="direction-0-wp-sf" required> <?php echo esc_html__( 'WordPress to Salesforce', 'object-sync-for-salesforce' ); ?></label>
360
-							<label><input type="radio" value="sync" name="direction[0]" id="direction-0-sync" required checked> <?php echo esc_html__( 'Sync', 'object-sync-for-salesforce' ); ?></label>
358
+							<label><input type="radio" value="sf_wp" name="direction[0]" id="direction-0-sf-wp" required> <?php echo esc_html__('Salesforce to WordPress', 'object-sync-for-salesforce'); ?></label>
359
+							<label><input type="radio" value="wp_sf" name="direction[0]" id="direction-0-wp-sf" required> <?php echo esc_html__('WordPress to Salesforce', 'object-sync-for-salesforce'); ?></label>
360
+							<label><input type="radio" value="sync" name="direction[0]" id="direction-0-sync" required checked> <?php echo esc_html__('Sync', 'object-sync-for-salesforce'); ?></label>
361 361
 						</div>
362 362
 					</td>
363 363
 					<td class="column-is_delete">
@@ -371,17 +371,17 @@  discard block
 block discarded – undo
371 371
 		</table>
372 372
 		<!--<div class="spinner"></div>-->
373 373
 		<?php
374
-		if ( isset( $fieldmap_fields ) && null !== $fieldmap_fields ) {
375
-			$add_button_label = esc_html__( 'Add another field mapping', 'object-sync-for-salesforce' );
374
+		if (isset($fieldmap_fields) && null !== $fieldmap_fields) {
375
+			$add_button_label = esc_html__('Add another field mapping', 'object-sync-for-salesforce');
376 376
 		} else {
377
-			$add_button_label = esc_html__( 'Add field mapping', 'object-sync-for-salesforce' );
377
+			$add_button_label = esc_html__('Add field mapping', 'object-sync-for-salesforce');
378 378
 		}
379 379
 		?>
380 380
 		<p><button type="button" id="add-field-mapping" class="button button-secondary"><?php echo $add_button_label; ?></button></p>
381
-		<p class="description"><?php echo esc_html__( 'Prematch tells the plugin to match records that have the same value before sending data to Salesforce. Salesforce Key indicates the Salesforce field is an External ID. If either of these is checked, the plugin will do an UPSERT to avoid duplicate data when possible.', 'object-sync-for-salesforce' ); ?></p>
381
+		<p class="description"><?php echo esc_html__('Prematch tells the plugin to match records that have the same value before sending data to Salesforce. Salesforce Key indicates the Salesforce field is an External ID. If either of these is checked, the plugin will do an UPSERT to avoid duplicate data when possible.', 'object-sync-for-salesforce'); ?></p>
382 382
 	</fieldset>
383 383
 	<fieldset class="sync_triggers">
384
-		<legend><?php echo esc_html__( 'Action triggers', 'object-sync-for-salesforce' ); ?></legend>
384
+		<legend><?php echo esc_html__('Action triggers', 'object-sync-for-salesforce'); ?></legend>
385 385
 		<div class="checkboxes">
386 386
 			<?php
387 387
 			$wordpress_create_checked  = '';
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
 			$salesforce_create_checked = '';
391 391
 			$salesforce_update_checked = '';
392 392
 			$salesforce_delete_checked = '';
393
-			if ( isset( $sync_triggers ) && is_array( $sync_triggers ) ) {
394
-				foreach ( $sync_triggers as $trigger ) {
395
-					switch ( $trigger ) {
393
+			if (isset($sync_triggers) && is_array($sync_triggers)) {
394
+				foreach ($sync_triggers as $trigger) {
395
+					switch ($trigger) {
396 396
 						case $this->mappings->sync_wordpress_create:
397 397
 							$wordpress_create_checked = ' checked';
398 398
 							break;
@@ -415,31 +415,31 @@  discard block
 block discarded – undo
415 415
 				}
416 416
 			}
417 417
 			?>
418
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_wordpress_create ); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-create" <?php echo esc_attr( $wordpress_create_checked ); ?>><?php echo esc_html__( 'WordPress create', 'object-sync-for-salesforce' ); ?></label>
419
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_wordpress_update ); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-update" <?php echo esc_attr( $wordpress_update_checked ); ?>><?php echo esc_html__( 'WordPress update', 'object-sync-for-salesforce' ); ?></label>
420
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_wordpress_delete ); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-delete" <?php echo esc_attr( $wordpress_delete_checked ); ?>><?php echo esc_html__( 'WordPress delete', 'object-sync-for-salesforce' ); ?></label>
421
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_sf_create ); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-create" <?php echo esc_attr( $salesforce_create_checked ); ?>><?php echo esc_html__( 'Salesforce create', 'object-sync-for-salesforce' ); ?></label>
422
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_sf_update ); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-update" <?php echo esc_attr( $salesforce_update_checked ); ?>><?php echo esc_html__( 'Salesforce update', 'object-sync-for-salesforce' ); ?></label>
423
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_sf_delete ); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-delete" <?php echo esc_attr( $salesforce_delete_checked ); ?>><?php echo esc_html__( 'Salesforce delete', 'object-sync-for-salesforce' ); ?></label>
418
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_wordpress_create); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-create" <?php echo esc_attr($wordpress_create_checked); ?>><?php echo esc_html__('WordPress create', 'object-sync-for-salesforce'); ?></label>
419
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_wordpress_update); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-update" <?php echo esc_attr($wordpress_update_checked); ?>><?php echo esc_html__('WordPress update', 'object-sync-for-salesforce'); ?></label>
420
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_wordpress_delete); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-delete" <?php echo esc_attr($wordpress_delete_checked); ?>><?php echo esc_html__('WordPress delete', 'object-sync-for-salesforce'); ?></label>
421
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_sf_create); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-create" <?php echo esc_attr($salesforce_create_checked); ?>><?php echo esc_html__('Salesforce create', 'object-sync-for-salesforce'); ?></label>
422
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_sf_update); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-update" <?php echo esc_attr($salesforce_update_checked); ?>><?php echo esc_html__('Salesforce update', 'object-sync-for-salesforce'); ?></label>
423
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_sf_delete); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-delete" <?php echo esc_attr($salesforce_delete_checked); ?>><?php echo esc_html__('Salesforce delete', 'object-sync-for-salesforce'); ?></label>
424 424
 			<p class="description">
425 425
 				<?php
426 426
 				// translators: placeholders are for the class names: salesforce_push and salesforce_pull
427
-				echo sprintf( esc_html__( 'Select which actions on WordPress objects and Salesforce objects should trigger a synchronization. These settings are used by the %1$s and %2$s classes respectively.', 'object-sync-for-salesforce' ), '<code>salesforce_push</code>', '<code>salesforce_pull</code>' );
427
+				echo sprintf(esc_html__('Select which actions on WordPress objects and Salesforce objects should trigger a synchronization. These settings are used by the %1$s and %2$s classes respectively.', 'object-sync-for-salesforce'), '<code>salesforce_push</code>', '<code>salesforce_pull</code>');
428 428
 				?>
429 429
 			</p>
430 430
 		</div>
431 431
 		<div class="checkboxes">
432
-			<label><input type="checkbox" name="push_async" id="process-async" value="1" <?php echo isset( $push_async ) && '1' === $push_async ? ' checked' : ''; ?>><?php echo esc_html__( 'Process asynchronously', 'object-sync-for-salesforce' ); ?></label>
432
+			<label><input type="checkbox" name="push_async" id="process-async" value="1" <?php echo isset($push_async) && '1' === $push_async ? ' checked' : ''; ?>><?php echo esc_html__('Process asynchronously', 'object-sync-for-salesforce'); ?></label>
433 433
 			<p class="description">
434 434
 				<?php
435 435
 				// translators: placeholder is for WordPress cron method name
436
-				echo sprintf( esc_html__( 'If selected, push data will be queued for processing and synchronized when %s is run. This may increase site performance, but changes will not be reflected in real time.', 'object-sync-for-salesforce' ), '<code>wp_cron</code>' );
436
+				echo sprintf(esc_html__('If selected, push data will be queued for processing and synchronized when %s is run. This may increase site performance, but changes will not be reflected in real time.', 'object-sync-for-salesforce'), '<code>wp_cron</code>');
437 437
 				?>
438 438
 			</p>
439 439
 		</div>
440 440
 		<div class="checkboxes">
441
-			<label><input type="checkbox" name="push_drafts" id="push-drafts" value="1" <?php echo isset( $push_drafts ) && '1' === $push_drafts ? ' checked' : ''; ?>><?php echo esc_html__( 'Push drafts', 'object-sync-for-salesforce' ); ?></label>
442
-			<p class="description"><?php echo esc_html__( 'If selected, WordPress will send drafts of this object type (if it creates drafts for it) to Salesforce.', 'object-sync-for-salesforce' ); ?></p>
441
+			<label><input type="checkbox" name="push_drafts" id="push-drafts" value="1" <?php echo isset($push_drafts) && '1' === $push_drafts ? ' checked' : ''; ?>><?php echo esc_html__('Push drafts', 'object-sync-for-salesforce'); ?></label>
442
+			<p class="description"><?php echo esc_html__('If selected, WordPress will send drafts of this object type (if it creates drafts for it) to Salesforce.', 'object-sync-for-salesforce'); ?></p>
443 443
 		</div>
444 444
 		<?php
445 445
 		/*
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	<?php
459 459
 		submit_button(
460 460
 			// translators: the placeholder refers to the currently selected method (add, edit, or clone)
461
-			sprintf( esc_html__( '%1$s fieldmap', 'object-sync-for-salesforce' ), ucfirst( $method ) )
461
+			sprintf(esc_html__('%1$s fieldmap', 'object-sync-for-salesforce'), ucfirst($method))
462 462
 		);
463 463
 	?>
464 464
 </form>
Please login to merge, or discard this patch.
classes/admin.php 2 patches
Indentation   +240 added lines, -240 removed lines patch added patch discarded remove patch
@@ -27,63 +27,63 @@  discard block
 block discarded – undo
27 27
 	protected $queue;
28 28
 
29 29
 	/**
30
-	* @var string
31
-	* Default path for the Salesforce authorize URL
32
-	*/
30
+	 * @var string
31
+	 * Default path for the Salesforce authorize URL
32
+	 */
33 33
 	public $default_authorize_url_path;
34 34
 
35 35
 	/**
36
-	* @var string
37
-	* Default path for the Salesforce token URL
38
-	*/
36
+	 * @var string
37
+	 * Default path for the Salesforce token URL
38
+	 */
39 39
 	public $default_token_url_path;
40 40
 
41 41
 	/**
42
-	* @var string
43
-	* What version of the Salesforce API should be the default on the settings screen.
44
-	* Users can edit this, but they won't see a correct list of all their available versions until WordPress has
45
-	* been authenticated with Salesforce.
46
-	*/
42
+	 * @var string
43
+	 * What version of the Salesforce API should be the default on the settings screen.
44
+	 * Users can edit this, but they won't see a correct list of all their available versions until WordPress has
45
+	 * been authenticated with Salesforce.
46
+	 */
47 47
 	public $default_api_version;
48 48
 
49 49
 	/**
50
-	* @var bool
51
-	* Default for whether to limit to triggerable items
52
-	* Users can edit this
53
-	*/
50
+	 * @var bool
51
+	 * Default for whether to limit to triggerable items
52
+	 * Users can edit this
53
+	 */
54 54
 	public $default_triggerable;
55 55
 
56 56
 	/**
57
-	* @var bool
58
-	* Default for whether to limit to updateable items
59
-	* Users can edit this
60
-	*/
57
+	 * @var bool
58
+	 * Default for whether to limit to updateable items
59
+	 * Users can edit this
60
+	 */
61 61
 	public $default_updateable;
62 62
 
63 63
 	/**
64
-	* @var int
65
-	* Default pull throttle for how often Salesforce can pull
66
-	* Users can edit this
67
-	*/
64
+	 * @var int
65
+	 * Default pull throttle for how often Salesforce can pull
66
+	 * Users can edit this
67
+	 */
68 68
 	public $default_pull_throttle;
69 69
 
70 70
 	/**
71
-	* Constructor which sets up admin pages
72
-	*
73
-	* @param object $wpdb
74
-	* @param string $version
75
-	* @param array $login_credentials
76
-	* @param string $slug
77
-	* @param object $wordpress
78
-	* @param object $salesforce
79
-	* @param object $mappings
80
-	* @param object $push
81
-	* @param object $pull
82
-	* @param object $logging
83
-	* @param array $schedulable_classes
84
-	* @param object $queue
85
-	* @throws \Exception
86
-	*/
71
+	 * Constructor which sets up admin pages
72
+	 *
73
+	 * @param object $wpdb
74
+	 * @param string $version
75
+	 * @param array $login_credentials
76
+	 * @param string $slug
77
+	 * @param object $wordpress
78
+	 * @param object $salesforce
79
+	 * @param object $mappings
80
+	 * @param object $push
81
+	 * @param object $pull
82
+	 * @param object $logging
83
+	 * @param array $schedulable_classes
84
+	 * @param object $queue
85
+	 * @throws \Exception
86
+	 */
87 87
 	public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes, $queue ) {
88 88
 		$this->wpdb                = $wpdb;
89 89
 		$this->version             = $version;
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	}
121 121
 
122 122
 	/**
123
-	* Create the action hooks to create the admin page(s)
124
-	*
125
-	*/
123
+	 * Create the action hooks to create the admin page(s)
124
+	 *
125
+	 */
126 126
 	public function add_actions() {
127 127
 		add_action( 'admin_init', array( $this, 'salesforce_settings_forms' ) );
128 128
 		add_action( 'admin_init', array( $this, 'notices' ) );
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 	}
158 158
 
159 159
 	/**
160
-	* Recurring task to check Salesforce for data
161
-	*
162
-	*/
160
+	 * Recurring task to check Salesforce for data
161
+	 *
162
+	 */
163 163
 	public function change_action_schedule( $old_schedule, $new_schedule, $option_name ) {
164 164
 
165 165
 		// exit if nothing changed
@@ -195,21 +195,21 @@  discard block
 block discarded – undo
195 195
 	}
196 196
 
197 197
 	/**
198
-	* Create WordPress admin options page
199
-	*
200
-	*/
198
+	 * Create WordPress admin options page
199
+	 *
200
+	 */
201 201
 	public function create_admin_menu() {
202 202
 		$title = __( 'Salesforce', 'object-sync-for-salesforce' );
203 203
 		add_options_page( $title, $title, 'configure_salesforce', 'object-sync-salesforce-admin', array( $this, 'show_admin_page' ) );
204 204
 	}
205 205
 
206 206
 	/**
207
-	* Render full admin pages in WordPress
208
-	* This allows other plugins to add tabs to the Salesforce settings screen
209
-	*
210
-	* todo: better front end: html, organization of html into templates, css, js
211
-	*
212
-	*/
207
+	 * Render full admin pages in WordPress
208
+	 * This allows other plugins to add tabs to the Salesforce settings screen
209
+	 *
210
+	 * todo: better front end: html, organization of html into templates, css, js
211
+	 *
212
+	 */
213 213
 	public function show_admin_page() {
214 214
 		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
215 215
 		echo '<div class="wrap">';
@@ -419,10 +419,10 @@  discard block
 block discarded – undo
419 419
 	}
420 420
 
421 421
 	/**
422
-	* Create default WordPress admin settings form for salesforce
423
-	* This is for the Settings page/tab
424
-	*
425
-	*/
422
+	 * Create default WordPress admin settings form for salesforce
423
+	 * This is for the Settings page/tab
424
+	 *
425
+	 */
426 426
 	public function salesforce_settings_forms() {
427 427
 		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
428 428
 		$page     = isset( $get_data['tab'] ) ? sanitize_key( $get_data['tab'] ) : 'settings';
@@ -447,13 +447,13 @@  discard block
 block discarded – undo
447 447
 	}
448 448
 
449 449
 	/**
450
-	* Fields for the Settings tab
451
-	* This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
452
-	*
453
-	* @param string $page
454
-	* @param string $section
455
-	* @param string $input_callback
456
-	*/
450
+	 * Fields for the Settings tab
451
+	 * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
452
+	 *
453
+	 * @param string $page
454
+	 * @param string $section
455
+	 * @param string $input_callback
456
+	 */
457 457
 	private function fields_settings( $page, $section, $callbacks ) {
458 458
 		add_settings_section( $page, ucwords( $page ), null, $page );
459 459
 		$salesforce_settings = array(
@@ -687,25 +687,25 @@  discard block
 block discarded – undo
687 687
 	}
688 688
 
689 689
 	/**
690
-	* Fields for the Fieldmaps tab
691
-	* This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
692
-	*
693
-	* @param string $page
694
-	* @param string $section
695
-	* @param string $input_callback
696
-	*/
690
+	 * Fields for the Fieldmaps tab
691
+	 * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
692
+	 *
693
+	 * @param string $page
694
+	 * @param string $section
695
+	 * @param string $input_callback
696
+	 */
697 697
 	private function fields_fieldmaps( $page, $section, $input_callback = '' ) {
698 698
 		add_settings_section( $page, ucwords( $page ), null, $page );
699 699
 	}
700 700
 
701 701
 	/**
702
-	* Fields for the Scheduling tab
703
-	* This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
704
-	*
705
-	* @param string $page
706
-	* @param string $section
707
-	* @param string $input_callback
708
-	*/
702
+	 * Fields for the Scheduling tab
703
+	 * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
704
+	 *
705
+	 * @param string $page
706
+	 * @param string $section
707
+	 * @param string $input_callback
708
+	 */
709 709
 	private function fields_scheduling( $page, $section, $callbacks ) {
710 710
 		foreach ( $this->schedulable_classes as $key => $value ) {
711 711
 			add_settings_section( $key, $value['label'], null, $page );
@@ -784,13 +784,13 @@  discard block
 block discarded – undo
784 784
 	}
785 785
 
786 786
 	/**
787
-	* Fields for the Log Settings tab
788
-	* This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
789
-	*
790
-	* @param string $page
791
-	* @param string $section
792
-	* @param array $callbacks
793
-	*/
787
+	 * Fields for the Log Settings tab
788
+	 * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
789
+	 *
790
+	 * @param string $page
791
+	 * @param string $section
792
+	 * @param array $callbacks
793
+	 */
794 794
 	private function fields_log_settings( $page, $section, $callbacks ) {
795 795
 		add_settings_section( $page, ucwords( str_replace( '_', ' ', $page ) ), null, $page );
796 796
 		$log_settings = array(
@@ -968,9 +968,9 @@  discard block
 block discarded – undo
968 968
 	}
969 969
 
970 970
 	/**
971
-	* Create the notices, settings, and conditions by which admin notices should appear
972
-	*
973
-	*/
971
+	 * Create the notices, settings, and conditions by which admin notices should appear
972
+	 *
973
+	 */
974 974
 	public function notices() {
975 975
 
976 976
 		// before a notice is displayed, we should make sure we are on a page related to this plugin
@@ -1043,14 +1043,14 @@  discard block
 block discarded – undo
1043 1043
 	}
1044 1044
 
1045 1045
 	/**
1046
-	* Get all the Salesforce object settings for fieldmapping
1047
-	* This takes either the $_POST array via ajax, or can be directly called with a $data array
1048
-	*
1049
-	* @param array $data
1050
-	* data must contain a salesforce_object
1051
-	* can optionally contain a type
1052
-	* @return array $object_settings
1053
-	*/
1046
+	 * Get all the Salesforce object settings for fieldmapping
1047
+	 * This takes either the $_POST array via ajax, or can be directly called with a $data array
1048
+	 *
1049
+	 * @param array $data
1050
+	 * data must contain a salesforce_object
1051
+	 * can optionally contain a type
1052
+	 * @return array $object_settings
1053
+	 */
1054 1054
 	public function get_salesforce_object_description( $data = array() ) {
1055 1055
 		$ajax = false;
1056 1056
 		if ( empty( $data ) ) {
@@ -1098,13 +1098,13 @@  discard block
 block discarded – undo
1098 1098
 	}
1099 1099
 
1100 1100
 	/**
1101
-	* Get Salesforce object fields for fieldmapping
1102
-	*
1103
-	* @param array $data
1104
-	* data must contain a salesforce_object
1105
-	* can optionally contain a type for the field
1106
-	* @return array $object_fields
1107
-	*/
1101
+	 * Get Salesforce object fields for fieldmapping
1102
+	 *
1103
+	 * @param array $data
1104
+	 * data must contain a salesforce_object
1105
+	 * can optionally contain a type for the field
1106
+	 * @return array $object_fields
1107
+	 */
1108 1108
 	public function get_salesforce_object_fields( $data = array() ) {
1109 1109
 
1110 1110
 		if ( ! empty( $data['salesforce_object'] ) ) {
@@ -1132,12 +1132,12 @@  discard block
 block discarded – undo
1132 1132
 	}
1133 1133
 
1134 1134
 	/**
1135
-	* Get WordPress object fields for fieldmapping
1136
-	* This takes either the $_POST array via ajax, or can be directly called with a $wordpress_object field
1137
-	*
1138
-	* @param string $wordpress_object
1139
-	* @return array $object_fields
1140
-	*/
1135
+	 * Get WordPress object fields for fieldmapping
1136
+	 * This takes either the $_POST array via ajax, or can be directly called with a $wordpress_object field
1137
+	 *
1138
+	 * @param string $wordpress_object
1139
+	 * @return array $object_fields
1140
+	 */
1141 1141
 	public function get_wordpress_object_fields( $wordpress_object = '' ) {
1142 1142
 		$ajax      = false;
1143 1143
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
@@ -1156,13 +1156,13 @@  discard block
 block discarded – undo
1156 1156
 	}
1157 1157
 
1158 1158
 	/**
1159
-	* Get WordPress and Salesforce object fields together for fieldmapping
1160
-	* This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $salesforce_object fields
1161
-	*
1162
-	* @param string $wordpress_object
1163
-	* @param string $salesforce_object
1164
-	* @return array $object_fields
1165
-	*/
1159
+	 * Get WordPress and Salesforce object fields together for fieldmapping
1160
+	 * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $salesforce_object fields
1161
+	 *
1162
+	 * @param string $wordpress_object
1163
+	 * @param string $salesforce_object
1164
+	 * @return array $object_fields
1165
+	 */
1166 1166
 	public function get_wp_sf_object_fields( $wordpress_object = '', $salesforce = '' ) {
1167 1167
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1168 1168
 		if ( empty( $wordpress_object ) ) {
@@ -1187,12 +1187,12 @@  discard block
 block discarded – undo
1187 1187
 	}
1188 1188
 
1189 1189
 	/**
1190
-	* Manually push the WordPress object to Salesforce
1191
-	* This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $wordpress_id fields
1192
-	*
1193
-	* @param string $wordpress_object
1194
-	* @param int $wordpress_id
1195
-	*/
1190
+	 * Manually push the WordPress object to Salesforce
1191
+	 * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $wordpress_id fields
1192
+	 *
1193
+	 * @param string $wordpress_object
1194
+	 * @param int $wordpress_id
1195
+	 */
1196 1196
 	public function push_to_salesforce( $wordpress_object = '', $wordpress_id = '' ) {
1197 1197
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1198 1198
 		if ( empty( $wordpress_object ) && empty( $wordpress_id ) ) {
@@ -1211,12 +1211,12 @@  discard block
 block discarded – undo
1211 1211
 	}
1212 1212
 
1213 1213
 	/**
1214
-	* Manually pull the Salesforce object into WordPress
1215
-	* This takes either the $_POST array via ajax, or can be directly called with $salesforce_id fields
1216
-	*
1217
-	* @param string $salesforce_id
1218
-	* @param string $wordpress_object
1219
-	*/
1214
+	 * Manually pull the Salesforce object into WordPress
1215
+	 * This takes either the $_POST array via ajax, or can be directly called with $salesforce_id fields
1216
+	 *
1217
+	 * @param string $salesforce_id
1218
+	 * @param string $wordpress_object
1219
+	 */
1220 1220
 	public function pull_from_salesforce( $salesforce_id = '', $wordpress_object = '' ) {
1221 1221
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1222 1222
 		if ( empty( $wordpress_object ) && empty( $salesforce_id ) ) {
@@ -1233,11 +1233,11 @@  discard block
 block discarded – undo
1233 1233
 	}
1234 1234
 
1235 1235
 	/**
1236
-	* Manually pull the Salesforce object into WordPress
1237
-	* This takes an id for a mapping object row
1238
-	*
1239
-	* @param int $mapping_id
1240
-	*/
1236
+	 * Manually pull the Salesforce object into WordPress
1237
+	 * This takes an id for a mapping object row
1238
+	 *
1239
+	 * @param int $mapping_id
1240
+	 */
1241 1241
 	public function refresh_mapped_data( $mapping_id = '' ) {
1242 1242
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1243 1243
 		if ( empty( $mapping_id ) ) {
@@ -1256,13 +1256,13 @@  discard block
 block discarded – undo
1256 1256
 	}
1257 1257
 
1258 1258
 	/**
1259
-	* Prepare fieldmap data and redirect after processing
1260
-	* This runs when the create or update forms are submitted
1261
-	* It is public because it depends on an admin hook
1262
-	* It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page
1263
-	* This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success
1264
-	*
1265
-	*/
1259
+	 * Prepare fieldmap data and redirect after processing
1260
+	 * This runs when the create or update forms are submitted
1261
+	 * It is public because it depends on an admin hook
1262
+	 * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page
1263
+	 * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success
1264
+	 *
1265
+	 */
1266 1266
 	public function prepare_fieldmap_data() {
1267 1267
 		$error     = false;
1268 1268
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
@@ -1310,12 +1310,12 @@  discard block
 block discarded – undo
1310 1310
 	}
1311 1311
 
1312 1312
 	/**
1313
-	* Delete fieldmap data and redirect after processing
1314
-	* This runs when the delete link is clicked, after the user confirms
1315
-	* It is public because it depends on an admin hook
1316
-	* It then calls the Object_Sync_Sf_Mapping class and the delete method
1317
-	*
1318
-	*/
1313
+	 * Delete fieldmap data and redirect after processing
1314
+	 * This runs when the delete link is clicked, after the user confirms
1315
+	 * It is public because it depends on an admin hook
1316
+	 * It then calls the Object_Sync_Sf_Mapping class and the delete method
1317
+	 *
1318
+	 */
1319 1319
 	public function delete_fieldmap() {
1320 1320
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1321 1321
 		if ( $post_data['id'] ) {
@@ -1331,13 +1331,13 @@  discard block
 block discarded – undo
1331 1331
 	}
1332 1332
 
1333 1333
 	/**
1334
-	* Prepare object data and redirect after processing
1335
-	* This runs when the update form is submitted
1336
-	* It is public because it depends on an admin hook
1337
-	* It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page
1338
-	* This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success
1339
-	*
1340
-	*/
1334
+	 * Prepare object data and redirect after processing
1335
+	 * This runs when the update form is submitted
1336
+	 * It is public because it depends on an admin hook
1337
+	 * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page
1338
+	 * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success
1339
+	 *
1340
+	 */
1341 1341
 	public function prepare_object_map_data() {
1342 1342
 		$error     = false;
1343 1343
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
@@ -1376,12 +1376,12 @@  discard block
 block discarded – undo
1376 1376
 	}
1377 1377
 
1378 1378
 	/**
1379
-	* Delete object map data and redirect after processing
1380
-	* This runs when the delete link is clicked on an error row, after the user confirms
1381
-	* It is public because it depends on an admin hook
1382
-	* It then calls the Object_Sync_Sf_Mapping class and the delete method
1383
-	*
1384
-	*/
1379
+	 * Delete object map data and redirect after processing
1380
+	 * This runs when the delete link is clicked on an error row, after the user confirms
1381
+	 * It is public because it depends on an admin hook
1382
+	 * It then calls the Object_Sync_Sf_Mapping class and the delete method
1383
+	 *
1384
+	 */
1385 1385
 	public function delete_object_map() {
1386 1386
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1387 1387
 		if ( $post_data['id'] ) {
@@ -1397,9 +1397,9 @@  discard block
 block discarded – undo
1397 1397
 	}
1398 1398
 
1399 1399
 	/**
1400
-	* Import a json file and use it for plugin data
1401
-	*
1402
-	*/
1400
+	 * Import a json file and use it for plugin data
1401
+	 *
1402
+	 */
1403 1403
 	public function import_json_file() {
1404 1404
 
1405 1405
 		if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_import'], 'object_sync_for_salesforce_nonce_import' ) ) {
@@ -1497,9 +1497,9 @@  discard block
 block discarded – undo
1497 1497
 	}
1498 1498
 
1499 1499
 	/**
1500
-	* Create a json file for exporting
1501
-	*
1502
-	*/
1500
+	 * Create a json file for exporting
1501
+	 *
1502
+	 */
1503 1503
 	public function export_json_file() {
1504 1504
 
1505 1505
 		if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_export'], 'object_sync_for_salesforce_nonce_export' ) ) {
@@ -1528,10 +1528,10 @@  discard block
 block discarded – undo
1528 1528
 	}
1529 1529
 
1530 1530
 	/**
1531
-	* Default display for <input> fields
1532
-	*
1533
-	* @param array $args
1534
-	*/
1531
+	 * Default display for <input> fields
1532
+	 *
1533
+	 * @param array $args
1534
+	 */
1535 1535
 	public function display_input_field( $args ) {
1536 1536
 		$type    = $args['type'];
1537 1537
 		$id      = $args['label_for'];
@@ -1578,11 +1578,11 @@  discard block
 block discarded – undo
1578 1578
 	}
1579 1579
 
1580 1580
 	/**
1581
-	* Display for multiple checkboxes
1582
-	* Above method can handle a single checkbox as it is
1583
-	*
1584
-	* @param array $args
1585
-	*/
1581
+	 * Display for multiple checkboxes
1582
+	 * Above method can handle a single checkbox as it is
1583
+	 *
1584
+	 * @param array $args
1585
+	 */
1586 1586
 	public function display_checkboxes( $args ) {
1587 1587
 		$type    = 'checkbox';
1588 1588
 		$name    = $args['name'];
@@ -1616,10 +1616,10 @@  discard block
 block discarded – undo
1616 1616
 	}
1617 1617
 
1618 1618
 	/**
1619
-	* Display for a dropdown
1620
-	*
1621
-	* @param array $args
1622
-	*/
1619
+	 * Display for a dropdown
1620
+	 *
1621
+	 * @param array $args
1622
+	 */
1623 1623
 	public function display_select( $args ) {
1624 1624
 		$type = $args['type'];
1625 1625
 		$id   = $args['label_for'];
@@ -1663,10 +1663,10 @@  discard block
 block discarded – undo
1663 1663
 	}
1664 1664
 
1665 1665
 	/**
1666
-	* Dropdown formatted list of Salesforce API versions
1667
-	*
1668
-	* @return array $args
1669
-	*/
1666
+	 * Dropdown formatted list of Salesforce API versions
1667
+	 *
1668
+	 * @return array $args
1669
+	 */
1670 1670
 	private function version_options() {
1671 1671
 		$versions = $this->salesforce['sfapi']->get_api_versions();
1672 1672
 		$args     = array();
@@ -1680,10 +1680,10 @@  discard block
 block discarded – undo
1680 1680
 	}
1681 1681
 
1682 1682
 	/**
1683
-	* Default display for <a href> links
1684
-	*
1685
-	* @param array $args
1686
-	*/
1683
+	 * Default display for <a href> links
1684
+	 *
1685
+	 * @param array $args
1686
+	 */
1687 1687
 	public function display_link( $args ) {
1688 1688
 		$label = $args['label'];
1689 1689
 		$desc  = $args['desc'];
@@ -1710,11 +1710,11 @@  discard block
 block discarded – undo
1710 1710
 	}
1711 1711
 
1712 1712
 	/**
1713
-	* Allow for a standard sanitize/validate method. We could use more specific ones if need be, but this one provides a baseline.
1714
-	*
1715
-	* @param string $option
1716
-	* @return string $option
1717
-	*/
1713
+	 * Allow for a standard sanitize/validate method. We could use more specific ones if need be, but this one provides a baseline.
1714
+	 *
1715
+	 * @param string $option
1716
+	 * @return string $option
1717
+	 */
1718 1718
 	public function sanitize_validate_text( $option ) {
1719 1719
 		if ( is_array( $option ) ) {
1720 1720
 			$options = array();
@@ -1728,10 +1728,10 @@  discard block
 block discarded – undo
1728 1728
 	}
1729 1729
 
1730 1730
 	/**
1731
-	* Run a demo of Salesforce API call on the authenticate tab after WordPress has authenticated with it
1732
-	*
1733
-	* @param object $sfapi
1734
-	*/
1731
+	 * Run a demo of Salesforce API call on the authenticate tab after WordPress has authenticated with it
1732
+	 *
1733
+	 * @param object $sfapi
1734
+	 */
1735 1735
 	private function status( $sfapi ) {
1736 1736
 
1737 1737
 		$versions = $sfapi->get_api_versions();
@@ -1790,10 +1790,10 @@  discard block
 block discarded – undo
1790 1790
 	}
1791 1791
 
1792 1792
 	/**
1793
-	* Deauthorize WordPress from Salesforce.
1794
-	* This deletes the tokens from the database; it does not currently do anything in Salesforce
1795
-	* For this plugin at this time, that is the decision we are making: don't do any kind of authorization stuff inside Salesforce
1796
-	*/
1793
+	 * Deauthorize WordPress from Salesforce.
1794
+	 * This deletes the tokens from the database; it does not currently do anything in Salesforce
1795
+	 * For this plugin at this time, that is the decision we are making: don't do any kind of authorization stuff inside Salesforce
1796
+	 */
1797 1797
 	private function logout() {
1798 1798
 		$this->access_token  = delete_option( $this->option_prefix . 'access_token' );
1799 1799
 		$this->instance_url  = delete_option( $this->option_prefix . 'instance_url' );
@@ -1805,8 +1805,8 @@  discard block
 block discarded – undo
1805 1805
 	}
1806 1806
 
1807 1807
 	/**
1808
-	* Ajax call to clear the plugin cache.
1809
-	*/
1808
+	 * Ajax call to clear the plugin cache.
1809
+	 */
1810 1810
 	public function clear_sfwp_cache() {
1811 1811
 		$result   = $this->clear_cache( true );
1812 1812
 		$response = array(
@@ -1817,9 +1817,9 @@  discard block
 block discarded – undo
1817 1817
 	}
1818 1818
 
1819 1819
 	/**
1820
-	* Clear the plugin's cache.
1821
-	* This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data.
1822
-	*/
1820
+	 * Clear the plugin's cache.
1821
+	 * This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data.
1822
+	 */
1823 1823
 	private function clear_cache( $ajax = false ) {
1824 1824
 		$result = (bool) $this->wordpress->sfwp_transients->flush();
1825 1825
 		if ( true === $result ) {
@@ -1839,9 +1839,9 @@  discard block
 block discarded – undo
1839 1839
 	}
1840 1840
 
1841 1841
 	/**
1842
-	* Check WordPress Admin permissions
1843
-	* Check if the current user is allowed to access the Salesforce plugin options
1844
-	*/
1842
+	 * Check WordPress Admin permissions
1843
+	 * Check if the current user is allowed to access the Salesforce plugin options
1844
+	 */
1845 1845
 	private function check_wordpress_admin_permissions() {
1846 1846
 
1847 1847
 		// one programmatic way to give this capability to additional user roles is the
@@ -1861,10 +1861,10 @@  discard block
 block discarded – undo
1861 1861
 	}
1862 1862
 
1863 1863
 	/**
1864
-	* Show what we know about this user's relationship to a Salesforce object, if any
1865
-	* @param object $user
1866
-	*
1867
-	*/
1864
+	 * Show what we know about this user's relationship to a Salesforce object, if any
1865
+	 * @param object $user
1866
+	 *
1867
+	 */
1868 1868
 	public function show_salesforce_user_fields( $user ) {
1869 1869
 		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
1870 1870
 		if ( true === $this->check_wordpress_admin_permissions() ) {
@@ -1888,10 +1888,10 @@  discard block
 block discarded – undo
1888 1888
 	}
1889 1889
 
1890 1890
 	/**
1891
-	* If the user profile has been mapped to Salesforce, do it
1892
-	* @param int $user_id
1893
-	*
1894
-	*/
1891
+	 * If the user profile has been mapped to Salesforce, do it
1892
+	 * @param int $user_id
1893
+	 *
1894
+	 */
1895 1895
 	public function save_salesforce_user_fields( $user_id ) {
1896 1896
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1897 1897
 		if ( isset( $post_data['salesforce_update_mapped_user'] ) && '1' === rawurlencode( $post_data['salesforce_update_mapped_user'] ) ) {
@@ -1916,10 +1916,10 @@  discard block
 block discarded – undo
1916 1916
 	}
1917 1917
 
1918 1918
 	/**
1919
-	* Render tabs for settings pages in admin
1920
-	* @param array $tabs
1921
-	* @param string $tab
1922
-	*/
1919
+	 * Render tabs for settings pages in admin
1920
+	 * @param array $tabs
1921
+	 * @param string $tab
1922
+	 */
1923 1923
 	private function tabs( $tabs, $tab = '' ) {
1924 1924
 
1925 1925
 		$get_data        = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
@@ -1949,9 +1949,9 @@  discard block
 block discarded – undo
1949 1949
 	}
1950 1950
 
1951 1951
 	/**
1952
-	* Clear schedule
1953
-	* This clears the schedule if the user clicks the button
1954
-	*/
1952
+	 * Clear schedule
1953
+	 * This clears the schedule if the user clicks the button
1954
+	 */
1955 1955
 	private function clear_schedule( $schedule_name = '' ) {
1956 1956
 		if ( '' !== $schedule_name ) {
1957 1957
 			$schedule = $this->schedule( $schedule_name );
@@ -1973,8 +1973,8 @@  discard block
 block discarded – undo
1973 1973
 	}
1974 1974
 
1975 1975
 	/**
1976
-	* Load the schedule class
1977
-	*/
1976
+	 * Load the schedule class
1977
+	 */
1978 1978
 	private function schedule( $schedule_name ) {
1979 1979
 		if ( ! class_exists( 'Object_Sync_Sf_Schedule' ) && file_exists( plugin_dir_path( __FILE__ ) . '../vendor/autoload.php' ) ) {
1980 1980
 			require_once plugin_dir_path( __FILE__ ) . '../vendor/autoload.php';
@@ -1986,21 +1986,21 @@  discard block
 block discarded – undo
1986 1986
 	}
1987 1987
 
1988 1988
 	/**
1989
-	* Create an object map between a WordPress object and a Salesforce object
1990
-	*
1991
-	* @param int $wordpress_id
1992
-	*   Unique identifier for the WordPress object
1993
-	* @param string $wordpress_object
1994
-	*   What kind of object is it?
1995
-	* @param string $salesforce_id
1996
-	*   Unique identifier for the Salesforce object
1997
-	* @param string $action
1998
-	*   Did we push or pull?
1999
-	*
2000
-	* @return int $wpdb->insert_id
2001
-	*   This is the database row for the map object
2002
-	*
2003
-	*/
1989
+	 * Create an object map between a WordPress object and a Salesforce object
1990
+	 *
1991
+	 * @param int $wordpress_id
1992
+	 *   Unique identifier for the WordPress object
1993
+	 * @param string $wordpress_object
1994
+	 *   What kind of object is it?
1995
+	 * @param string $salesforce_id
1996
+	 *   Unique identifier for the Salesforce object
1997
+	 * @param string $action
1998
+	 *   Did we push or pull?
1999
+	 *
2000
+	 * @return int $wpdb->insert_id
2001
+	 *   This is the database row for the map object
2002
+	 *
2003
+	 */
2004 2004
 	private function create_object_map( $wordpress_id, $wordpress_object, $salesforce_id, $action = '' ) {
2005 2005
 		// Create object map and save it
2006 2006
 		$mapping_object = $this->mappings->create_object_map(
Please login to merge, or discard this patch.
Spacing   +570 added lines, -570 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @file
6 6
  */
7 7
 
8
-if ( ! class_exists( 'Object_Sync_Salesforce' ) ) {
8
+if ( ! class_exists('Object_Sync_Salesforce')) {
9 9
 	die();
10 10
 }
11 11
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	* @param object $queue
85 85
 	* @throws \Exception
86 86
 	*/
87
-	public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes, $queue ) {
87
+	public function __construct($wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes, $queue) {
88 88
 		$this->wpdb                = $wpdb;
89 89
 		$this->version             = $version;
90 90
 		$this->login_credentials   = $login_credentials;
@@ -124,35 +124,35 @@  discard block
 block discarded – undo
124 124
 	*
125 125
 	*/
126 126
 	public function add_actions() {
127
-		add_action( 'admin_init', array( $this, 'salesforce_settings_forms' ) );
128
-		add_action( 'admin_init', array( $this, 'notices' ) );
129
-		add_action( 'admin_post_post_fieldmap', array( $this, 'prepare_fieldmap_data' ) );
130
-
131
-		add_action( 'admin_post_delete_fieldmap', array( $this, 'delete_fieldmap' ) );
132
-		add_action( 'wp_ajax_get_salesforce_object_description', array( $this, 'get_salesforce_object_description' ) );
133
-		add_action( 'wp_ajax_get_wordpress_object_description', array( $this, 'get_wordpress_object_fields' ) );
134
-		add_action( 'wp_ajax_get_wp_sf_object_fields', array( $this, 'get_wp_sf_object_fields' ) );
135
-		add_action( 'wp_ajax_push_to_salesforce', array( $this, 'push_to_salesforce' ) );
136
-		add_action( 'wp_ajax_pull_from_salesforce', array( $this, 'pull_from_salesforce' ) );
137
-		add_action( 'wp_ajax_refresh_mapped_data', array( $this, 'refresh_mapped_data' ) );
138
-		add_action( 'wp_ajax_clear_sfwp_cache', array( $this, 'clear_sfwp_cache' ) );
139
-
140
-		add_action( 'edit_user_profile', array( $this, 'show_salesforce_user_fields' ) );
141
-		add_action( 'personal_options_update', array( $this, 'save_salesforce_user_fields' ) );
142
-		add_action( 'edit_user_profile_update', array( $this, 'save_salesforce_user_fields' ) );
127
+		add_action('admin_init', array($this, 'salesforce_settings_forms'));
128
+		add_action('admin_init', array($this, 'notices'));
129
+		add_action('admin_post_post_fieldmap', array($this, 'prepare_fieldmap_data'));
130
+
131
+		add_action('admin_post_delete_fieldmap', array($this, 'delete_fieldmap'));
132
+		add_action('wp_ajax_get_salesforce_object_description', array($this, 'get_salesforce_object_description'));
133
+		add_action('wp_ajax_get_wordpress_object_description', array($this, 'get_wordpress_object_fields'));
134
+		add_action('wp_ajax_get_wp_sf_object_fields', array($this, 'get_wp_sf_object_fields'));
135
+		add_action('wp_ajax_push_to_salesforce', array($this, 'push_to_salesforce'));
136
+		add_action('wp_ajax_pull_from_salesforce', array($this, 'pull_from_salesforce'));
137
+		add_action('wp_ajax_refresh_mapped_data', array($this, 'refresh_mapped_data'));
138
+		add_action('wp_ajax_clear_sfwp_cache', array($this, 'clear_sfwp_cache'));
139
+
140
+		add_action('edit_user_profile', array($this, 'show_salesforce_user_fields'));
141
+		add_action('personal_options_update', array($this, 'save_salesforce_user_fields'));
142
+		add_action('edit_user_profile_update', array($this, 'save_salesforce_user_fields'));
143 143
 
144 144
 		// when either field for schedule settings changes
145
-		foreach ( $this->schedulable_classes as $key => $value ) {
146
-			add_filter( 'update_option_' . $this->option_prefix . $key . '_schedule_number', array( $this, 'change_action_schedule' ), 10, 3 );
147
-			add_filter( 'update_option_' . $this->option_prefix . $key . '_schedule_unit', array( $this, 'change_action_schedule' ), 10, 3 );
145
+		foreach ($this->schedulable_classes as $key => $value) {
146
+			add_filter('update_option_' . $this->option_prefix . $key . '_schedule_number', array($this, 'change_action_schedule'), 10, 3);
147
+			add_filter('update_option_' . $this->option_prefix . $key . '_schedule_unit', array($this, 'change_action_schedule'), 10, 3);
148 148
 		}
149 149
 
150
-		add_action( 'admin_post_delete_object_map', array( $this, 'delete_object_map' ) );
151
-		add_action( 'admin_post_post_object_map', array( $this, 'prepare_object_map_data' ) );
150
+		add_action('admin_post_delete_object_map', array($this, 'delete_object_map'));
151
+		add_action('admin_post_post_object_map', array($this, 'prepare_object_map_data'));
152 152
 
153 153
 		// import and export plugin data
154
-		add_action( 'admin_post_object_sync_for_salesforce_import', array( $this, 'import_json_file' ) );
155
-		add_action( 'admin_post_object_sync_for_salesforce_export', array( $this, 'export_json_file' ) );
154
+		add_action('admin_post_object_sync_for_salesforce_import', array($this, 'import_json_file'));
155
+		add_action('admin_post_object_sync_for_salesforce_export', array($this, 'export_json_file'));
156 156
 
157 157
 	}
158 158
 
@@ -160,35 +160,35 @@  discard block
 block discarded – undo
160 160
 	* Recurring task to check Salesforce for data
161 161
 	*
162 162
 	*/
163
-	public function change_action_schedule( $old_schedule, $new_schedule, $option_name ) {
163
+	public function change_action_schedule($old_schedule, $new_schedule, $option_name) {
164 164
 
165 165
 		// exit if nothing changed
166
-		if ( $old_schedule === $new_schedule ) {
166
+		if ($old_schedule === $new_schedule) {
167 167
 			return;
168 168
 		}
169 169
 
170 170
 		// get the current schedule name from the task, based on pattern in the foreach
171
-		preg_match( '/' . $this->option_prefix . '(.*)_schedule/', $option_name, $matches );
171
+		preg_match('/' . $this->option_prefix . '(.*)_schedule/', $option_name, $matches);
172 172
 		$schedule_name     = $matches[1];
173 173
 		$action_group_name = $schedule_name . '_check_records';
174 174
 
175 175
 		// exit if there is no initializer property on this schedule
176
-		if ( ! isset( $this->schedulable_classes[ $schedule_name ]['initializer'] ) ) {
176
+		if ( ! isset($this->schedulable_classes[$schedule_name]['initializer'])) {
177 177
 			return;
178 178
 		}
179 179
 
180 180
 		// cancel previous task
181 181
 		$this->queue->cancel(
182
-			$this->schedulable_classes[ $schedule_name ]['initializer'],
182
+			$this->schedulable_classes[$schedule_name]['initializer'],
183 183
 			array(),
184 184
 			$action_group_name
185 185
 		);
186 186
 
187 187
 		// create new recurring task for action-scheduler to check for data to pull from salesforce
188 188
 		$this->queue->schedule_recurring(
189
-			current_time( 'timestamp', true ), // plugin seems to expect UTC
190
-			$this->queue->get_frequency( $schedule_name, 'seconds' ),
191
-			$this->schedulable_classes[ $schedule_name ]['initializer'],
189
+			current_time('timestamp', true), // plugin seems to expect UTC
190
+			$this->queue->get_frequency($schedule_name, 'seconds'),
191
+			$this->schedulable_classes[$schedule_name]['initializer'],
192 192
 			array(),
193 193
 			$action_group_name
194 194
 		);
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
 	*
200 200
 	*/
201 201
 	public function create_admin_menu() {
202
-		$title = __( 'Salesforce', 'object-sync-for-salesforce' );
203
-		add_options_page( $title, $title, 'configure_salesforce', 'object-sync-salesforce-admin', array( $this, 'show_admin_page' ) );
202
+		$title = __('Salesforce', 'object-sync-for-salesforce');
203
+		add_options_page($title, $title, 'configure_salesforce', 'object-sync-salesforce-admin', array($this, 'show_admin_page'));
204 204
 	}
205 205
 
206 206
 	/**
@@ -211,114 +211,114 @@  discard block
 block discarded – undo
211 211
 	*
212 212
 	*/
213 213
 	public function show_admin_page() {
214
-		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
214
+		$get_data = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
215 215
 		echo '<div class="wrap">';
216
-		echo '<h1>' . esc_html( get_admin_page_title() ) . '</h1>';
216
+		echo '<h1>' . esc_html(get_admin_page_title()) . '</h1>';
217 217
 		$allowed = $this->check_wordpress_admin_permissions();
218
-		if ( false === $allowed ) {
218
+		if (false === $allowed) {
219 219
 			return;
220 220
 		}
221 221
 		$tabs = array(
222
-			'settings'      => __( 'Settings', 'object-sync-for-salesforce' ),
223
-			'authorize'     => __( 'Authorize', 'object-sync-for-salesforce' ),
224
-			'fieldmaps'     => __( 'Fieldmaps', 'object-sync-for-salesforce' ),
225
-			'schedule'      => __( 'Scheduling', 'object-sync-for-salesforce' ),
226
-			'import-export' => __( 'Import &amp; Export', 'object-sync-for-salesforce' ),
222
+			'settings'      => __('Settings', 'object-sync-for-salesforce'),
223
+			'authorize'     => __('Authorize', 'object-sync-for-salesforce'),
224
+			'fieldmaps'     => __('Fieldmaps', 'object-sync-for-salesforce'),
225
+			'schedule'      => __('Scheduling', 'object-sync-for-salesforce'),
226
+			'import-export' => __('Import &amp; Export', 'object-sync-for-salesforce'),
227 227
 		); // this creates the tabs for the admin
228 228
 
229 229
 		// optionally make tab(s) for logging and log settings
230
-		$logging_enabled      = get_option( $this->option_prefix . 'enable_logging', false );
231
-		$tabs['log_settings'] = __( 'Log Settings', 'object-sync-for-salesforce' );
230
+		$logging_enabled      = get_option($this->option_prefix . 'enable_logging', false);
231
+		$tabs['log_settings'] = __('Log Settings', 'object-sync-for-salesforce');
232 232
 
233 233
 		$mapping_errors = $this->mappings->get_failed_object_maps();
234
-		if ( ! empty( $mapping_errors ) ) {
235
-			$tabs['mapping_errors'] = __( 'Mapping Errors', 'object-sync-for-salesforce' );
234
+		if ( ! empty($mapping_errors)) {
235
+			$tabs['mapping_errors'] = __('Mapping Errors', 'object-sync-for-salesforce');
236 236
 		}
237 237
 
238 238
 		// filter for extending the tabs available on the page
239 239
 		// currently it will go into the default switch case for $tab
240
-		$tabs = apply_filters( 'object_sync_for_salesforce_settings_tabs', $tabs );
240
+		$tabs = apply_filters('object_sync_for_salesforce_settings_tabs', $tabs);
241 241
 
242
-		$tab = isset( $get_data['tab'] ) ? sanitize_key( $get_data['tab'] ) : 'settings';
243
-		$this->tabs( $tabs, $tab );
242
+		$tab = isset($get_data['tab']) ? sanitize_key($get_data['tab']) : 'settings';
243
+		$this->tabs($tabs, $tab);
244 244
 
245 245
 		$consumer_key    = $this->login_credentials['consumer_key'];
246 246
 		$consumer_secret = $this->login_credentials['consumer_secret'];
247 247
 		$callback_url    = $this->login_credentials['callback_url'];
248 248
 
249
-		if ( true !== $this->salesforce['is_authorized'] ) {
250
-			$url     = esc_url( $callback_url );
251
-			$anchor  = esc_html__( 'Authorize tab', 'object-sync-for-salesforce' );
252
-			$message = sprintf( 'Salesforce needs to be authorized to connect to this website. Use the <a href="%s">%s</a> to connect.', $url, $anchor );
253
-			require( plugin_dir_path( __FILE__ ) . '/../templates/admin/error.php' );
249
+		if (true !== $this->salesforce['is_authorized']) {
250
+			$url     = esc_url($callback_url);
251
+			$anchor  = esc_html__('Authorize tab', 'object-sync-for-salesforce');
252
+			$message = sprintf('Salesforce needs to be authorized to connect to this website. Use the <a href="%s">%s</a> to connect.', $url, $anchor);
253
+			require(plugin_dir_path(__FILE__) . '/../templates/admin/error.php');
254 254
 		}
255 255
 
256
-		if ( 0 === count( $this->mappings->get_fieldmaps() ) ) {
257
-			$url     = esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps' ) );
258
-			$anchor  = esc_html__( 'Fieldmaps tab', 'object-sync-for-salesforce' );
259
-			$message = sprintf( 'No fieldmaps exist yet. Use the <a href="%s">%s</a> to map WordPress and Salesforce objects to each other.', $url, $anchor );
260
-			require( plugin_dir_path( __FILE__ ) . '/../templates/admin/error.php' );
256
+		if (0 === count($this->mappings->get_fieldmaps())) {
257
+			$url     = esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps'));
258
+			$anchor  = esc_html__('Fieldmaps tab', 'object-sync-for-salesforce');
259
+			$message = sprintf('No fieldmaps exist yet. Use the <a href="%s">%s</a> to map WordPress and Salesforce objects to each other.', $url, $anchor);
260
+			require(plugin_dir_path(__FILE__) . '/../templates/admin/error.php');
261 261
 		}
262 262
 
263
-		$push_schedule_number = get_option( $this->option_prefix . 'salesforce_push_schedule_number', '' );
264
-		$push_schedule_unit   = get_option( $this->option_prefix . 'salesforce_push_schedule_unit', '' );
265
-		$pull_schedule_number = get_option( $this->option_prefix . 'salesforce_pull_schedule_number', '' );
266
-		$pull_schedule_unit   = get_option( $this->option_prefix . 'salesforce_pull_schedule_unit', '' );
263
+		$push_schedule_number = get_option($this->option_prefix . 'salesforce_push_schedule_number', '');
264
+		$push_schedule_unit   = get_option($this->option_prefix . 'salesforce_push_schedule_unit', '');
265
+		$pull_schedule_number = get_option($this->option_prefix . 'salesforce_pull_schedule_number', '');
266
+		$pull_schedule_unit   = get_option($this->option_prefix . 'salesforce_pull_schedule_unit', '');
267 267
 
268
-		if ( '' === $push_schedule_number && '' === $push_schedule_unit && '' === $pull_schedule_number && '' === $pull_schedule_unit ) {
269
-			$url     = esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=schedule' ) );
270
-			$anchor  = esc_html__( 'Scheduling tab', 'object-sync-for-salesforce' );
271
-			$message = sprintf( 'Because the plugin schedule has not been saved, the plugin cannot run automatic operations. Use the <a href="%s">%s</a> to create schedules to run.', $url, $anchor );
272
-			require( plugin_dir_path( __FILE__ ) . '/../templates/admin/error.php' );
268
+		if ('' === $push_schedule_number && '' === $push_schedule_unit && '' === $pull_schedule_number && '' === $pull_schedule_unit) {
269
+			$url     = esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=schedule'));
270
+			$anchor  = esc_html__('Scheduling tab', 'object-sync-for-salesforce');
271
+			$message = sprintf('Because the plugin schedule has not been saved, the plugin cannot run automatic operations. Use the <a href="%s">%s</a> to create schedules to run.', $url, $anchor);
272
+			require(plugin_dir_path(__FILE__) . '/../templates/admin/error.php');
273 273
 		}
274 274
 
275 275
 		try {
276
-			switch ( $tab ) {
276
+			switch ($tab) {
277 277
 				case 'authorize':
278
-					if ( isset( $get_data['code'] ) ) {
278
+					if (isset($get_data['code'])) {
279 279
 						// this string is an oauth token
280
-						$data          = esc_html( wp_unslash( $get_data['code'] ) );
281
-						$is_authorized = $this->salesforce['sfapi']->request_token( $data );
280
+						$data          = esc_html(wp_unslash($get_data['code']));
281
+						$is_authorized = $this->salesforce['sfapi']->request_token($data);
282 282
 						?>
283
-						<script>window.location = '<?php echo esc_url_raw( $callback_url ); ?>'</script>
283
+						<script>window.location = '<?php echo esc_url_raw($callback_url); ?>'</script>
284 284
 						<?php
285
-					} elseif ( true === $this->salesforce['is_authorized'] ) {
286
-							require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/authorized.php' );
287
-							$this->status( $this->salesforce['sfapi'] );
288
-					} elseif ( true === is_object( $this->salesforce['sfapi'] ) && isset( $consumer_key ) && isset( $consumer_secret ) ) {
285
+					} elseif (true === $this->salesforce['is_authorized']) {
286
+							require_once(plugin_dir_path(__FILE__) . '/../templates/admin/authorized.php');
287
+							$this->status($this->salesforce['sfapi']);
288
+					} elseif (true === is_object($this->salesforce['sfapi']) && isset($consumer_key) && isset($consumer_secret)) {
289 289
 						?>
290
-						<p><a class="button button-primary" href="<?php echo esc_url( $this->salesforce['sfapi']->get_authorization_code() ); ?>"><?php echo esc_html__( 'Connect to Salesforce', 'object-sync-for-salesforce' ); ?></a></p>
290
+						<p><a class="button button-primary" href="<?php echo esc_url($this->salesforce['sfapi']->get_authorization_code()); ?>"><?php echo esc_html__('Connect to Salesforce', 'object-sync-for-salesforce'); ?></a></p>
291 291
 						<?php
292 292
 					} else {
293
-						$url    = esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=settings' ) );
294
-						$anchor = esc_html__( 'Settings', 'object-sync-for-salesforce' );
293
+						$url    = esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=settings'));
294
+						$anchor = esc_html__('Settings', 'object-sync-for-salesforce');
295 295
 						// translators: placeholders are for the settings tab link: 1) the url, and 2) the anchor text
296
-						$message = sprintf( esc_html__( 'Salesforce needs to be authorized to connect to this website but the credentials are missing. Use the <a href="%1$s">%2$s</a> tab to add them.', 'object-sync-salesforce' ), $url, $anchor );
297
-						require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/error.php' );
296
+						$message = sprintf(esc_html__('Salesforce needs to be authorized to connect to this website but the credentials are missing. Use the <a href="%1$s">%2$s</a> tab to add them.', 'object-sync-salesforce'), $url, $anchor);
297
+						require_once(plugin_dir_path(__FILE__) . '/../templates/admin/error.php');
298 298
 					}
299 299
 					break;
300 300
 				case 'fieldmaps':
301
-					if ( isset( $get_data['method'] ) ) {
301
+					if (isset($get_data['method'])) {
302 302
 
303
-						$method      = sanitize_key( $get_data['method'] );
304
-						$error_url   = get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=' . $method );
305
-						$success_url = get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps' );
303
+						$method      = sanitize_key($get_data['method']);
304
+						$error_url   = get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=' . $method);
305
+						$success_url = get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps');
306 306
 
307
-						if ( isset( $get_data['transient'] ) ) {
308
-							$transient = sanitize_key( $get_data['transient'] );
309
-							$posted    = $this->sfwp_transients->get( $transient );
307
+						if (isset($get_data['transient'])) {
308
+							$transient = sanitize_key($get_data['transient']);
309
+							$posted    = $this->sfwp_transients->get($transient);
310 310
 						}
311 311
 
312
-						if ( isset( $posted ) && is_array( $posted ) ) {
312
+						if (isset($posted) && is_array($posted)) {
313 313
 							$map = $posted;
314
-						} elseif ( 'edit' === $method || 'clone' === $method || 'delete' === $method ) {
315
-							$map = $this->mappings->get_fieldmaps( isset( $get_data['id'] ) ? sanitize_key( $get_data['id'] ) : '' );
314
+						} elseif ('edit' === $method || 'clone' === $method || 'delete' === $method) {
315
+							$map = $this->mappings->get_fieldmaps(isset($get_data['id']) ? sanitize_key($get_data['id']) : '');
316 316
 						}
317 317
 
318
-						if ( isset( $map ) && is_array( $map ) ) {
318
+						if (isset($map) && is_array($map)) {
319 319
 							$label                           = $map['label'];
320 320
 							$salesforce_object               = $map['salesforce_object'];
321
-							$salesforce_record_types_allowed = maybe_unserialize( $map['salesforce_record_types_allowed'] );
321
+							$salesforce_record_types_allowed = maybe_unserialize($map['salesforce_record_types_allowed']);
322 322
 							$salesforce_record_type_default  = $map['salesforce_record_type_default'];
323 323
 							$wordpress_object                = $map['wordpress_object'];
324 324
 							$pull_trigger_field              = $map['pull_trigger_field'];
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
 							$weight                          = $map['weight'];
330 330
 						}
331 331
 
332
-						if ( 'add' === $method || 'edit' === $method || 'clone' === $method ) {
333
-							require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/fieldmaps-add-edit-clone.php' );
334
-						} elseif ( 'delete' === $method ) {
335
-							require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/fieldmaps-delete.php' );
332
+						if ('add' === $method || 'edit' === $method || 'clone' === $method) {
333
+							require_once(plugin_dir_path(__FILE__) . '/../templates/admin/fieldmaps-add-edit-clone.php');
334
+						} elseif ('delete' === $method) {
335
+							require_once(plugin_dir_path(__FILE__) . '/../templates/admin/fieldmaps-delete.php');
336 336
 						}
337 337
 					} else {
338 338
 						$fieldmaps = $this->mappings->get_fieldmaps();
339
-						require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/fieldmaps-list.php' );
339
+						require_once(plugin_dir_path(__FILE__) . '/../templates/admin/fieldmaps-list.php');
340 340
 					} // End if().
341 341
 					break;
342 342
 				case 'logout':
@@ -346,73 +346,73 @@  discard block
 block discarded – undo
346 346
 					$this->clear_cache();
347 347
 					break;
348 348
 				case 'clear_schedule':
349
-					if ( isset( $get_data['schedule_name'] ) ) {
350
-						$schedule_name = sanitize_key( $get_data['schedule_name'] );
349
+					if (isset($get_data['schedule_name'])) {
350
+						$schedule_name = sanitize_key($get_data['schedule_name']);
351 351
 					}
352
-					$this->clear_schedule( $schedule_name );
352
+					$this->clear_schedule($schedule_name);
353 353
 					break;
354 354
 				case 'settings':
355
-					require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/settings.php' );
355
+					require_once(plugin_dir_path(__FILE__) . '/../templates/admin/settings.php');
356 356
 					break;
357 357
 				case 'mapping_errors':
358
-					if ( isset( $get_data['method'] ) ) {
358
+					if (isset($get_data['method'])) {
359 359
 
360
-						$method      = sanitize_key( $get_data['method'] );
361
-						$error_url   = get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=' . $method );
362
-						$success_url = get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors' );
360
+						$method      = sanitize_key($get_data['method']);
361
+						$error_url   = get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=' . $method);
362
+						$success_url = get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors');
363 363
 
364
-						if ( isset( $get_data['map_transient'] ) ) {
365
-							$transient = sanitize_key( $get_data['map_transient'] );
366
-							$posted    = $this->sfwp_transients->get( $transient );
364
+						if (isset($get_data['map_transient'])) {
365
+							$transient = sanitize_key($get_data['map_transient']);
366
+							$posted    = $this->sfwp_transients->get($transient);
367 367
 						}
368 368
 
369
-						if ( isset( $posted ) && is_array( $posted ) ) {
369
+						if (isset($posted) && is_array($posted)) {
370 370
 							$map_row = $posted;
371
-						} elseif ( 'edit' === $method || 'delete' === $method ) {
372
-							$map_row = $this->mappings->get_failed_object_map( isset( $get_data['id'] ) ? sanitize_key( $get_data['id'] ) : '' );
371
+						} elseif ('edit' === $method || 'delete' === $method) {
372
+							$map_row = $this->mappings->get_failed_object_map(isset($get_data['id']) ? sanitize_key($get_data['id']) : '');
373 373
 						}
374 374
 
375
-						if ( isset( $map_row ) && is_array( $map_row ) ) {
375
+						if (isset($map_row) && is_array($map_row)) {
376 376
 							$salesforce_id = $map_row['salesforce_id'];
377 377
 							$wordpress_id  = $map_row['wordpress_id'];
378 378
 						}
379 379
 
380
-						if ( 'edit' === $method ) {
381
-							require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/mapping-errors-edit.php' );
382
-						} elseif ( 'delete' === $method ) {
383
-							require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/mapping-errors-delete.php' );
380
+						if ('edit' === $method) {
381
+							require_once(plugin_dir_path(__FILE__) . '/../templates/admin/mapping-errors-edit.php');
382
+						} elseif ('delete' === $method) {
383
+							require_once(plugin_dir_path(__FILE__) . '/../templates/admin/mapping-errors-delete.php');
384 384
 						}
385 385
 					} else {
386
-						require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/mapping-errors.php' );
386
+						require_once(plugin_dir_path(__FILE__) . '/../templates/admin/mapping-errors.php');
387 387
 					}
388 388
 					break;
389 389
 				case 'import-export':
390
-					require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/import-export.php' );
390
+					require_once(plugin_dir_path(__FILE__) . '/../templates/admin/import-export.php');
391 391
 					break;
392 392
 				default:
393
-					$include_settings = apply_filters( 'object_sync_for_salesforce_settings_tab_include_settings', true, $tab );
394
-					$content_before   = apply_filters( 'object_sync_for_salesforce_settings_tab_content_before', null, $tab );
395
-					$content_after    = apply_filters( 'object_sync_for_salesforce_settings_tab_content_after', null, $tab );
396
-					if ( null !== $content_before ) {
397
-						echo esc_html( $content_before );
393
+					$include_settings = apply_filters('object_sync_for_salesforce_settings_tab_include_settings', true, $tab);
394
+					$content_before   = apply_filters('object_sync_for_salesforce_settings_tab_content_before', null, $tab);
395
+					$content_after    = apply_filters('object_sync_for_salesforce_settings_tab_content_after', null, $tab);
396
+					if (null !== $content_before) {
397
+						echo esc_html($content_before);
398 398
 					}
399
-					if ( true === $include_settings ) {
400
-						require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/settings.php' );
399
+					if (true === $include_settings) {
400
+						require_once(plugin_dir_path(__FILE__) . '/../templates/admin/settings.php');
401 401
 					}
402
-					if ( null !== $content_after ) {
403
-						echo esc_html( $content_after );
402
+					if (null !== $content_after) {
403
+						echo esc_html($content_after);
404 404
 					}
405 405
 					break;
406 406
 			} // End switch().
407
-		} catch ( SalesforceApiException $ex ) {
408
-			echo sprintf( '<p>Error <strong>%1$s</strong>: %2$s</p>',
409
-				absint( $ex->getCode() ),
410
-				esc_html( $ex->getMessage() )
407
+		} catch (SalesforceApiException $ex) {
408
+			echo sprintf('<p>Error <strong>%1$s</strong>: %2$s</p>',
409
+				absint($ex->getCode()),
410
+				esc_html($ex->getMessage())
411 411
 			);
412
-		} catch ( Exception $ex ) {
413
-			echo sprintf( '<p>Error <strong>%1$s</strong>: %2$s</p>',
414
-				absint( $ex->getCode() ),
415
-				esc_html( $ex->getMessage() )
412
+		} catch (Exception $ex) {
413
+			echo sprintf('<p>Error <strong>%1$s</strong>: %2$s</p>',
414
+				absint($ex->getCode()),
415
+				esc_html($ex->getMessage())
416 416
 			);
417 417
 		} // End try().
418 418
 		echo '</div>';
@@ -424,14 +424,14 @@  discard block
 block discarded – undo
424 424
 	*
425 425
 	*/
426 426
 	public function salesforce_settings_forms() {
427
-		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
428
-		$page     = isset( $get_data['tab'] ) ? sanitize_key( $get_data['tab'] ) : 'settings';
429
-		$section  = isset( $get_data['tab'] ) ? sanitize_key( $get_data['tab'] ) : 'settings';
427
+		$get_data = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
428
+		$page     = isset($get_data['tab']) ? sanitize_key($get_data['tab']) : 'settings';
429
+		$section  = isset($get_data['tab']) ? sanitize_key($get_data['tab']) : 'settings';
430 430
 
431
-		$input_callback_default   = array( $this, 'display_input_field' );
432
-		$input_checkboxes_default = array( $this, 'display_checkboxes' );
433
-		$input_select_default     = array( $this, 'display_select' );
434
-		$link_default             = array( $this, 'display_link' );
431
+		$input_callback_default   = array($this, 'display_input_field');
432
+		$input_checkboxes_default = array($this, 'display_checkboxes');
433
+		$input_select_default     = array($this, 'display_select');
434
+		$link_default             = array($this, 'display_link');
435 435
 
436 436
 		$all_field_callbacks = array(
437 437
 			'text'       => $input_callback_default,
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 			'link'       => $link_default,
441 441
 		);
442 442
 
443
-		$this->fields_settings( 'settings', 'settings', $all_field_callbacks );
444
-		$this->fields_fieldmaps( 'fieldmaps', 'objects' );
445
-		$this->fields_scheduling( 'schedule', 'schedule', $all_field_callbacks );
446
-		$this->fields_log_settings( 'log_settings', 'log_settings', $all_field_callbacks );
443
+		$this->fields_settings('settings', 'settings', $all_field_callbacks);
444
+		$this->fields_fieldmaps('fieldmaps', 'objects');
445
+		$this->fields_scheduling('schedule', 'schedule', $all_field_callbacks);
446
+		$this->fields_log_settings('log_settings', 'log_settings', $all_field_callbacks);
447 447
 	}
448 448
 
449 449
 	/**
@@ -454,11 +454,11 @@  discard block
 block discarded – undo
454 454
 	* @param string $section
455 455
 	* @param string $input_callback
456 456
 	*/
457
-	private function fields_settings( $page, $section, $callbacks ) {
458
-		add_settings_section( $page, ucwords( $page ), null, $page );
457
+	private function fields_settings($page, $section, $callbacks) {
458
+		add_settings_section($page, ucwords($page), null, $page);
459 459
 		$salesforce_settings = array(
460 460
 			'consumer_key'                   => array(
461
-				'title'    => __( 'Consumer Key', 'object-sync-for-salesforce' ),
461
+				'title'    => __('Consumer Key', 'object-sync-for-salesforce'),
462 462
 				'callback' => $callbacks['text'],
463 463
 				'page'     => $page,
464 464
 				'section'  => $section,
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 
472 472
 			),
473 473
 			'consumer_secret'                => array(
474
-				'title'    => __( 'Consumer Secret', 'object-sync-for-salesforce' ),
474
+				'title'    => __('Consumer Secret', 'object-sync-for-salesforce'),
475 475
 				'callback' => $callbacks['text'],
476 476
 				'page'     => $page,
477 477
 				'section'  => $section,
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 				),
484 484
 			),
485 485
 			'callback_url'                   => array(
486
-				'title'    => __( 'Callback URL', 'object-sync-for-salesforce' ),
486
+				'title'    => __('Callback URL', 'object-sync-for-salesforce'),
487 487
 				'callback' => $callbacks['text'],
488 488
 				'page'     => $page,
489 489
 				'section'  => $section,
@@ -491,14 +491,14 @@  discard block
 block discarded – undo
491 491
 					'type'     => 'url',
492 492
 					'validate' => 'sanitize_validate_text',
493 493
 					// translators: %1$s is the admin URL for the Authorize tab
494
-					'desc'     => sprintf( __( 'In most cases, you will want to use %1$s for this value.', 'object-sync-for-salesforce' ),
495
-						get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=authorize' )
494
+					'desc'     => sprintf(__('In most cases, you will want to use %1$s for this value.', 'object-sync-for-salesforce'),
495
+						get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=authorize')
496 496
 					),
497 497
 					'constant' => 'OBJECT_SYNC_SF_SALESFORCE_CALLBACK_URL',
498 498
 				),
499 499
 			),
500 500
 			'login_base_url'                 => array(
501
-				'title'    => __( 'Login Base URL', 'object-sync-for-salesforce' ),
501
+				'title'    => __('Login Base URL', 'object-sync-for-salesforce'),
502 502
 				'callback' => $callbacks['text'],
503 503
 				'page'     => $page,
504 504
 				'section'  => $section,
@@ -506,22 +506,22 @@  discard block
 block discarded – undo
506 506
 					'type'     => 'url',
507 507
 					'validate' => 'sanitize_validate_text',
508 508
 					// translators: 1) production salesforce login, 2) sandbox salesforce login
509
-					'desc'     => sprintf( __( 'For most Salesforce setups, you should use %1$s for production and %2$s for sandbox.', 'object-sync-for-salesforce' ),
510
-						esc_url( 'https://login.salesforce.com' ),
511
-						esc_url( 'https://test.salesforce.com' )
509
+					'desc'     => sprintf(__('For most Salesforce setups, you should use %1$s for production and %2$s for sandbox.', 'object-sync-for-salesforce'),
510
+						esc_url('https://login.salesforce.com'),
511
+						esc_url('https://test.salesforce.com')
512 512
 					),
513 513
 					'constant' => 'OBJECT_SYNC_SF_SALESFORCE_LOGIN_BASE_URL',
514 514
 				),
515 515
 			),
516 516
 			'authorize_url_path'             => array(
517
-				'title'    => __( 'Authorize URL Path', 'object-sync-for-salesforce' ),
517
+				'title'    => __('Authorize URL Path', 'object-sync-for-salesforce'),
518 518
 				'callback' => $callbacks['text'],
519 519
 				'page'     => $page,
520 520
 				'section'  => $section,
521 521
 				'args'     => array(
522 522
 					'type'     => 'text',
523 523
 					'validate' => 'sanitize_validate_text',
524
-					'desc'     => __( 'For most Salesforce installs, this should not be changed.', 'object-sync-for-salesforce' ),
524
+					'desc'     => __('For most Salesforce installs, this should not be changed.', 'object-sync-for-salesforce'),
525 525
 					'constant' => 'OBJECT_SYNC_SF_SALESFORCE_AUTHORIZE_URL_PATH',
526 526
 					'default'  => $this->default_authorize_url_path,
527 527
 				),
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 				'args'     => array(
535 535
 					'type'     => 'text',
536 536
 					'validate' => 'sanitize_validate_text',
537
-					'desc'     => __( 'For most Salesforce installs, this should not be changed.', 'object-sync-for-salesforce' ),
537
+					'desc'     => __('For most Salesforce installs, this should not be changed.', 'object-sync-for-salesforce'),
538 538
 					'constant' => 'OBJECT_SYNC_SF_SALESFORCE_TOKEN_URL_PATH',
539 539
 					'default'  => $this->default_token_url_path,
540 540
 				),
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 				'args'     => array(
561 561
 					'type'     => 'checkboxes',
562 562
 					'validate' => 'sanitize_validate_text',
563
-					'desc'     => __( 'Allows you to limit which Salesforce objects can be mapped', 'object-sync-for-salesforce' ),
563
+					'desc'     => __('Allows you to limit which Salesforce objects can be mapped', 'object-sync-for-salesforce'),
564 564
 					'items'    => array(
565 565
 						'triggerable' => array(
566 566
 							'text'    => 'Only Triggerable objects',
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 					'constant' => '',
590 590
 					'items'    => array(
591 591
 						'field_label' => array(
592
-							'text'  => __( 'Field Label', 'object-sync-for-salesforce' ),
592
+							'text'  => __('Field Label', 'object-sync-for-salesforce'),
593 593
 							'value' => 'field_label',
594 594
 						),
595 595
 						/*'field_name'  => array(
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 							'value' => 'field_name',
598 598
 						),*/
599 599
 						'api_name'    => array(
600
-							'text'  => __( 'API Name', 'object-sync-for-salesforce' ),
600
+							'text'  => __('API Name', 'object-sync-for-salesforce'),
601 601
 							'value' => 'api_name',
602 602
 						),
603 603
 					),
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 				'args'     => array(
612 612
 					'type'     => 'number',
613 613
 					'validate' => 'sanitize_validate_text',
614
-					'desc'     => __( 'Number of seconds to wait between repeated salesforce pulls. Prevents the webserver from becoming overloaded in case of too many cron runs, or webhook usage.', 'object-sync-for-salesforce' ),
614
+					'desc'     => __('Number of seconds to wait between repeated salesforce pulls. Prevents the webserver from becoming overloaded in case of too many cron runs, or webhook usage.', 'object-sync-for-salesforce'),
615 615
 					'constant' => '',
616 616
 					'default'  => $this->default_pull_throttle,
617 617
 				),
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 				'args'     => array(
625 625
 					'type'     => 'checkbox',
626 626
 					'validate' => 'sanitize_validate_text',
627
-					'desc'     => __( 'Debug mode can, combined with the Log Settings, log things like Salesforce API requests. It can create a lot of entries if enabled; it is not recommended to use it in a production environment.', 'object-sync-for-salesforce' ),
627
+					'desc'     => __('Debug mode can, combined with the Log Settings, log things like Salesforce API requests. It can create a lot of entries if enabled; it is not recommended to use it in a production environment.', 'object-sync-for-salesforce'),
628 628
 					'constant' => '',
629 629
 				),
630 630
 			),
@@ -636,13 +636,13 @@  discard block
 block discarded – undo
636 636
 				'args'     => array(
637 637
 					'type'     => 'checkbox',
638 638
 					'validate' => 'sanitize_validate_text',
639
-					'desc'     => __( 'If checked, the plugin will delete the tables and other data it creates when you uninstall it. Unchecking this field can be useful if you need to reactivate the plugin for any reason without losing data.', 'object-sync-for-salesforce' ),
639
+					'desc'     => __('If checked, the plugin will delete the tables and other data it creates when you uninstall it. Unchecking this field can be useful if you need to reactivate the plugin for any reason without losing data.', 'object-sync-for-salesforce'),
640 640
 					'constant' => '',
641 641
 				),
642 642
 			),
643 643
 		);
644 644
 
645
-		if ( true === is_object( $this->salesforce['sfapi'] ) && true === $this->salesforce['sfapi']->is_authorized() ) {
645
+		if (true === is_object($this->salesforce['sfapi']) && true === $this->salesforce['sfapi']->is_authorized()) {
646 646
 			$salesforce_settings['api_version'] = array(
647 647
 				'title'    => 'Salesforce API Version',
648 648
 				'callback' => $callbacks['select'],
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 			);
659 659
 		}
660 660
 
661
-		foreach ( $salesforce_settings as $key => $attributes ) {
661
+		foreach ($salesforce_settings as $key => $attributes) {
662 662
 			$id       = $this->option_prefix . $key;
663 663
 			$name     = $this->option_prefix . $key;
664 664
 			$title    = $attributes['title'];
@@ -677,12 +677,12 @@  discard block
 block discarded – undo
677 677
 			);
678 678
 
679 679
 			// if there is a constant and it is defined, don't run a validate function
680
-			if ( isset( $attributes['args']['constant'] ) && defined( $attributes['args']['constant'] ) ) {
680
+			if (isset($attributes['args']['constant']) && defined($attributes['args']['constant'])) {
681 681
 				$validate = '';
682 682
 			}
683 683
 
684
-			add_settings_field( $id, $title, $callback, $page, $section, $args );
685
-			register_setting( $page, $id, array( $this, $validate ) );
684
+			add_settings_field($id, $title, $callback, $page, $section, $args);
685
+			register_setting($page, $id, array($this, $validate));
686 686
 		}
687 687
 	}
688 688
 
@@ -694,8 +694,8 @@  discard block
 block discarded – undo
694 694
 	* @param string $section
695 695
 	* @param string $input_callback
696 696
 	*/
697
-	private function fields_fieldmaps( $page, $section, $input_callback = '' ) {
698
-		add_settings_section( $page, ucwords( $page ), null, $page );
697
+	private function fields_fieldmaps($page, $section, $input_callback = '') {
698
+		add_settings_section($page, ucwords($page), null, $page);
699 699
 	}
700 700
 
701 701
 	/**
@@ -706,12 +706,12 @@  discard block
 block discarded – undo
706 706
 	* @param string $section
707 707
 	* @param string $input_callback
708 708
 	*/
709
-	private function fields_scheduling( $page, $section, $callbacks ) {
710
-		foreach ( $this->schedulable_classes as $key => $value ) {
711
-			add_settings_section( $key, $value['label'], null, $page );
709
+	private function fields_scheduling($page, $section, $callbacks) {
710
+		foreach ($this->schedulable_classes as $key => $value) {
711
+			add_settings_section($key, $value['label'], null, $page);
712 712
 			$schedule_settings = array(
713 713
 				$key . '_schedule_number' => array(
714
-					'title'    => __( 'Run schedule every', 'object-sync-for-salesforce' ),
714
+					'title'    => __('Run schedule every', 'object-sync-for-salesforce'),
715 715
 					'callback' => $callbacks['text'],
716 716
 					'page'     => $page,
717 717
 					'section'  => $key,
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 					),
724 724
 				),
725 725
 				$key . '_schedule_unit'   => array(
726
-					'title'    => __( 'Time unit', 'object-sync-for-salesforce' ),
726
+					'title'    => __('Time unit', 'object-sync-for-salesforce'),
727 727
 					'callback' => $callbacks['select'],
728 728
 					'page'     => $page,
729 729
 					'section'  => $key,
@@ -733,15 +733,15 @@  discard block
 block discarded – undo
733 733
 						'desc'     => '',
734 734
 						'items'    => array(
735 735
 							'minutes' => array(
736
-								'text'  => __( 'Minutes', 'object-sync-for-salesforce' ),
736
+								'text'  => __('Minutes', 'object-sync-for-salesforce'),
737 737
 								'value' => 'minutes',
738 738
 							),
739 739
 							'hours'   => array(
740
-								'text'  => __( 'Hours', 'object-sync-for-salesforce' ),
740
+								'text'  => __('Hours', 'object-sync-for-salesforce'),
741 741
 								'value' => 'hours',
742 742
 							),
743 743
 							'days'    => array(
744
-								'text'  => __( 'Days', 'object-sync-for-salesforce' ),
744
+								'text'  => __('Days', 'object-sync-for-salesforce'),
745 745
 								'value' => 'days',
746 746
 							),
747 747
 						),
@@ -749,19 +749,19 @@  discard block
 block discarded – undo
749 749
 				),
750 750
 				$key . '_clear_button'    => array(
751 751
 					// translators: $this->get_schedule_count is an integer showing how many items are in the current queue
752
-					'title'    => sprintf( 'This queue has ' . _n( '%s item', '%s items', $this->get_schedule_count( $key ), 'object-sync-for-salesforce' ), $this->get_schedule_count( $key ) ),
752
+					'title'    => sprintf('This queue has ' . _n('%s item', '%s items', $this->get_schedule_count($key), 'object-sync-for-salesforce'), $this->get_schedule_count($key)),
753 753
 					'callback' => $callbacks['link'],
754 754
 					'page'     => $page,
755 755
 					'section'  => $key,
756 756
 					'args'     => array(
757
-						'label'      => __( 'Clear this queue', 'object-sync-for-salesforce' ),
757
+						'label'      => __('Clear this queue', 'object-sync-for-salesforce'),
758 758
 						'desc'       => '',
759
-						'url'        => esc_url( '?page=object-sync-salesforce-admin&amp;tab=clear_schedule&amp;schedule_name=' . $key ),
759
+						'url'        => esc_url('?page=object-sync-salesforce-admin&amp;tab=clear_schedule&amp;schedule_name=' . $key),
760 760
 						'link_class' => 'button button-secondary',
761 761
 					),
762 762
 				),
763 763
 			);
764
-			foreach ( $schedule_settings as $key => $attributes ) {
764
+			foreach ($schedule_settings as $key => $attributes) {
765 765
 				$id       = $this->option_prefix . $key;
766 766
 				$name     = $this->option_prefix . $key;
767 767
 				$title    = $attributes['title'];
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
 						'name'      => $name,
778 778
 					)
779 779
 				);
780
-				add_settings_field( $id, $title, $callback, $page, $section, $args );
781
-				register_setting( $page, $id );
780
+				add_settings_field($id, $title, $callback, $page, $section, $args);
781
+				register_setting($page, $id);
782 782
 			}
783 783
 		} // End foreach().
784 784
 	}
@@ -791,11 +791,11 @@  discard block
 block discarded – undo
791 791
 	* @param string $section
792 792
 	* @param array $callbacks
793 793
 	*/
794
-	private function fields_log_settings( $page, $section, $callbacks ) {
795
-		add_settings_section( $page, ucwords( str_replace( '_', ' ', $page ) ), null, $page );
794
+	private function fields_log_settings($page, $section, $callbacks) {
795
+		add_settings_section($page, ucwords(str_replace('_', ' ', $page)), null, $page);
796 796
 		$log_settings = array(
797 797
 			'enable_logging'        => array(
798
-				'title'    => __( 'Enable Logging?', 'object-sync-for-salesforce' ),
798
+				'title'    => __('Enable Logging?', 'object-sync-for-salesforce'),
799 799
 				'callback' => $callbacks['text'],
800 800
 				'page'     => $page,
801 801
 				'section'  => $section,
@@ -807,32 +807,32 @@  discard block
 block discarded – undo
807 807
 				),
808 808
 			),
809 809
 			'statuses_to_log'       => array(
810
-				'title'    => __( 'Statuses to log', 'object-sync-for-salesforce' ),
810
+				'title'    => __('Statuses to log', 'object-sync-for-salesforce'),
811 811
 				'callback' => $callbacks['checkboxes'],
812 812
 				'page'     => $page,
813 813
 				'section'  => $section,
814 814
 				'args'     => array(
815 815
 					'type'     => 'checkboxes',
816 816
 					'validate' => 'sanitize_validate_text',
817
-					'desc'     => __( 'these are the statuses to log', 'object-sync-for-salesforce' ),
817
+					'desc'     => __('these are the statuses to log', 'object-sync-for-salesforce'),
818 818
 					'items'    => array(
819 819
 						'error'   => array(
820
-							'text' => __( 'Error', 'object-sync-for-salesforce' ),
820
+							'text' => __('Error', 'object-sync-for-salesforce'),
821 821
 							'id'   => 'error',
822 822
 							'desc' => '',
823 823
 						),
824 824
 						'success' => array(
825
-							'text' => __( 'Success', 'object-sync-for-salesforce' ),
825
+							'text' => __('Success', 'object-sync-for-salesforce'),
826 826
 							'id'   => 'success',
827 827
 							'desc' => '',
828 828
 						),
829 829
 						'notice'  => array(
830
-							'text' => __( 'Notice', 'object-sync-for-salesforce' ),
830
+							'text' => __('Notice', 'object-sync-for-salesforce'),
831 831
 							'id'   => 'notice',
832 832
 							'desc' => '',
833 833
 						),
834 834
 						'debug'   => array(
835
-							'text' => __( 'Debug', 'object-sync-for-salesforce' ),
835
+							'text' => __('Debug', 'object-sync-for-salesforce'),
836 836
 							'id'   => 'debug',
837 837
 							'desc' => '',
838 838
 						),
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 				),
841 841
 			),
842 842
 			'prune_logs'            => array(
843
-				'title'    => __( 'Automatically delete old log entries?', 'object-sync-for-salesforce' ),
843
+				'title'    => __('Automatically delete old log entries?', 'object-sync-for-salesforce'),
844 844
 				'callback' => $callbacks['text'],
845 845
 				'page'     => $page,
846 846
 				'section'  => $section,
@@ -852,20 +852,20 @@  discard block
 block discarded – undo
852 852
 				),
853 853
 			),
854 854
 			'logs_how_old'          => array(
855
-				'title'    => __( 'Age to delete log entries', 'object-sync-for-salesforce' ),
855
+				'title'    => __('Age to delete log entries', 'object-sync-for-salesforce'),
856 856
 				'callback' => $callbacks['text'],
857 857
 				'page'     => $page,
858 858
 				'section'  => $section,
859 859
 				'args'     => array(
860 860
 					'type'     => 'text',
861 861
 					'validate' => 'sanitize_validate_text',
862
-					'desc'     => __( 'If automatic deleting is enabled, it will affect logs this old.', 'object-sync-for-salesforce' ),
862
+					'desc'     => __('If automatic deleting is enabled, it will affect logs this old.', 'object-sync-for-salesforce'),
863 863
 					'default'  => '2 weeks',
864 864
 					'constant' => '',
865 865
 				),
866 866
 			),
867 867
 			'logs_how_often_number' => array(
868
-				'title'    => __( 'Check for old logs every', 'object-sync-for-salesforce' ),
868
+				'title'    => __('Check for old logs every', 'object-sync-for-salesforce'),
869 869
 				'callback' => $callbacks['text'],
870 870
 				'page'     => $page,
871 871
 				'section'  => $section,
@@ -878,67 +878,67 @@  discard block
 block discarded – undo
878 878
 				),
879 879
 			),
880 880
 			'logs_how_often_unit'   => array(
881
-				'title'    => __( 'Time unit', 'object-sync-for-salesforce' ),
881
+				'title'    => __('Time unit', 'object-sync-for-salesforce'),
882 882
 				'callback' => $callbacks['select'],
883 883
 				'page'     => $page,
884 884
 				'section'  => $section,
885 885
 				'args'     => array(
886 886
 					'type'     => 'select',
887 887
 					'validate' => 'sanitize_validate_text',
888
-					'desc'     => __( 'These two fields are how often the site will check for logs to delete.', 'object-sync-for-salesforce' ),
888
+					'desc'     => __('These two fields are how often the site will check for logs to delete.', 'object-sync-for-salesforce'),
889 889
 					'items'    => array(
890 890
 						'minutes' => array(
891
-							'text'  => __( 'Minutes', 'object-sync-for-salesforce' ),
891
+							'text'  => __('Minutes', 'object-sync-for-salesforce'),
892 892
 							'value' => 'minutes',
893 893
 						),
894 894
 						'hours'   => array(
895
-							'text'  => __( 'Hours', 'object-sync-for-salesforce' ),
895
+							'text'  => __('Hours', 'object-sync-for-salesforce'),
896 896
 							'value' => 'hours',
897 897
 						),
898 898
 						'days'    => array(
899
-							'text'  => __( 'Days', 'object-sync-for-salesforce' ),
899
+							'text'  => __('Days', 'object-sync-for-salesforce'),
900 900
 							'value' => 'days',
901 901
 						),
902 902
 					),
903 903
 				),
904 904
 			),
905 905
 			'triggers_to_log'       => array(
906
-				'title'    => __( 'Triggers to log', 'object-sync-for-salesforce' ),
906
+				'title'    => __('Triggers to log', 'object-sync-for-salesforce'),
907 907
 				'callback' => $callbacks['checkboxes'],
908 908
 				'page'     => $page,
909 909
 				'section'  => $section,
910 910
 				'args'     => array(
911 911
 					'type'     => 'checkboxes',
912 912
 					'validate' => 'sanitize_validate_text',
913
-					'desc'     => __( 'these are the triggers to log', 'object-sync-for-salesforce' ),
913
+					'desc'     => __('these are the triggers to log', 'object-sync-for-salesforce'),
914 914
 					'items'    => array(
915 915
 						$this->mappings->sync_wordpress_create => array(
916
-							'text' => __( 'WordPress create', 'object-sync-for-salesforce' ),
916
+							'text' => __('WordPress create', 'object-sync-for-salesforce'),
917 917
 							'id'   => 'wordpress_create',
918 918
 							'desc' => '',
919 919
 						),
920 920
 						$this->mappings->sync_wordpress_update => array(
921
-							'text' => __( 'WordPress update', 'object-sync-for-salesforce' ),
921
+							'text' => __('WordPress update', 'object-sync-for-salesforce'),
922 922
 							'id'   => 'wordpress_update',
923 923
 							'desc' => '',
924 924
 						),
925 925
 						$this->mappings->sync_wordpress_delete => array(
926
-							'text' => __( 'WordPress delete', 'object-sync-for-salesforce' ),
926
+							'text' => __('WordPress delete', 'object-sync-for-salesforce'),
927 927
 							'id'   => 'wordpress_delete',
928 928
 							'desc' => '',
929 929
 						),
930 930
 						$this->mappings->sync_sf_create => array(
931
-							'text' => __( 'Salesforce create', 'object-sync-for-salesforce' ),
931
+							'text' => __('Salesforce create', 'object-sync-for-salesforce'),
932 932
 							'id'   => 'sf_create',
933 933
 							'desc' => '',
934 934
 						),
935 935
 						$this->mappings->sync_sf_update => array(
936
-							'text' => __( 'Salesforce update', 'object-sync-for-salesforce' ),
936
+							'text' => __('Salesforce update', 'object-sync-for-salesforce'),
937 937
 							'id'   => 'sf_update',
938 938
 							'desc' => '',
939 939
 						),
940 940
 						$this->mappings->sync_sf_delete => array(
941
-							'text' => __( 'Salesforce delete', 'object-sync-for-salesforce' ),
941
+							'text' => __('Salesforce delete', 'object-sync-for-salesforce'),
942 942
 							'id'   => 'sf_delete',
943 943
 							'desc' => '',
944 944
 						),
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 				),
947 947
 			),
948 948
 		);
949
-		foreach ( $log_settings as $key => $attributes ) {
949
+		foreach ($log_settings as $key => $attributes) {
950 950
 			$id       = $this->option_prefix . $key;
951 951
 			$name     = $this->option_prefix . $key;
952 952
 			$title    = $attributes['title'];
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 					'name'      => $name,
963 963
 				)
964 964
 			);
965
-			add_settings_field( $id, $title, $callback, $page, $section, $args );
966
-			register_setting( $page, $id );
965
+			add_settings_field($id, $title, $callback, $page, $section, $args);
966
+			register_setting($page, $id);
967 967
 		}
968 968
 	}
969 969
 
@@ -974,69 +974,69 @@  discard block
 block discarded – undo
974 974
 	public function notices() {
975 975
 
976 976
 		// before a notice is displayed, we should make sure we are on a page related to this plugin
977
-		if ( ! isset( $_GET['page'] ) || 'object-sync-salesforce-admin' !== $_GET['page'] ) {
977
+		if ( ! isset($_GET['page']) || 'object-sync-salesforce-admin' !== $_GET['page']) {
978 978
 			return;
979 979
 		}
980 980
 
981
-		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
982
-		require_once plugin_dir_path( __FILE__ ) . '../classes/admin-notice.php';
981
+		$get_data = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
982
+		require_once plugin_dir_path(__FILE__) . '../classes/admin-notice.php';
983 983
 
984 984
 		$notices = array(
985 985
 			'permission'      => array(
986 986
 				'condition'   => false === $this->check_wordpress_admin_permissions(),
987
-				'message'     => __( "Your account does not have permission to edit the Salesforce REST API plugin's settings.", 'object-sync-for-salesforce' ),
987
+				'message'     => __("Your account does not have permission to edit the Salesforce REST API plugin's settings.", 'object-sync-for-salesforce'),
988 988
 				'type'        => 'error',
989 989
 				'dismissible' => false,
990 990
 			),
991 991
 			'fieldmap'        => array(
992
-				'condition'   => isset( $get_data['transient'] ),
993
-				'message'     => __( 'Errors kept this fieldmap from being saved.', 'object-sync-for-salesforce' ),
992
+				'condition'   => isset($get_data['transient']),
993
+				'message'     => __('Errors kept this fieldmap from being saved.', 'object-sync-for-salesforce'),
994 994
 				'type'        => 'error',
995 995
 				'dismissible' => true,
996 996
 			),
997 997
 			'object_map'      => array(
998
-				'condition'   => isset( $get_data['map_transient'] ),
999
-				'message'     => __( 'Errors kept this object map from being saved.', 'object-sync-for-salesforce' ),
998
+				'condition'   => isset($get_data['map_transient']),
999
+				'message'     => __('Errors kept this object map from being saved.', 'object-sync-for-salesforce'),
1000 1000
 				'type'        => 'error',
1001 1001
 				'dismissible' => true,
1002 1002
 			),
1003 1003
 			'data_saved'      => array(
1004
-				'condition'   => isset( $get_data['data_saved'] ) && 'true' === $get_data['data_saved'],
1005
-				'message'     => __( 'This data was successfully saved.', 'object-sync-for-salesforce' ),
1004
+				'condition'   => isset($get_data['data_saved']) && 'true' === $get_data['data_saved'],
1005
+				'message'     => __('This data was successfully saved.', 'object-sync-for-salesforce'),
1006 1006
 				'type'        => 'success',
1007 1007
 				'dismissible' => true,
1008 1008
 			),
1009 1009
 			'data_save_error' => array(
1010
-				'condition'   => isset( $get_data['data_saved'] ) && 'false' === $get_data['data_saved'],
1011
-				'message'     => __( 'This data was not successfully saved. Try again.', 'object-sync-for-salesforce' ),
1010
+				'condition'   => isset($get_data['data_saved']) && 'false' === $get_data['data_saved'],
1011
+				'message'     => __('This data was not successfully saved. Try again.', 'object-sync-for-salesforce'),
1012 1012
 				'type'        => 'error',
1013 1013
 				'dismissible' => true,
1014 1014
 			),
1015 1015
 		);
1016 1016
 
1017
-		foreach ( $notices as $key => $value ) {
1017
+		foreach ($notices as $key => $value) {
1018 1018
 
1019 1019
 			$condition = $value['condition'];
1020 1020
 			$message   = $value['message'];
1021 1021
 
1022
-			if ( isset( $value['dismissible'] ) ) {
1022
+			if (isset($value['dismissible'])) {
1023 1023
 				$dismissible = $value['dismissible'];
1024 1024
 			} else {
1025 1025
 				$dismissible = false;
1026 1026
 			}
1027 1027
 
1028
-			if ( isset( $value['type'] ) ) {
1028
+			if (isset($value['type'])) {
1029 1029
 				$type = $value['type'];
1030 1030
 			} else {
1031 1031
 				$type = '';
1032 1032
 			}
1033 1033
 
1034
-			if ( ! isset( $value['template'] ) ) {
1034
+			if ( ! isset($value['template'])) {
1035 1035
 				$template = '';
1036 1036
 			}
1037 1037
 
1038
-			if ( $condition ) {
1039
-				new Object_Sync_Sf_Admin_Notice( $condition, $message, $dismissible, $type, $template );
1038
+			if ($condition) {
1039
+				new Object_Sync_Sf_Admin_Notice($condition, $message, $dismissible, $type, $template);
1040 1040
 			}
1041 1041
 		}
1042 1042
 
@@ -1051,47 +1051,47 @@  discard block
 block discarded – undo
1051 1051
 	* can optionally contain a type
1052 1052
 	* @return array $object_settings
1053 1053
 	*/
1054
-	public function get_salesforce_object_description( $data = array() ) {
1054
+	public function get_salesforce_object_description($data = array()) {
1055 1055
 		$ajax = false;
1056
-		if ( empty( $data ) ) {
1057
-			$data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1056
+		if (empty($data)) {
1057
+			$data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1058 1058
 			$ajax = true;
1059 1059
 		}
1060 1060
 
1061 1061
 		$object_description = array();
1062 1062
 
1063
-		if ( ! empty( $data['salesforce_object'] ) ) {
1064
-			$object = $this->salesforce['sfapi']->object_describe( esc_attr( $data['salesforce_object'] ) );
1063
+		if ( ! empty($data['salesforce_object'])) {
1064
+			$object = $this->salesforce['sfapi']->object_describe(esc_attr($data['salesforce_object']));
1065 1065
 
1066 1066
 			$object_fields        = array();
1067 1067
 			$include_record_types = array();
1068 1068
 
1069 1069
 			// these can come from ajax
1070
-			$include = isset( $data['include'] ) ? (array) $data['include'] : array();
1071
-			$include = array_map( 'esc_attr', $include );
1072
-
1073
-			if ( in_array( 'fields', $include, true ) || empty( $include ) ) {
1074
-				$type = isset( $data['field_type'] ) ? esc_attr( $data['field_type'] ) : ''; // can come from ajax
1075
-				foreach ( $object['data']['fields'] as $key => $value ) {
1076
-					if ( '' === $type || $type === $value['type'] ) {
1077
-						$object_fields[ $key ] = $value;
1070
+			$include = isset($data['include']) ? (array) $data['include'] : array();
1071
+			$include = array_map('esc_attr', $include);
1072
+
1073
+			if (in_array('fields', $include, true) || empty($include)) {
1074
+				$type = isset($data['field_type']) ? esc_attr($data['field_type']) : ''; // can come from ajax
1075
+				foreach ($object['data']['fields'] as $key => $value) {
1076
+					if ('' === $type || $type === $value['type']) {
1077
+						$object_fields[$key] = $value;
1078 1078
 					}
1079 1079
 				}
1080 1080
 				$object_description['fields'] = $object_fields;
1081 1081
 			}
1082 1082
 
1083
-			if ( in_array( 'recordTypeInfos', $include, true ) ) {
1084
-				if ( isset( $object['data']['recordTypeInfos'] ) && count( $object['data']['recordTypeInfos'] ) > 1 ) {
1085
-					foreach ( $object['data']['recordTypeInfos'] as $type ) {
1086
-						$object_record_types[ $type['recordTypeId'] ] = $type['name'];
1083
+			if (in_array('recordTypeInfos', $include, true)) {
1084
+				if (isset($object['data']['recordTypeInfos']) && count($object['data']['recordTypeInfos']) > 1) {
1085
+					foreach ($object['data']['recordTypeInfos'] as $type) {
1086
+						$object_record_types[$type['recordTypeId']] = $type['name'];
1087 1087
 					}
1088 1088
 					$object_description['recordTypeInfos'] = $object_record_types;
1089 1089
 				}
1090 1090
 			}
1091 1091
 		}
1092 1092
 
1093
-		if ( true === $ajax ) {
1094
-			wp_send_json_success( $object_description );
1093
+		if (true === $ajax) {
1094
+			wp_send_json_success($object_description);
1095 1095
 		} else {
1096 1096
 			return $object_description;
1097 1097
 		}
@@ -1105,23 +1105,23 @@  discard block
 block discarded – undo
1105 1105
 	* can optionally contain a type for the field
1106 1106
 	* @return array $object_fields
1107 1107
 	*/
1108
-	public function get_salesforce_object_fields( $data = array() ) {
1108
+	public function get_salesforce_object_fields($data = array()) {
1109 1109
 
1110
-		if ( ! empty( $data['salesforce_object'] ) ) {
1111
-			$object               = $this->salesforce['sfapi']->object_describe( esc_attr( $data['salesforce_object'] ) );
1110
+		if ( ! empty($data['salesforce_object'])) {
1111
+			$object               = $this->salesforce['sfapi']->object_describe(esc_attr($data['salesforce_object']));
1112 1112
 			$object_fields        = array();
1113
-			$type                 = isset( $data['type'] ) ? esc_attr( $data['type'] ) : '';
1114
-			$include_record_types = isset( $data['include_record_types'] ) ? esc_attr( $data['include_record_types'] ) : false;
1115
-			foreach ( $object['data']['fields'] as $key => $value ) {
1116
-				if ( '' === $type || $type === $value['type'] ) {
1117
-					$object_fields[ $key ] = $value;
1113
+			$type                 = isset($data['type']) ? esc_attr($data['type']) : '';
1114
+			$include_record_types = isset($data['include_record_types']) ? esc_attr($data['include_record_types']) : false;
1115
+			foreach ($object['data']['fields'] as $key => $value) {
1116
+				if ('' === $type || $type === $value['type']) {
1117
+					$object_fields[$key] = $value;
1118 1118
 				}
1119 1119
 			}
1120
-			if ( true === $include_record_types ) {
1120
+			if (true === $include_record_types) {
1121 1121
 				$object_record_types = array();
1122
-				if ( isset( $object['data']['recordTypeInfos'] ) && count( $object['data']['recordTypeInfos'] ) > 1 ) {
1123
-					foreach ( $object['data']['recordTypeInfos'] as $type ) {
1124
-						$object_record_types[ $type['recordTypeId'] ] = $type['name'];
1122
+				if (isset($object['data']['recordTypeInfos']) && count($object['data']['recordTypeInfos']) > 1) {
1123
+					foreach ($object['data']['recordTypeInfos'] as $type) {
1124
+						$object_record_types[$type['recordTypeId']] = $type['name'];
1125 1125
 					}
1126 1126
 				}
1127 1127
 			}
@@ -1138,18 +1138,18 @@  discard block
 block discarded – undo
1138 1138
 	* @param string $wordpress_object
1139 1139
 	* @return array $object_fields
1140 1140
 	*/
1141
-	public function get_wordpress_object_fields( $wordpress_object = '' ) {
1141
+	public function get_wordpress_object_fields($wordpress_object = '') {
1142 1142
 		$ajax      = false;
1143
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1144
-		if ( empty( $wordpress_object ) ) {
1145
-			$wordpress_object = isset( $post_data['wordpress_object'] ) ? sanitize_text_field( wp_unslash( $post_data['wordpress_object'] ) ) : '';
1143
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1144
+		if (empty($wordpress_object)) {
1145
+			$wordpress_object = isset($post_data['wordpress_object']) ? sanitize_text_field(wp_unslash($post_data['wordpress_object'])) : '';
1146 1146
 			$ajax             = true;
1147 1147
 		}
1148 1148
 
1149
-		$object_fields = $this->wordpress->get_wordpress_object_fields( $wordpress_object );
1149
+		$object_fields = $this->wordpress->get_wordpress_object_fields($wordpress_object);
1150 1150
 
1151
-		if ( true === $ajax ) {
1152
-			wp_send_json_success( $object_fields );
1151
+		if (true === $ajax) {
1152
+			wp_send_json_success($object_fields);
1153 1153
 		} else {
1154 1154
 			return $object_fields;
1155 1155
 		}
@@ -1163,24 +1163,24 @@  discard block
 block discarded – undo
1163 1163
 	* @param string $salesforce_object
1164 1164
 	* @return array $object_fields
1165 1165
 	*/
1166
-	public function get_wp_sf_object_fields( $wordpress_object = '', $salesforce = '' ) {
1167
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1168
-		if ( empty( $wordpress_object ) ) {
1169
-			$wordpress_object = isset( $post_data['wordpress_object'] ) ? sanitize_text_field( wp_unslash( $post_data['wordpress_object'] ) ) : '';
1166
+	public function get_wp_sf_object_fields($wordpress_object = '', $salesforce = '') {
1167
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1168
+		if (empty($wordpress_object)) {
1169
+			$wordpress_object = isset($post_data['wordpress_object']) ? sanitize_text_field(wp_unslash($post_data['wordpress_object'])) : '';
1170 1170
 		}
1171
-		if ( empty( $salesforce_object ) ) {
1172
-			$salesforce_object = isset( $post_data['salesforce_object'] ) ? sanitize_text_field( wp_unslash( $post_data['salesforce_object'] ) ) : '';
1171
+		if (empty($salesforce_object)) {
1172
+			$salesforce_object = isset($post_data['salesforce_object']) ? sanitize_text_field(wp_unslash($post_data['salesforce_object'])) : '';
1173 1173
 		}
1174 1174
 
1175
-		$object_fields['wordpress']  = $this->get_wordpress_object_fields( $wordpress_object );
1175
+		$object_fields['wordpress']  = $this->get_wordpress_object_fields($wordpress_object);
1176 1176
 		$object_fields['salesforce'] = $this->get_salesforce_object_fields(
1177 1177
 			array(
1178 1178
 				'salesforce_object' => $salesforce_object,
1179 1179
 			)
1180 1180
 		);
1181 1181
 
1182
-		if ( ! empty( $post_data ) ) {
1183
-			wp_send_json_success( $object_fields );
1182
+		if ( ! empty($post_data)) {
1183
+			wp_send_json_success($object_fields);
1184 1184
 		} else {
1185 1185
 			return $object_fields;
1186 1186
 		}
@@ -1193,17 +1193,17 @@  discard block
 block discarded – undo
1193 1193
 	* @param string $wordpress_object
1194 1194
 	* @param int $wordpress_id
1195 1195
 	*/
1196
-	public function push_to_salesforce( $wordpress_object = '', $wordpress_id = '' ) {
1197
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1198
-		if ( empty( $wordpress_object ) && empty( $wordpress_id ) ) {
1199
-			$wordpress_object = isset( $post_data['wordpress_object'] ) ? sanitize_text_field( wp_unslash( $post_data['wordpress_object'] ) ) : '';
1200
-			$wordpress_id     = isset( $post_data['wordpress_id'] ) ? absint( $post_data['wordpress_id'] ) : '';
1196
+	public function push_to_salesforce($wordpress_object = '', $wordpress_id = '') {
1197
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1198
+		if (empty($wordpress_object) && empty($wordpress_id)) {
1199
+			$wordpress_object = isset($post_data['wordpress_object']) ? sanitize_text_field(wp_unslash($post_data['wordpress_object'])) : '';
1200
+			$wordpress_id     = isset($post_data['wordpress_id']) ? absint($post_data['wordpress_id']) : '';
1201 1201
 		}
1202
-		$data   = $this->wordpress->get_wordpress_object_data( $wordpress_object, $wordpress_id );
1203
-		$result = $this->push->manual_object_update( $data, $wordpress_object );
1202
+		$data   = $this->wordpress->get_wordpress_object_data($wordpress_object, $wordpress_id);
1203
+		$result = $this->push->manual_object_update($data, $wordpress_object);
1204 1204
 
1205
-		if ( ! empty( $post_data['wordpress_object'] ) && ! empty( $post_data['wordpress_id'] ) ) {
1206
-			wp_send_json_success( $result );
1205
+		if ( ! empty($post_data['wordpress_object']) && ! empty($post_data['wordpress_id'])) {
1206
+			wp_send_json_success($result);
1207 1207
 		} else {
1208 1208
 			return $result;
1209 1209
 		}
@@ -1217,16 +1217,16 @@  discard block
 block discarded – undo
1217 1217
 	* @param string $salesforce_id
1218 1218
 	* @param string $wordpress_object
1219 1219
 	*/
1220
-	public function pull_from_salesforce( $salesforce_id = '', $wordpress_object = '' ) {
1221
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1222
-		if ( empty( $wordpress_object ) && empty( $salesforce_id ) ) {
1223
-			$wordpress_object = isset( $post_data['wordpress_object'] ) ? sanitize_text_field( wp_unslash( $post_data['wordpress_object'] ) ) : '';
1224
-			$salesforce_id    = isset( $post_data['salesforce_id'] ) ? sanitize_text_field( wp_unslash( $post_data['salesforce_id'] ) ) : '';
1225
-		}
1226
-		$type   = $this->salesforce['sfapi']->get_sobject_type( $salesforce_id );
1227
-		$result = $this->pull->manual_pull( $type, $salesforce_id, $wordpress_object ); // we want the wp object to make sure we get the right fieldmap
1228
-		if ( ! empty( $post_data ) ) {
1229
-			wp_send_json_success( $result );
1220
+	public function pull_from_salesforce($salesforce_id = '', $wordpress_object = '') {
1221
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1222
+		if (empty($wordpress_object) && empty($salesforce_id)) {
1223
+			$wordpress_object = isset($post_data['wordpress_object']) ? sanitize_text_field(wp_unslash($post_data['wordpress_object'])) : '';
1224
+			$salesforce_id    = isset($post_data['salesforce_id']) ? sanitize_text_field(wp_unslash($post_data['salesforce_id'])) : '';
1225
+		}
1226
+		$type   = $this->salesforce['sfapi']->get_sobject_type($salesforce_id);
1227
+		$result = $this->pull->manual_pull($type, $salesforce_id, $wordpress_object); // we want the wp object to make sure we get the right fieldmap
1228
+		if ( ! empty($post_data)) {
1229
+			wp_send_json_success($result);
1230 1230
 		} else {
1231 1231
 			return $result;
1232 1232
 		}
@@ -1238,18 +1238,18 @@  discard block
 block discarded – undo
1238 1238
 	*
1239 1239
 	* @param int $mapping_id
1240 1240
 	*/
1241
-	public function refresh_mapped_data( $mapping_id = '' ) {
1242
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1243
-		if ( empty( $mapping_id ) ) {
1244
-			$mapping_id = isset( $post_data['mapping_id'] ) ? absint( $post_data['mapping_id'] ) : '';
1241
+	public function refresh_mapped_data($mapping_id = '') {
1242
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1243
+		if (empty($mapping_id)) {
1244
+			$mapping_id = isset($post_data['mapping_id']) ? absint($post_data['mapping_id']) : '';
1245 1245
 		}
1246 1246
 		$result = $this->mappings->get_object_maps(
1247 1247
 			array(
1248 1248
 				'id' => $mapping_id,
1249 1249
 			)
1250 1250
 		);
1251
-		if ( ! empty( $post_data ) ) {
1252
-			wp_send_json_success( $result );
1251
+		if ( ! empty($post_data)) {
1252
+			wp_send_json_success($result);
1253 1253
 		} else {
1254 1254
 			return $result;
1255 1255
 		}
@@ -1265,47 +1265,47 @@  discard block
 block discarded – undo
1265 1265
 	*/
1266 1266
 	public function prepare_fieldmap_data() {
1267 1267
 		$error     = false;
1268
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1269
-		$cachekey  = md5( wp_json_encode( $post_data ) );
1268
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1269
+		$cachekey  = md5(wp_json_encode($post_data));
1270 1270
 
1271
-		if ( ! isset( $post_data['label'] ) || ! isset( $post_data['salesforce_object'] ) || ! isset( $post_data['wordpress_object'] ) ) {
1271
+		if ( ! isset($post_data['label']) || ! isset($post_data['salesforce_object']) || ! isset($post_data['wordpress_object'])) {
1272 1272
 			$error = true;
1273 1273
 		}
1274
-		if ( true === $error ) {
1275
-			$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
1276
-			if ( '' !== $cachekey ) {
1277
-				$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&transient=' . $cachekey;
1274
+		if (true === $error) {
1275
+			$this->sfwp_transients->set($cachekey, $post_data, $this->wordpress->options['cache_expiration']);
1276
+			if ('' !== $cachekey) {
1277
+				$url = esc_url_raw($post_data['redirect_url_error']) . '&transient=' . $cachekey;
1278 1278
 			}
1279 1279
 		} else { // there are no errors
1280 1280
 			// send the row to the fieldmap class
1281 1281
 			// if it is add or clone, use the create method
1282
-			$method            = esc_attr( $post_data['method'] );
1282
+			$method            = esc_attr($post_data['method']);
1283 1283
 			$salesforce_fields = $this->get_salesforce_object_fields(
1284 1284
 				array(
1285 1285
 					'salesforce_object' => $post_data['salesforce_object'],
1286 1286
 				)
1287 1287
 			);
1288
-			$wordpress_fields  = $this->get_wordpress_object_fields( $post_data['wordpress_object'] );
1289
-			if ( 'add' === $method || 'clone' === $method ) {
1290
-				$result = $this->mappings->create_fieldmap( $post_data, $wordpress_fields, $salesforce_fields );
1291
-			} elseif ( 'edit' === $method ) { // if it is edit, use the update method
1292
-				$id     = esc_attr( $post_data['id'] );
1293
-				$result = $this->mappings->update_fieldmap( $post_data, $wordpress_fields, $salesforce_fields, $id );
1288
+			$wordpress_fields = $this->get_wordpress_object_fields($post_data['wordpress_object']);
1289
+			if ('add' === $method || 'clone' === $method) {
1290
+				$result = $this->mappings->create_fieldmap($post_data, $wordpress_fields, $salesforce_fields);
1291
+			} elseif ('edit' === $method) { // if it is edit, use the update method
1292
+				$id     = esc_attr($post_data['id']);
1293
+				$result = $this->mappings->update_fieldmap($post_data, $wordpress_fields, $salesforce_fields, $id);
1294 1294
 			}
1295
-			if ( false === $result ) { // if the database didn't save, it's still an error
1296
-				$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
1297
-				if ( '' !== $cachekey ) {
1298
-					$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&transient=' . $cachekey;
1295
+			if (false === $result) { // if the database didn't save, it's still an error
1296
+				$this->sfwp_transients->set($cachekey, $post_data, $this->wordpress->options['cache_expiration']);
1297
+				if ('' !== $cachekey) {
1298
+					$url = esc_url_raw($post_data['redirect_url_error']) . '&transient=' . $cachekey;
1299 1299
 				}
1300 1300
 			} else {
1301
-				if ( isset( $post_data['transient'] ) ) { // there was previously an error saved. can delete it now.
1302
-					$this->sfwp_transients->delete( esc_attr( $post_data['map_transient'] ) );
1301
+				if (isset($post_data['transient'])) { // there was previously an error saved. can delete it now.
1302
+					$this->sfwp_transients->delete(esc_attr($post_data['map_transient']));
1303 1303
 				}
1304 1304
 				// then send the user to the list of fieldmaps
1305
-				$url = esc_url_raw( $post_data['redirect_url_success'] );
1305
+				$url = esc_url_raw($post_data['redirect_url_success']);
1306 1306
 			}
1307 1307
 		}
1308
-		wp_safe_redirect( $url );
1308
+		wp_safe_redirect($url);
1309 1309
 		exit();
1310 1310
 	}
1311 1311
 
@@ -1317,15 +1317,15 @@  discard block
 block discarded – undo
1317 1317
 	*
1318 1318
 	*/
1319 1319
 	public function delete_fieldmap() {
1320
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1321
-		if ( $post_data['id'] ) {
1322
-			$result = $this->mappings->delete_fieldmap( $post_data['id'] );
1323
-			if ( true === $result ) {
1324
-				$url = esc_url_raw( $post_data['redirect_url_success'] );
1320
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1321
+		if ($post_data['id']) {
1322
+			$result = $this->mappings->delete_fieldmap($post_data['id']);
1323
+			if (true === $result) {
1324
+				$url = esc_url_raw($post_data['redirect_url_success']);
1325 1325
 			} else {
1326
-				$url = esc_url_raw( $post_data['redirect_url_error'] . '&id=' . $post_data['id'] );
1326
+				$url = esc_url_raw($post_data['redirect_url_error'] . '&id=' . $post_data['id']);
1327 1327
 			}
1328
-			wp_safe_redirect( $url );
1328
+			wp_safe_redirect($url);
1329 1329
 			exit();
1330 1330
 		}
1331 1331
 	}
@@ -1340,38 +1340,38 @@  discard block
 block discarded – undo
1340 1340
 	*/
1341 1341
 	public function prepare_object_map_data() {
1342 1342
 		$error     = false;
1343
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1344
-		$cachekey  = md5( wp_json_encode( $post_data ) );
1343
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1344
+		$cachekey  = md5(wp_json_encode($post_data));
1345 1345
 
1346
-		if ( ! isset( $post_data['wordpress_id'] ) || ! isset( $post_data['salesforce_id'] ) ) {
1346
+		if ( ! isset($post_data['wordpress_id']) || ! isset($post_data['salesforce_id'])) {
1347 1347
 			$error = true;
1348 1348
 		}
1349
-		if ( true === $error ) {
1350
-			$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
1351
-			if ( '' !== $cachekey ) {
1352
-				$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&map_transient=' . $cachekey;
1349
+		if (true === $error) {
1350
+			$this->sfwp_transients->set($cachekey, $post_data, $this->wordpress->options['cache_expiration']);
1351
+			if ('' !== $cachekey) {
1352
+				$url = esc_url_raw($post_data['redirect_url_error']) . '&map_transient=' . $cachekey;
1353 1353
 			}
1354 1354
 		} else { // there are no errors
1355 1355
 			// send the row to the object map class
1356
-			$method = esc_attr( $post_data['method'] );
1357
-			if ( 'edit' === $method ) { // if it is edit, use the update method
1358
-				$id     = esc_attr( $post_data['id'] );
1359
-				$result = $this->mappings->update_object_map( $post_data, $id );
1356
+			$method = esc_attr($post_data['method']);
1357
+			if ('edit' === $method) { // if it is edit, use the update method
1358
+				$id     = esc_attr($post_data['id']);
1359
+				$result = $this->mappings->update_object_map($post_data, $id);
1360 1360
 			}
1361
-			if ( false === $result ) { // if the database didn't save, it's still an error
1362
-				$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
1363
-				if ( '' !== $cachekey ) {
1364
-					$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&map_transient=' . $cachekey;
1361
+			if (false === $result) { // if the database didn't save, it's still an error
1362
+				$this->sfwp_transients->set($cachekey, $post_data, $this->wordpress->options['cache_expiration']);
1363
+				if ('' !== $cachekey) {
1364
+					$url = esc_url_raw($post_data['redirect_url_error']) . '&map_transient=' . $cachekey;
1365 1365
 				}
1366 1366
 			} else {
1367
-				if ( isset( $post_data['map_transient'] ) ) { // there was previously an error saved. can delete it now.
1368
-					$this->sfwp_transients->delete( esc_attr( $post_data['map_transient'] ) );
1367
+				if (isset($post_data['map_transient'])) { // there was previously an error saved. can delete it now.
1368
+					$this->sfwp_transients->delete(esc_attr($post_data['map_transient']));
1369 1369
 				}
1370 1370
 				// then send the user to the success redirect url
1371
-				$url = esc_url_raw( $post_data['redirect_url_success'] );
1371
+				$url = esc_url_raw($post_data['redirect_url_success']);
1372 1372
 			}
1373 1373
 		}
1374
-		wp_safe_redirect( $url );
1374
+		wp_safe_redirect($url);
1375 1375
 		exit();
1376 1376
 	}
1377 1377
 
@@ -1383,15 +1383,15 @@  discard block
 block discarded – undo
1383 1383
 	*
1384 1384
 	*/
1385 1385
 	public function delete_object_map() {
1386
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1387
-		if ( $post_data['id'] ) {
1388
-			$result = $this->mappings->delete_object_map( $post_data['id'] );
1389
-			if ( true === $result ) {
1390
-				$url = esc_url_raw( $post_data['redirect_url_success'] );
1386
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1387
+		if ($post_data['id']) {
1388
+			$result = $this->mappings->delete_object_map($post_data['id']);
1389
+			if (true === $result) {
1390
+				$url = esc_url_raw($post_data['redirect_url_success']);
1391 1391
 			} else {
1392
-				$url = esc_url_raw( $post_data['redirect_url_error'] . '&id=' . $post_data['id'] );
1392
+				$url = esc_url_raw($post_data['redirect_url_error'] . '&id=' . $post_data['id']);
1393 1393
 			}
1394
-			wp_safe_redirect( $url );
1394
+			wp_safe_redirect($url);
1395 1395
 			exit();
1396 1396
 		}
1397 1397
 	}
@@ -1402,95 +1402,95 @@  discard block
 block discarded – undo
1402 1402
 	*/
1403 1403
 	public function import_json_file() {
1404 1404
 
1405
-		if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_import'], 'object_sync_for_salesforce_nonce_import' ) ) {
1405
+		if ( ! wp_verify_nonce($_POST['object_sync_for_salesforce_nonce_import'], 'object_sync_for_salesforce_nonce_import')) {
1406 1406
 			return;
1407 1407
 		}
1408
-		if ( ! current_user_can( 'manage_options' ) ) {
1408
+		if ( ! current_user_can('manage_options')) {
1409 1409
 			return;
1410 1410
 		}
1411 1411
 		$path      = $_FILES['import_file']['name'];
1412
-		$extension = pathinfo( $path, PATHINFO_EXTENSION );
1413
-		if ( 'json' !== $extension ) {
1414
-			wp_die( __( 'Please upload a valid .json file' ) );
1412
+		$extension = pathinfo($path, PATHINFO_EXTENSION);
1413
+		if ('json' !== $extension) {
1414
+			wp_die(__('Please upload a valid .json file'));
1415 1415
 		}
1416 1416
 
1417 1417
 		$import_file = $_FILES['import_file']['tmp_name'];
1418
-		if ( empty( $import_file ) ) {
1419
-			wp_die( __( 'Please upload a file to import' ) );
1418
+		if (empty($import_file)) {
1419
+			wp_die(__('Please upload a file to import'));
1420 1420
 		}
1421 1421
 
1422 1422
 		// Retrieve the data from the file and convert the json object to an array.
1423
-		$data = (array) json_decode( file_get_contents( $import_file ), true );
1423
+		$data = (array) json_decode(file_get_contents($import_file), true);
1424 1424
 
1425 1425
 		// if there is only one object map, fix the array
1426
-		if ( isset( $data['object_maps'] ) ) {
1427
-			if ( count( $data['object_maps'] ) === count( $data['object_maps'], COUNT_RECURSIVE ) ) {
1428
-				$data['object_maps'] = array( 0 => $data['object_maps'] );
1426
+		if (isset($data['object_maps'])) {
1427
+			if (count($data['object_maps']) === count($data['object_maps'], COUNT_RECURSIVE)) {
1428
+				$data['object_maps'] = array(0 => $data['object_maps']);
1429 1429
 			}
1430 1430
 		}
1431 1431
 
1432
-		$overwrite = isset( $_POST['overwrite'] ) ? esc_attr( $_POST['overwrite'] ) : '';
1433
-		if ( '1' === $overwrite ) {
1434
-			if ( isset( $data['fieldmaps'] ) ) {
1432
+		$overwrite = isset($_POST['overwrite']) ? esc_attr($_POST['overwrite']) : '';
1433
+		if ('1' === $overwrite) {
1434
+			if (isset($data['fieldmaps'])) {
1435 1435
 				$fieldmaps = $this->mappings->get_fieldmaps();
1436
-				foreach ( $fieldmaps as $fieldmap ) {
1436
+				foreach ($fieldmaps as $fieldmap) {
1437 1437
 					$id     = $fieldmap['id'];
1438
-					$delete = $this->mappings->delete_fieldmap( $id );
1438
+					$delete = $this->mappings->delete_fieldmap($id);
1439 1439
 				}
1440 1440
 			}
1441
-			if ( isset( $data['object_maps'] ) ) {
1441
+			if (isset($data['object_maps'])) {
1442 1442
 				$object_maps = $this->mappings->get_object_maps();
1443 1443
 
1444 1444
 				// if there is only one existing object map, fix the array
1445
-				if ( count( $object_maps ) === count( $object_maps, COUNT_RECURSIVE ) ) {
1446
-					$object_maps = array( 0 => $object_maps );
1445
+				if (count($object_maps) === count($object_maps, COUNT_RECURSIVE)) {
1446
+					$object_maps = array(0 => $object_maps);
1447 1447
 				}
1448 1448
 
1449
-				foreach ( $object_maps as $object_map ) {
1449
+				foreach ($object_maps as $object_map) {
1450 1450
 					$id     = $object_map['id'];
1451
-					$delete = $this->mappings->delete_object_map( $id );
1451
+					$delete = $this->mappings->delete_object_map($id);
1452 1452
 				}
1453 1453
 			}
1454
-			if ( isset( $data['plugin_settings'] ) ) {
1455
-				foreach ( $data['plugin_settings'] as $key => $value ) {
1456
-					delete_option( $value['option_name'] );
1454
+			if (isset($data['plugin_settings'])) {
1455
+				foreach ($data['plugin_settings'] as $key => $value) {
1456
+					delete_option($value['option_name']);
1457 1457
 				}
1458 1458
 			}
1459 1459
 		}
1460 1460
 
1461 1461
 		$success = true;
1462 1462
 
1463
-		if ( isset( $data['fieldmaps'] ) ) {
1464
-			foreach ( $data['fieldmaps'] as $fieldmap ) {
1465
-				unset( $fieldmap['id'] );
1466
-				$create = $this->mappings->create_fieldmap( $fieldmap );
1467
-				if ( false === $create ) {
1463
+		if (isset($data['fieldmaps'])) {
1464
+			foreach ($data['fieldmaps'] as $fieldmap) {
1465
+				unset($fieldmap['id']);
1466
+				$create = $this->mappings->create_fieldmap($fieldmap);
1467
+				if (false === $create) {
1468 1468
 					$success = false;
1469 1469
 				}
1470 1470
 			}
1471 1471
 		}
1472 1472
 
1473
-		if ( isset( $data['object_maps'] ) ) {
1474
-			foreach ( $data['object_maps'] as $object_map ) {
1475
-				unset( $object_map['id'] );
1476
-				$create = $this->mappings->create_object_map( $object_map );
1477
-				if ( false === $create ) {
1473
+		if (isset($data['object_maps'])) {
1474
+			foreach ($data['object_maps'] as $object_map) {
1475
+				unset($object_map['id']);
1476
+				$create = $this->mappings->create_object_map($object_map);
1477
+				if (false === $create) {
1478 1478
 					$success = false;
1479 1479
 				}
1480 1480
 			}
1481 1481
 		}
1482 1482
 
1483
-		if ( isset( $data['plugin_settings'] ) ) {
1484
-			foreach ( $data['plugin_settings'] as $key => $value ) {
1485
-				update_option( $value['option_name'], maybe_unserialize( $value['option_value'] ), $value['autoload'] );
1483
+		if (isset($data['plugin_settings'])) {
1484
+			foreach ($data['plugin_settings'] as $key => $value) {
1485
+				update_option($value['option_name'], maybe_unserialize($value['option_value']), $value['autoload']);
1486 1486
 			}
1487 1487
 		}
1488 1488
 
1489
-		if ( true === $success ) {
1490
-			wp_safe_redirect( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=import-export&data_saved=true' ) );
1489
+		if (true === $success) {
1490
+			wp_safe_redirect(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=import-export&data_saved=true'));
1491 1491
 			exit;
1492 1492
 		} else {
1493
-			wp_safe_redirect( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=import-export&data_saved=false' ) );
1493
+			wp_safe_redirect(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=import-export&data_saved=false'));
1494 1494
 			exit;
1495 1495
 		}
1496 1496
 
@@ -1502,28 +1502,28 @@  discard block
 block discarded – undo
1502 1502
 	*/
1503 1503
 	public function export_json_file() {
1504 1504
 
1505
-		if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_export'], 'object_sync_for_salesforce_nonce_export' ) ) {
1505
+		if ( ! wp_verify_nonce($_POST['object_sync_for_salesforce_nonce_export'], 'object_sync_for_salesforce_nonce_export')) {
1506 1506
 			return;
1507 1507
 		}
1508
-		if ( ! current_user_can( 'manage_options' ) ) {
1508
+		if ( ! current_user_can('manage_options')) {
1509 1509
 			return;
1510 1510
 		}
1511
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1511
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1512 1512
 		$export    = array();
1513
-		if ( in_array( 'fieldmaps', $post_data['export'] ) ) {
1513
+		if (in_array('fieldmaps', $post_data['export'])) {
1514 1514
 			$export['fieldmaps'] = $this->mappings->get_fieldmaps();
1515 1515
 		}
1516
-		if ( in_array( 'object_maps', $post_data['export'] ) ) {
1516
+		if (in_array('object_maps', $post_data['export'])) {
1517 1517
 			$export['object_maps'] = $this->mappings->get_object_maps();
1518 1518
 		}
1519
-		if ( in_array( 'plugin_settings', $post_data['export'] ) ) {
1520
-			$export['plugin_settings'] = $this->wpdb->get_results( 'SELECT * FROM ' . $this->wpdb->prefix . 'options' . ' WHERE option_name like "' . $this->option_prefix . '%"', ARRAY_A );
1519
+		if (in_array('plugin_settings', $post_data['export'])) {
1520
+			$export['plugin_settings'] = $this->wpdb->get_results('SELECT * FROM ' . $this->wpdb->prefix . 'options' . ' WHERE option_name like "' . $this->option_prefix . '%"', ARRAY_A);
1521 1521
 		}
1522 1522
 		nocache_headers();
1523
-		header( 'Content-Type: application/json; charset=utf-8' );
1524
-		header( 'Content-Disposition: attachment; filename=object-sync-for-salesforce-data-export-' . date( 'm-d-Y' ) . '.json' );
1525
-		header( 'Expires: 0' );
1526
-		echo wp_json_encode( $export );
1523
+		header('Content-Type: application/json; charset=utf-8');
1524
+		header('Content-Disposition: attachment; filename=object-sync-for-salesforce-data-export-' . date('m-d-Y') . '.json');
1525
+		header('Expires: 0');
1526
+		echo wp_json_encode($export);
1527 1527
 		exit;
1528 1528
 	}
1529 1529
 
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
 	*
1533 1533
 	* @param array $args
1534 1534
 	*/
1535
-	public function display_input_field( $args ) {
1535
+	public function display_input_field($args) {
1536 1536
 		$type    = $args['type'];
1537 1537
 		$id      = $args['label_for'];
1538 1538
 		$name    = $args['name'];
@@ -1541,38 +1541,38 @@  discard block
 block discarded – undo
1541 1541
 
1542 1542
 		$class = 'regular-text';
1543 1543
 
1544
-		if ( 'checkbox' === $type ) {
1544
+		if ('checkbox' === $type) {
1545 1545
 			$class = 'checkbox';
1546 1546
 		}
1547 1547
 
1548
-		if ( ! isset( $args['constant'] ) || ! defined( $args['constant'] ) ) {
1549
-			$value = esc_attr( get_option( $id, '' ) );
1550
-			if ( 'checkbox' === $type ) {
1551
-				if ( '1' === $value ) {
1548
+		if ( ! isset($args['constant']) || ! defined($args['constant'])) {
1549
+			$value = esc_attr(get_option($id, ''));
1550
+			if ('checkbox' === $type) {
1551
+				if ('1' === $value) {
1552 1552
 					$checked = 'checked ';
1553 1553
 				}
1554 1554
 				$value = 1;
1555 1555
 			}
1556
-			if ( '' === $value && isset( $args['default'] ) && '' !== $args['default'] ) {
1556
+			if ('' === $value && isset($args['default']) && '' !== $args['default']) {
1557 1557
 				$value = $args['default'];
1558 1558
 			}
1559 1559
 
1560
-			echo sprintf( '<input type="%1$s" value="%2$s" name="%3$s" id="%4$s" class="%5$s"%6$s>',
1561
-				esc_attr( $type ),
1562
-				esc_attr( $value ),
1563
-				esc_attr( $name ),
1564
-				esc_attr( $id ),
1565
-				sanitize_html_class( $class . esc_html( ' code' ) ),
1566
-				esc_html( $checked )
1560
+			echo sprintf('<input type="%1$s" value="%2$s" name="%3$s" id="%4$s" class="%5$s"%6$s>',
1561
+				esc_attr($type),
1562
+				esc_attr($value),
1563
+				esc_attr($name),
1564
+				esc_attr($id),
1565
+				sanitize_html_class($class . esc_html(' code')),
1566
+				esc_html($checked)
1567 1567
 			);
1568
-			if ( '' !== $desc ) {
1569
-				echo sprintf( '<p class="description">%1$s</p>',
1570
-					esc_html( $desc )
1568
+			if ('' !== $desc) {
1569
+				echo sprintf('<p class="description">%1$s</p>',
1570
+					esc_html($desc)
1571 1571
 				);
1572 1572
 			}
1573 1573
 		} else {
1574
-			echo sprintf( '<p><code>%1$s</code></p>',
1575
-				esc_html__( 'Defined in wp-config.php', 'object-sync-for-salesforce' )
1574
+			echo sprintf('<p><code>%1$s</code></p>',
1575
+				esc_html__('Defined in wp-config.php', 'object-sync-for-salesforce')
1576 1576
 			);
1577 1577
 		}
1578 1578
 	}
@@ -1583,33 +1583,33 @@  discard block
 block discarded – undo
1583 1583
 	*
1584 1584
 	* @param array $args
1585 1585
 	*/
1586
-	public function display_checkboxes( $args ) {
1586
+	public function display_checkboxes($args) {
1587 1587
 		$type    = 'checkbox';
1588 1588
 		$name    = $args['name'];
1589
-		$options = get_option( $name, array() );
1590
-		foreach ( $args['items'] as $key => $value ) {
1589
+		$options = get_option($name, array());
1590
+		foreach ($args['items'] as $key => $value) {
1591 1591
 			$text    = $value['text'];
1592 1592
 			$id      = $value['id'];
1593 1593
 			$desc    = $value['desc'];
1594 1594
 			$checked = '';
1595
-			if ( is_array( $options ) && in_array( (string) $key, $options, true ) ) {
1595
+			if (is_array($options) && in_array((string) $key, $options, true)) {
1596 1596
 				$checked = 'checked';
1597
-			} elseif ( is_array( $options ) && empty( $options ) ) {
1598
-				if ( isset( $value['default'] ) && true === $value['default'] ) {
1597
+			} elseif (is_array($options) && empty($options)) {
1598
+				if (isset($value['default']) && true === $value['default']) {
1599 1599
 					$checked = 'checked';
1600 1600
 				}
1601 1601
 			}
1602
-			echo sprintf( '<div class="checkbox"><label><input type="%1$s" value="%2$s" name="%3$s[]" id="%4$s"%5$s>%6$s</label></div>',
1603
-				esc_attr( $type ),
1604
-				esc_attr( $key ),
1605
-				esc_attr( $name ),
1606
-				esc_attr( $id ),
1607
-				esc_html( $checked ),
1608
-				esc_html( $text )
1602
+			echo sprintf('<div class="checkbox"><label><input type="%1$s" value="%2$s" name="%3$s[]" id="%4$s"%5$s>%6$s</label></div>',
1603
+				esc_attr($type),
1604
+				esc_attr($key),
1605
+				esc_attr($name),
1606
+				esc_attr($id),
1607
+				esc_html($checked),
1608
+				esc_html($text)
1609 1609
 			);
1610
-			if ( '' !== $desc ) {
1611
-				echo sprintf( '<p class="description">%1$s</p>',
1612
-					esc_html( $desc )
1610
+			if ('' !== $desc) {
1611
+				echo sprintf('<p class="description">%1$s</p>',
1612
+					esc_html($desc)
1613 1613
 				);
1614 1614
 			}
1615 1615
 		}
@@ -1620,44 +1620,44 @@  discard block
 block discarded – undo
1620 1620
 	*
1621 1621
 	* @param array $args
1622 1622
 	*/
1623
-	public function display_select( $args ) {
1623
+	public function display_select($args) {
1624 1624
 		$type = $args['type'];
1625 1625
 		$id   = $args['label_for'];
1626 1626
 		$name = $args['name'];
1627 1627
 		$desc = $args['desc'];
1628
-		if ( ! isset( $args['constant'] ) || ! defined( $args['constant'] ) ) {
1629
-			$current_value = get_option( $name );
1628
+		if ( ! isset($args['constant']) || ! defined($args['constant'])) {
1629
+			$current_value = get_option($name);
1630 1630
 
1631
-			echo sprintf( '<div class="select"><select id="%1$s" name="%2$s"><option value="">- ' . __( 'Select one', 'object-sync-for-salesforce' ) . ' -</option>',
1632
-				esc_attr( $id ),
1633
-				esc_attr( $name )
1631
+			echo sprintf('<div class="select"><select id="%1$s" name="%2$s"><option value="">- ' . __('Select one', 'object-sync-for-salesforce') . ' -</option>',
1632
+				esc_attr($id),
1633
+				esc_attr($name)
1634 1634
 			);
1635 1635
 
1636
-			foreach ( $args['items'] as $key => $value ) {
1636
+			foreach ($args['items'] as $key => $value) {
1637 1637
 				$text     = $value['text'];
1638 1638
 				$value    = $value['value'];
1639 1639
 				$selected = '';
1640
-				if ( $key === $current_value || $value === $current_value ) {
1640
+				if ($key === $current_value || $value === $current_value) {
1641 1641
 					$selected = ' selected';
1642 1642
 				}
1643 1643
 
1644
-				echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
1645
-					esc_attr( $value ),
1646
-					esc_attr( $selected ),
1647
-					esc_html( $text )
1644
+				echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
1645
+					esc_attr($value),
1646
+					esc_attr($selected),
1647
+					esc_html($text)
1648 1648
 				);
1649 1649
 
1650 1650
 			}
1651 1651
 			echo '</select>';
1652
-			if ( '' !== $desc ) {
1653
-				echo sprintf( '<p class="description">%1$s</p>',
1654
-					esc_html( $desc )
1652
+			if ('' !== $desc) {
1653
+				echo sprintf('<p class="description">%1$s</p>',
1654
+					esc_html($desc)
1655 1655
 				);
1656 1656
 			}
1657 1657
 			echo '</div>';
1658 1658
 		} else {
1659
-			echo sprintf( '<p><code>%1$s</code></p>',
1660
-				esc_html__( 'Defined in wp-config.php', 'object-sync-for-salesforce' )
1659
+			echo sprintf('<p><code>%1$s</code></p>',
1660
+				esc_html__('Defined in wp-config.php', 'object-sync-for-salesforce')
1661 1661
 			);
1662 1662
 		}
1663 1663
 	}
@@ -1670,7 +1670,7 @@  discard block
 block discarded – undo
1670 1670
 	private function version_options() {
1671 1671
 		$versions = $this->salesforce['sfapi']->get_api_versions();
1672 1672
 		$args     = array();
1673
-		foreach ( $versions['data'] as $key => $value ) {
1673
+		foreach ($versions['data'] as $key => $value) {
1674 1674
 			$args[] = array(
1675 1675
 				'value' => $value['version'],
1676 1676
 				'text'  => $value['label'] . ' (' . $value['version'] . ')',
@@ -1684,26 +1684,26 @@  discard block
 block discarded – undo
1684 1684
 	*
1685 1685
 	* @param array $args
1686 1686
 	*/
1687
-	public function display_link( $args ) {
1687
+	public function display_link($args) {
1688 1688
 		$label = $args['label'];
1689 1689
 		$desc  = $args['desc'];
1690 1690
 		$url   = $args['url'];
1691
-		if ( isset( $args['link_class'] ) ) {
1692
-			echo sprintf( '<p><a class="%1$s" href="%2$s">%3$s</a></p>',
1693
-				esc_attr( $args['link_class'] ),
1694
-				esc_url( $url ),
1695
-				esc_html( $label )
1691
+		if (isset($args['link_class'])) {
1692
+			echo sprintf('<p><a class="%1$s" href="%2$s">%3$s</a></p>',
1693
+				esc_attr($args['link_class']),
1694
+				esc_url($url),
1695
+				esc_html($label)
1696 1696
 			);
1697 1697
 		} else {
1698
-			echo sprintf( '<p><a href="%1$s">%2$s</a></p>',
1699
-				esc_url( $url ),
1700
-				esc_html( $label )
1698
+			echo sprintf('<p><a href="%1$s">%2$s</a></p>',
1699
+				esc_url($url),
1700
+				esc_html($label)
1701 1701
 			);
1702 1702
 		}
1703 1703
 
1704
-		if ( '' !== $desc ) {
1705
-			echo sprintf( '<p class="description">%1$s</p>',
1706
-				esc_html( $desc )
1704
+		if ('' !== $desc) {
1705
+			echo sprintf('<p class="description">%1$s</p>',
1706
+				esc_html($desc)
1707 1707
 			);
1708 1708
 		}
1709 1709
 
@@ -1715,15 +1715,15 @@  discard block
 block discarded – undo
1715 1715
 	* @param string $option
1716 1716
 	* @return string $option
1717 1717
 	*/
1718
-	public function sanitize_validate_text( $option ) {
1719
-		if ( is_array( $option ) ) {
1718
+	public function sanitize_validate_text($option) {
1719
+		if (is_array($option)) {
1720 1720
 			$options = array();
1721
-			foreach ( $option as $key => $value ) {
1722
-				$options[ $key ] = sanitize_text_field( $value );
1721
+			foreach ($option as $key => $value) {
1722
+				$options[$key] = sanitize_text_field($value);
1723 1723
 			}
1724 1724
 			return $options;
1725 1725
 		}
1726
-		$option = sanitize_text_field( $option );
1726
+		$option = sanitize_text_field($option);
1727 1727
 		return $option;
1728 1728
 	}
1729 1729
 
@@ -1732,60 +1732,60 @@  discard block
 block discarded – undo
1732 1732
 	*
1733 1733
 	* @param object $sfapi
1734 1734
 	*/
1735
-	private function status( $sfapi ) {
1735
+	private function status($sfapi) {
1736 1736
 
1737 1737
 		$versions = $sfapi->get_api_versions();
1738 1738
 
1739 1739
 		// format this array into text so users can see the versions
1740
-		if ( true === $versions['cached'] ) {
1741
-			$versions_is_cached = esc_html__( 'This list is cached, and', 'object-sync-salesforce' );
1740
+		if (true === $versions['cached']) {
1741
+			$versions_is_cached = esc_html__('This list is cached, and', 'object-sync-salesforce');
1742 1742
 		} else {
1743
-			$versions_is_cached = esc_html__( 'This list is not cached, but', 'object-sync-salesforce' );
1743
+			$versions_is_cached = esc_html__('This list is not cached, but', 'object-sync-salesforce');
1744 1744
 		}
1745 1745
 
1746
-		if ( true === $versions['from_cache'] ) {
1747
-			$versions_from_cache = esc_html__( 'items were loaded from the cache', 'object-sync-salesforce' );
1746
+		if (true === $versions['from_cache']) {
1747
+			$versions_from_cache = esc_html__('items were loaded from the cache', 'object-sync-salesforce');
1748 1748
 		} else {
1749
-			$versions_from_cache = esc_html__( 'items were not loaded from the cache', 'object-sync-salesforce' );
1749
+			$versions_from_cache = esc_html__('items were not loaded from the cache', 'object-sync-salesforce');
1750 1750
 		}
1751 1751
 
1752 1752
 		// translators: 1) $versions_is_cached is the "This list is/is not cached, and/but" line, 2) $versions_from_cache is the "items were/were not loaded from the cache" line
1753
-		$versions_apicall_summary = sprintf( esc_html__( 'Available Salesforce API versions. %1$s %2$s. This is not an authenticated request, so it does not touch the Salesforce token.', 'object-sync-for-salesforce' ),
1753
+		$versions_apicall_summary = sprintf(esc_html__('Available Salesforce API versions. %1$s %2$s. This is not an authenticated request, so it does not touch the Salesforce token.', 'object-sync-for-salesforce'),
1754 1754
 			$versions_is_cached,
1755 1755
 			$versions_from_cache
1756 1756
 		);
1757 1757
 
1758
-		$contacts = $sfapi->query( 'SELECT Name, Id from Contact LIMIT 100' );
1758
+		$contacts = $sfapi->query('SELECT Name, Id from Contact LIMIT 100');
1759 1759
 
1760 1760
 		// format this array into html so users can see the contacts
1761
-		if ( true === $contacts['cached'] ) {
1762
-			$contacts_is_cached = esc_html__( 'They are cached, and', 'object-sync-salesforce' );
1761
+		if (true === $contacts['cached']) {
1762
+			$contacts_is_cached = esc_html__('They are cached, and', 'object-sync-salesforce');
1763 1763
 		} else {
1764
-			$contacts_is_cached = esc_html__( 'They are not cached, but', 'object-sync-salesforce' );
1764
+			$contacts_is_cached = esc_html__('They are not cached, but', 'object-sync-salesforce');
1765 1765
 		}
1766 1766
 
1767
-		if ( true === $contacts['from_cache'] ) {
1768
-			$contacts_from_cache = esc_html__( 'they were loaded from the cache', 'object-sync-salesforce' );
1767
+		if (true === $contacts['from_cache']) {
1768
+			$contacts_from_cache = esc_html__('they were loaded from the cache', 'object-sync-salesforce');
1769 1769
 		} else {
1770
-			$contacts_from_cache = esc_html__( 'they were not loaded from the cache', 'object-sync-salesforce' );
1770
+			$contacts_from_cache = esc_html__('they were not loaded from the cache', 'object-sync-salesforce');
1771 1771
 		}
1772 1772
 
1773
-		if ( true === $contacts['is_redo'] ) {
1774
-			$contacts_refreshed_token = esc_html__( 'This request did require refreshing the Salesforce token', 'object-sync-salesforce' );
1773
+		if (true === $contacts['is_redo']) {
1774
+			$contacts_refreshed_token = esc_html__('This request did require refreshing the Salesforce token', 'object-sync-salesforce');
1775 1775
 		} else {
1776
-			$contacts_refreshed_token = esc_html__( 'This request did not require refreshing the Salesforce token', 'object-sync-salesforce' );
1776
+			$contacts_refreshed_token = esc_html__('This request did not require refreshing the Salesforce token', 'object-sync-salesforce');
1777 1777
 		}
1778 1778
 
1779 1779
 		// translators: 1) $contacts['data']['totalSize'] is the number of items loaded, 2) $contacts['data']['records'][0]['attributes']['type'] is the name of the Salesforce object, 3) $contacts_is_cached is the "They are/are not cached, and/but" line, 4) $contacts_from_cache is the "they were/were not loaded from the cache" line, 5) is the "this request did/did not require refreshing the Salesforce token" line
1780
-		$contacts_apicall_summary = sprintf( esc_html__( 'Salesforce successfully returned %1$s %2$s records. %3$s %4$s. %5$s.', 'object-sync-for-salesforce' ),
1781
-			absint( $contacts['data']['totalSize'] ),
1782
-			esc_html( $contacts['data']['records'][0]['attributes']['type'] ),
1780
+		$contacts_apicall_summary = sprintf(esc_html__('Salesforce successfully returned %1$s %2$s records. %3$s %4$s. %5$s.', 'object-sync-for-salesforce'),
1781
+			absint($contacts['data']['totalSize']),
1782
+			esc_html($contacts['data']['records'][0]['attributes']['type']),
1783 1783
 			$contacts_is_cached,
1784 1784
 			$contacts_from_cache,
1785 1785
 			$contacts_refreshed_token
1786 1786
 		);
1787 1787
 
1788
-		require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/status.php' );
1788
+		require_once(plugin_dir_path(__FILE__) . '/../templates/admin/status.php');
1789 1789
 
1790 1790
 	}
1791 1791
 
@@ -1795,12 +1795,12 @@  discard block
 block discarded – undo
1795 1795
 	* For this plugin at this time, that is the decision we are making: don't do any kind of authorization stuff inside Salesforce
1796 1796
 	*/
1797 1797
 	private function logout() {
1798
-		$this->access_token  = delete_option( $this->option_prefix . 'access_token' );
1799
-		$this->instance_url  = delete_option( $this->option_prefix . 'instance_url' );
1800
-		$this->refresh_token = delete_option( $this->option_prefix . 'refresh_token' );
1801
-		echo sprintf( '<p>You have been logged out. You can use the <a href="%1$s">%2$s</a> tab to log in again.</p>',
1802
-			esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=authorize' ) ),
1803
-			esc_html__( 'Authorize', 'object-sync-for-salesforce' )
1798
+		$this->access_token  = delete_option($this->option_prefix . 'access_token');
1799
+		$this->instance_url  = delete_option($this->option_prefix . 'instance_url');
1800
+		$this->refresh_token = delete_option($this->option_prefix . 'refresh_token');
1801
+		echo sprintf('<p>You have been logged out. You can use the <a href="%1$s">%2$s</a> tab to log in again.</p>',
1802
+			esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=authorize')),
1803
+			esc_html__('Authorize', 'object-sync-for-salesforce')
1804 1804
 		);
1805 1805
 	}
1806 1806
 
@@ -1808,28 +1808,28 @@  discard block
 block discarded – undo
1808 1808
 	* Ajax call to clear the plugin cache.
1809 1809
 	*/
1810 1810
 	public function clear_sfwp_cache() {
1811
-		$result   = $this->clear_cache( true );
1811
+		$result   = $this->clear_cache(true);
1812 1812
 		$response = array(
1813 1813
 			'message' => $result['message'],
1814 1814
 			'success' => $result['success'],
1815 1815
 		);
1816
-		wp_send_json_success( $response );
1816
+		wp_send_json_success($response);
1817 1817
 	}
1818 1818
 
1819 1819
 	/**
1820 1820
 	* Clear the plugin's cache.
1821 1821
 	* This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data.
1822 1822
 	*/
1823
-	private function clear_cache( $ajax = false ) {
1823
+	private function clear_cache($ajax = false) {
1824 1824
 		$result = (bool) $this->wordpress->sfwp_transients->flush();
1825
-		if ( true === $result ) {
1826
-			$message = __( 'The plugin cache has been cleared.', 'object-sync-for-salesforce' );
1825
+		if (true === $result) {
1826
+			$message = __('The plugin cache has been cleared.', 'object-sync-for-salesforce');
1827 1827
 		} else {
1828
-			$message = __( 'There was an error clearing the plugin cache. Try refreshing this page.', 'object-sync-for-salesforce' );
1828
+			$message = __('There was an error clearing the plugin cache. Try refreshing this page.', 'object-sync-for-salesforce');
1829 1829
 		}
1830
-		if ( false === $ajax ) {
1830
+		if (false === $ajax) {
1831 1831
 			// translators: parameter 1 is the result message
1832
-			echo sprintf( '<p>%1$s</p>', $message );
1832
+			echo sprintf('<p>%1$s</p>', $message);
1833 1833
 		} else {
1834 1834
 			return array(
1835 1835
 				'message' => $message,
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
 		// alternatively, other roles can get this capability in whatever other way you like
1853 1853
 		// point is: to administer this plugin, you need this capability
1854 1854
 
1855
-		if ( ! current_user_can( 'configure_salesforce' ) ) {
1855
+		if ( ! current_user_can('configure_salesforce')) {
1856 1856
 			return false;
1857 1857
 		} else {
1858 1858
 			return true;
@@ -1865,23 +1865,23 @@  discard block
 block discarded – undo
1865 1865
 	* @param object $user
1866 1866
 	*
1867 1867
 	*/
1868
-	public function show_salesforce_user_fields( $user ) {
1869
-		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
1870
-		if ( true === $this->check_wordpress_admin_permissions() ) {
1871
-			$mapping  = $this->mappings->load_by_wordpress( 'user', $user->ID );
1868
+	public function show_salesforce_user_fields($user) {
1869
+		$get_data = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
1870
+		if (true === $this->check_wordpress_admin_permissions()) {
1871
+			$mapping  = $this->mappings->load_by_wordpress('user', $user->ID);
1872 1872
 			$fieldmap = $this->mappings->get_fieldmaps(
1873 1873
 				null, // id field must be null for multiples
1874 1874
 				array(
1875 1875
 					'wordpress_object' => 'user',
1876 1876
 				)
1877 1877
 			);
1878
-			if ( isset( $mapping['id'] ) && ! isset( $get_data['edit_salesforce_mapping'] ) ) {
1879
-				require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/user-profile-salesforce.php' );
1880
-			} elseif ( ! empty( $fieldmap ) ) { // is the user mapped to something already?
1881
-				if ( isset( $get_data['edit_salesforce_mapping'] ) && 'true' === sanitize_key( $get_data['edit_salesforce_mapping'] ) ) {
1882
-					require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/user-profile-salesforce-change.php' );
1878
+			if (isset($mapping['id']) && ! isset($get_data['edit_salesforce_mapping'])) {
1879
+				require_once(plugin_dir_path(__FILE__) . '/../templates/admin/user-profile-salesforce.php');
1880
+			} elseif ( ! empty($fieldmap)) { // is the user mapped to something already?
1881
+				if (isset($get_data['edit_salesforce_mapping']) && 'true' === sanitize_key($get_data['edit_salesforce_mapping'])) {
1882
+					require_once(plugin_dir_path(__FILE__) . '/../templates/admin/user-profile-salesforce-change.php');
1883 1883
 				} else {
1884
-					require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/user-profile-salesforce-map.php' );
1884
+					require_once(plugin_dir_path(__FILE__) . '/../templates/admin/user-profile-salesforce-map.php');
1885 1885
 				}
1886 1886
 			}
1887 1887
 		}
@@ -1892,10 +1892,10 @@  discard block
 block discarded – undo
1892 1892
 	* @param int $user_id
1893 1893
 	*
1894 1894
 	*/
1895
-	public function save_salesforce_user_fields( $user_id ) {
1896
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1897
-		if ( isset( $post_data['salesforce_update_mapped_user'] ) && '1' === rawurlencode( $post_data['salesforce_update_mapped_user'] ) ) {
1898
-			$mapping_object                  = $this->mappings->get_object_maps(
1895
+	public function save_salesforce_user_fields($user_id) {
1896
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1897
+		if (isset($post_data['salesforce_update_mapped_user']) && '1' === rawurlencode($post_data['salesforce_update_mapped_user'])) {
1898
+			$mapping_object = $this->mappings->get_object_maps(
1899 1899
 				array(
1900 1900
 					'wordpress_id'     => $user_id,
1901 1901
 					'wordpress_object' => 'user',
@@ -1903,14 +1903,14 @@  discard block
 block discarded – undo
1903 1903
 			);
1904 1904
 			$mapping_object['salesforce_id'] = $post_data['salesforce_id'];
1905 1905
 
1906
-			$result = $this->mappings->update_object_map( $mapping_object, $mapping_object['id'] );
1907
-		} elseif ( isset( $post_data['salesforce_create_mapped_user'] ) && '1' === rawurlencode( $post_data['salesforce_create_mapped_user'] ) ) {
1906
+			$result = $this->mappings->update_object_map($mapping_object, $mapping_object['id']);
1907
+		} elseif (isset($post_data['salesforce_create_mapped_user']) && '1' === rawurlencode($post_data['salesforce_create_mapped_user'])) {
1908 1908
 			// if a Salesforce ID was entered
1909
-			if ( isset( $post_data['salesforce_id'] ) && ! empty( $post_data['salesforce_id'] ) ) {
1910
-				$mapping_object = $this->create_object_map( $user_id, 'user', $post_data['salesforce_id'] );
1911
-			} elseif ( isset( $post_data['push_new_user_to_salesforce'] ) ) {
1909
+			if (isset($post_data['salesforce_id']) && ! empty($post_data['salesforce_id'])) {
1910
+				$mapping_object = $this->create_object_map($user_id, 'user', $post_data['salesforce_id']);
1911
+			} elseif (isset($post_data['push_new_user_to_salesforce'])) {
1912 1912
 				// otherwise, create a new record in Salesforce
1913
-				$result = $this->push_to_salesforce( 'user', $user_id );
1913
+				$result = $this->push_to_salesforce('user', $user_id);
1914 1914
 			}
1915 1915
 		}
1916 1916
 	}
@@ -1920,29 +1920,29 @@  discard block
 block discarded – undo
1920 1920
 	* @param array $tabs
1921 1921
 	* @param string $tab
1922 1922
 	*/
1923
-	private function tabs( $tabs, $tab = '' ) {
1923
+	private function tabs($tabs, $tab = '') {
1924 1924
 
1925
-		$get_data        = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
1925
+		$get_data        = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
1926 1926
 		$consumer_key    = $this->login_credentials['consumer_key'];
1927 1927
 		$consumer_secret = $this->login_credentials['consumer_secret'];
1928 1928
 		$callback_url    = $this->login_credentials['callback_url'];
1929 1929
 
1930 1930
 		$current_tab = $tab;
1931 1931
 		echo '<h2 class="nav-tab-wrapper">';
1932
-		foreach ( $tabs as $tab_key => $tab_caption ) {
1932
+		foreach ($tabs as $tab_key => $tab_caption) {
1933 1933
 			$active = $current_tab === $tab_key ? ' nav-tab-active' : '';
1934
-			if ( 'settings' === $tab_key || ( isset( $consumer_key ) && isset( $consumer_secret ) && ! empty( $consumer_key ) && ! empty( $consumer_secret ) ) ) {
1935
-				echo sprintf( '<a class="nav-tab%1$s" href="%2$s">%3$s</a>',
1936
-					esc_attr( $active ),
1937
-					esc_url( '?page=object-sync-salesforce-admin&tab=' . $tab_key ),
1938
-					esc_html( $tab_caption )
1934
+			if ('settings' === $tab_key || (isset($consumer_key) && isset($consumer_secret) && ! empty($consumer_key) && ! empty($consumer_secret))) {
1935
+				echo sprintf('<a class="nav-tab%1$s" href="%2$s">%3$s</a>',
1936
+					esc_attr($active),
1937
+					esc_url('?page=object-sync-salesforce-admin&tab=' . $tab_key),
1938
+					esc_html($tab_caption)
1939 1939
 				);
1940 1940
 			}
1941 1941
 		}
1942 1942
 		echo '</h2>';
1943 1943
 
1944
-		if ( isset( $get_data['tab'] ) ) {
1945
-			$tab = sanitize_key( $get_data['tab'] );
1944
+		if (isset($get_data['tab'])) {
1945
+			$tab = sanitize_key($get_data['tab']);
1946 1946
 		} else {
1947 1947
 			$tab = '';
1948 1948
 		}
@@ -1952,21 +1952,21 @@  discard block
 block discarded – undo
1952 1952
 	* Clear schedule
1953 1953
 	* This clears the schedule if the user clicks the button
1954 1954
 	*/
1955
-	private function clear_schedule( $schedule_name = '' ) {
1956
-		if ( '' !== $schedule_name ) {
1957
-			$schedule = $this->schedule( $schedule_name );
1958
-			$schedule->cancel_by_name( $schedule_name );
1955
+	private function clear_schedule($schedule_name = '') {
1956
+		if ('' !== $schedule_name) {
1957
+			$schedule = $this->schedule($schedule_name);
1958
+			$schedule->cancel_by_name($schedule_name);
1959 1959
 			// translators: $schedule_name is the name of the current queue. Defaults: salesforce_pull, salesforce_push, salesforce
1960
-			echo sprintf( esc_html__( 'You have cleared the %s schedule.', 'object-sync-for-salesforce' ), esc_html( $schedule_name ) );
1960
+			echo sprintf(esc_html__('You have cleared the %s schedule.', 'object-sync-for-salesforce'), esc_html($schedule_name));
1961 1961
 		} else {
1962
-			echo esc_html__( 'You need to specify the name of the schedule you want to clear.', 'object-sync-for-salesforce' );
1962
+			echo esc_html__('You need to specify the name of the schedule you want to clear.', 'object-sync-for-salesforce');
1963 1963
 		}
1964 1964
 	}
1965 1965
 
1966
-	private function get_schedule_count( $schedule_name = '' ) {
1967
-		if ( '' !== $schedule_name ) {
1968
-			$schedule = $this->schedule( $schedule_name );
1969
-			return $this->schedule->count_queue_items( $schedule_name );
1966
+	private function get_schedule_count($schedule_name = '') {
1967
+		if ('' !== $schedule_name) {
1968
+			$schedule = $this->schedule($schedule_name);
1969
+			return $this->schedule->count_queue_items($schedule_name);
1970 1970
 		} else {
1971 1971
 			return 'unknown';
1972 1972
 		}
@@ -1975,12 +1975,12 @@  discard block
 block discarded – undo
1975 1975
 	/**
1976 1976
 	* Load the schedule class
1977 1977
 	*/
1978
-	private function schedule( $schedule_name ) {
1979
-		if ( ! class_exists( 'Object_Sync_Sf_Schedule' ) && file_exists( plugin_dir_path( __FILE__ ) . '../vendor/autoload.php' ) ) {
1980
-			require_once plugin_dir_path( __FILE__ ) . '../vendor/autoload.php';
1981
-			require_once plugin_dir_path( __FILE__ ) . '../classes/schedule.php';
1978
+	private function schedule($schedule_name) {
1979
+		if ( ! class_exists('Object_Sync_Sf_Schedule') && file_exists(plugin_dir_path(__FILE__) . '../vendor/autoload.php')) {
1980
+			require_once plugin_dir_path(__FILE__) . '../vendor/autoload.php';
1981
+			require_once plugin_dir_path(__FILE__) . '../classes/schedule.php';
1982 1982
 		}
1983
-		$schedule       = new Object_Sync_Sf_Schedule( $this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->wordpress, $this->salesforce, $this->mappings, $schedule_name, $this->logging, $this->schedulable_classes );
1983
+		$schedule       = new Object_Sync_Sf_Schedule($this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->wordpress, $this->salesforce, $this->mappings, $schedule_name, $this->logging, $this->schedulable_classes);
1984 1984
 		$this->schedule = $schedule;
1985 1985
 		return $schedule;
1986 1986
 	}
@@ -2001,17 +2001,17 @@  discard block
 block discarded – undo
2001 2001
 	*   This is the database row for the map object
2002 2002
 	*
2003 2003
 	*/
2004
-	private function create_object_map( $wordpress_id, $wordpress_object, $salesforce_id, $action = '' ) {
2004
+	private function create_object_map($wordpress_id, $wordpress_object, $salesforce_id, $action = '') {
2005 2005
 		// Create object map and save it
2006 2006
 		$mapping_object = $this->mappings->create_object_map(
2007 2007
 			array(
2008 2008
 				'wordpress_id'      => $wordpress_id, // wordpress unique id
2009 2009
 				'salesforce_id'     => $salesforce_id, // salesforce unique id. we don't care what kind of object it is at this point
2010 2010
 				'wordpress_object'  => $wordpress_object, // keep track of what kind of wp object this is
2011
-				'last_sync'         => current_time( 'mysql' ),
2011
+				'last_sync'         => current_time('mysql'),
2012 2012
 				'last_sync_action'  => $action,
2013 2013
 				'last_sync_status'  => $this->mappings->status_success,
2014
-				'last_sync_message' => __( 'Mapping object updated via function: ', 'object-sync-for-salesforce' ) . __FUNCTION__,
2014
+				'last_sync_message' => __('Mapping object updated via function: ', 'object-sync-for-salesforce') . __FUNCTION__,
2015 2015
 			)
2016 2016
 		);
2017 2017
 
Please login to merge, or discard this patch.
classes/activate.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 	private $installed_version;
22 22
 
23 23
 	/**
24
-	* Constructor which sets up activate hooks
25
-	*
26
-	* @param object $wpdb
27
-	* @param string $version
28
-	* @param string $slug
29
-	*
30
-	*/
24
+	 * Constructor which sets up activate hooks
25
+	 *
26
+	 * @param object $wpdb
27
+	 * @param string $version
28
+	 * @param string $slug
29
+	 *
30
+	 */
31 31
 	public function __construct( $wpdb, $version, $slug ) {
32 32
 		$this->wpdb    = $wpdb;
33 33
 		$this->version = $version;
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	}
40 40
 
41 41
 	/**
42
-	* Activation hooks
43
-	*/
42
+	 * Activation hooks
43
+	 */
44 44
 	private function add_actions() {
45 45
 
46 46
 		// on initial activation, run these hooks
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 
55 55
 	/**
56
-	* Check for the minimum required version of php
57
-	*/
56
+	 * Check for the minimum required version of php
57
+	 */
58 58
 	public function php_requirements() {
59 59
 		if ( version_compare( PHP_VERSION, '5.5', '<' ) ) {
60 60
 			deactivate_plugins( plugin_basename( __FILE__ ) );
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 
65 65
 	/**
66
-	* Create database tables for Salesforce
67
-	* This creates tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
68
-	*
69
-	*/
66
+	 * Create database tables for Salesforce
67
+	 * This creates tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
68
+	 *
69
+	 */
70 70
 	public function wordpress_salesforce_tables() {
71 71
 
72 72
 		$charset_collate = $this->wpdb->get_charset_collate();
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	/**
130
-	* Add roles and capabilities
131
-	* This adds the configure_salesforce capability to the admin role
132
-	*
133
-	* It also allows other plugins to add the capability to other roles
134
-	*
135
-	*/
130
+	 * Add roles and capabilities
131
+	 * This adds the configure_salesforce capability to the admin role
132
+	 *
133
+	 * It also allows other plugins to add the capability to other roles
134
+	 *
135
+	 */
136 136
 	public function add_roles_capabilities() {
137 137
 
138 138
 		// by default, only administrators can configure the plugin
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
 	}
154 154
 
155 155
 	/**
156
-	* Check for database version on plugin upgrade
157
-	* When the plugin is upgraded, if the database version does not match the current version, perform these methods
158
-	*
159
-	* @param object $upgrader_object
160
-	* @param array $hook_extra
161
-	*
162
-	* See https://developer.wordpress.org/reference/hooks/upgrader_process_complete/
163
-	*
164
-	*/
156
+	 * Check for database version on plugin upgrade
157
+	 * When the plugin is upgraded, if the database version does not match the current version, perform these methods
158
+	 *
159
+	 * @param object $upgrader_object
160
+	 * @param array $hook_extra
161
+	 *
162
+	 * See https://developer.wordpress.org/reference/hooks/upgrader_process_complete/
163
+	 *
164
+	 */
165 165
 	public function wordpress_salesforce_update_db_check( $upgrader_object, $hook_extra ) {
166 166
 		if ( get_site_option( 'object_sync_for_salesforce_db_version' ) !== $this->version ) {
167 167
 			$this->wordpress_salesforce_tables();
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @file
6 6
  */
7 7
 
8
-if ( ! class_exists( 'Object_Sync_Salesforce' ) ) {
8
+if ( ! class_exists('Object_Sync_Salesforce')) {
9 9
 	die();
10 10
 }
11 11
 
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 	* @param string $slug
29 29
 	*
30 30
 	*/
31
-	public function __construct( $wpdb, $version, $slug ) {
31
+	public function __construct($wpdb, $version, $slug) {
32 32
 		$this->wpdb    = $wpdb;
33 33
 		$this->version = $version;
34 34
 		$this->slug    = $slug;
35 35
 
36
-		$this->installed_version = get_option( 'object_sync_for_salesforce_db_version', '' );
36
+		$this->installed_version = get_option('object_sync_for_salesforce_db_version', '');
37 37
 
38 38
 		$this->add_actions();
39 39
 	}
@@ -44,21 +44,21 @@  discard block
 block discarded – undo
44 44
 	private function add_actions() {
45 45
 
46 46
 		// on initial activation, run these hooks
47
-		register_activation_hook( dirname( __DIR__ ) . '/' . $this->slug . '.php', array( $this, 'php_requirements' ) );
48
-		register_activation_hook( dirname( __DIR__ ) . '/' . $this->slug . '.php', array( $this, 'wordpress_salesforce_tables' ) );
49
-		register_activation_hook( dirname( __DIR__ ) . '/' . $this->slug . '.php', array( $this, 'add_roles_capabilities' ) );
47
+		register_activation_hook(dirname(__DIR__) . '/' . $this->slug . '.php', array($this, 'php_requirements'));
48
+		register_activation_hook(dirname(__DIR__) . '/' . $this->slug . '.php', array($this, 'wordpress_salesforce_tables'));
49
+		register_activation_hook(dirname(__DIR__) . '/' . $this->slug . '.php', array($this, 'add_roles_capabilities'));
50 50
 
51 51
 		// when users upgrade the plugin, run these hooks
52
-		add_action( 'upgrader_process_complete', array( $this, 'wordpress_salesforce_update_db_check' ), 10, 2 );
52
+		add_action('upgrader_process_complete', array($this, 'wordpress_salesforce_update_db_check'), 10, 2);
53 53
 	}
54 54
 
55 55
 	/**
56 56
 	* Check for the minimum required version of php
57 57
 	*/
58 58
 	public function php_requirements() {
59
-		if ( version_compare( PHP_VERSION, '5.5', '<' ) ) {
60
-			deactivate_plugins( plugin_basename( __FILE__ ) );
61
-			wp_die( '<strong>This plugin requires PHP Version 5.5</strong> <br />Please contact your host to upgrade PHP on your server, and then retry activating the plugin.' );
59
+		if (version_compare(PHP_VERSION, '5.5', '<')) {
60
+			deactivate_plugins(plugin_basename(__FILE__));
61
+			wp_die('<strong>This plugin requires PHP Version 5.5</strong> <br />Please contact your host to upgrade PHP on your server, and then retry activating the plugin.');
62 62
 		}
63 63
 	}
64 64
 
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 			KEY salesforce_object (salesforce_id)
112 112
 		) $charset_collate";
113 113
 
114
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
114
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
115 115
 
116 116
 		// Note: see https://wordpress.stackexchange.com/questions/67345/how-to-implement-wordpress-plugin-update-that-modifies-the-database
117 117
 		// When we run the dbDelta method below, "it checks if the table exists. What's more, it checks the column types. So if the table doesn't exist, it creates it, if it does, but some column types have changed it updates them, and if a column doesn't exists - it adds it."
118 118
 		// This does not remove columns if we remove columns, so we'll need to expand beyond this in the future if that happens, although I think the schema is pretty solid now.
119
-		dbDelta( $field_map_sql );
120
-		dbDelta( $object_map_sql );
119
+		dbDelta($field_map_sql);
120
+		dbDelta($object_map_sql);
121 121
 
122
-		update_option( 'object_sync_for_salesforce_db_version', $this->version );
122
+		update_option('object_sync_for_salesforce_db_version', $this->version);
123 123
 
124 124
 		// store right now as the time for the plugin's activation
125
-		update_option( 'object_sync_for_salesforce_activate_time', current_time( 'timestamp', true ) );
125
+		update_option('object_sync_for_salesforce_activate_time', current_time('timestamp', true));
126 126
 
127 127
 	}
128 128
 
@@ -136,17 +136,17 @@  discard block
 block discarded – undo
136 136
 	public function add_roles_capabilities() {
137 137
 
138 138
 		// by default, only administrators can configure the plugin
139
-		$role = get_role( 'administrator' );
140
-		$role->add_cap( 'configure_salesforce' );
139
+		$role = get_role('administrator');
140
+		$role->add_cap('configure_salesforce');
141 141
 
142 142
 		// hook that allows other roles to configure the plugin as well
143
-		$roles = apply_filters( 'object_sync_for_salesforce_roles_configure_salesforce', null );
143
+		$roles = apply_filters('object_sync_for_salesforce_roles_configure_salesforce', null);
144 144
 
145 145
 		// for each role that we have, give it the configure salesforce capability
146
-		if ( null !== $roles ) {
147
-			foreach ( $roles as $role ) {
148
-				$role = get_role( $role );
149
-				$role->add_cap( 'configure_salesforce' );
146
+		if (null !== $roles) {
147
+			foreach ($roles as $role) {
148
+				$role = get_role($role);
149
+				$role->add_cap('configure_salesforce');
150 150
 			}
151 151
 		}
152 152
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	* See https://developer.wordpress.org/reference/hooks/upgrader_process_complete/
163 163
 	*
164 164
 	*/
165
-	public function wordpress_salesforce_update_db_check( $upgrader_object, $hook_extra ) {
166
-		if ( get_site_option( 'object_sync_for_salesforce_db_version' ) !== $this->version ) {
165
+	public function wordpress_salesforce_update_db_check($upgrader_object, $hook_extra) {
166
+		if (get_site_option('object_sync_for_salesforce_db_version') !== $this->version) {
167 167
 			$this->wordpress_salesforce_tables();
168 168
 		}
169 169
 	}
Please login to merge, or discard this patch.