Exemple #1
0
 public static function start()
 {
     if (!isset(self::$instance) || self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Exemple #2
0
 public static function constructFromArray($props)
 {
     $layers = array();
     if (isset($props['layers'])) {
         foreach ($props['layers'] as $layer) {
             if ($layer instanceof Layer) {
                 $layers[] = $layer;
             } else {
                 $layers[] = Layer::constructFromArray($layer);
             }
         }
     }
     $directions = array();
     if (isset($props['directions'])) {
         foreach ($props['directions'] as $direction) {
             switch ($direction['directionType']) {
                 case 'metronome':
                     $directions[] = DirectionMetronome::constructFromArray($direction);
                     break;
                 case 'dynamics':
                     $directions[] = DirectionDynamics::constructFromArray($direction);
                     break;
                 default:
             }
         }
     }
     if ($props['time'] instanceof Time) {
         $time = $props['time'];
     } else {
         $time = Time::constructFromArray($props['time']);
     }
     if ($props['clef'] instanceof Clef) {
         $clef = $props['clef'];
     } else {
         $clef = Clef::constructFromArray($props['clef']);
     }
     if ($props['key'] instanceof Key) {
         $key = $props['key'];
     } else {
         $key = Key::constructFromArray($props['key']);
     }
     $divisions = $props['divisions'];
     if ($props['barline'] instanceof Barline) {
         $barline = $props['barline'];
     } else {
         $barline = Barline::constructFromArray($props['barline']);
     }
     $implicit = $props['implicit'];
     $nonControlling = $props['nonControlling'];
     $width = $props['width'];
     return new Measure($layers, $directions, $time, $clef, $key, $divisions, $barline, $implicit, $nonControlling, $width);
 }
 /**
  * Logout by WebHook
  *
  * @access public
  * @return Response
  */
 public function logout()
 {
     // Token from Clef.io
     if (isset($_POST['logout_token'])) {
         // Verif token
         $clef = Clef::logout($_POST['logout_token']);
         if (!$clef) {
             // Verif in Authentication table
             $auth = Authentication::whereprovider("clef")->whereprovider_uid($clef)->first();
             if (!empty($auth)) {
                 $user = User::find($auth->user_id);
                 if (!empty($user)) {
                     $user->logout = 1;
                     $user->save();
                 }
             }
         }
     }
 }
Exemple #4
0
Author: Clef
Author URI: https://getclef.com
License: MIT
License URI: http://opensource.org/licenses/MIT
*/
/**

Copyright (c) 2012 David Ross <*****@*****.**>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

**/
if (!defined('ABSPATH')) {
    exit;
}
if (!defined('CLEF_DEBUG')) {
    define('CLEF_DEBUG', false);
}
if (CLEF_DEBUG) {
    require_once 'includes/lib/symlink-fix.php';
}
if (!defined('CLEF_IS_BASE_PLUGIN')) {
    define('CLEF_IS_BASE_PLUGIN', true);
}
require_once 'clef-require.php';
Clef::start();
Exemple #5
0
 /**
  * renders the object's properties as XML
  * @return  string  the XML
  */
 private function _renderproperties()
 {
     $out = '';
     $out .= '<divisions>' . $this->properties['divisions'] . '</divisions>';
     $staves = 1;
     if (isset($this->properties['key'])) {
         $key = $this->properties['key'];
         if (!$key instanceof Key) {
             $key = new Key($key);
         }
         $out .= $key->toXML();
     }
     if (isset($this->properties['time'])) {
         $out .= '<time';
         if (isset($this->properties['time']['symbol'])) {
             $out .= ' symbol="' . $this->properties['time']['symbol'] . '"';
         }
         $out .= '>';
         if (isset($this->properties['time']['beats'])) {
             $out .= '<beats>' . $this->properties['time']['beats'] . '</beats>';
         }
         if (isset($this->properties['time']['beat-type'])) {
             $out .= '<beat-type>' . $this->properties['time']['beat-type'] . '</beat-type>';
         }
         $out .= '</time>';
     }
     $clefs = '';
     if (isset($this->properties['clef'])) {
         if (!is_array($this->properties['clef'])) {
             $this->properties['clef'] = array($this->properties['clef']);
         }
         $num = 0;
         foreach ($this->properties['clef'] as $clef) {
             $num++;
             if (!$clef instanceof Clef) {
                 $clef = new Clef($clef);
             }
             $clefs .= $clef->toXML($num);
         }
         $staves = $num;
     }
     if (isset($this->properties['staves'])) {
         $staves = $this->properties['staves'];
     }
     // output staves first, and then clefs.
     $out .= '<staves>' . $staves . '</staves>';
     $out .= $clefs;
     return $out;
 }