public function __construct($collection, $directory = ".")
 {
     $this->collection = $collection;
     $this->directory = $directory;
     $this->file_path = APP_ROOT . '/' . $this->directory . '/' . $this->collection . '.yml';
     if (!file_exists(dirname($this->file_path))) {
         throw new YamlRecordCollectionFileException("Containing folder for collection does not exist");
     }
     if (!file_exists($this->file_path)) {
         touch($this->file_path);
     }
     $this->data = yaml::read($this->file_path);
     if (!array_key_exists('last_id', $this->data)) {
         $this->data['last_id'] = 0;
     }
     if (!array_key_exists('records', $this->data)) {
         $this->data['records'] = array();
     }
     $this->serialize();
 }
Esempio n. 2
0
<?php

if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
/*
---------------------------------------
License Setup
---------------------------------------
Please add your license key, which you've received
via email after purchasing Kirby on http://getkirby.com/buy
It is not permitted to run a public website without a
valid license key. Please read the End User License Agreement
for more information: http://getkirby.com/license
*/
c::set('license', yaml::read(detect::documentRoot() . DS . 'secrets.yml')['licenses']['kirby']);
/*
---------------------------------------
Kirby Configuration
---------------------------------------
By default you don't have to configure anything to
make Kirby work. For more fine-grained configuration
of the system, please check out http://getkirby.com/docs/advanced/options
*/
c::set('markdown.extra', true);
c::set('smartypants', true);
Esempio n. 3
0
     $city = get('city');
     if (!$city) {
         $error = 'City is required.';
         goto errored;
     }
     $state = get('state');
     if (!$state) {
         $error = 'State is required.';
         goto errored;
     }
     $zip = get('zip');
     if (!$zip) {
         $error = 'ZIP is required.';
         goto errored;
     }
     \Stripe\Stripe::setApiKey(yaml::read(detect::documentRoot() . DS . 'secrets.yml')['keys']['stripe']['secret']);
     // Get the credit card details submitted by the form
     $token = get('stripeToken');
     try {
         $customer = \Stripe\Customer::create(["source" => $token, "email" => $email, "metadata" => ["name" => $name, "address" => $address, "city" => $city, "state" => strtoupper($state), "zip" => $zip]]);
         $charge = \Stripe\Charge::create(["amount" => $amount * 100, "currency" => "usd", "customer" => $customer->id, "description" => "Web donation", "receipt_email" => $email]);
         $completed = true;
     } catch (\Stripe\Error\Card $e) {
         $error = $e->getMessage();
         goto errored;
     } catch (\Stripe\Error\InvalidRequest $e) {
         $error = $e->getMessage();
         goto errored;
     }
 }
 errored:
function get_blueprint($blueprint)
{
    $file = get_blueprint_path($blueprint);
    if ($file) {
        return yaml::read($file);
    } else {
        return false;
    }
}
Esempio n. 5
0
">
  <meta name="keywords" content="<?php 
echo $site->keywords()->html();
?>
">

  <link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet" />
  <link href="https://fonts.googleapis.com/css?family=Raleway:500,600,700" rel="stylesheet" />
  <link href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,700,400italic" rel="stylesheet" />
  <?php 
echo css('public/styles/evanosky.css');
?>
  
  <script type="text/javascript" src="https://js.stripe.com/v2/"></script>
  <script type="text/javascript">
    Stripe.setPublishableKey("<?php 
echo yaml::read(detect::documentRoot() . DS . 'secrets.yml')['keys']['stripe']['publishable'];
?>
");
  </script>
  <?php 
echo js('public/scripts/vendor/modernizr-custom.min.js');
?>

  <div class="invisible"><?php 
echo file_get_contents(url('public/sprites.svg'));
?>
</div>
  <div class="wrapper">
    <?php 
snippet('site-header');