本文整理汇总了PHP中prefix函数的典型用法代码示例。如果您正苦于以下问题:PHP prefix函数的具体用法?PHP prefix怎么用?PHP prefix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prefix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _element
protected function _element($data, $tab, $start)
{
static $start;
$eof = EOL;
$output = '';
$attrs = '';
$tab = str_repeat("\t", $start);
if (!is_array($data)) {
return $data . $eof;
} else {
foreach ($data as $k => $v) {
if (isRealNumeric($k)) {
$value = $k;
$k = 'li';
} else {
$value = NULL;
}
$end = prefix(Arrays::getFirst(explode(' ', $k)));
if (!is_array($v)) {
$output .= "{$tab}<{$k}>{$v}<{$end}>{$eof}";
} else {
if (stripos($k, 'ul') !== 0 && stripos($k, 'ol') !== 0 && $k !== 'li') {
$value = $k;
$k = 'li';
$end = prefix($k);
} else {
$value = NULL;
}
$output .= $tab . "<{$k}>{$value}{$eof}" . $this->_element($v, $tab, $start++) . $tab . "<{$end}>" . $tab . $eof;
$start--;
}
}
}
return $output;
}
示例2: new_image
static function new_image($image)
{
global $_zp_exifvars;
$entry_locale = getUserLocale();
$languages = generateLanguageList();
$languageTags = $element = array();
$candidates = self::getTaggingItems();
foreach ($candidates as $key) {
if ($meta = $image->get($key)) {
setupCurrentLocale('en_US');
$en_us = $element[] = exifTranslate($meta);
foreach ($languages as $language) {
setupCurrentLocale($language);
$xlated = exifTranslate($meta);
if ($xlated != $en_us) {
// the string has a translation in this language
$element[] = $xlated;
$languageTags[$language] = $xlated;
}
}
}
}
setupCurrentLocale($entry_locale);
$element = array_unique(array_merge($image->getTags(), $element));
$image->setTags($element);
$image->save();
foreach ($languageTags as $language => $tag) {
$sql = 'UPDATE ' . prefix('tags') . ' SET `language`=' . db_quote($language) . ' WHERE `name`=' . db_quote($tag) . ' AND `language`=NULL OR `language` LIKE ""';
query($sql, false);
}
return $image;
}
示例3: delete
public static function delete($view, $id)
{
$view->actions(function ($view) {
$view->submit(__('admin::account.delete.buttons.delete'), 'primary');
$view->button(prefix('admin') . 'account', __('admin::account.delete.buttons.cancel'));
});
}
示例4: handleOption
function handleOption($option, $currentValue)
{
if ($option == "zenpage_homepage") {
$unpublishedpages = query_full_array("SELECT titlelink FROM " . prefix('pages') . " WHERE `show` != 1 ORDER by `sort_order`");
if (empty($unpublishedpages)) {
echo gettext("No unpublished pages available");
// clear option if no unpublished pages are available or have been published meanwhile
// so that the normal gallery index appears and no page is accidentally set if set to unpublished again.
setOption("zenpage_homepage", "none", true);
} else {
echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'selector-zenpage_homepage" value="0" />' . "\n";
echo '<select id="' . $option . '" name="zenpage_homepage">' . "\n";
if ($currentValue === "none") {
$selected = " selected = 'selected'";
} else {
$selected = "";
}
echo "<option{$selected}>" . gettext("none") . "</option>";
foreach ($unpublishedpages as $page) {
if ($currentValue === $page["titlelink"]) {
$selected = " selected = 'selected'";
} else {
$selected = "";
}
echo "<option{$selected}>" . $page["titlelink"] . "</option>";
}
echo "</select>\n";
}
}
}
示例5: getOptionsSupported
function getOptionsSupported()
{
$unpublishedpages = query_full_array("SELECT title,titlelink FROM " . prefix('pages') . " WHERE `show` != 1 ORDER by `sort_order`");
$list = array();
foreach ($unpublishedpages as $page) {
$list[get_language_string($page['title'])] = $page['titlelink'];
}
return array(gettext('Allow search') => array('key' => 'Allow_search', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Check to enable search form.')), gettext('News on index page') => array('key' => 'zenpage_zp_index_news', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext("Enable this if you want to show the news section’s first page on the <code>index.php</code> page.")), gettext('Homepage') => array('key' => 'zenpage_homepage', 'type' => OPTION_TYPE_SELECTOR, 'selections' => $list, 'null_selection' => gettext('none'), 'desc' => gettext("Choose here any <em>un-published Zenpage page</em> (listed by <em>titlelink</em>) to act as your site’s homepage instead the normal gallery index.") . "<p class='notebox'>" . gettext("<strong>Note:</strong> This of course overrides the <em>News on index page</em> option and your theme must be setup for this feature! Visit the theming tutorial for details.") . "</p>"), gettext('Use standard contact page') => array('key' => 'zenpage_contactpage', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Disable this if you do not want to use the separate contact page with the contact form. You can also use the codeblock of a page for this. See the contact_form plugin documentation for more info.')), gettext('Use custom menu') => array('key' => 'zenpage_custommenu', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Check this if you want to use the <em>menu_manager</em> plugin if enabled to build a custom menu instead of the separate standard ones. A standard menu named "zenpage" is created and used automatically.')));
}
示例6: handler
/**
*
* Logs User searches
* @param array $search_statistics the search criteria
* @param string $type 'album', 'image', etc.
* @param bool $success did the search return a result
* @param bool $dynamic was it from a dynamic album
* @param int $iteration count of the filters since the search engine instantiation
*/
static function handler($search_statistics, $type, $success, $dynamic, $iteration)
{
if (!$dynamic) {
// log unique user searches
$store = array('type' => $type, 'success' => $success, 'iteration' => $iteration, 'data' => $search_statistics);
$sql = 'INSERT INTO ' . prefix('plugin_storage') . ' (`type`, `aux`,`data`) VALUES ("search_statistics", ' . db_quote(getUserIP()) . ',' . db_quote(serialize($store)) . ')';
query($sql);
}
return $search_statistics;
}
示例7: get_dom_article
public function get_dom_article($limit = 8)
{
return $this->ci->db->query('
SELECT a.*, c.link AS cat_link, c.name AS cat_name
FROM ' . prefix('article') . ' AS a JOIN ' . prefix('category') . ' AS c
ON a.cid=c.cid
WHERE a.state=1
ORDER BY rand()
DESC LIMIT ' . $limit)->result();
}
示例8: getLatestImages
static function getLatestImages($limit = 3)
{
if (!isset($limit) || !is_numeric($limit)) {
$limit = 3;
}
$t_images = prefix("images");
$t_albums = prefix("albums");
$query = "SELECT i.filename, i.title, a.folder FROM {$t_images} i " . "LEFT JOIN {$t_albums} a ON i.albumid=a.id " . "ORDER BY i.id DESC LIMIT {$limit}";
$result = query_full_array($query);
return self::createImages($result);
}
示例9: tag_list
public function tag_list($tid, $start, $offset)
{
return $this->db->query('
SELECT a.*, c.link AS cat_link, c.name AS cat_name
FROM ' . prefix('relation') . ' AS r, ' . prefix('article') . ' AS a
LEFT JOIN ' . prefix('category AS c') . ' ON a.cid=c.cid
WHERE r.aid=a.aid AND r.tid=' . $tid . ' AND a.state=1
LIMIT ' . $start . ', ' . $offset . '
')->result();
// return $this->db->query('SELECT p.*, c.id AS cate_id, c.name AS cate_name, c.alias AS cate_alias, c.keywords AS cate_keywords, c.description
// AS cate_description FROM '.tn('posts').' AS p, '.tn('categories').' AS c, '.tn('tagrelas').' AS t WHERE p.cid=c.id AND t.oid=p.id AND
// t.tid='.(int) $tid.' AND p.status=1 LIMIT '.(int) $start.', '.(int) $offset);
// return $query->result_array();
}
示例10: setCurrentNewsPage
static function setCurrentNewsPage()
{
global $_zp_current_zenpage_news, $_zp_page;
if (isset($_zp_current_zenpage_news)) {
$table = prefix('zenpage_news');
$id = $_zp_current_zenpage_news->getID();
$query = "SELECT count(id) ct FROM {$table} where id >= {$id} AND `show`=1";
$result = query_single_row($query);
$count = $result['ct'];
$pageNumber = ceil($count / max(1, getOption("zenpage_articles_per_page")));
$_GET["page"] = $pageNumber;
$_zp_page = $pageNumber;
}
}
示例11: zenphoto_recent_comments
function zenphoto_recent_comments()
{
////////////////////////////////////////////////////////////////////
/*------------------- START OF CONFIGURATION ---------------------*/
/*MySQL Settings*/
$zen_db = '';
//The name of the database
$zen_username = '';
//Your MySQL username
$zen_password = '';
//...and password
$zen_host = 'localhost';
//99% chance you won't need to change this value
$mysql_prefix = '';
//Zen Database Tables prefix (if any)
/*More...*/
$num_of_comments = '10';
//Number of comments you want to show up.
$mods_rewrite = true;
//If you have Apache mod_rewrite, put true here, and you'll get nice cruft-free URLs.
$gallery_folder = 'zenphoto';
//eg. http://mysite.com/zenphoto
/*--------------------- END OF CONFIGURATION ---------------------*/
////////////////////////////////////////////////////////////////////
//we will try to connect to the database
@($mysql_connection = mysql_connect($zen_host, $zen_username, $zen_password)) or die('Could not connect to database.');
//selecting zenphoto database
@mysql_select_db($zen_db) or die('Could not select database.');
$sql = "SELECT c.id, i.title, i.filename, a.folder, a.title AS albumtitle, c.name, c.website," . " c.date, c.comment FROM " . prefix('comments') . " AS c, " . prefix('images') . " AS i, " . prefix('albums') . " AS a " . " WHERE c.imageid = i.id AND i.albumid = a.id ORDER BY c.id DESC LIMIT 10";
$result = mysql_query($sql, $mysql_connection) or die('MySQL Query ( ' . $sql . ' ) Failed. Error: ' . mysql_error());
$allrows = array();
while ($row = mysql_fetch_assoc($result)) {
$allrows[] = $row;
}
foreach ($allrows as $comment) {
$author = $comment['name'];
$album = $comment['folder'];
$image = $comment['filename'];
$albumtitle = $comment['albumtitle'];
if ($comment['title'] == "") {
$title = $image;
} else {
$title = $comment['title'];
}
$website = $comment['website'];
$comment = truncate_string($comment['comment'], 123);
echo "<li><div>{$author} on <a href=\"" . ($mods_rewrite ? "../{$gallery_folder}/{$album}/{$image}" : "../{$gallery_folder}/index.php?album=" . urlencode($album) . "&image=" . urlencode($image)) . "\">{$albumtitle} / {$title}</a>:</div><div>{$comment}</div></li>";
}
}
示例12: generateCaptcha
/**
* generates a Mollom captcha for comments
*
* Returns the captcha code string and image URL (via the $image parameter).
*
* @return string;
*/
function generateCaptcha(&$image)
{
Mollom::setPublicKey(getOption('public_key'));
Mollom::setPrivateKey(getOption('private_key'));
$servers = Mollom::getServerList();
Mollom::setServerList($servers);
// get captcha
$captcha = Mollom::getImageCaptcha();
$session_id = $captcha['session_id'];
query('DELETE FROM ' . prefix('captcha') . ' WHERE `ptime`<' . (time() - 3600), true);
// expired tickets
query("INSERT INTO " . prefix('captcha') . " (ptime, hash) VALUES ('" . escape(time()) . "','" . escape($session_id) . "')", true);
$image = $captcha['url'];
return $session_id;
}
示例13: index
/**
* 显示搜索结果
*
* @access public
* @return void
*/
public function index()
{
$start = ($this->_page - 1) * $this->_prepage;
$rows = $this->db->query('SELECT * FROM ' . prefix('article') . ' WHERE `title` LIKE "%' . $this->_keys . '%" OR `description` LIKE "%' . $this->_keys . '%"');
$list = $this->db->query('SELECT * FROM ' . prefix('article') . ' WHERE `title` LIKE "%' . $this->_keys . '%" OR `description` LIKE "%' . $this->_keys . '%" LIMIT ' . $start . ', ' . $this->_prepage . '');
$data['rows'] = $rows->num_rows();
$data['pres'] = $this->_prepage;
$data['list'] = $list->result();
$data['page'] = $this->_setpagestring($data['rows']);
$data['keys'] = $this->_keys;
if ($data['rows']) {
$this->load->model('search_model');
$this->search_model->insert_keyword($this->_keys);
}
$this->load->view('site_search', $data);
}
示例14: auto_id
function auto_id($prefix = '', $n = 1)
{
if ($prefix == '') {
$prefix = prefix();
}
$sql = "select id from `{$prefix}counter`";
$q = query($sql, '', 1);
if (!$q) {
$q = create_autoid($prefix);
}
$r = fetch($q);
$id = $r['id'] + $n;
$sql = "UPDATE `{$prefix}counter` SET `id` = '{$id}' ";
$q = query($sql);
return $id;
}
示例15: getTitle
function getTitle($table, $row)
{
switch ($table) {
case 'images':
$album = query_single_row('SELECT `folder` FROM ' . prefix('albums') . ' WHERE `id`=' . $row[albumid]);
$title = sprintf(gettext('%1$s: image %2$s'), $album['folder'], $row[$filename]);
break;
case 'albums':
$title = sprintf(gettext('album %s'), $row[$folder]);
break;
case 'news':
case 'pages':
$title = sprintf(gettext('%1$s: %2$s'), $table, $row['titlelink']);
break;
}
return $title;
}