Skip to content

Commit

Permalink
Replaced double quotes with single quotes
Browse files Browse the repository at this point in the history
To hold to convention, I replaced all instances of double quotes with single quotes - assuming the string didn't need parsing of any kind.
  • Loading branch information
cedwardsmedia committed Jan 6, 2016
1 parent 1c02229 commit 46d5a8f
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions src/cnam.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
error_reporting(E_ALL & ~E_NOTICE);

// Define our constants
define("APPNAME", "CNAM");
define("VERSION", "2.0.0");
define("APIVersion", "1");
define("DEVGITHUB", "https://www.github.com/cedwardsmedia/cnam");
define("DEVELOPER", "Corey Edwards");
define("COPYRIGHTYEAR", "2014 - 2015");
define("COPYRIGHT", "© " . COPYRIGHTYEAR . " " . DEVELOPER);
define("OS", strtoupper(php_uname('s')));
define('APPNAME', 'CNAM');
define('VERSION', '2.0.0');
define('APIVersion', '1');
define('DEVGITHUB', 'https://www.github.com/cedwardsmedia/cnam');
define('DEVELOPER', 'Corey Edwards');
define('COPYRIGHTYEAR', '2014 - 2015');
define('COPYRIGHT', '© ' . COPYRIGHTYEAR . ' ' . DEVELOPER);
define('OS', strtoupper(php_uname('s')));

// Check which version of PHP we're using. If it's too old, die.
if (phpversion() < "5.3") {
echo(APPNAME . " requires PHP 5.5 or greater. You are currently running PHP " . phpversion() . ". Please upgrade PHP.\n");
if (phpversion() < '5.3') {
echo(APPNAME . ' requires PHP 5.5 or greater. You are currently running PHP ' . phpversion() . ". Please upgrade PHP.\n");
exit(1);
}

// Determine our config path
if (OS == "DARWIN" || OS == "LINUX" || stristr(OS, "BSD") || stristr(OS, "UNIX")){
define("CONFIGPATH", $_SERVER['HOME'] . DIRECTORY_SEPARATOR . ".cnam" . DIRECTORY_SEPARATOR);
} elseif (OS == stristr(OS, "WINDOWS")){
define("CONFIGPATH", $_SERVER['HOMEDRIVE'] . $_SERVER['HOMEPATH'] . DIRECTORY_SEPARATOR . ".cnam" . DIRECTORY_SEPARATOR);
if (OS == 'DARWIN' || OS == 'LINUX' || stristr(OS, 'BSD') || stristr(OS, 'UNIX')){
define('CONFIGPATH', $_SERVER['HOME'] . DIRECTORY_SEPARATOR . '.cnam' . DIRECTORY_SEPARATOR);
} elseif (OS == stristr(OS, 'WINDOWS')){
define('CONFIGPATH', $_SERVER['HOMEDRIVE'] . $_SERVER['HOMEPATH'] . DIRECTORY_SEPARATOR . '.cnam' . DIRECTORY_SEPARATOR);
}

// Define our config file
define("CONFIGFILE", CONFIGPATH . "cnam.conf");
define('CONFIGFILE', CONFIGPATH . 'cnam.conf');

// Check for our config file
if (file_exists(CONFIGFILE)) {
Expand All @@ -52,20 +52,20 @@
$ARGS = $_SERVER['argv'];

//print_r($ARGS); die();
if ( array_key_exists("1",$ARGS) ) {
if ( array_key_exists('1',$ARGS) ) {

// Check for setup command
if (in_array("setup", $ARGS)){
if (in_array('setup', $ARGS)){

if (file_exists(CONFIGFILE)){
echo "A config file already exists at " . CONFIGFILE . ".\nAs a precaution, you must delete the existing file before creating a new one.\n";
exit();
}

echo "Enter your EveryoneAPI credentials.\nThese can be found at https://www.everyoneapi.com/dashboard/account\n\n";
echo "SID: ";
echo 'SID: ';
$sid = trim(fgets(STDIN));
echo "TOKEN: ";
echo 'TOKEN: ';
$token = trim(fgets(STDIN));

$configdata = <<<CONF
Expand Down Expand Up @@ -96,43 +96,43 @@
}

// Check for debug flag
if (in_array("--debug", $ARGS) || in_array("-d", $ARGS)){
if (in_array('--debug', $ARGS) || in_array('-d', $ARGS)){
debug();

// Check for help flags.

} elseif (in_array("--help", $ARGS) || in_array("-h", $ARGS)){
} elseif (in_array('--help', $ARGS) || in_array('-h', $ARGS)){
help();
} elseif (in_array("--version", $ARGS) || in_array("-v", $ARGS)){
} elseif (in_array('--version', $ARGS) || in_array('-v', $ARGS)){
// Check for version flags
version();
} else {

// Check for data point selection
$data=array();
if (in_array("--name", $ARGS)) { array_push($data,"name"); }
if (in_array("--profile", $ARGS)){ array_push($data,"profile"); }
if (in_array("--cnam", $ARGS)){ array_push($data,"cnam"); }
if (in_array("--gender", $ARGS)){ array_push($data,"gender"); }
if (in_array("--image", $ARGS)){ array_push($data,"image"); }
if (in_array("--address", $ARGS)){ array_push($data,"address"); }
if (in_array("--location", $ARGS)){ array_push($data,"location"); }
if (in_array("--provider", $ARGS)){ array_push($data,"line_provider"); }
if (in_array("--carrier", $ARGS)){ array_push($data,"carrier"); }
if (in_array("--carrier_o", $ARGS)){ array_push($data,"carrier_o"); }
if (in_array("--linetype", $ARGS)){ array_push($data,"linetype"); }
if (in_array('--name', $ARGS)) { array_push($data,'name'); }
if (in_array('--profile', $ARGS)){ array_push($data,'profile'); }
if (in_array('--cnam', $ARGS)){ array_push($data,'cnam'); }
if (in_array('--gender', $ARGS)){ array_push($data,'gender'); }
if (in_array('--image', $ARGS)){ array_push($data,'image'); }
if (in_array('--address', $ARGS)){ array_push($data,'address'); }
if (in_array('--location', $ARGS)){ array_push($data,'location'); }
if (in_array('--provider', $ARGS)){ array_push($data,'line_provider'); }
if (in_array('--carrier', $ARGS)){ array_push($data,'carrier'); }
if (in_array('--carrier_o', $ARGS)){ array_push($data,'carrier_o'); }
if (in_array('--linetype', $ARGS)){ array_push($data,'linetype'); }

// Check for test flag to set testing number
if (in_array("--test", $ARGS) || in_array("-t", $ARGS)){
$phone = "5551234567";
} elseif (in_array("--testconfig", $ARGS) || in_array("-tc", $ARGS)){
$phone = "16153756622";
array_push($data,"linetype");
if (in_array('--test', $ARGS) || in_array('-t', $ARGS)){
$phone = '5551234567';
} elseif (in_array('--testconfig', $ARGS) || in_array('-tc', $ARGS)){
$phone = '16153756622';
array_push($data,'linetype');
$api = new EveryonePHP();
$api->sid = $config["SID"];
$api->token = $config["TOKEN"];
$api->sid = $config['SID'];
$api->token = $config['TOKEN'];
$api->query($phone, $data);
if ($api->results->data->linetype == "landline") {
if ($api->results->data->linetype == 'landline') {
echo "EveryoneAPI Config Test: Passed\n";
exit;
} else {
Expand All @@ -144,8 +144,8 @@
}

$api = new EveryonePHP();
$api->sid = $config["SID"];
$api->token = $config["TOKEN"];
$api->sid = $config['SID'];
$api->token = $config['TOKEN'];
$api->query($phone, $data);


Expand Down Expand Up @@ -271,14 +271,14 @@ function usage() {

// Print version
function version() {
echo APPNAME . " " . VERSION . "\n";
echo APPNAME . ' ' . VERSION . "\n";
exit(0);
}

// Print Help
function help() {
echo APPNAME . " " . VERSION . " by " . DEVELOPER . "\n";
echo "© " . COPYRIGHTYEAR . " All Rights Reserved.\n\n";
echo APPNAME . ' ' . VERSION . ' by ' . DEVELOPER . "\n";
echo '© ' . COPYRIGHTYEAR . " All Rights Reserved.\n\n";
echo "Command-line client for EveryoneAPI.\nRun `cnam` without any arguments for usage information.\n";
exit(0);
}
Expand Down

0 comments on commit 46d5a8f

Please sign in to comment.