本文整理汇总了PHP中get_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP get_slug函数的具体用法?PHP get_slug怎么用?PHP get_slug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_slug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: action_counter
function action_counter($action_KEY, $options = NULL)
{
global $db;
$slug = get_slug($action_KEY);
if ($options['date']) {
$date_condition = ' and Date_Created >= "' . $options['date'] . '"';
}
$sql = 'select COUNT(supporter_KEY) as count from supporter where Source_Details LIKE "http://' . SALSA_URL . '/p/dia/action/public/?action_KEY=' . $action_KEY . '%" ' . $date_condition;
if ($options['on_list'] == TRUE) {
$sql = 'select COUNT(s.supporter_KEY) as count from supporter as s, supporter_groups as g where s.Source_Details LIKE "http://' . SALSA_URL . '/p/dia/action/public/?action_KEY=' . $action_KEY . '%" and g.groups_KEY = ' . SALSA_GROUP_FULL_LIST . ' and g.supporter_KEY = s.supporter_KEY' . $date_condition;
}
$R = $db->CacheExecute($sql) or die($db->errorMsg());
$r = $R->FetchRow();
if ($r['count'] == 0 && $slug) {
$sql = 'select COUNT(supporter_KEY) as count from supporter where Source_Details LIKE "' . ACTION_URL . $slug . '%" ' . $date_condition;
#echo $sql;
#for supporters that are currently on a list
if ($options['on_list'] == TRUE) {
$sql = 'select COUNT(s.supporter_KEY) as count from supporter as s, supporter_groups as g where s.Source_Details LIKE "' . ACTION_URL . $slug . '%" and g.groups_KEY = ' . SALSA_GROUP_FULL_LIST . ' and g.supporter_KEY = s.supporter_KEY' . $date_condition;
}
$R = $db->CacheExecute($sql) or die($db->errorMsg());
$r = $R->FetchRow();
}
return $r['count'];
}
开发者ID:radicaldesigns,项目名称:jaguar,代码行数:25,代码来源:action.php
示例2: nav_main
function nav_main($dbc, $path)
{
//$q = "SELECT * FROM navigation ORDER BY position ASC";
//$r = mysqli_query($dbc, $q);
$stmt = $dbc->query('SELECT * FROM navigation ORDER BY position ASC');
$stmt->setFetchMode(PDO::FETCH_ASSOC);
while ($nav = $stmt->fetch()) {
$nav['slug'] = get_slug($dbc, $nav['url']);
?>
<li<?php
selected($path['call_parts'][0], $nav['slug'], ' class="active"');
?>
><a href="<?php
echo $nav['url'];
?>
"><?php
echo $nav['label'];
?>
</a></li>
<?php
}
}
开发者ID:mastigos,项目名称:Atom.CMS3,代码行数:25,代码来源:template.php
示例3: display_page_header
function display_page_header($module, $document, $id, $metadata, $current_version, $options = array())
{
$is_archive = $document->isArchive();
$mobile_version = c2cTools::mobileVersion();
$content_class = $module . '_content';
$lang = $document->getCulture();
$version = $is_archive ? $document->getVersion() : NULL;
$slug = '';
$prepend = _option($options, 'prepend', '');
$separator = _option($options, 'separator', '');
$nav_options = _option($options, 'nav_options');
$item_type = _option($options, 'item_type', '');
$nb_comments = _option($options, 'nb_comments');
$creator_id = _option($options, 'creator_id');
if (!$is_archive) {
if ($module != 'users') {
$slug = get_slug($document);
$url = "@document_by_id_lang_slug?module={$module}&id={$id}&lang={$lang}&slug={$slug}";
} else {
$url = "@document_by_id_lang?module={$module}&id={$id}&lang={$lang}";
}
} else {
$url = "@document_by_id_lang_version?module={$module}&id={$id}&lang={$lang}&version={$version}";
}
if (!empty($prepend)) {
$prepend .= $separator;
}
echo display_title($prepend . $document->get('name'), $module, true, 'default_nav', $url);
if (!$mobile_version) {
echo '<div id="nav_space"> </div>';
sfLoader::loadHelpers('WikiTabs');
$tabs = tabs_list_tag($id, $lang, $document->isAvailable(), 'view', $version, $slug, $nb_comments);
echo $tabs;
// liens internes vers les sections repliables du document
if ($nav_options == null) {
include_partial("{$module}/nav_anchor");
} else {
include_partial("{$module}/nav_anchor", array('section_list' => $nav_options));
}
// boutons vers des fonctions annexes et de gestion du document
include_partial("{$module}/nav", isset($creator_id) ? array('id' => $id, 'document' => $document, 'creator_id' => $creator_id) : array('id' => $id, 'document' => $document));
if ($module != 'users') {
sfLoader::loadHelpers('Button');
echo '<div id="nav_share" class="nav_box">' . button_share() . '</div>';
}
}
echo display_content_top('doc_content', $item_type);
echo start_content_tag($content_class);
if ($merged_into = $document->get('redirects_to')) {
include_partial('documents/merged_warning', array('merged_into' => $merged_into));
}
if ($is_archive) {
include_partial('documents/versions_browser', array('id' => $id, 'document' => $document, 'metadata' => $metadata, 'current_version' => $current_version));
}
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:55,代码来源:ViewerHelper.php
示例4: create
public function create()
{
$nombre = $_POST['category_name'];
$slug = get_slug($nombre);
$existe = $this->category_exist($slug);
if ($existe) {
$result = site_url() . 'admin/categorias/?code=6&cat=' . $nombre;
url_redirect($result);
} else {
$data = $this->model('CategoriesModel');
$result = $data->save($nombre, $slug);
url_redirect($result);
}
}
开发者ID:chokonet,项目名称:alejandrocervantes.me,代码行数:14,代码来源:CategoriesController.php
示例5: create
public function create()
{
$count = 1;
if (isset($_POST['titulo']) and $_POST['titulo'] != '') {
$titlulo = $_POST['titulo'];
$slug = get_slug($titlulo);
$data = $this->model('PostsModel');
$existe = $data->slug_exist($slug);
if ($existe) {
$slug = $this->cambiaSlug($slug);
}
$result = $data->save($_POST, $slug);
if (isset($_POST['categorias']) and !empty($_POST['categorias']) and isset($result[1])) {
$this->set_categories($result[1], $_POST['categorias']);
}
url_redirect($result[0]);
}
}
开发者ID:chokonet,项目名称:alejandrocervantes.me,代码行数:18,代码来源:PostsController.php
示例6: nav_main
function nav_main($dbc, $path)
{
$q = "SELECT * FROM navigation ORDER BY position ASC";
$r = mysqli_query($dbc, $q);
while ($nav = mysqli_fetch_assoc($r)) {
$nav['slug'] = get_slug($dbc, $nav['url']);
?>
<li<?php
selected($path['call_parts'][0], $nav['url'], ' class="active"');
?>
><a href="<?php
echo $nav['url'];
?>
"><?php
echo $nav['label'];
?>
</a></li>
<?php
}
}
开发者ID:pallav1991,项目名称:mca,代码行数:20,代码来源:template.php
示例7: nav_items
function nav_items($dbc, $path)
{
$q = "SELECT * FROM navigation WHERE status = 1 AND sub = 0 ORDER BY position ASC";
$r = mysqli_query($dbc, $q);
while ($nav = mysqli_fetch_assoc($r)) {
$position = $nav['position'];
$nav['slug'] = get_slug($dbc, $nav['url']);
?>
<li <?php
selected($path['call_parts'][0], $nav['slug'], ' class="active"');
?>
><a href="<?php
echo $nav['url'];
?>
"><?php
echo $nav['icon'];
echo stripslashes($nav['label']);
?>
</a>
<?php
$query = "SELECT `url`, `label`, `icon`, `sub` FROM navigation WHERE `sub` = '{$position}' AND `status` = '1'";
$result = mysqli_query($dbc, $query);
if (mysqli_num_rows($result) >= 1) {
echo "<i class='fa fa-sort-desc menu-caret'></i>";
echo "<ul class='sub-menu'>";
while ($numrows = mysqli_fetch_assoc($result)) {
if ($numrows['sub'] == $position) {
echo "<li class='sub-item'><a href='" . $numrows['url'] . "'>" . $numrows['icon'] . "" . stripslashes($numrows['label']) . "</a></li>";
}
}
echo "</ul>";
}
?>
</li>
<?php
}
}
开发者ID:JasonMate,项目名称:Atom-CMS-Project,代码行数:40,代码来源:main-nav.php
示例8: picto_tag
echo !$mobile_version ? '</td><td>' : ' - ';
$author_info =& $outing['versions'][0]['history_metadata']['user_private_data'];
$georef = '';
if (!$outing->getRaw('geom_wkt') instanceof Doctrine_Null) {
$georef = ($mobile_version ? ' - ' : '') . picto_tag('action_gps', __('has GPS track'));
}
$images = '';
if (isset($outing['nb_images'])) {
if ($mobile_version) {
$images = ' - ' . picto_tag('picto_images_light') . ' ' . $outing['nb_images'];
} else {
$images = picto_tag('picto_images_light', format_number_choice('[1]1 image|(1,+Inf]%1% images', array('%1%' => $outing['nb_images']), $outing['nb_images']));
}
}
$outing_lang = $outing->get('culture');
echo link_to($outing->get('name'), '@document_by_id_lang_slug?module=outings&id=' . $outing->get('id') . '&lang=' . $outing_lang . '&slug=' . get_slug($outing), array('hreflang' => $outing_lang)) . (!$mobile_version ? '</td><td>' : '') . $georef . (!$mobile_version ? '</td><td>' : '') . $images . (!$mobile_version ? '</td><td>' : ' - ') . link_to($author_info['topo_name'], '@document_by_id?module=users&id=' . $author_info['id']);
echo !$mobile_version ? '</td></tr>' : '</li>';
}
echo !$mobile_version ? '</tbody></table>' : '</ul>';
if (count($routes_outings) > 1) {
echo simple_pager_navigation($count, count($routes_outings), 'routings_group_');
}
?>
</div>
<?php
}
// routes outings list link
include_partial('outings/linked_outings', array('id' => $ids, 'module' => 'routes', 'nb_outings' => $nb_routes_outings, 'document' => $document));
}
}
// new outing button
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:viewSuccess.php
示例9: config_load
/**
* Load config file
*
* @param string $path the configuration file path
* @param boolean $load_user_configuration_dir do we have to parse all user configuration files ? No for upgrade for example...
*
* @return array [ badges , files ]
*/
function config_load($load_user_configuration_dir = true)
{
$badges = false;
$files = false;
// Read config file
$config = get_config_file();
if (is_null($config)) {
return array($badges, $files);
}
// Get badges
$badges = $config['badges'];
// Set user constant
foreach ($config['globals'] as $cst => $val) {
if ($cst == strtoupper($cst)) {
@define($cst, $val);
}
}
// Set unset constants
load_default_constants();
// Set time limit
@set_time_limit(MAX_SEARCH_LOG_TIME + 2);
// Append files from the USER_CONFIGURATION_DIR
if ($load_user_configuration_dir === true) {
if (is_dir(PML_CONFIG_BASE . DIRECTORY_SEPARATOR . USER_CONFIGURATION_DIR)) {
$dir = PML_CONFIG_BASE . DIRECTORY_SEPARATOR . USER_CONFIGURATION_DIR;
$userfiles = new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD), '/^.+\\.(json|php)$/i', RecursiveRegexIterator::GET_MATCH);
foreach ($userfiles as $userfile) {
$filepath = realpath($userfile[0]);
$c = get_config_file($filepath);
if (!is_null($c)) {
foreach ($c as $k => $v) {
$fileid = get_slug(str_replace(PML_CONFIG_BASE, '', $filepath) . '/' . $k);
$config['files'][$fileid] = $v;
$config['files'][$fileid]['included_from'] = $filepath;
}
}
}
}
}
// Oups, there is no file... abort
if (!isset($config['files'])) {
return array($badges, $files);
}
// Try to generate the files tree if there are globs...
$files_tmp = $config['files'];
$files = array();
foreach ($files_tmp as $fileid => $file) {
$path = $file['path'];
$count = max(1, @(int) $file['count']);
$gpaths = glob($path, GLOB_MARK | GLOB_NOCHECK);
if (count($gpaths) == 0) {
} else {
if (count($gpaths) == 1) {
$files[$fileid] = $file;
$files[$fileid]['path'] = $gpaths[0];
} else {
$new_paths = array();
$i = 1;
foreach ($gpaths as $path) {
$new_paths[$path] = filemtime($path);
}
// The most recent file will be the first
arsort($new_paths, SORT_NUMERIC);
// The first file id is the ID of the configuration file then others files are suffixed with _2, _3, etc...
foreach ($new_paths as $path => $lastmodified) {
$ext = $i > 1 ? '_' . $i : '';
$files[$fileid . $ext] = $file;
$files[$fileid . $ext]['oid'] = $fileid;
$files[$fileid . $ext]['odisplay'] = $files[$fileid . $ext]['display'];
$files[$fileid . $ext]['path'] = $path;
$files[$fileid . $ext]['display'] .= ' > ' . basename($path);
if ($i >= $count) {
break;
}
$i++;
}
}
}
}
// Remove forbidden files
if (Sentinel::isAuthSet()) {
// authentication is enabled on this instance
$username = Sentinel::getCurrentUsername();
$final = array();
// Anonymous access only
if (is_null($username)) {
foreach ($files as $fileid => $file) {
$a = $fileid;
// glob file
if (isset($files[$fileid]['oid'])) {
$a = $files[$fileid]['oid'];
}
//.........这里部分代码省略.........
开发者ID:expressive-analytics,项目名称:docker-dt-standard.php,代码行数:101,代码来源:global.inc.php
示例10: Export
/**
* returns a GPX, KML or GeoJSON version of the document geometry with some useful additional informations in best possible lang
*/
protected function Export($module, $id, $lang, $format, $version = null)
{
if (!$id) {
$this->setErrorAndRedirect('Could not understand your request', "@default_index?module={$module}");
}
if (!empty($version)) {
$document = $this->getDocument($id, $lang, $version);
}
if (empty($document)) {
$document = Document::find('Document', $id, array('module', 'geom_wkt'));
}
if (!$document || $document->get('module') != $module) {
$this->setErrorAndRedirect('Document does not exist', "@default_index?module={$module}");
}
if ($document->get('geom_wkt')) {
sfLoader::loadHelpers(array('General'));
$doc = DocumentI18n::findNameDescription($id, $lang);
// document can exist (id) but not in required lang (id, lang)
if ($doc) {
$this->name = $doc->get('name');
$this->description = $doc->get('description');
$this->slug = get_slug($doc);
} else {
$this->name = 'C2C::' . ucfirst(substr($module, 0, strlen($module) - 1)) . " {$id}";
$this->description = "";
$this->slug = "";
}
$response = $this->getResponse();
switch ($format) {
case 'gpx':
$this->points = gisQuery::getEWKT($id, true, $module, $version);
$this->setTemplate('../../documents/templates/exportgpx');
$response->setContentType('application/gpx+xml');
break;
case 'kml':
$this->points = gisQuery::getEWKT($id, true, $module, $version);
$this->setTemplate('../../documents/templates/exportkml');
$response->setContentType('application/vnd.google-earth.kml+xml');
break;
case 'json':
$this->geojson = gisQuery::getGeoJSON($id, $module, $version, 6);
$this->setTemplate('../../documents/templates/exportjson');
$response->setContentType('application/json');
break;
}
$this->setLayout(false);
} else {
sfLoader::loadHelpers('General');
$this->setErrorAndRedirect('This document has no geometry', "@document_by_id_lang_slug?module={$module}&id={$id}&lang={$lang}&slug=" . get_slug($document));
}
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:54,代码来源:actions.class.php
示例11: _h
<ul class="nav navbar-nav"><li class="dropdown" title="<?php
_h('Select a log file to display');
?>
"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><span id="file_selector"></span></a><ul class="dropdown-menu"><?php
$notagged = '';
$tagged = '';
foreach (config_extract_tags($files) as $tag => $f) {
if ($tag === '_') {
foreach ($f as $file_id) {
$selected = isset($_GET['i']) && $_GET['i'] === $file_id ? ' active' : '';
$notagged .= '<li id="file_' . $file_id . '" data-file="' . $file_id . '" class="file_menup' . $selected . '"><a class="file_menu" href="#" title="';
$notagged .= isset($files[$file_id]['included_from']) ? h(sprintf(__('Log file #%s defined in %s'), $file_id, $files[$file_id]['included_from'])) : h(sprintf(__('Log file #%s defined in main configuration file'), $file_id));
$notagged .= '">' . $files[$file_id]['display'] . '</a></li>';
}
} else {
$tagged .= '<li class="tag-' . get_slug($tag) . '"><a href="#">' . h($tag);
if (TAG_DISPLAY_LOG_FILES_COUNT === true) {
$tagged .= ' <small class="text-muted">(' . count($f) . ')</small>';
}
$tagged .= '</a>';
$tagged .= '<ul class="dropdown-menu">';
foreach ($f as $file_id) {
$selected = isset($_GET['i']) && $_GET['i'] === $file_id ? ' active' : '';
$tagged .= '<li id="file_' . $file_id . '" data-file="' . $file_id . '" class="file_menup' . $selected . '"><a class="file_menu" href="#" title="';
$tagged .= isset($files[$file_id]['included_from']) ? h(sprintf(__('Log file #%s defined in %s'), $file_id, $files[$file_id]['included_from'])) : h(sprintf(__('Log file #%s defined in main configuration file'), $file_id));
$tagged .= '">' . $files[$file_id]['display'] . '</a></li>';
}
$tagged .= '</ul>';
$tagged .= '</li>';
}
}
开发者ID:expressive-analytics,项目名称:docker-dt-standard.php,代码行数:31,代码来源:index.php
示例12: bloginfo
bloginfo('stylesheet_directory');
?>
/application.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="<?php
bloginfo('stylesheet_directory');
?>
/theme.js"></script>
<?php
wp_head();
?>
</head>
<body <?php
body_class(get_slug());
?>
>
<div id="bg-fade"></div>
<div id="navbar">
<?php
wp_nav_menu(array('container_class' => 'menu', 'theme_location' => 'header-menu'));
?>
</div>
<header>
<h1 id="logo">
<a href="<?php
echo home_url('/');
?>
开发者ID:amiel,项目名称:bellinghamcircusguild,代码行数:31,代码来源:header.php
示例13: include_partial
include_partial('documents/welcome', array('sf_cache_key' => $id . '_' . $culture . '_' . $lang, 'title' => $title, 'description' => $abstract, 'default_open' => true));
include_partial('documents/wizard_button', array('sf_cache_key' => ($is_connected ? 'connected' : 'not_connected') . '_' . $culture));
if ($has_images && $has_map) {
$image_url_params = $sf_data->getRaw('image_url_params');
$image_url_params = implode('&', $image_url_params);
$custom_title_link = 'images/list';
$custom_rss_link = 'images/rss';
if (!empty($image_url_params)) {
$custom_title_link .= '?' . $image_url_params;
$custom_rss_link .= '?' . $image_url_params;
}
include_partial('images/latest', array('items' => $latest_images, 'culture' => $culture, 'default_open' => true, 'custom_title_link' => $custom_title_link, 'custom_rss_link' => $custom_rss_link, 'home_section' => false));
}
include_partial('documents/prepare', array('sf_cache_key' => $culture, 'default_open' => true));
if ($is_moderator) {
$tabs = tabs_list_tag($id, $document->getCulture(), $document->isAvailable(), 'view', $is_not_archive ? NULL : $document->getVersion(), get_slug($document), $nb_comments);
echo $tabs;
}
include_partial('portals/nav', array('id' => $id, 'document' => $document));
echo '<div id="nav_share" class="nav_box">' . button_share() . '</div>';
}
echo display_content_top('home');
echo start_content_tag('portals_content', true);
if ($merged_into = $document->get('redirects_to')) {
include_partial('documents/merged_warning', array('merged_into' => $merged_into));
}
if (!$is_not_archive) {
include_partial('documents/versions_browser', array('id' => $id, 'document' => $document, 'metadata' => $metadata, 'current_version' => $current_version));
}
if ($has_map && !$mobile_version) {
$map_filter = $sf_data->getRaw('map_filter');
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:viewSuccess.php
示例14: define
<?php
define('DS', DIRECTORY_SEPARATOR);
define('BASE_DIR', dirname(__FILE__) . DS);
define('SITE_ROOT', '');
require_once BASE_DIR . 'Libs' . DS . 'autoload.php';
require_once BASE_DIR . 'configs' . DS . 'incs.php';
require_once BASE_DIR . 'helpers' . DS . 'incs.php';
//-------------------------------------------------------
Util::$template_path = BASE_DIR . 'templates' . DS;
//-------------------------------------------------------
$notFound = false;
$db = new Db($db_config);
$sql_menus = "SELECT `id`, `menu_title`, `page_title`, `slug` FROM `pages` WHERE `active` = 1 AND `is_menu` = 1 AND `is_home` = 0";
$sql_home = "SELECT `id`, `menu_title`, `page_title`, `slug` FROM `pages` WHERE `active` = 1 AND `is_menu` = 1 AND `is_home` = 1";
$slug = get_slug();
$home = $db->row($sql_home);
if ($slug == "") {
if (!is_null($home)) {
$slug = $home['slug'];
} else {
$notFound = true;
}
}
$sql_page = sprintf("SELECT * FROM `pages` WHERE `slug` = '%s'", $db->escString($slug));
$page = $db->row($sql_page);
if (is_null($page)) {
$notFound = true;
}
//-------------------------------------------------------
if ($notFound) {
开发者ID:rajuthapa8086,项目名称:cms,代码行数:31,代码来源:index.php
示例15: defineLookupOrder
//.........这里部分代码省略.........
// taxonomy-[taxonomy]-[term-slug]
// taxonomy-[taxonomy]
// taxonomy-[post-type]
// taxonomy
// archive-[post-type]
// [post-type]
// archive
$term = get_queried_object();
if (!empty($term->slug)) {
$result[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug;
$result[] = 'taxonomy-' . $term->taxonomy;
}
if ($query_post_type) {
$result[] = 'taxonomy-' . $query_post_type;
}
$result[] = 'taxonomy';
if ($query_post_type) {
$result[] = 'archive-' . $query_post_type;
$result[] = $query_post_type;
}
$result[] = 'archive';
} elseif ($wp_query->is_date()) {
// date-[post-type]
// date
// archive-[post-type]
// [post-type]
// archive
if ($query_post_type) {
$result[] = 'date-' . $query_post_type;
}
$result[] = 'date';
if ($query_post_type) {
$result[] = 'archive-' . $query_post_type;
$result[] = $query_post_type;
}
$result[] = 'archive';
} elseif ($wp_query->is_archive()) {
// archive-[post-type]
// [post-type]
// archive
if ($query_post_type) {
$result[] = 'archive-' . $query_post_type;
$result[] = $query_post_type;
}
$result[] = 'archive';
} elseif ($wp_query->is_page()) {
// page-[parent-slug]-[post-slug]
// page-[post-slug]
// [page-template-name]
// page
// singular
if ($post->post_parent) {
if ($parent_slug = get_slug($post->post_parent)) {
$result[] = 'page-' . $parent_slug . '-' . $post_slug;
}
}
$result[] = 'page-' . $post_slug;
// page templates can have their unique names, let's add them before the fallback
if ($page_template_name = get_page_template_name($post->ID)) {
$result[] = $page_template_name;
}
$result[] = 'page';
$result[] = 'singular';
} elseif ($wp_query->is_attachment()) {
// single-attachment-[slugfied-long-mime-type]
// single-attachment-[slugfied-short-mime-type]
// single-attachment
// attachment
// single
// singular
// slugfied-long-mime-type = image-jpeg
// slugfied-short-mime-type = jpeg
if (!empty($post->post_mime_type)) {
$result[] = 'single-attachment-' . \Bond\to_slug($post->post_mime_type);
$mime = explode('/', $post->post_mime_type);
if (count($mime) > 1) {
$result[] = 'single-attachment-' . \Bond\to_slug($mime[1]);
}
$result[] = 'single-attachment-' . $mime[0];
}
$result[] = 'single-attachment';
$result[] = 'attachment';
$result[] = 'single';
$result[] = 'singular';
} elseif ($wp_query->is_single()) {
// single-[post-type]-[post-slug]
// single-[post-type]
// [post-type]
// single
// singular
$result[] = 'single-' . $post_type . '-' . $post_slug;
$result[] = 'single-' . $post_type;
$result[] = $post_type;
$result[] = 'single';
$result[] = 'singular';
}
// everything is handled, allow a filter and go
$result = apply_filters($this->hooks_prefix . '/lookup_order', $result);
return $result;
}
开发者ID:andrefelipe,项目名称:bond,代码行数:101,代码来源:Bond.php
示例16: video_link
/**
* Gets link of video
*
* Get video link depending how you have configured clipbucket
* SEO or Non-Seo or change patterns.
*
* @param ARRAY video details or it can be INT videoid
* @param STRING type , {link|download}
*/
function video_link($vdetails, $type = NULL)
{
global $myquery, $db;
#checking what kind of input we have
if (is_array($vdetails)) {
if (empty($vdetails['title'])) {
#check for videoid
if (empty($vdetails['videoid']) && empty($vdetails['vid']) && empty($vdetails['videokey'])) {
return BASEURL;
} else {
if (!empty($vdetails['videoid'])) {
$vid = $vdetails['videoid'];
} elseif (!empty($vdetails['vid'])) {
$vid = $vdetails['vid'];
} elseif (!empty($vdetails['videokey'])) {
$vid = $vdetails['videokey'];
} else {
return BASEURL;
}
}
}
} else {
if (is_numeric($vdetails)) {
$vid = $vdetails;
} else {
return BASEURL;
}
}
#checking if we have vid , so fetch the details
if (!empty($vid)) {
$vdetails = $myquery->get_video_details($vid);
}
//calling for custom video link functions
$functions = cb_get_functions('video_link');
if ($functions) {
foreach ($functions as $func) {
$array = array('vdetails' => $vdetails, 'type' => $type);
if (function_exists($func['func'])) {
$returned = $func['func']($array);
if ($returned) {
$link = $returned;
return $link;
break;
}
}
}
}
$plist = "";
if (SEO == 'yes') {
if ($vdetails['slug']) {
$slug = $vdetails['slug'];
} else {
//check if slug was recently added...
if (!$vdetails['slug']) {
$slug_arr = get_slug($vdetails['videoid'], 'v');
} else {
$slug_arr = $vdetails;
}
if (!$slug_arr) {
$slug_arr = add_slug(slug($vdetails['title']), $vdetails['videoid'], 'v');
$db->update(tbl('video'), array('slug_id', 'slug'), array($slug_arr['id'], $slug_arr['slug']), "videoid='" . $vdetails['videoid'] . "'");
}
$slug = $slug_arr['slug'];
}
if ($vdetails['playlist_id']) {
$plist = '?play_list=' . $vdetails['playlist_id'];
}
switch (config('seo_vido_url')) {
default:
$link = BASEURL . '/video/' . $vdetails['videokey'] . '/' . $slug . $plist;
break;
case 1:
$link = BASEURL . '/' . $slug . '_v' . $vdetails['videoid'] . $plist;
break;
case 2:
$link = BASEURL . '/video/' . $vdetails['videoid'] . '/' . $slug . $plist;
break;
case 3:
$link = BASEURL . '/video/' . $vdetails['videoid'] . '_' . $slug . $plist;
case 4:
$link = BASEURL . '/video/' . $slug . $plist;
break;
}
} else {
if ($vdetails['playlist_id']) {
$plist = '&play_list=' . $vdetails['playlist_id'];
}
$link = BASEURL . '/watch_video.php?v=' . $vdetails['videokey'] . $plist;
}
if (!$type || $type == 'link') {
return $link;
//.........这里部分代码省略.........
开发者ID:karamasmouh,项目名称:clipbucket,代码行数:101,代码来源:functions_videos.php
示例17: index
//.........这里部分代码省略.........
}
$this->request->data['Visitor']['id'] = $id;
$this->request->data['Visitor']['ip_address'] = $ip;
$this->request->data['Visitor']['user_agent'] = $agent;
$this->request->data['Visitor']['datetime'] = date('Y-m-d H:i:s');
$this->Visitor->set($this->request->data);
if ($this->Visitor->validates()) {
$this->Visitor->create();
$this->Visitor->save($this->request->data);
} else {
$errors = $this->Visitor->validationErrors;
}
} else {
$this->request->data['Visitor']['id'] = $cek_ip["Visitor"]["id"];
$this->request->data['Visitor']['user_agent'] = $agent;
$this->request->data['Visitor']['datetime'] = date('Y-m-d H:i:s');
$this->Visitor->set($this->request->data);
if ($this->Visitor->validates()) {
$this->Visitor->save($this->request->data);
} else {
$errors = $this->Visitor->validationErrors;
}
}
$this->loadModel("Config");
$hit_counter = $this->Config->find("first", array('conditions' => array('Config.id' => 70)));
$this->Config->id = 70;
$this->request->data["Config"]["c_value"] = $hit_counter["Config"]["c_value"] + 1;
$this->Config->set($this->request->data);
if ($this->Config->validates()) {
$this->Config->save($this->request->data);
} else {
$errors = $this->Config->validationErrors;
}
/* ============== WELCOME NOTE ============== */
$this->loadModel("Page");
$note = $this->Page->find('first', array('fields' => array('Page.id', 'Page.p_image', 'media_image_1.*', 'page_detail_many.*'), 'joins' => array("LEFT JOIN `ca_page_detail` AS `page_detail_many` ON `Page`.`id` = `page_detail_many`.`pd_p_id`"), 'conditions' => array('(page_detail_many.pd_active = 3) AND page_detail_many.pd_language="' . $this->default_language_id . '" AND Page.id=1'), 'recursive' => 0));
$this->set("note", $note);
/* ============== SLIDESHOW ============== */
$this->loadModel("Slideshow");
$slideshow = $this->Slideshow->find('all', array('fields' => array('Slideshow.id', 'Slideshow.s_image', 'media_image_1.*', 'slideshow_detail_many.*'), 'joins' => array("LEFT JOIN `ca_slideshow_detail` AS `slideshow_detail_many` ON `Slideshow`.`id` = `slideshow_detail_many`.`id_slideshow`"), 'conditions' => array('(slideshow_detail_many.sd_active = 3) AND slideshow_detail_many.sd_language="' . $this->default_language["Language"]["lg_code"] . '"'), 'recursive' => 0));
$this->set("slideshow", $slideshow);
/* ============== KNOW US ============== */
$this->loadModel("Page");
$know_text = $this->Page->find('first', array('fields' => array('Page.id', 'page_detail_many.*'), 'joins' => array("LEFT JOIN `ca_page_detail` AS `page_detail_many` ON `Page`.`id` = `page_detail_many`.`pd_p_id`"), 'conditions' => array('(page_detail_many.pd_active = 3) AND page_detail_many.pd_language="' . $this->default_language_id . '" AND Page.id=4'), 'recursive' => 0));
$this->set("know_text", $know_text);
$this->loadModel("Know");
$know = $this->Know->find('all', array('fields' => array('Know.id', 'Know.k_image', 'media_image_1.*', 'know_detail_many.*'), 'joins' => array("LEFT JOIN `ca_know_detail` AS `know_detail_many` ON `Know`.`id` = `know_detail_many`.`kd_k_id`"), 'conditions' => array('(know_detail_many.kd_active = 3) AND know_detail_many.kd_language="' . $this->default_language_id . '"'), 'order' => array('Know.k_sequence' => 'ASC'), 'recursive' => 0));
$this->set("know", $know);
/* ======================================== */
/* PRODUCT */
$this->loadModel("Product");
$product = $this->Product->find("all", array('recursive' => 0, 'fields' => array('Product.*', 'product_detail_many.*', 'shop_shop.*', 'UserLike.like_count'), 'limit' => 8, 'joins' => array("LEFT JOIN `ca_product_detail` AS `product_detail_many` ON `Product`.`id` = `product_detail_many`.`pd_pr_id`", "LEFT JOIN \n\t\t\t\t\t(\n\t\t\t\t\t\tSELECT \n\t\t\t\t\t\t\tProductLike.`id_product`, COUNT(ProductLike.id) AS like_count \n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t `ca_product_like` AS `ProductLike` \n\t\t\t\t\t\tWHERE ProductLike.id_account = '" . $this->user_front["id"] . "'\n\t\t\t\t\t\tGROUP BY ProductLike.`id_product`\n\t\t\t\t\t) UserLike\n\t\t\t\t ON `Product`.`id` = `UserLike`.`id_product`\t\t\t\t\t\t\t\n\t\t\t\t"), 'conditions' => array('((Product.pr_active = 3) AND product_detail_many.pd_language="' . $this->default_language_id . '")'), 'order' => array('(Product.pr_total_like + Product.pr_total_sales)' => 'DESC', 'Product.pr_date_created' => 'DESC')));
$this->set("product", $product);
/* ======================================== */
$this->loadModel("Shop");
$shop = $this->Shop->find("all", array('recursive' => 0, 'fields' => array('Shop.*', 'UserLike.like_count'), 'limit' => 3, 'joins' => array("LEFT JOIN \n\t\t\t\t\t(\n\t\t\t\t\t\tSELECT \n\t\t\t\t\t\t\tShopLike.`id_shop`, COUNT(ShopLike.id) AS like_count \n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t `ca_shop_like` AS `ShopLike` \n\t\t\t\t\t\tWHERE ShopLike.id_account = '" . $this->user_front["id"] . "'\n\t\t\t\t\t\tGROUP BY ShopLike.`id_shop`\n\t\t\t\t\t) UserLike\n\t\t\t\t ON `Shop`.`id` = `UserLike`.`id_shop`\n\t\t\t\t"), 'conditions' => array('(Shop.sh_active = 1)'), 'order' => array('(Shop.sh_total_like + Shop.sh_total_sales)' => 'DESC', 'Shop.sh_date_created' => 'DESC')));
foreach ($shop as $key => $shop_detail) {
$this->loadModel("Product");
$product = $this->Product->find("all", array('recursive' => 0, 'fields' => array('Product.*', 'product_detail_many.*'), 'limit' => 4, 'joins' => array("LEFT JOIN `ca_product_detail` AS `product_detail_many` ON `Product`.`id` = `product_detail_many`.`pd_pr_id`"), 'conditions' => array('((Product.pr_active = 3) AND product_detail_many.pd_language="' . $this->default_language_id . '") AND Product.id_shop ="' . $shop_detail["Shop"]["id"] . '" ORDER BY Product.pr_total_sales DESC')));
$shop[$key]["ProductDetail"] = $product;
}
/* COUNT */
foreach ($shop as $key => $shop_detail) {
$this->loadModel("Product");
$product = $this->Product->find("count", array('conditions' => array('(Product.pr_active = 3) AND Product.id_shop ="' . $shop_detail["Shop"]["id"] . '"')));
$shop[$key]["ProductCount"] = $product;
}
/* DIBINA */
// foreach ($shop as $key => $shop_detail):
// $this->loadModel("Coach");
// $coach = $this->Coach->find('all',array(
// 'fields'=> array('Coach.*','media_image_1.*'),
// 'joins' => array("LEFT JOIN `ca_coach_detail` AS `coach_detail_many` ON `Coach`.`id` = `coach_detail_many`.`id_coach`",
// ),
// 'conditions' => array('coach_detail_many.id_shop' => $shop_detail["Shop"]["id"]),
// 'recursive' => 0,
// ));
// $shop[$key]["Coach"] = $coach;
// endforeach;
$this->set('shop', $shop);
$this->loadModel("PopularCategory");
$category = $this->PopularCategory->find('all', array('fields' => array('PopularCategory.pc_c_id', 'PopularCategory.pc_type'), 'conditions' => array('PopularCategory.pc_active' => 1)));
foreach ($category as $categoriespopuler) {
if ($categoriespopuler['PopularCategory']['pc_type'] == 1) {
$this->loadModel("CategoryDetail");
$category = $this->CategoryDetail->find('first', array('fields' => array('CategoryDetail.ctd_ct_id', 'CategoryDetail.ctd_title'), 'conditions' => array('CategoryDetail.ctd_active' => 1, 'CategoryDetail.ctd_ct_id' => $categoriespopuler['PopularCategory']['pc_c_id'], 'CategoryDetail.ctd_language' => $this->default_language_id)));
$popular_category[] = array('Name' => $category['CategoryDetail']['ctd_title'], 'URL' => Router::url('/', true) . strtolower($this->default_language_id) . '/product/browse/' . $category['CategoryDetail']['ctd_ct_id'] . '/' . get_slug($category['CategoryDetail']['ctd_title']) . '/');
} elseif ($categoriespopuler['PopularCategory']['pc_type'] == 2) {
$this->loadModel("SubcategoryDetail");
$category = $this->SubcategoryDetail->find('first', array('fields' => array('SubcategoryDetail.sctd_sct_id', 'SubcategoryDetail.sctd_title', 'CategoryDetail.ctd_ct_id', 'CategoryDetail.ctd_title'), 'joi
|
请发表评论