Inheritance: use trait t
コード例 #1
0
ファイル: 720.php プロジェクト: badlamer/hhvm
function main()
{
    set_error_handler('error_handler');
    $c = new c(false);
    $c->get();
    echo "Error\n";
}
コード例 #2
0
ファイル: inline_closure_gen.php プロジェクト: n3b/hiphop-php
function main()
{
    $c = new c();
    $f = $c->genclo();
    foreach ($f() as $v) {
        var_dump($v);
    }
}
コード例 #3
0
ファイル: BladeView.php プロジェクト: jevets/kirby-view-blade
 /**
  * Create an instance of the view
  *
  * @param array $options
  * @return void
  */
 public function __construct($options = array())
 {
     $views = isset($options['views']) ? $options['views'] : Config::get('blade_views_dir', kirby()->roots()->templates());
     $cache = isset($options['cache']) ? $options['cache'] : Config::get('blade_cache_dir', kirby()->roots()->cache() . DS . 'views');
     $this->engine = new Blade($views, $cache);
     $this->setEchoFormat();
 }
コード例 #4
0
ファイル: ct.php プロジェクト: BastinRobin/CodeSprints
function ct($n, $m)
{
    $ct = c::get($n, $m);
    if (!is_null($ct)) {
        return $ct;
    }
    if ($n === $m) {
        $ct = 0.0;
    } elseif ($n === 1 && $m === 0) {
        $ct = 2.0;
    } elseif ($m === 0) {
        $ct = (1 + ct($n - 1, 0)) * 2;
    } else {
        for ($i = $m + 1; $i != $n; ++$i) {
            $ct0 = c::get($n, $i);
            if (!is_null($ct0)) {
                break;
            }
        }
        for ($i -= 1; $i != $m; --$i) {
            $ct1 = 1 + $ct0 / 2 + ct($n, 0) / 2;
            c::set($n, $i, $ct1);
            $ct0 = $ct1;
        }
        $ct = 1 + ct($n, $m + 1) / 2 + ct($n, 0) / 2;
    }
    c::set($n, $m, $ct);
    return $ct;
}
コード例 #5
0
 public function set_cache($type, $result)
 {
     $cache_path = __DIR__ . '/../cache/' . $type . '.json';
     $period = c::get('kg.cache_period') ? c::get('kg.cache_period') : '30 Minutes';
     $cache = array('to' => strtotime($period), 'payload' => $result);
     \f::write($cache_path, json_encode($cache));
 }
コード例 #6
0
ファイル: wysiwyg.php プロジェクト: aoimedia/kirby-wysiwyg
 /**
  * Load and prepare configuration
  *
  * @since 1.0.0
  *
  * @return \WysiwygField
  */
 public function __construct()
 {
     /*
        (1) Load button configuration
     */
     $this->buttons = c::get('field.wysiwyg.buttons', false);
     if (!is_array($this->buttons) or count($this->buttons) <= 0) {
         $this->buttons = $this->defaults['buttons'];
     }
     /*
        (2) Load heading style configuration
     */
     $this->headingStyle = c::get('field.wysiwyg.heading-style', false);
     if (!in_array($this->headingStyle, array('atx', 'setext'))) {
         $this->headingStyle = $this->defaults['heading-style'];
     }
     /*
        (3) Load double returns configuration
     */
     $this->doubleReturns = c::get('field.wysiwyg.double-returns', null);
     if (!is_bool($this->doubleReturns)) {
         $this->doubleReturns = $this->defaults['double-returns'];
     }
     /*
        (4) Load drag/drop configuration
     */
     $this->kirbyDragDrop = c::get('field.wysiwyg.dragdrop.kirby', false);
     if (!is_bool($this->kirbyDragDrop)) {
         $this->kirbyDragDrop = false;
     }
     $this->mediumDragDrop = c::get('field.wysiwyg.dragdrop.medium', false);
     if (!is_bool($this->mediumDragDrop)) {
         $this->mediumDragDrop = false;
     }
 }
コード例 #7
0
ファイル: helpers.php プロジェクト: robinandersen/robin
function dragText($obj)
{
    if (c::get('panel.kirbytext') === false) {
        if (is_a($obj, 'Page')) {
            return '[' . $obj->title() . '](' . $obj->url() . ')';
        } else {
            if (is_a($obj, 'File')) {
                switch ($obj->type()) {
                    case 'image':
                        return '![' . $obj->name() . '](' . $obj->url() . ')';
                        break;
                    default:
                        return '[' . $obj->filename() . '](' . $obj->url() . ')';
                        break;
                }
            }
        }
    } else {
        if (is_a($obj, 'Page')) {
            return '(link: ' . $obj->uri() . ' text: ' . $obj->title() . ')';
        } else {
            if (is_a($obj, 'File')) {
                switch ($obj->type()) {
                    case 'image':
                        return '(image: ' . $obj->filename() . ')';
                        break;
                    default:
                        return '(file: ' . $obj->filename() . ')';
                        break;
                }
            }
        }
    }
}
コード例 #8
0
ファイル: oembed.php プロジェクト: muten84/luigibifulco.it
 protected function template($class = false)
 {
     $output = new Brick('div');
     $output->addClass('oembed');
     if ($class !== false) {
         $output->addClass($class);
     } else {
         $output->addClass('oembed-' . substr(md5($this->url), 0, 6));
     }
     if ($this->media->get('type') === 'video') {
         $output = OembedTemplate::ratio($output, $this->media);
         if (c::get('oembed.lazyvideo', false)) {
             $output->addClass('oembed-lazyvideo');
         }
         $play = OembedTemplate::play();
         $output->append($play);
         $thumb = OembedTemplate::thumb($this->thumb->get($this->media()));
         $output->append($thumb);
         $html = OembedTemplate::embed($this->media, $this->autoplay);
     } else {
         $html = $this->media->get('html');
     }
     $html = OembedTemplate::validation($html);
     $output->append($html);
     return $output;
 }
コード例 #9
0
/**
 *  Helpfer function relativeDate()
 */
function relativeDate($date, $args = array())
{
    // default for $args
    $defaults = array('lang' => count(site()->languages()) >= 1 ? site()->language()->code() : c::get('relativedate.lang', 'en'), 'length' => c::get('relativedate.length', 2), 'threshold' => c::get('relativedate.threshold', false), 'fuzzy' => c::get('relativedate.fuzzy', true), 'format' => c::get('relativedate.format', 'd.m.Y'));
    $args = array_merge($defaults, $args);
    // check if $date is a timestamp
    if (RelativeDate::isTimestamp($date)) {
        $date = date(DATE_ATOM, $date);
    }
    // only convert to relative if time difference no exceeds threshold
    if ($args['threshold'] === false or abs(strtotime($date) - time()) <= $args['threshold']) {
        try {
            $relative = new RelativeDate($date, $args);
            $result = $relative->get($args['length']);
        } catch (Exception $e) {
            $result = $date;
        }
    } else {
        $result = $date;
    }
    // if we had no change to date due to any bug or exceeding threshold
    if ($result === $date) {
        $date = new Datetime($date);
        $result = $date->format($args['format']);
    }
    return $result;
}
コード例 #10
0
ファイル: installation.php プロジェクト: kompuser/panel
 public function index()
 {
     if (app::$site->users()->count() > 0) {
         go('panel/login');
     }
     if ($problems = installation::check()) {
         $content = view('installation/check', array('problems' => $problems));
     } else {
         $form = app::form('installation', array('language' => c::get('panel.language', 'en')));
         $form->cancel = false;
         $form->save = l::get('installation.signup.button');
         $form->centered = true;
         foreach (app::languages() as $lang) {
             $form->fields()->get('language')->options[$lang->code()] = $lang->title();
         }
         $form->on('submit', function ($form) {
             try {
                 app::$site->users()->create($form->serialize());
                 go('panel/login/welcome');
             } catch (Exception $e) {
                 $form->alert($e->getMessage());
             }
         });
         $content = view('installation/signup', array('form' => $form));
     }
     return layout('installation', array('meta' => new Snippet('meta'), 'content' => $content));
 }
コード例 #11
0
ファイル: thumb.php プロジェクト: roblen/kirbycms-extensions
 function __construct($image, $options = array())
 {
     $this->root = c::get('thumb.cache.root', c::get('root') . '/thumbs');
     $this->url = c::get('thumb.cache.url', c::get('url') . '/thumbs');
     if (!$image) {
         return false;
     }
     $this->obj = $image;
     // set some values from the image
     $this->sourceWidth = $this->obj->width();
     $this->sourceHeight = $this->obj->height();
     $this->width = $this->sourceWidth;
     $this->height = $this->sourceHeight;
     $this->source = $this->obj->root();
     $this->mime = $this->obj->mime();
     // set the max width and height
     $this->maxWidth = @$options['width'];
     $this->maxHeight = @$options['height'];
     // set the quality
     $this->crop = @$options['crop'];
     // set the quality
     $this->quality = a::get($options, 'quality', c::get('thumb.quality', 100));
     // set the default upscale behavior
     $this->upscale = a::get($options, 'upscale', c::get('thumb.upscale', false));
     // set the alt text
     $this->alt = a::get($options, 'alt', $this->obj->name());
     // set the className text
     $this->className = @$options['class'];
     // set the new size
     $this->size();
     // create the thumbnail
     $this->create();
 }
コード例 #12
0
ファイル: testcase.php プロジェクト: aoimedia/kosmonautensofa
 public function kirbyInstance($options = array())
 {
     c::$data = array();
     $kirby = new Kirby($options);
     $kirby->roots->content = TEST_ROOT_ETC . DS . 'content';
     return $kirby;
 }
コード例 #13
0
function ourl($url = false)
{
    if (!$url) {
        $url = c::get('url');
    }
    return replace_once('/' . c::get('panel.folder'), '', $url);
}
コード例 #14
0
ファイル: e.php プロジェクト: exakat/exakat
 function foo()
 {
     a::inFamilya();
     a::inFamilyb();
     a::notDefined();
     c::notAClass();
 }
コード例 #15
0
ファイル: thumb.php プロジェクト: muten84/luigibifulco.it
 protected function clearCache($path)
 {
     $expired = time() - c::get('oembed.cacheexpires', 3600 * 24);
     if (file_exists($path) and filemtime($path) < $expired) {
         unlink($path);
     }
 }
コード例 #16
0
ファイル: cache.php プロジェクト: narrenfrei/kirbycms
 static function modified($file)
 {
     if (!c::get('cache')) {
         return false;
     }
     return @filectime(self::file($file));
 }
コード例 #17
0
ファイル: Sitemap.php プロジェクト: arzynik/cana
 public function __construct($params = null)
 {
     if (isset($params['baseurl'])) {
         $this->_baseUrl = $params['baseurl'];
     } else {
         $this->_baseUrl = c::config()->baseUrl->{c::env()};
     }
 }
コード例 #18
0
ファイル: load.php プロジェクト: nilshendriks/kirbycms
 static function language()
 {
     $root = c::get('root.site') . '/languages';
     $default = $root . '/' . c::get('lang.default') . '.php';
     $current = $root . '/' . c::get('lang.current') . '.php';
     self::file($default);
     self::file($current);
 }
コード例 #19
0
ファイル: place.php プロジェクト: aguynamedirvin/F-C
 public function __construct()
 {
     $this->type = 'place';
     $this->icon = 'map-marker';
     $this->label = l::get('fields.place.label', 'Place');
     $this->placeholder = l::get('fields.place.placeholder', 'Address or Location');
     $this->map_settings = array('lat' => c::get('place.defaults.lat', 43.9), 'lng' => c::get('place.defaults.lng', -120.2291901), 'zoom' => c::get('place.defaults.zoom', 1));
 }
コード例 #20
0
ファイル: output.php プロジェクト: dmak78/panel-bar
 public function __construct($visible)
 {
     $this->before = array();
     $this->elements = array();
     $this->after = array();
     $this->visible = $visible;
     $this->position = c::get('panelbar.position', 'top');
 }
コード例 #21
0
ファイル: uri.php プロジェクト: narrenfrei/kirbycms
 function raw($uri = false)
 {
     $raw = $uri ? $uri : ltrim(server::get('request_uri'), '/');
     // strip subfolders from uri
     if (c::get('subfolder')) {
         $raw = ltrim(str_replace(c::get('subfolder') . '/', '/', $raw), '/');
     }
     return $raw;
 }
コード例 #22
0
ファイル: IsUpperFamily.04.php プロジェクト: exakat/exakat
 function foo()
 {
     parent::inAA();
     parent::inA();
     parent::inB();
     parent::inTrait();
     parent::nowhere();
     c::inC();
 }
コード例 #23
0
ファイル: IsUpperFamily.03.php プロジェクト: exakat/exakat
 function foo()
 {
     self::inAA();
     self::inA();
     self::inB();
     self::inTrait();
     self::nowhere();
     c::inC();
 }
コード例 #24
0
ファイル: IsUpperFamily.02.php プロジェクト: exakat/exakat
 function foo()
 {
     \a::inAA();
     \a::inA();
     \a::inB();
     \a::inTrait();
     \a::nowhere();
     \c::inC();
 }
コード例 #25
0
ファイル: source.php プロジェクト: oytuntez/phploc
 public function aPublicMethod()
 {
     $a = true ? true : false;
     c::m();
     c::$m();
     c::$a;
     c::$a;
     c::aConstant;
 }
コード例 #26
0
ファイル: IsUpperFamily.01.php プロジェクト: exakat/exakat
 function foo()
 {
     a::inAA();
     a::inA();
     a::inB();
     a::inTrait();
     a::nowhere();
     c::inC();
 }
コード例 #27
0
 public function aPublicMethod()
 {
     $a = TRUE ? TRUE : FALSE;
     c::m();
     c::$m();
     c::$a;
     c::$a;
     c::aConstant;
 }
コード例 #28
0
ファイル: uri.php プロジェクト: codecuts/lanningsmith-website
 static function raw($uri = false)
 {
     $raw = $uri ? $uri : ltrim(server::get('request_uri'), '/');
     // strip subfolders from uri
     if (c::get('subfolder')) {
         $raw = ltrim(preg_replace('!^' . preg_quote(c::get('subfolder')) . '\\/!i', '/', $raw), '/');
     }
     return $raw;
 }
コード例 #29
0
ファイル: IsUpperFamily.05.php プロジェクト: exakat/exakat
 function foo()
 {
     static::inAA();
     static::inA();
     static::inB();
     static::inTrait();
     static::nowhere();
     c::inC();
 }
コード例 #30
0
ファイル: Mailer.php プロジェクト: evendev/paintcrazy
 /**
  * Create a new CrazyMailer
  *
  * @var array $config data, accepts same as Email::__construct()
  */
 public function __construct($config)
 {
     $defaults = ['to' => KirbyConfig::get('mailer.to'), 'from' => KirbyConfig::get('mailer.from'), 'service' => 'mailgun', 'options' => ['key' => KirbyConfig::get('mailgun.key'), 'domain' => KirbyConfig::get('mailgun.domain')]];
     $this->emailer = new KirbyEmailer(KirbyArray::merge($defaults, $config));
     $this->enabled = env('MAILER_ENABLED', false);
     $handler = new StreamHandler(kirby()->roots()->site() . '/../logs/emailer.log', Logger::WARNING);
     $this->logger = new Logger('crazy');
     $this->logger->pushHandler($handler);
 }