/**
 * This function used to include headers in <head> tag
 * it will check weather to include the file or not
 * it will take file and its type as an array
 * then compare its type with THIS_PAGE constant
 * if header has TYPE of THIS_PAGE then it will be inlucded
 */
function include_header($params)
{
    $file = $params['file'];
    $type = $params['type'];
    if ($file == 'global_header') {
        Template(BASEDIR . '/styles/global/head.html', false);
        return false;
    }
    if ($file == 'admin_bar') {
        if (has_access('admin_access', TRUE)) {
            Template(BASEDIR . '/styles/global/admin_bar.html', false);
        }
        return false;
    }
    if (!$type) {
        $type = "global";
    }
    if (is_includeable($type)) {
        Template($file, false);
    }
    return false;
}
                        file_put_contents($file, $code);
                    }
                }
            } else {
                $code .= $token[1];
            }
        }
    }
}
if (!class_exists("SoapClient")) {
    die("SOAP is required for this script to function.");
}
if (!class_exists("DOMDocument")) {
    die("DOM is required for this script to function.");
}
if (!is_includeable("wsdl2php.php")) {
    die("wsdl2php is required for this script to function.");
}
if (!ini_get('user_agent')) {
    die("This script requires that your user_agent ini setting be configured. This is due to Mindbody blocking all requests from clients not providing a user_agent header.\nAn example would be: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.19) Gecko/20110707 Firefox/3.6.19'\n");
}
$services = array("https://api.mindbodyonline.com/0_5/AppointmentService.asmx?WSDL", "https://api.mindbodyonline.com/0_5/ClassService.asmx?WSDL", "https://api.mindbodyonline.com/0_5/ClientService.asmx?WSDL", "https://api.mindbodyonline.com/0_5/SiteService.asmx?WSDL", "https://api.mindbodyonline.com/0_5/SaleService.asmx?WSDL", "https://api.mindbodyonline.com/0_5/StaffService.asmx?WSDL", "https://api.mindbodyonline.com/0_5/DataService.asmx?WSDL", "https://api.mindbodyonline.com/0_5/FinderService.asmx?WSDL");
if (!is_dir("wsdl2phpoutput")) {
    mkdir("wsdl2phpoutput");
}
chdir("wsdl2phpoutput");
foreach ($services as $service) {
    $result = shell_exec("wsdl2php {$service}");
    if (!strpos($result, "Writing")) {
        die("Failed to fetch {$service}.");
    }