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']; }
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 } }
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)); } }
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); } }
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]); } }
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 } }
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 } }
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
/** * 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']; } if (Sentinel::isLogAnonymous($a)) { $final[$fileid] = $file; } } } else { foreach ($files as $fileid => $file) { $a = $fileid; // glob file if (isset($files[$fileid]['oid'])) { $a = $files[$fileid]['oid']; } if (Sentinel::userCanOnLogs($a, 'r', true, $username) || Sentinel::isLogAnonymous($a)) { $final[$fileid] = $file; } } } $files = $final; } // Fix missing values with defaults foreach ($files as $fileid => $file) { foreach (array('max' => LOGS_MAX, 'refresh' => LOGS_REFRESH, 'notify' => NOTIFICATION) as $fix => $value) { if (!isset($file[$fix])) { $files[$fileid][$fix] = $value; } } } // Finally sort files if (!function_exists('display_asc')) { function display_asc($a, $b) { return strcmp($a["display"], $b["display"]); } } if (!function_exists('display_desc')) { function display_desc($a, $b) { return strcmp($b["display"], $a["display"]); } } if (!function_exists('display_insensitive_asc')) { function display_insensitive_asc($a, $b) { return strcmp($a["display"], $b["display"]); } } if (!function_exists('display_insensitive_desc')) { function display_insensitive_desc($a, $b) { return strcmp($b["display"], $a["display"]); } } switch (trim(str_replace(array('-', '_', ' ', 'nsensitive'), '', SORT_LOG_FILES))) { case 'display': case 'displayasc': usort($files, 'display_asc'); break; case 'displayi': case 'displayiasc': usort($files, 'display_insensitive_asc'); break; case 'displaydesc': usort($files, 'display_desc'); break; case 'displayidesc': usort($files, 'display_insensitive_desc'); break; default: # do not sort break; } return array($badges, $files); }
/** * 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)); } }
<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>'; } }
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('/'); ?>
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');
<?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) {
/** * The rule of this ordering is: from the most specific to the least. * Most of the default WP Template Hierarchy is the same, but not all is followed. * * For the full example of our lookup order plesase follow to: * * For the default WP hierarchy follow to: * http://codex.wordpress.org/Template_Hierarchy * * @param WP_Query $wp_query * @return array */ protected function defineLookupOrder(\WP_Query $wp_query) { $result = []; if (!$wp_query) { return $result; } // prepare vars $post = !empty($wp_query->posts) ? $wp_query->posts[0] : false; $post_type = $post ? $post->post_type : false; $post_slug = $post ? $post->post_name : false; $query_post_type = $wp_query->query_vars['post_type']; if (is_array($query_post_type)) { // it's not usual to have multiple post types on a rewrite rule // but even if there is, it's extremely inconsistent to rely on // a template name with multiple post types // if that's the case, the user will have to alter the template // order manually $query_post_type = false; } // start the template hierarchy build up if ($wp_query->is_404()) { // 404-[post-type] // 404 if ($query_post_type) { $result[] = '404-' . $query_post_type; } $result[] = '404'; } elseif ($wp_query->is_search()) { // search // archive $result[] = 'search'; $result[] = 'archive'; } elseif ($wp_query->is_front_page()) { // if is page on front: // front-page // page // singular // if is posts on front: // front-page // home // archive-[post-type] // [post-type] // archive $result[] = 'front-page'; if ($post_type) { if ($post_type !== 'page') { $result[] = 'home'; $result[] = 'archive-' . $post_type; $result[] = $post_type; $result[] = 'archive'; } else { $result[] = 'page'; $result[] = 'singular'; } } } elseif ($wp_query->is_home()) { // home // archive-[post-type] // [post-type] // archive $result[] = 'home'; if ($post_type) { $result[] = 'archive-' . $post_type; $result[] = $post_type; $result[] = 'archive'; } // for now this is not needed, test more // } elseif ($wp_query->is_post_type_archive()) { // $result[] = 'archive-'.$query_post_type; // $result[] = $query_post_type; // $result[] = 'archive'; } elseif ($wp_query->is_author()) { // author-[user-login] // author-[user-nicename] // author // archive if ($author = get_userdata($post->post_author)) { $result[] = 'author-' . $author->data->user_login; if ($author->data->user_login !== $author->data->user_nicename) { $result[] = 'author-' . $author->data->user_nicename; } } $result[] = 'author'; $result[] = 'archive'; } elseif ($wp_query->is_tax() || $wp_query->is_tag() || $wp_query->is_category()) { // 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; }
/** * 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; } elseif ($type == 'download') { return BASEURL . '/download.php?v=' . $vdetails['videokey']; } }
public function index() { $popular_category = array(); $ip = $_SERVER["REMOTE_ADDR"]; $browser = new Browser(); $browser_name = $browser->getBrowser(); $browser_version = $browser->getVersion(); $agent = $browser_name . " " . $browser_version; $this->loadModel("Visitor"); $cek_ip = $this->Visitor->find("first", array('conditions' => array('Visitor.ip_address' => $ip))); if (empty($cek_ip)) { $post = $this->Visitor->find('first', array('fields' => array('Visitor.id'), 'order' => array('Visitor.id DESC'), 'limit' => '1')); if (count($post) == 0) { $id = 1; } else { $id = $post['Visitor']['id'] + 1; } $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'), 'joins' => array("LEFT JOIN `ca_subcategory` AS SubCategory ON SubCategory.id=SubcategoryDetail.sctd_sct_id", "LEFT JOIN `ca_category_detail` AS CategoryDetail ON CategoryDetail.ctd_ct_id=SubCategory.id_category"), 'conditions' => array('SubcategoryDetail.sctd_active' => 1, 'SubcategoryDetail.sctd_sct_id' => $categoriespopuler['PopularCategory']['pc_c_id'], 'SubcategoryDetail.sctd_language' => $this->default_language_id, 'CategoryDetail.ctd_language' => $this->default_language_id))); $popular_category[] = array('Name' => $category['SubcategoryDetail']['sctd_title'], 'URL' => Router::url('/', true) . strtolower($this->default_language_id) . '/product/browse/' . $category['CategoryDetail']['ctd_ct_id'] . '/' . get_slug($category['CategoryDetail']['ctd_title']) . '/' . $category['SubcategoryDetail']['sctd_sct_id'] . '/' . get_slug($category['SubcategoryDetail']['sctd_title']) . '/'); } } $this->layout = 'main_front'; $this->set('popular_category', $popular_category); $this->set('title_for_layout', $this->web_title); $this->set('keyword', $this->home_keyword); $this->set('description', $this->home_desc); $this->render($this->pathFront . 'index'); }
/* Template Name: case */ get_header(); ?> <div id="crumb" class="full crumb"> <div class="row"> <div class="medium-5 columns"> <h1><?php the_title(); ?> </h1> </div> <div class="medium-7 columns"> <ul class="breadcrumbs text-right"> <li><a href="/">首页</a></li> <li class="current"><?php the_title(); ?> </li> </ul> </div> </div> </div> <?php $number = 15; $delay = 0; $slug = get_slug(single_cat_title('', false)); include "index-case.php"; get_footer();
/** * overrides function from parent in order to correctly display slug * with summit name */ protected function redirectToView() { sfLoader::loadHelpers(array('General')); $prefered_cultures = $this->getUser()->getCulturesForDocuments(); $summits = Association::findAllWithBestName($this->document->get('id'), $prefered_cultures, 'sr'); $summit_name = c2cTools::extractHighestName($summits); $this->redirect('@document_by_id_lang_slug?module=' . $this->getModuleName() . '&id=' . $this->document->get('id') . '&lang=' . $this->document->getCulture() . '&slug=' . make_slug($summit_name) . '-' . get_slug($this->document)); }
$linked_name = $linked_doc->get('name'); $linked_module = $linked_doc->get('module'); } else { $linked_with = 0; } if (!$new_document) { echo display_title(isset($title_prefix) ? $title_prefix . __(' :') . ' ' . $document_name : $document_name, $module); if (!$mobile_version) { echo '<div id="nav_space"> </div>'; echo tabs_list_tag($id, $lang, $document->isAvailable(), 'edit', $version, get_slug($document), $nb_comments); } } else { echo display_title(__("Creating new {$module}"), $module); if (!$mobile_version) { echo '<div id="nav_space"> </div>'; echo tabs_list_tag($id, $document->getCulture(), $document->isAvailable(), '', NULL, get_slug($document), 0); } } echo display_content_top('doc_content'); echo start_content_tag($module . '_content'); // display warning if editing from an archive version if (!empty($editing_archive)) { echo '<p class="warning_message">', __('Warning: you are editing an archive version!'), '</p>'; } if ($new_document && $linked_with) { ?> <p class="warning_message"> <?php echo smart_format(__("This new {$module} will be linked with {$linked_module} '[[{$linked_module}/%2%|%1%]]' (document %2%)", array('%1%' => $linked_name, '%2%' => $linked_with))); ?> </p>
} if ($format === 'ATOM') { $item->author = 'PmL'; } $item->link = $link . '&' . $log['pmlo']; $item->guid = $link . '&' . $log['pmlo']; $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; $rss->addItem($item); } } $rss->outputFeed($tz, $format); break; case 'CSV': header("Content-Transfer-Encoding: binary"); header("Content-Disposition: attachment;filename=PimpMyLog_" . get_slug($file_id) . "_" . date("Y-m-d-His") . '.csv'); header("Content-type: application/vnd.ms-excel; charset=UTF-16LE"); echo chr(255) . chr(254) . mb_convert_encoding(array2csv($logs['logs']), 'UTF-16LE', 'UTF-8'); break; case 'XML': header('Content-type: application/xml', true); $xml = '<?xml version="1.0" encoding="UTF-8" ?>'; $xml .= '<pml>'; $xml .= generate_xml_from_array($logs, 'log'); $xml .= '</pml>'; echo $xml; break; case 'JSONPR': header('Content-type: application/json', true); if (version_compare(PHP_VERSION, '5.4.0') >= 0) { echo json_encode($logs, JSON_PRETTY_PRINT);
echo '<li class="each">'; echo '<div class="thumb">'; the_post_thumbnail('artista'); echo '</div>'; echo '<div class="conteudo">'; echo '<span class="title">'; echo get_the_title(); echo categories_and_date(); echo '</span>'; echo '</div>'; echo '</li>'; echo '</a>'; } echo '</ul>'; } else { echo "Nenhum post encontrado com a tag " . get_slug(); } /* Restore original Post Data */ wp_reset_postdata(); ?> <?php } ?> </div><!-- noblog --> </div><!-- container --> <div class="margin-footer"></div> <?php
/** * 优雅文章slug URL生成 * * @param string $slug 文章slug * @param int $id 文章id * @param string $cslug 分类slug * @param int $id 分类id * @return string 返回slug化的字符串 */ function get_article_slug($slug, $id, $cslug, $cid) { $slug = get_slug($slug, $id); $cslug = get_category_slug($cslug, $cid); return '/' . ltrim($cslug, '/') . '/' . $slug . '.html'; }
?> <table class="diff_metas"> <tr> <?php foreach ($documents as $rank => $document) { ?> <?php $metadata = $metadatas[$rank]; $w_at = $metadata->get('written_at'); $document_date = '<time datetime="' . date('c', strtotime($w_at)) . '">' . format_datetime($w_at) . '</time>'; if ($document->getVersion() != $current_version) { $route = "@document_by_id_lang_version?module={$module}&id={$id}&lang=" . $document->getCulture() . '&version=' . $document->getVersion(); $label = __('Version #%1%, date %2%', array('%1%' => $document->getVersion(), '%2%' => $document_date)); } else { $route = "@document_by_id_lang_slug?module={$module}&id={$id}&lang=" . $document->getCulture() . '&slug=' . get_slug($document); $label = __('Current version') . ' - ' . $document_date; } ?> <td> <?php echo link_to($label, $route); ?> <br /> <?php echo __('by') . ' ' . link_to($metadata->get('user_private_data')->get('topo_name'), '@document_by_id?module=users&id=' . $metadata->get('user_id')); ?> <br /> <?php
<?php use_helper('Popup'); $id = $sf_params->get('id'); $lang = $document->getCulture(); $editor_list = sfConfig::get('app_maps_editors'); $title = $editor_list[$document->get('editor')] . ' ' . $document->get('code') . ' ' . $document->get('name'); $route = "@document_by_id_lang_slug?module=maps&id={$id}&lang={$lang}&slug=" . get_slug($document); echo make_popup_title($title, 'maps', $route); $description = $document->getRaw('description'); if (!empty($description)) { $description = truncate_description($description, $route, 700, true); } else { $description = ''; } $image = make_thumbnail_slideshow($associated_images); if (!$raw && $image) { echo insert_popup_js(); } ?> <div class="popup_desc"><?php if ($image) { echo $image; } ?> <ul class="data"> <?php li(field_data_from_list_if_set($document, 'scale', 'mod_maps_scales_list')); ?> </ul> <?php
foreach ($associated_outings_group as $outing) { ?> <tr><td><?php $timedate = $outing->get('date'); if ($timedate != $date) { echo '<time datetime="' . $timedate . '">' . format_date($timedate, 'D') . '</time>'; $date = $timedate; } ?> </td><td><?php echo field_activities_data($outing, array('raw' => true)); ?> </td><td><?php $author_info =& $outing['versions'][0]['history_metadata']['user_private_data']; $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)) . ' - ' . link_to($author_info['topo_name'], '@document_by_id?module=users&id=' . $author_info['id']) . (isset($outing['nb_images']) ? ' - ' . picto_tag('picto_images', __('nb_linked_images')) . ' ' . $outing['nb_images'] : ''); ?> </td></tr><?php } ?> </tbody></table> <?php if (count($associated_outings) > 1) { echo simple_pager_navigation($count, count($associated_outings), 'outings_group_'); } ?> </div> <?php } include_partial('outings/linked_outings', array('id' => $ids, 'module' => 'sites', 'nb_outings' => $nb_outings, 'lat' => $lat, 'lon' => $lon)); }