本文整理汇总了PHP中c类的典型用法代码示例。如果您正苦于以下问题:PHP c类的具体用法?PHP c怎么用?PHP c使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了c类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main()
{
set_error_handler('error_handler');
$c = new c(false);
$c->get();
echo "Error\n";
}
示例2: main
function main()
{
$c = new c();
$f = $c->genclo();
foreach ($f() as $v) {
var_dump($v);
}
}
示例3: __construct
/**
* 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: ct
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: set_cache
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: __construct
/**
* 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: dragText
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: template
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: relativeDate
/**
* 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: index
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: __construct
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: kirbyInstance
public function kirbyInstance($options = array())
{
c::$data = array();
$kirby = new Kirby($options);
$kirby->roots->content = TEST_ROOT_ETC . DS . 'content';
return $kirby;
}
示例13: ourl
function ourl($url = false)
{
if (!$url) {
$url = c::get('url');
}
return replace_once('/' . c::get('panel.folder'), '', $url);
}
示例14: foo
function foo()
{
a::inFamilya();
a::inFamilyb();
a::notDefined();
c::notAClass();
}
示例15: clearCache
protected function clearCache($path)
{
$expired = time() - c::get('oembed.cacheexpires', 3600 * 24);
if (file_exists($path) and filemtime($path) < $expired) {
unlink($path);
}
}