test

Lazy File Manager

Lazy File Manager

Current Path : /home/cruisin2/pix.cruisingclub.org/ccadmin/passbook_maker/
PPPath/home/cruisin2/pix.cruisingclub.org/ccadmin/passbook_maker
Upload File :
Current File : /home/cruisin2/pix.cruisingclub.org/ccadmin/passbook_maker/example.php

<?php

//data from database :


$clubDescription = 'Yacht Club Membership';
$clubName = 'Mars Yacht Club';
$clubLocations = array ( //up to 10
        array ('latitude' => 37.871728, 'longitude' => -122.457095, 'relevantText' => 'Corinthian Yacht Club'),
        array ('latitude' => 37.8726912, 'longitude' => -122.4632122, 'relevantText' => 'San Francisco Yacht Club'),
        array ('latitude' => 37.80781, 'longitude' => -122.4433967, 'relevantText' => 'St Francis Yacht Club'),
        array ('latitude' => 37.8072675, 'longitude' => -122.4466369, 'relevantText' => 'Golden Gate Yacht Club')
    );

date_default_timezone_set('America/Los_Angeles');
$memberExpire = DateTime::createFromFormat('j-M-Y', '31-Dec-2015');
$memberName = 'Michael Moradzadeh';
$memberPosition = 'Commodore (non resident)';
$memberURL = 'http://yachtpc.com/';
$memberSerial = '8';
//also need to save member photo in thumbnail.png and thumbnail@2x.png taking into account multitasking

$passSerial = '1';


require('src/PKPass.php');

$pass = new PKPass\PKPass();

$pass->setCertificate('./Certificate.p12');  // 2. Set the path to your Pass Certificate (.p12 file)
$pass->setCertificatePassword('Hemper4Apple');     // 2. Set password for certificate
$pass->setWWDRcertPath('./AppleWWDRCA.pem'); // 3. Set the path to your WWDR Intermediate certificate (.pem file)

// Top-Level Keys http://developer.apple.com/library/ios/#documentation/userexperience/Reference/PassKit_Bundle/Chapters/TopLevel.html


$standardKeys         = array(
    'description'        => $clubDescription,
    'formatVersion'      => 1,
    'organizationName'   => $clubName,
    'passTypeIdentifier' => 'pass.com.yachtclub.membership', // 4. Set to yours
    'serialNumber'       => $passSerial,
    'teamIdentifier'     => 'E8XXXD4S77',           // 4. Set to yours
);

$associatedAppKeys    = array();
$expirationKeys       = array (
        'expirationDate'     => $memberExpire->format('c'),
);
$relevanceKeys        = array(
        'locations'          => $clubLocations,
);
$styleKeys            = array(
    'generic' => array(
        'headerFields' => array (
        ),
        'primaryFields' => array(
            array(
                'key'   => 'name',
                'label' => 'Member',
                'value' => $memberName
            ) 
        ),
        'secondaryFields' => array(
            array(
                'key'   => 'date',
                'label' => 'Expiration',
                'value' => $memberExpire->format('F j, Y')
            ),
            array(
                'key'   => 'member',
                'label' => 'Member',
                'value' => $memberSerial
            ),
        ),
        'auxiliaryFields' => array(
            array(
                'key'   => 'title',
                'label' => 'Position',
                'value' => $memberPosition
            )
        ),
        'backFields' => array(
            array(
                'key'   => 'TBD',
                'label' => 'Validation URL',
                'value' => 'http://yachtpc.com'
            )
        )
    )
);
$visualAppearanceKeys = array(
    'backgroundColor' => 'rgb(200, 200, 255)',
 //   'backgroundColor' => 'rgb(107,156,196)',
     'barcode' => array (
        'format' => 'PKBarcodeFormatQR',
        'message' => $memberURL,
        'messageEncoding' => 'iso-8859-1',
        'altText' => $memberName
        ),
     'labelColor' => "rgb(45, 54, 129)",
     'logoText'          => $clubName
);
$webServiceKeys       = array(
    //Configure your REST Web service here
//    'webServiceURL' => 'https://yachtpc.com/whatever',
//    'authenticationToken' => '01234567890ABCDEF...'
    );

// Merge all pass data and set JSON for $pass object
$passData = array_merge(
    $standardKeys,
    $associatedAppKeys,
    $relevanceKeys,
    $expirationKeys,
    $styleKeys,
    $visualAppearanceKeys,
    $webServiceKeys
);

$myJson=json_encode($passData);


$pass->setJSON($myJson);

// Add files to the PKPass package
$pass->addFile('images/icon.png');
$pass->addFile('images/icon@2x.png');
$pass->addFile('images/logo.png');
$pass->addFile('images/thumbnail.png');
$pass->addFile('images/thumbnail@2x.png');

// Create and output the PKPass
$passContents = $pass->create(true);  //change to true to generate pass to browser
if ($passContents === false) { 
    echo 'Error: '.$pass->getError();
} else {
    //create file
    $filename = './yachtclub.pkpass';
    if (file_put_contents($filename, $passContents) === false) {
        echo 'Error: could not write file '.$filename;
    } 


}

Da3s File Manager Version 1.0, Coded By Da3s HaCkEr
Email: R0@hotmail.com