当前位置: 首页>>代码示例>>PHP>>正文


PHP Lock::exists方法代码示例

本文整理汇总了PHP中Lock::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Lock::exists方法的具体用法?PHP Lock::exists怎么用?PHP Lock::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lock的用法示例。


在下文中一共展示了Lock::exists方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isset

<?php

/**
 * Lists all content blocks for editing.
 */
$page->layout = 'admin';
$this->require_acl('admin', 'blocks');
$limit = 20;
$num = isset($_GET['offset']) ? $_GET['offset'] : 1;
$offset = ($num - 1) * $limit;
$lock = new Lock();
$blocks = Block::query('id, title, access')->order('id asc')->fetch_orig($limit, $offset);
$count = Block::query()->count();
foreach ($blocks as $k => $b) {
    $blocks[$k]->locked = $lock->exists('Block', $b->id);
}
$page->title = __('Content Blocks');
echo $tpl->render('blocks/admin', array('limit' => $limit, 'total' => $count, 'blocks' => $blocks, 'count' => count($blocks), 'url' => '/blocks/admin?offset=%d'));
开发者ID:Selwyn-b,项目名称:elefant,代码行数:18,代码来源:admin.php

示例2: Lock

if ($b->error) {
    if ($fallback_id) {
        $lock = new Lock('Block', $fallback_id);
        $b = new Block($fallback_id);
        $b->new_id = $id;
    }
    if ($b->error) {
        if (User::require_acl('admin', 'admin/edit', 'blocks')) {
            $fallback_id = $id;
            echo $tpl->render('blocks/editable', (object) array('id' => $fallback_id, 'locked' => false, 'title' => false));
        }
        return;
    }
}
// permissions
if ($b->access !== 'public') {
    if (!User::require_login()) {
        return;
    }
    if (!User::access($b->access)) {
        return;
    }
}
if ($b->show_title == 'yes') {
    printf('<' . $level . '>%s</' . $level . '>', $b->title);
}
$b->locked = $lock->exists();
if (User::require_acl('admin', 'admin/edit', 'blocks')) {
    echo $tpl->render('blocks/editable', $b);
}
echo $tpl->run_includes($b->body);
开发者ID:Selwyn-b,项目名称:elefant,代码行数:31,代码来源:index.php

示例3: Lock

<?php

/**
 * The page edit form.
 */
$page->layout = 'admin';
if (!User::require_admin()) {
    $this->redirect('/admin');
}
$lock = new Lock('Webpage', $_GET['page']);
if ($lock->exists()) {
    $page->title = i18n_get('Editing Locked');
    echo $tpl->render('admin/locked', $lock->info());
    return;
} else {
    $lock->add();
}
require_once 'apps/admin/lib/Functions.php';
$wp = new Webpage($_GET['page']);
$f = new Form('post', 'admin/edit');
$f->verify_csrf = false;
if ($f->submit()) {
    $wp->id = $_POST['id'];
    $wp->title = $_POST['title'];
    $wp->menu_title = $_POST['menu_title'];
    $wp->window_title = $_POST['window_title'];
    $wp->access = $_POST['access'];
    $wp->layout = $_POST['layout'];
    $wp->description = $_POST['description'];
    $wp->keywords = $_POST['keywords'];
    $wp->body = $_POST['body'];
开发者ID:nathanieltite,项目名称:elefant,代码行数:31,代码来源:edit.php

示例4: assertEquals

assertEquals("ș'aibă", FlexStringUtil::placeAccent("șaibă", 2, 'a'));
assertEquals("ș'aibă", FlexStringUtil::placeAccent("șaibă", 3, 'a'));
assertEquals("șa'ibă", FlexStringUtil::placeAccent("șaibă", 2, 'i'));
assertEquals("șa'ibă", FlexStringUtil::placeAccent("șaibă", 3, 'i'));
assertEquals("unfuckingbelievable", FlexStringUtil::insert("unbelievable", "fucking", 2));
assertEquals("abcdef", FlexStringUtil::insert("cdef", "ab", 0));
assertEquals("abcdef", FlexStringUtil::insert("abcd", "ef", 4));
assertEquals('mamă      ', AdminStringUtil::padRight('mamă', 10));
assertEquals('mama      ', AdminStringUtil::padRight('mama', 10));
assertEquals('ăâîșț   ', AdminStringUtil::padRight('ăâîșț', 8));
assertEquals('ăâîșț', AdminStringUtil::padRight('ăâîșț', 5));
assertEquals('ăâîșț', AdminStringUtil::padRight('ăâîșț', 3));
assertEqualArrays(array('c', 'a', 'r'), AdminStringUtil::unicodeExplode('car'));
assertEqualArrays(array('ă', 'a', 'â', 'ș', 'ț'), AdminStringUtil::unicodeExplode('ăaâșț'));
assertEqualArrays(array(1, 5, 10), util_intersectArrays(array(1, 3, 5, 7, 9, 10), array(1, 2, 4, 5, 6, 8, 10)));
assertEqualArrays(array(), util_intersectArrays(array(2, 4, 6, 8), array(1, 3, 5, 7)));
assert(!Lock::release('test'));
assert(!Lock::exists('test'));
assert(Lock::acquire('test'));
assert(Lock::exists('test'));
assert(!Lock::acquire('test'));
assert(Lock::release('test'));
assert(!Lock::exists('test'));
assert(!Lock::release('test'));
assertEquals(0, util_findSnippet(array(array(1, 2, 10))));
assertEquals(1, util_findSnippet(array(array(1, 2, 10), array(5, 6, 9))));
assertEquals(2, util_findSnippet(array(array(1, 2, 10), array(5, 6, 8))));
assertEquals(4, util_findSnippet(array(array(1, 2, 10), array(6, 20), array(8, 15))));
assertEquals('$abc$ @def@', AdminStringUtil::formatLexem('$abc$ @def@'));
// This is intentional -- lexem formatting is very lenient.
assertEquals("m'amă m'are", AdminStringUtil::formatLexem("m'am~a máre  "));
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:test.php

示例5: smarty_assign

if ($cuv) {
    smarty_assign('cuv', $cuv);
    $arr = StringUtil::analyzeQuery($cuv);
    $hasDiacritics = session_user_prefers('FORCE_DIACRITICS') || $arr[0];
    $hasRegexp = $arr[1];
    $isAllDigits = $arr[2];
}
if ($isAllDigits) {
    $d = Definition::get_by_id($cuv);
    if ($d) {
        util_redirect(util_getWwwRoot() . "definitie/{$d->lexicon}/{$d->id}" . ($xml ? '/xml' : ''));
    }
}
if ($text) {
    $searchType = SEARCH_FULL_TEXT;
    if (Lock::exists(LOCK_FULL_TEXT_INDEX)) {
        smarty_assign('lockExists', true);
        $definitions = array();
    } else {
        $words = preg_split('/ +/', $cuv);
        list($properWords, $stopWords) = StringUtil::separateStopWords($words, $hasDiacritics);
        smarty_assign('stopWords', $stopWords);
        $defIds = Definition::searchFullText($properWords, $hasDiacritics);
        smarty_assign('numResults', count($defIds));
        // Show at most 50 definitions;
        $defIds = array_slice($defIds, 0, 500);
        // Load definitions in the given order
        $definitions = array();
        foreach ($defIds as $id) {
            if ($res = Definition::get_by_id($id)) {
                $definitions[] = $res;
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:search.php

示例6: isset

<?php

/**
 * Admin page where you can edit posts and create new ones.
 */
$page->layout = 'admin';
if (!User::require_admin()) {
    $this->redirect('/admin');
}
require_once 'apps/blog/lib/Filters.php';
$limit = 20;
$_GET['offset'] = isset($_GET['offset']) ? $_GET['offset'] : 0;
$lock = new Lock();
$posts = blog\Post::query('id, title, ts, author, published')->order('ts desc')->fetch_orig($limit, $_GET['offset']);
$count = blog\Post::query()->count();
foreach ($posts as $k => $p) {
    $posts[$k]->locked = $lock->exists('Blog', $p->id);
}
$page->title = i18n_get('Blog Posts');
echo $tpl->render('blog/admin', array('posts' => $posts, 'count' => $count, 'offset' => $_GET['offset'], 'more' => $count > $_GET['offset'] + $limit ? true : false, 'prev' => $_GET['offset'] - $limit, 'next' => $_GET['offset'] + $limit));
开发者ID:nathanieltite,项目名称:elefant,代码行数:20,代码来源:admin.php

示例7: isset

}
$level = isset($data['level']) && preg_match('/^h[1-6]$/', $data['level']) ? $data['level'] : 'h3';
$divs = isset($data['divs']) ? true : false;
if (isset($data['units'])) {
    echo $this->run('admin/util/minimal-grid');
    $units = explode(',', $data['units']);
    $divs = true;
} else {
    $units = 'auto';
}
$qs = array();
foreach ($ids as $id) {
    $qs[] = '?';
}
$lock = new Lock();
$locks = $lock->exists('Block', $ids);
$query = Block::query()->where('id in(' . join(', ', $qs) . ')');
$query->query_params = $ids;
$blocks = $query->fetch();
$list = array();
foreach ($blocks as $block) {
    $list[$block->id] = $block;
}
$total = count($blocks);
if ($units === 'auto' || $total !== count($units)) {
    if ($total === 2) {
        $units = array(66, 33);
    } elseif ($total > 0) {
        $units = array();
        $w = floor(100 / $total);
        for ($k = 0; $k < $total; $k++) {
开发者ID:Selwyn-b,项目名称:elefant,代码行数:31,代码来源:group.php

示例8: isset

<?php

$this->require_admin();
$page->layout = 'admin';
$page->title = i18n_get('All Pages');
$limit = 20;
$_GET['offset'] = isset($_GET['offset']) ? $_GET['offset'] : 0;
$lock = new Lock();
$pages = Webpage::query('id, title, access')->order('title asc')->fetch_orig($limit, $_GET['offset']);
$count = Webpage::query()->count();
foreach ($pages as $k => $p) {
    $pages[$k]->locked = $lock->exists('Webpage', $p->id);
}
echo $tpl->render('admin/pages', array('pages' => $pages, 'count' => $count, 'offset' => $_GET['offset'], 'more' => $count > $_GET['offset'] + $limit ? true : false, 'prev' => $_GET['offset'] - $limit, 'next' => $_GET['offset'] + $limit));
开发者ID:nathanieltite,项目名称:elefant,代码行数:14,代码来源:pages.php

示例9: Lock

 * Displays a list of layout templates and stylesheets in two tabs.
 */
$page->layout = 'admin';
if (!User::require_admin()) {
    $this->redirect('/admin');
}
$lock = new Lock();
$out = array('layouts' => glob('layouts/*.html'), 'layouts2' => glob('layouts/*/*.html'), 'stylesheets' => glob('css/*.css'), 'stylesheets2' => glob('layouts/*/*.css'), 'locks' => array());
if ($out['layouts2']) {
    foreach ($out['layouts2'] as $name) {
        $out['layouts'][] = $name;
    }
}
if ($out['stylesheets2']) {
    foreach ($out['stylesheets2'] as $name) {
        $out['stylesheets'][] = $name;
    }
}
if ($out['layouts']) {
    foreach ($out['layouts'] as $name) {
        $out['locks'][$name] = $lock->exists('Designer', $name);
    }
}
if ($out['stylesheets']) {
    foreach ($out['stylesheets'] as $name) {
        $out['locks'][$name] = $lock->exists('Designer', $name);
    }
}
require_once 'apps/designer/lib/Functions.php';
$page->title = i18n_get('Designer');
echo $tpl->render('designer/index', $out);
开发者ID:nathanieltite,项目名称:elefant,代码行数:31,代码来源:index.php

示例10: Lock

    }
    if (!User::access($wp->access)) {
        $page->title = i18n_get('Login required');
        echo $this->run('user/login');
        return;
    }
}
// set the page properties
$page->id = $id;
$page->title = $wp->title;
$page->_menu_title = $wp->menu_title;
$page->_window_title = $wp->window_title;
$page->description = $wp->description;
$page->keywords = $wp->keywords;
$page->layout = $wp->layout;
$page->head = $wp->head;
// show admin edit buttons
if (User::is_valid() && User::is('admin')) {
    $lock = new Lock('Webpage', $id);
    $page->locked = $lock->exists();
    echo $tpl->render('admin/editable', $page);
}
// execute any embedded includes
$out = $tpl->run_includes($wp->body);
if ($wp->access == 'public' && $out === $wp->body) {
    // public page, no includes, cacheable.
    $page->body = $out;
    $memcache->set('_admin_page_' . $id, serialize($page));
}
// output the page body
echo $out;
开发者ID:nathanieltite,项目名称:elefant,代码行数:31,代码来源:page.php

示例11: Lock

<?php

/**
 * Admin page where you can edit forms, view results, and create new forms.
 */
$page->layout = 'admin';
if (!User::require_admin()) {
    $this->redirect('/admin');
}
require_once 'apps/form/lib/Functions.php';
$page->title = 'Forms';
$lock = new Lock();
$forms = form\Form::query()->order('title asc')->fetch_orig();
foreach ($forms as $k => $form) {
    $forms[$k]->locked = $lock->exists('Form', $form->id);
}
echo $tpl->render('form/admin', array('forms' => $forms));
开发者ID:Alm001,项目名称:form,代码行数:17,代码来源:admin.php

示例12: isset

 * a GET request. For delete, this will be an `id` parameter in a POST request.
 *
 * Automatically adds the appropriate access control checks on each action, and
 * hides the button if the current user doesn't have permission:
 *
 * - `add` -			`admin/edit` and `admin/add`
 * - `edit` - 			`admin/edit`
 * - `delete` - 		`admin/delete`
 * - `versions` - 		`admin/versions`
 */
if (!User::require_admin()) {
    return;
}
if (!isset($this->data['id'])) {
    echo '<!-- error in admin/util/editbuttons, missing parameter: id -->';
    return;
}
if (!isset($this->data['class'])) {
    echo '<!-- error in admin/util/editbuttons, missing parameter: class -->';
    return;
}
$class = $this->data['class'];
$this->data['add'] = isset($this->data['add']) ? $this->data['add'] : false;
$this->data['edit'] = isset($this->data['edit']) ? $this->data['edit'] : false;
$this->data['delete'] = isset($this->data['delete']) ? $this->data['delete'] : false;
$this->data['versions'] = isset($this->data['versions']) ? $this->data['versions'] : false;
$this->data['label'] = isset($this->data['label']) ? $this->data['label'] : (isset($class::$display_name) ? $class::$display_name : __('Item'));
$this->data['confirm_msg'] = __('Are you sure you want to delete the current %s?', strtolower($this->data['label']));
$lock = new Lock($this->data['class'], $this->data['id']);
$this->data['locked'] = $lock->exists();
echo $tpl->render('admin/util/editbuttons', $this->data);
开发者ID:Selwyn-b,项目名称:elefant,代码行数:31,代码来源:editbuttons.php


注:本文中的Lock::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。