function et_load_dailyjournal_scripts() { if (!is_admin()) { $template_dir = get_template_directory_uri(); if (get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_enqueue_script('easing', $template_dir . '/js/jquery.easing.1.3.js', array('jquery'), '1.0', true); wp_enqueue_script('jquery_address', $template_dir . '/js/jquery.address-1.5.min.js', array('jquery'), '1.0', true); wp_enqueue_script('mousewheel', $template_dir . '/js/jquery.mousewheel.js', array('jquery'), '1.0', true); wp_enqueue_script('jscrollpane', $template_dir . '/js/jquery.jscrollpane.min.js', array('jquery'), '1.0', true); wp_enqueue_script('gleam_plugin_fixes', $template_dir . '/js/gleam_plugin_fixes.js', array('jquery'), '1.0', true); wp_enqueue_script('custom_script', $template_dir . '/js/custom.js', array('jquery'), '1.0', true); $data = array('site_url' => home_url('/'), 'theme_url' => $template_dir); if (function_exists('qtrans_getLanguage')) { $data['qtranslate_lang'] = '?lang=' . qtrans_getLanguage(); } if (function_exists('icl_object_id')) { $data['wpml_lang'] = '?lang=' . ICL_LANGUAGE_CODE; } wp_localize_script('custom_script', 'et_site_data', $data); wp_localize_script('custom_script', 'et_shortcodes_strings', array('previous' => __('Previous', 'Gleam'), 'next' => __('Next', 'Gleam'))); if (defined('ET_LB_PLUGIN_URI')) { wp_localize_script('custom_script', 'et_gleam_lb', array('plugin_url' => ET_LB_PLUGIN_URI)); } wp_localize_script('gleam_plugin_fixes', 'et_plugin_data', array('folder' => plugins_url())); } }
/** * Get data from context * * @since 1.0 * @return array */ public function get_context_data() { $data = array($this->id); if (function_exists('qtrans_getLanguage')) { $data[] = qtrans_getLanguage(); } return $data; }
function dsq_qtrans_get_lang() { if (function_exists('qtranxf_getLanguage')) { return qtranxf_getLanguage($text); } else { return qtrans_getLanguage($text); } }
/** * Мы храним иногда язык в базе как отдельное поле. В таком случае у нас есть цифровой код языка * @return int */ public function getCurrentLangCode($lang = NULL) { $lang = empty($lang) ? qtrans_getLanguage() : $lang; $langCodes = array('ru' => 1, 'ro' => 2); if (array_key_exists($lang, $langCodes)) { return $langCodes[$lang]; } return 0; }
/** * This function include files of javascript. */ function tfuse_add_js() { wp_enqueue_script('jquery'); wp_register_script('modernizr', tfuse_get_file_uri('/js/lib/modernizr.min.js'), array('jquery'), '', true); wp_enqueue_script('modernizr'); wp_register_script('respond', tfuse_get_file_uri('/js/lib/respond.min.js'), array('jquery'), '', true); wp_enqueue_script('respond'); wp_register_script('jquery-ui.min', tfuse_get_file_uri('/js/lib/jquery-ui.min.js'), array('jquery'), '', true); wp_enqueue_script('jquery-ui.min'); // wp_register_script('bootstrap', tfuse_get_file_uri('/js/lib/bootstrap.min.js'), array('jquery'), '', true); wp_enqueue_script('bootstrap'); wp_register_script('jquery.slicknav.min', tfuse_get_file_uri('/js/jquery.slicknav.min.js'), array('jquery'), '', true); wp_enqueue_script('jquery.slicknav.min'); wp_register_script('jquery.customInput', tfuse_get_file_uri('/js/jquery.customInput.js'), array('jquery'), '', false); wp_enqueue_script('jquery.customInput'); wp_register_script('jquery.carouFredSel-6.2.1-packed', tfuse_get_file_uri('/js/jquery.carouFredSel-6.2.1-packed.js'), array('jquery'), '', false); wp_enqueue_script('jquery.carouFredSel-6.2.1-packed'); wp_register_script('general', tfuse_get_file_uri('/js/general.js'), array('jquery'), '', true); wp_enqueue_script('general'); wp_register_script('html5shiv', tfuse_get_file_uri('/js/lib/html5shiv.js'), array('jquery'), '', true); wp_enqueue_script('html5shiv'); wp_register_script('maps.google.com', '//maps.google.com/maps/api/js?sensor=false', array('jquery'), '1.0', true); wp_enqueue_script('maps.google.com'); wp_register_script('jquery.gmap.min', tfuse_get_file_uri('/js/jquery.gmap.min.js'), array('jquery'), '', true); wp_enqueue_script('jquery.gmap.min'); wp_register_script('html5gallery', tfuse_get_file_uri('/js/html5gallery.js'), array('jquery'), '', true); wp_enqueue_script('html5gallery'); wp_register_script('jquery.touchSwipe.min', tfuse_get_file_uri('/js/jquery.touchSwipe.min.js'), array('jquery'), '', true); wp_enqueue_script('jquery.touchSwipe.min'); wp_register_script('video', tfuse_get_file_uri('/js/video.js'), array('jquery'), '', true); wp_enqueue_script('video'); // wp_register_script('prettyPhoto', TFUSE_ADMIN_JS . '/jquery.prettyPhoto.js', array('jquery'), '3.1.4', true); wp_enqueue_script('prettyPhoto'); wp_register_script('youtube-api.min', tfuse_get_file_uri('/js/youtube-api.min.js'), array('jquery'), '', true); wp_enqueue_script('youtube-api.min'); wp_register_script('shCore', tfuse_get_file_uri('/js/shCore.js'), array('jquery'), '', true); wp_enqueue_script('shCore'); wp_register_script('calendar', tfuse_get_file_uri('/js/calendar/calendar.js'), array('jquery'), '', true); wp_enqueue_script('calendar'); wp_register_script('underscore-min', tfuse_get_file_uri('/js/calendar/underscore-min.js'), array('jquery'), '', true); wp_enqueue_script('underscore-min'); wp_register_script('shBrushPlain', tfuse_get_file_uri('/js/shBrushPlain.js'), array('jquery'), '', true); wp_enqueue_script('shBrushPlain'); wp_register_script('sintaxHighlighter', tfuse_get_file_uri('/js/sintaxHighlighter.js'), array('jquery'), '', true); wp_enqueue_script('sintaxHighlighter'); if (function_exists('qtrans_getLanguage')) { wp_localize_script('calendar', 'tf_qtrans_lang', array('lang' => qtrans_getLanguage())); } if (!is_admin()) { do_action('tf_scripts_added'); } }
public static function detectLanguage() { $DW =& $GLOBALS['DW']; if (self::detect(FALSE)) { $qtlang = get_option('qtranslate_default_language'); $curlang = qtrans_getLanguage(); $DW->message('QT language: ' . $curlang); if ($qtlang != $curlang) { $DW->qt = TRUE; $DW->message('QT enabled'); } return $curlang; } }
function of_meta($id, $key, $echo = true) { if (function_exists('qtrans_getAvailableLanguages')) { $selectedLanguage = qtrans_getLanguage(); if ($echo) { echo get_post_meta($id, $key . "_" . $selectedLanguage, true); } else { return get_post_meta($id, $key . "_" . $selectedLanguage, true); } } else { if ($echo) { echo get_post_meta($id, $key, true); } else { return get_post_meta($id, $key, true); } } }
/** * We use the blogfilter function to define all the page urls and category mappings * * @Params the name of the page * @Params 'display' * @return string - the url or category name * **/ function blogfilter($arg, $arg2) { global $current_user, $authordata, $group; $userInfo = wp_get_current_user(); $loggedin = is_user_logged_in(); $lang = qtrans_getLanguage(); switch ($arg2) { /* === Main Page Links === */ case 'main_url': return get_bloginfo('wpurl'); case 'company_url': return get_bloginfo('wpurl') . "/" . $lang . "/company"; case 'company_history_url': return get_bloginfo('wpurl') . "/" . $lang . "/company-history"; case 'company_events_url': return get_bloginfo('wpurl') . "/" . $lang . "/company-events"; case 'company_careers_url': return get_bloginfo('wpurl') . "/" . $lang . "/company-careers"; case 'activity_url': return get_bloginfo('wpurl') . "/" . $lang . "/activity"; case 'activity_geography_url': return get_bloginfo('wpurl') . "/" . $lang . "/activity-geography"; case 'activity_license_url': return get_bloginfo('wpurl') . "/" . $lang . "/activity-license"; case 'services_url': return get_bloginfo('wpurl') . "/" . $lang . "/services"; case 'ecology_url': return get_bloginfo('wpurl') . "/" . $lang . "/ecology"; case 'partners_url': return get_bloginfo('wpurl') . "/" . $lang . "/partners"; case 'news_url': return get_bloginfo('wpurl') . "/" . $lang . "/news"; case 'contacts_url': return get_bloginfo('wpurl') . "/" . $lang . "/contacts"; /* === Main Category Names === */ /* === Main Category Names === */ case 'main_cat': return "main"; /* === MISC === */ /* === MISC === */ case 'ajax_queries_url': return get_bloginfo('stylesheet_directory') . '/ajax_queries.php'; } return $arg; }
public static function load_item($id, $vista) { $settings = unserialize(get_option("chronosly-settings")); if ($settings["disable_cache"]) { return false; } if (isset($_REQUEST["small"])) { $vista .= "_small"; } if (function_exists("qtrans_getLanguage")) { $vista .= qtrans_getLanguage(); } $html = get_option("chronosly_template_{$id}_{$vista}"); if (!Chronosly_Utils::validate_closure($html)) { return false; } return $html; }
/** * This function include files of javascript. */ function tfuse_add_js() { wp_enqueue_script('jquery'); wp_register_script('jquery-ui', tfuse_get_file_uri('/js/lib/jquery-ui.min.js'), array('jquery'), '1.10.4', false); wp_enqueue_script('jquery-ui'); wp_register_script('bootstrap', tfuse_get_file_uri('/js/lib/bootstrap.min.js'), array('jquery'), '3.1.0', false); wp_enqueue_script('bootstrap'); wp_register_script('prettyPhoto', TFUSE_ADMIN_JS . '/jquery.prettyPhoto.js', array('jquery'), '3.1.4', false); wp_enqueue_script('prettyPhoto'); // general.js can be overridden in a child theme by copying it in child theme's js folder wp_register_script('general', tfuse_get_file_uri('/js/general.js'), array('jquery'), '2.0', false); wp_enqueue_script('general'); wp_localize_script('general', 'TfPhpVars', array('home' => __('Home', 'tfuse'))); wp_register_script('events', tfuse_get_file_uri('/js/events.js'), array('jquery'), '', true); wp_enqueue_script('events'); if (function_exists('qtrans_getLanguage')) { wp_localize_script('events', 'tf_qtrans_lang', array('lang' => qtrans_getLanguage())); } wp_register_script('slicknav', tfuse_get_file_uri('/js/jquery.slicknav.min.js'), array('jquery'), '1.0', true); wp_enqueue_script('slicknav'); wp_register_script('modernizr', tfuse_get_file_uri('/js/lib/modernizr.min.js')); wp_enqueue_script('modernizr'); wp_register_script('html5shiv', tfuse_get_file_uri('/js/lib/html5shiv.js')); wp_enqueue_script('html5shiv'); wp_register_script('respond', tfuse_get_file_uri('/js/lib/respond.min.js')); wp_enqueue_script('respond'); wp_register_script('carouFredSel', tfuse_get_file_uri('/js/jquery.carouFredSel-6.2.1.js'), array('jquery'), '6.2.1', true); wp_enqueue_script('carouFredSel'); wp_register_script('cusel-min', tfuse_get_file_uri('/js/cusel.min.js'), array('jquery'), '3.0', true); wp_enqueue_script('cusel-min'); wp_register_script('parallax', tfuse_get_file_uri('/js/parallax.js'), array('jquery'), '1.1.3', true); wp_enqueue_script('parallax'); wp_register_script('scrollto', tfuse_get_file_uri('/js/scrollto.js'), array('jquery'), '1.0', true); wp_enqueue_script('scrollto'); if (!is_admin()) { do_action('tf_scripts_added'); } }
/** * The map template tag. * * Returns HTML for a Google map. Must use with echo in a template: echo GeoMashup::map();. * * @since 1.0 * @link http://github.com/cyberhobo/wordpress-geo-mashup/wiki/Tag-Reference#map tag parameter documentation * @uses $_SERVER['QUERY_STRING'] The first global map on a page uses query string parameters like tag parameters. * @uses apply_filters() geo_mashup_static_map Modify a static map image generated by geo mashup. * @staticvar $map_number Used to index maps per request. * * @param string|array $atts Template tag parameters. * @return string The HTML for the requested map. */ public static function map($atts = null) { global $wp_query, $in_comment_loop, $geo_mashup_options; static $map_number = 1; $atts = wp_parse_args($atts); $static = (bool) (!empty($atts['static']) and 'true' == $atts['static']); unset($atts['static']); if (empty($atts['lang'])) { if (function_exists('qtrans_getLanguage')) { // qTranslate integration $atts['lang'] = qtrans_getLanguage(); } else { if (defined('ICL_LANGUAGE_CODE')) { // WPML integration $atts['lang'] = ICL_LANGUAGE_CODE; } } } $click_to_load_options = array('click_to_load', 'click_to_load_text'); self::convert_map_attributes($atts); // Default query is for posts $object_name = isset($atts['object_name']) ? $atts['object_name'] : 'post'; // Map content type isn't required, if empty we'll choose one $map_content = isset($atts['map_content']) ? $atts['map_content'] : null; // Find the ID and location of the container object if it exists if ('post' == $object_name and $wp_query->in_the_loop) { $context_object_id = $wp_query->post->ID; } else { if ('comment' == $object_name and $in_comment_loop) { $context_object_id = get_comment_ID(); } else { if ('user' == $object_name and $wp_query->post) { $context_object_id = $wp_query->post->post_author; } } } if (empty($atts['object_id'])) { if (!empty($context_object_id)) { // If we found a context object, we'll query for that by default $atts['object_id'] = $context_object_id; $context_location = GeoMashupDB::get_object_location($object_name, $context_object_id); } else { if ('single' == $map_content and 'post' == $object_name) { // In secondary post loops we won't find a context object // but can at least allow explicit single maps $atts['object_id'] = get_the_ID(); } } } if (empty($map_content) and !empty($atts['object_ids'])) { $map_content = 'global'; } if (empty($map_content)) { if (empty($context_object_id)) { $map_content = 'contextual'; } else { if (empty($context_location)) { // Not located, go global $map_content = 'global'; } else { // Located, go single $map_content = 'single'; } } } else { if ($map_content instanceof WP_Query) { // We've been given a post query, put its contents in a global map $atts['object_ids'] = implode(',', wp_list_pluck($map_content->posts, 'ID')); $map_content = 'global'; } } switch ($map_content) { case 'contextual': $atts['map_content'] = 'contextual'; $atts += $geo_mashup_options->get('context_map', $click_to_load_options); $object_ids = array(); if ('comment' == $object_name) { $context_objects = $wp_query->comments; } else { $context_objects = $wp_query->posts; } if (!is_array($context_objects)) { return '<!-- ' . __('Geo Mashup found no objects to map in this context', 'GeoMashup') . '-->'; } foreach ($context_objects as $context_object) { if ('post' == $object_name) { $object_ids[] = $context_object->ID; } else { if ('user' == $object_name) { $object_ids[] = $context_object->post_author; } else { if ('comment' == $object_name) { $object_ids[] = $context_object->comment_ID; } } } } $atts['object_ids'] = implode(',', $object_ids); break; case 'single': $atts['map_content'] = 'single'; $atts += $geo_mashup_options->get('single_map', $click_to_load_options); if (empty($atts['object_id'])) { return '<!-- ' . __('Geo Mashup found no current object to map', 'GeoMashup') . '-->'; } $single_location = GeoMashupDB::get_object_location($object_name, $atts['object_id']); if (empty($single_location)) { return '<!-- ' . __('Geo Mashup omitted a map for an object with no location', 'GeoMashup') . '-->'; } break; case 'global': if (isset($_GET['template']) and 'full-post' == $_GET['template']) { // Global maps tags in response to a full-post query can infinitely nest, prevent this return '<!-- ' . __('Geo Mashup map omitted to avoid nesting maps', 'GeoMashup') . '-->'; } $atts['map_content'] = 'global'; // Global maps on a page will make use of query string arguments unless directed otherwise $ignore_url = false; if (isset($atts['ignore_url']) && 'true' == $atts['ignore_url']) { $ignore_url = true; unset($atts['ignore_url']); } if (isset($_SERVER['QUERY_STRING']) and !$ignore_url) { $atts = wp_parse_args($_SERVER['QUERY_STRING'], $atts); } $atts += $geo_mashup_options->get('global_map', $click_to_load_options); // Don't query more than max_posts $max_posts = $geo_mashup_options->get('global', 'max_posts'); if (empty($atts['limit']) and !empty($max_posts)) { $atts['limit'] = $max_posts; } break; default: return '<div class="gm-map"><p>Unrecognized value for map_content: "' . $map_content . '".</p></div>'; } $click_to_load = $atts['click_to_load']; unset($atts['click_to_load']); $click_to_load_text = $atts['click_to_load_text']; unset($atts['click_to_load_text']); if (!isset($atts['name'])) { $atts['name'] = 'gm-map-' . $map_number; } $map_data = self::build_map_data($atts); if (empty($map_data['object_data']['objects']) and !isset($map_data['load_empty_map'])) { return '<!-- ' . __('Geo Mashup omitted a map with no located objects found.', 'GeoMashup') . '-->'; } unset($map_data['load_empty_map']); $width_units = '%' === substr($map_data['width'], -1) ? '%' : 'px'; $width = intval($map_data['width']); $width_style = $width . $width_units; $height_units = '%' === substr($map_data['height'], -1) ? '%' : 'px'; $height = intval($map_data['height']); $height_style = $height . $height_units; $map_image = ''; if ($static) { // Static maps have a limit of 50 markers: http://code.google.com/apis/maps/documentation/staticmaps/#Markers $atts['limit'] = empty($atts['limit']) ? 50 : $atts['limit']; if (!empty($map_data['object_data']['objects'])) { $map_image = '<img src="http://maps.google.com/maps/api/staticmap?size=' . $width . 'x' . $height; if (count($map_data['object_data']['objects']) == 1) { $map_image .= '&center=' . $map_data['object_data']['objects'][0]['lat'] . ',' . $map_data['object_data']['objects'][0]['lng']; } $map_image .= '&sensor=false&zoom=' . $map_data['zoom'] . '&markers=size:small|color:red'; foreach ($map_data['object_data']['objects'] as $location) { // TODO: Try to use the correct color for the category? Draw category lines? $map_image .= '|' . $location['lat'] . ',' . $location['lng']; } $map_image .= '" alt="geo_mashup_map"'; if ($click_to_load == 'true') { $map_image .= '" title="' . $click_to_load_text . '"'; } $map_image .= ' />'; $map_image = apply_filters('geo_mashup_static_map', $map_image, $map_data, array('click_to_load' => $click_to_load, 'click_to_load_text' => $click_to_load_text)); } } $atts_md5 = md5(serialize($atts)); set_transient('gmm' . $atts_md5, $map_data, 20); $src_args = array('geo_mashup_content' => 'render-map', 'map_data_key' => $atts_md5); if (!empty($atts['lang'])) { $src_args['lang'] = $atts['lang']; } if (isset($atts['object_ids']) and strlen($atts['object_ids']) > 1800) { // Try to shorten the URL a bit if (!class_exists('GM_Int_list')) { include GEO_MASHUP_DIR_PATH . '/gm-int-list.php'; } $id_list = new GM_Int_List($atts['object_ids']); $atts['oids'] = $id_list->compressed(); unset($atts['object_ids']); } $iframe_src = self::build_home_url($src_args + $atts); $content = ""; if ($click_to_load == 'true') { if (is_feed()) { $content .= "<a href=\"{$iframe_src}\">{$click_to_load_text}</a>"; } else { self::$add_loader_script = true; $style = "height: {$height_style}; width: {$width_style}; background-color: #ddd;" . "background-image: url(" . GEO_MASHUP_URL_PATH . "/images/wp-gm-pale.png);" . "background-repeat: no-repeat;background-position:center; cursor: pointer;"; $content = "<div class=\"gm-map\" style=\"{$style}\" " . "onclick=\"GeoMashupLoader.addMapFrame(this,'{$iframe_src}','{$height_style}','{$width_style}','{$map_data['name']}')\">"; if ($static) { // TODO: test whether click to load really works with a static map $content .= $map_image . '</div>'; } else { $content .= "<p style=\"text-align:center;\">{$click_to_load_text}</p></div>"; } } } else { if ($static) { $content = "<div class=\"gm-map\">{$map_image}</div>"; } else { $content = "<div class=\"gm-map\"><iframe name=\"{$map_data['name']}\" src=\"{$iframe_src}\" " . "style=\"height: {$height_style}; width: {$width_style}; border: none; overflow: hidden;\"></iframe></div>"; } } $map_number++; return apply_filters('geo_mashup_map_content', $content, $map_data); }
<?php global $qtransMETA; global $q_config; //Get languages $languages = qtrans_getSortedLanguages(); //Check for & set view if (isset($_REQUEST['qtm_view'])) { $_SESSION['qtm_view'] = filter_var($_REQUEST['qtm_view'], FILTER_SANITIZE_STRING); } $_view = $_SESSION['qtm_view'] ? $_SESSION['qtm_view'] : 'flags'; //Check for & set lang if (isset($_REQUEST['qtm_lang'])) { $_SESSION['qtm_lang'] = filter_var($_REQUEST['qtm_lang'], FILTER_SANITIZE_STRING); } $_lang = $_SESSION['qtm_lang'] ? $_SESSION['qtm_lang'] : qtrans_getLanguage(); ?> <form method="post" action=""> <div class="tablenav"> <div class="alignleft actions"> <?php _e('View', 'qtranslate-meta'); ?> : <select name="qtm_view" onchange="this.form.submit()"> <option value="flags" <?php if ($_view == 'flags') { echo 'selected="selected"'; } ?>
if (qtrans_getLanguage() == 'es') { ?> Tarde <?php } else { ?> Afternoon <?php } ?> </a> </li> <li class="span3"> <a href="#filter" data-option-value=".noche"> <?php if (qtrans_getLanguage() == 'es') { ?> Noche <?php } else { ?> Night <?php } ?> </a> </li> </ul> </section> <p class="titulo-programacion"> <span class="icono-filters"></span>Eventos organizados de la Alcaldía de Medellín
function eme_detect_lang() { $language=""; if (function_exists('qtrans_getLanguage')) { // if permalinks are on, $_GET doesn't contain lang as a parameter // so we get it like this to be sure $language=qtrans_getLanguage(); } elseif (function_exists('ppqtrans_getLanguage')) { $language=ppqtrans_getLanguage(); } elseif (function_exists('qtranxf_getLanguage')) { $language=qtranxf_getLanguage(); } elseif (function_exists('pll_current_language') && function_exists('pll_languages_list')) { $languages=pll_languages_list(); if (is_array($languages)) { foreach ($languages as $tmp_lang) { if (preg_match("/^$tmp_lang\/|\/$tmp_lang\//",$_SERVER['REQUEST_URI'])) $language=$tmp_lang; } } if (empty($language)) $language=pll_current_language('slug'); } elseif (defined('ICL_LANGUAGE_CODE')) { // Both polylang and wpml define this constant, so check polylang first (above) // if permalinks are on, $_GET doesn't contain lang as a parameter // so we get it like this to be sure $language=ICL_LANGUAGE_CODE; } elseif (isset($_GET['lang'])) { $language=eme_strip_tags($_GET['lang']); } else { $language=""; } return $language; }
function get_ajax_url() { if (defined('ICL_LANGUAGE_CODE')) { return admin_url('admin-ajax.php') . '?lang=' . ICL_LANGUAGE_CODE; } if (function_exists('qtrans_getLanguage')) { return admin_url('admin-ajax.php') . '?lang=' . qtrans_getLanguage(); } return admin_url('admin-ajax.php'); }
function qtrans_excludePages($pages) { global $wpdb, $q_config; static $exclude = 0; if (!$q_config['hide_untranslated']) { return $pages; } if (is_array($exclude)) { return array_merge($exclude, $pages); } $query = "SELECT id FROM {$wpdb->posts} WHERE post_type = 'page' AND post_status = 'publish' AND NOT ({$wpdb->posts}.post_title LIKE '%<!--:" . qtrans_getLanguage() . "-->%')"; $hide_pages = $wpdb->get_results($query); $exclude = array(); foreach ($hide_pages as $page) { $exclude[] = $page->id; } return array_merge($exclude, $pages); }
/** * Find a comic file in the filesystem. * @param string $folder The folder name to search. * @param string $override_post A WP Post object to use in place of global $post. * @param string $filter The $comic_filename_filters to use. * @return string The relative path to the comic file, or false if not found. */ function get_comic_path($folder = 'comic', $override_post = null, $filter = 'default') { global $post, $comic_filename_filters, $comic_pathfinding_errors; $post_to_use = !empty($override_post) ? $override_post : $post; $meta_name = 'comic'; $comicfile = ''; if (function_exists('xlanguage_current_language_code')) { $meta_name .= '-' . xlanguage_current_language_code(); } $comicfile = get_post_meta($post_to_use->ID, $meta_name, false); // Backswards compatibility here switch ($folder) { case "rss": $subfolder_to_use = comicpress_themeinfo('rss_comic_folder'); break; case "archive": $subfolder_to_use = comicpress_themeinfo('archive_comic_folder'); break; case "mini": $subfolder_to_use = comicpress_themeinfo('mini_comic_folder'); break; case "comic": default: $subfolder_to_use = comicpress_themeinfo('comic_folder'); break; } // comic-en comic-esp etc.. language directories if (function_exists('qtrans_getLanguage')) { $language_to_use = qtrans_getLanguage(); $subfolder_to_use = $subfolder_to_use . '-' . $language_to_use; } $folder_to_use = comicpress_themeinfo('basedir') . $subfolder_to_use; // if (!file_exists($folder_to_use . '/' . $comicfile) && $folder !== 'comic') // $subfolder_to_use = comicpress_themeinfo('comic_folder'); if (!empty($comicfile)) { // return this as an array if we want to include in the future multiple comics found type thing, keeping it compatible. $newresults = array(); foreach ($comicfile as $comic) { if (!file_exists($folder_to_use . '/' . $comic) && $folder !== 'comic') { $subfolder_to_use = comicpress_themeinfo('comic_folder'); } $newresults[] = trailingslashit($subfolder_to_use) . $comic; } return $newresults; } else { // backwards compatibility if (isset($comic_filename_filters[$filter])) { $filter_to_use = $comic_filename_filters[$filter]; } else { $filter_to_use = '{date}*.*'; } $post_date = mysql2date(CP_DATE_FORMAT, $post_to_use->post_date); $filter_with_date = str_replace('{date}', $post_date, $filter_to_use); $results = array(); if (count($results = glob("{$folder_to_use}/{$filter_with_date}")) > 0) { $newresults = array(); if (is_array($results)) { foreach ($results as $result) { // Strip the base directory off. $newresults[] = str_replace(comicpress_themeinfo('basedir'), '', $result); } } else { $newresults[] = str_replace(comicpress_themeinfo('basedir'), '', $result); } return $newresults; } else { // fallback to the comics directory $folder_to_use = trailingslashit(comicpress_themeinfo('basedir')) . comicpress_themeinfo('comic_folder'); if (count($results = glob("{$folder_to_use}/{$filter_with_date}")) > 0) { $newresults = array(); foreach ($results as $result) { // Strip the base directory off. $newresults[] = str_replace(untrailingslashit(comicpress_themeinfo('basedir')), '', $result); } return $newresults; } } } $comic_pathfinding_errors[] = sprintf(__("Unable to find the file in the <strong>%s</strong> folder that matched the pattern <strong>%s</strong>. Check your WordPress and ComicPress settings.", 'comicpress'), $folder_to_use, $filter_with_date); return false; }
function delibera_des_filtro_qtranslate($where) { if (is_archive()) { global $q_config, $wpdb; if ($q_config['hide_untranslated'] && !is_singular()) { $where = str_replace(" AND {$wpdb->posts}.post_content LIKE '%<!--:" . qtrans_getLanguage() . "-->%'", '', $where); } } return $where; }
function alm_shortcode($atts, $content = null) { $options = get_option('alm_settings'); // Get Ajax Load More Settingss extract(shortcode_atts(array('previous_post' => false, 'previous_post_id' => 'null', 'cache' => 'false', 'cache_id' => '', 'paging' => 'false', 'paging_controls' => 'false', 'paging_show_at_most' => '7', 'paging_classes' => '', 'preloaded' => 'false', 'preloaded_amount' => '5', 'seo' => 'false', 'repeater' => 'default', 'theme_repeater' => 'null', 'post_type' => 'post', 'post_format' => '', 'category' => '', 'category__not_in' => '', 'tag' => '', 'tag__not_in' => '', 'taxonomy' => '', 'taxonomy_terms' => '', 'taxonomy_operator' => '', 'meta_key' => '', 'meta_value' => '', 'meta_compare' => '', 'meta_relation' => '', 'meta_type' => '', 'year' => '', 'month' => '', 'day' => '', 'author' => '', 'search' => '', 'custom_args' => '', 'post_status' => '', 'order' => 'DESC', 'orderby' => 'date', 'post__in' => '', 'exclude' => '', 'offset' => '0', 'posts_per_page' => '5', 'scroll' => 'true', 'scroll_distance' => '150', 'max_pages' => '5', 'pause_override' => 'false', 'pause' => 'false', 'destroy_after' => '', 'transition' => 'slide', 'images_loaded' => 'false', 'button_label' => __('Older Posts', 'ajax-load-more'), 'container_type' => '', 'css_classes' => ''), $atts)); // Enqueue core Ajax Load More JS wp_enqueue_script('ajax-load-more'); // Enqueue add-on JS if (has_action('alm_seo_installed') && $seo === 'true') { wp_enqueue_script('ajax-load-more-seo'); } if (has_action('alm_paging_installed') && $paging === 'true') { wp_enqueue_script('ajax-load-more-paging'); } if (has_action('alm_prev_post_installed') && $previous_post === 'true') { wp_enqueue_script('ajax-load-more-previous-post'); } if ($previous_post === 'true') { $previous_post === true; } // Get container elements (ul | div) $container_element = 'ul'; if ($options['_alm_container_type'] == '2' || $previous_post) { $container_element = 'div'; } // override shortcode param if ($container_type) { $container_element = $container_type; } // Previous post override if ($previous_post) { $posts_per_page = 1; $container_element = 'div'; } // Get extra classnames $classname = ''; if (isset($options['_alm_classname'])) { $classname = ' ' . $options['_alm_classname']; } // Get button color $btn_color = ''; if (isset($options['_alm_btn_color'])) { $btn_color = ' ' . $options['_alm_btn_color']; } // Get button color $paging_color = ''; if (isset($options['_alm_paging_color'])) { $paging_color = ' paging-' . $options['_alm_paging_color']; } // Get btn classnames $button_classname = ''; if (isset($options['_alm_btn_classname'])) { $button_classname = $options['_alm_btn_classname']; } // Language support $lang = defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : ''; // WPML - http://wpml.org if (function_exists('pll_current_language')) { // Polylang - https://wordpress.org/plugins/polylang/ $lang = pll_current_language(); } if (function_exists('qtrans_getLanguage')) { // qTranslate - https://wordpress.org/plugins/qtranslate/ $lang = qtrans_getLanguage(); } $wp_posts_per_page = get_option('posts_per_page'); // Posts per page - settings -> reading /* If $wp_posts_per_page > than shortcode value then $posts_per_page to $wp_posts_per_page */ if (has_action('alm_seo_installed') && $wp_posts_per_page > $posts_per_page && $seo === 'true') { $posts_per_page = $wp_posts_per_page; } $paging_container_class = ''; if ($paging === 'true') { $paging_container_class = ' alm-paging-wrap'; $preloaded = "false"; } // Start ALM object $ajaxloadmore = ''; // ALM Filter (alm_before_container) $ajaxloadmore .= apply_filters('alm_before_container', ''); $ajaxloadmore .= '<div id="ajax-load-more" class="ajax-load-more-wrap ' . $btn_color . '' . $paging_color . '" data-id="" data-canonical-url="' . get_permalink() . '">'; // Previous Post // - Set other add-on params to false if ($previous_post) { $preloaded = false; $seo = false; $paging = false; $cache = false; } // Preloaded Add-on // Get preloaded posts and append to ajax load more object if (has_action('alm_preload_installed') && $preloaded === 'true') { $preload_offset = $offset; // If SEO, set $preloaded_amount to $posts_per_page if (has_action('alm_seo_installed') && $seo === 'true') { $preloaded_amount = $posts_per_page; } // If Paging, set $preloaded_amount to $posts_per_page if ($paging === 'true') { $preloaded_amount = $posts_per_page; $paged = get_query_var('paged') ? get_query_var('paged') : 1; if ($paged > 1) { $preload_offset = $preloaded_amount * ($paged - 2); } } $preloaded_arr = array('post_type' => $post_type, 'post_format' => $post_format, 'category' => $category, 'category__not_in' => $category__not_in, 'tag' => $tag, 'tag__not_in' => $tag__not_in, 'taxonomy' => $taxonomy, 'taxonomy_terms' => $taxonomy_terms, 'taxonomy_operator' => $taxonomy_operator, 'meta_key' => $meta_key, 'meta_value' => $meta_value, 'meta_compare' => $meta_compare, 'meta_relation' => $meta_relation, 'meta_type' => $meta_type, 'year' => $year, 'month' => $month, 'day' => $day, 'author' => $author, 'post__in' => $post__in, 'search' => $search, 'custom_args' => $custom_args, 'post_status' => $post_status, 'order' => $order, 'orderby' => $orderby, 'exclude' => $exclude, 'offset' => $preload_offset, 'posts_per_page' => $preloaded_amount, 'lang' => $lang, 'css_classes' => $css_classes); $preloaded_type = preg_split('/(?=\\d)/', $repeater, 2); // split $repeater at number to retrieve type $preloaded_type = $preloaded_type[0]; // (default | repeater | template_) // Create $args array and store it in $preloaded_arg_array $args = apply_filters('alm_preload_args', $preloaded_arr); $alm_preload_query = new WP_Query($args); $alm_total_posts = $alm_preload_query->found_posts - $offset; $output = ''; if ($alm_preload_query->have_posts()) { $alm_loop_count = 0; // Count var $alm_page = 0; // Set page to 0 $alm_found_posts = $alm_total_posts; while ($alm_preload_query->have_posts()) { $alm_preload_query->the_post(); $alm_loop_count++; $alm_item = $alm_loop_count; // Get current item in loop if ($theme_repeater != 'null' && has_filter('alm_get_theme_repeater')) { $preloaded_type = null; } $output .= apply_filters('alm_preload_inc', $repeater, $preloaded_type, $theme_repeater, $alm_found_posts, $alm_page, $alm_item); } wp_reset_query(); if (has_action('alm_seo_installed')) { // If SEO, add noscript paging // Create noscript paging for SEO if preload and seo are enabled $noscript_paging = alm_paging_no_script($alm_preload_query); } } $preloaded_output = '<' . $container_element . ' class="alm-listing alm-preloaded' . $classname . ' ' . $css_classes . '" data-total-posts="' . $alm_total_posts . '">'; $preloaded_output .= $output; $preloaded_output .= '</' . $container_element . '>'; if (has_action('alm_seo_installed')) { // If SEO, add noscript paging $preloaded_output .= $noscript_paging; } $ajaxloadmore .= $preloaded_output; // Add $preloaded_output data to $ajaxloadmore } // End Preload Posts $ajaxloadmore .= '<' . $container_element . ' class="alm-listing alm-ajax' . $paging_container_class . ' ' . $classname . ' ' . $css_classes . '"'; // Build ALM container // Cache Add-on if (has_action('alm_cache_installed') && $cache === 'true') { $cache_return = apply_filters('alm_cache_shortcode', $cache, $cache_id, $options); $ajaxloadmore .= $cache_return; } // Paging Add-on if (has_action('alm_paging_installed') && $paging === 'true') { $paging_return = apply_filters('alm_paging_shortcode', $paging, $paging_controls, $paging_show_at_most, $paging_classes, $options); $ajaxloadmore .= $paging_return; } // Preloaded Add-on if (has_action('alm_preload_installed') && $preloaded === 'true') { $ajaxloadmore .= ' data-preloaded="' . $preloaded . '"'; $ajaxloadmore .= ' data-preloaded-amount="' . $preloaded_amount . '"'; } // SEO Add-on if (has_action('alm_seo_installed') && $seo === 'true') { $seo_return = apply_filters('alm_seo_shortcode', $seo, $preloaded, $options); $ajaxloadmore .= $seo_return; } // Previous Post Post Add-on if (has_action('alm_prev_post_installed') && $previous_post) { $prev_post_return = apply_filters('alm_prev_post_shortcode', $previous_post_id, $options); $ajaxloadmore .= $prev_post_return; } $ajaxloadmore .= ' data-repeater="' . $repeater . '"'; if ($theme_repeater != 'null') { $ajaxloadmore .= ' data-theme-repeater="' . $theme_repeater . '"'; } $ajaxloadmore .= ' data-post-type="' . $post_type . '"'; $ajaxloadmore .= ' data-post-format="' . $post_format . '"'; $ajaxloadmore .= ' data-category="' . $category . '"'; $ajaxloadmore .= ' data-category-not-in="' . $category__not_in . '"'; $ajaxloadmore .= ' data-tag="' . $tag . '"'; $ajaxloadmore .= ' data-tag-not-in="' . $tag__not_in . '"'; $ajaxloadmore .= ' data-taxonomy="' . $taxonomy . '"'; $ajaxloadmore .= ' data-taxonomy-terms="' . $taxonomy_terms . '"'; $ajaxloadmore .= ' data-taxonomy-operator="' . $taxonomy_operator . '"'; $ajaxloadmore .= ' data-meta-key="' . $meta_key . '"'; $ajaxloadmore .= ' data-meta-value="' . $meta_value . '"'; $ajaxloadmore .= ' data-meta-compare="' . $meta_compare . '"'; $ajaxloadmore .= ' data-meta-relation="' . $meta_relation . '"'; $ajaxloadmore .= ' data-meta-type="' . $meta_type . '"'; $ajaxloadmore .= ' data-year="' . $year . '"'; $ajaxloadmore .= ' data-month="' . $month . '"'; $ajaxloadmore .= ' data-day="' . $day . '"'; $ajaxloadmore .= ' data-author="' . $author . '"'; $ajaxloadmore .= ' data-post-in="' . $post__in . '"'; $ajaxloadmore .= ' data-exclude="' . $exclude . '"'; $ajaxloadmore .= ' data-search="' . $search . '"'; $ajaxloadmore .= ' data-custom-args="' . $custom_args . '"'; $ajaxloadmore .= ' data-post-status="' . $post_status . '"'; $ajaxloadmore .= ' data-order="' . $order . '"'; $ajaxloadmore .= ' data-orderby="' . $orderby . '"'; $ajaxloadmore .= ' data-offset="' . $offset . '"'; $ajaxloadmore .= ' data-posts-per-page="' . $posts_per_page . '"'; $ajaxloadmore .= ' data-lang="' . $lang . '"'; $ajaxloadmore .= ' data-scroll="' . $scroll . '"'; $ajaxloadmore .= ' data-scroll-distance="' . $scroll_distance . '"'; $ajaxloadmore .= ' data-max-pages="' . $max_pages . '"'; $ajaxloadmore .= ' data-pause-override="' . $pause_override . '"'; $ajaxloadmore .= ' data-pause="' . $pause . '"'; $ajaxloadmore .= ' data-button-label="' . $button_label . '"'; $ajaxloadmore .= ' data-button-class="' . $button_classname . '"'; $ajaxloadmore .= ' data-destroy-after="' . $destroy_after . '"'; $ajaxloadmore .= ' data-transition="' . $transition . '"'; $ajaxloadmore .= ' data-images-loaded="' . $images_loaded . '"'; $ajaxloadmore .= '>'; // Previous Post Add-on // - Get first post and append to ajax load more object if (has_action('alm_prev_post_installed') && $previous_post) { $repeater_type = preg_split('/(?=\\d)/', $repeater, 2); // split $repeater at number to retrieve type $repeater_type = $repeater_type[0]; // (default | repeater | template_) if ($theme_repeater != 'null' && has_filter('alm_get_theme_repeater')) { $repeater_type = null; } // Get next post include and build the output from the next post filter $previous_post_output = '<div class="alm-reveal alm-previous-post post-' . $previous_post_id . '" data-url="' . get_permalink($previous_post_id) . '" data-title="' . get_the_title($previous_post_id) . '" data-id="' . $previous_post_id . '">'; // Set teh post id .alm-reveal div $previous_post_output .= apply_filters('alm_prev_post_inc', $repeater, $repeater_type, $theme_repeater, $previous_post_id, $post_type); $previous_post_output .= '</div>'; $ajaxloadmore .= $previous_post_output; // Add $next_post_output data to $ajaxloadmore } // End Previous Post $ajaxloadmore .= '</' . $container_element . '>'; // ALM Filter (alm_before_button) $ajaxloadmore .= apply_filters('alm_before_button', ''); $ajaxloadmore .= '</div>'; // ALM Filter (alm_after_container) $ajaxloadmore .= apply_filters('alm_after_container', ''); // End ALM object return $ajaxloadmore; }
/** * @since 4.3 * * @param $link * * @return string */ public function vcRenderEditButtonLink($link) { return add_query_arg(array('qlang' => qtrans_getLanguage()), $link); }
/** * If a multilingual plugin like WPML or qTranslate X is active * we return the active language code. * * @since 2.0.0 * @return string Empty or the current language code */ public function check_multilingual_code() { $language_code = ''; if ($this->wpml_exists()) { $language_code = '_' . ICL_LANGUAGE_CODE; } else { if ($this->qtrans_exists()) { if (function_exists('qtranxf_getLanguage')) { $language_code = '_' . qtranxf_getLanguage(); } else { if (function_exists('qtrans_getLanguage')) { $language_code = '_' . qtrans_getLanguage(); } } } } return $language_code; }
<div class="Impressum"> <?php global $lang; global $txt_reg; global $txt_login; if ($lang == "de") { echo '<a href="/impressum">Impressum</a>'; } if ($lang == "de" && !is_user_logged_in()) { echo ' | '; } $val = ""; if (function_exists(qtrans_getLanguage)) { $val = "/" . qtrans_getLanguage(); } if ($val == "/us") { $val = ""; } if (!is_user_logged_in()) { echo '<a href="' . $val . '/login?action=register">' . $txt_reg . '</a> | <a href="' . $val . '/login">' . $txt_login . '</a> '; } ?> </div> </div> <?php //Debug code // Get current user object
function alm_shortcode($atts, $content = null) { $options = get_option('alm_settings'); //Get plugin options extract(shortcode_atts(array('cache' => 'false', 'cache_id' => '', 'paging' => 'false', 'paging_controls' => 'false', 'paging_show_at_most' => '7', 'paging_classes' => '', 'preloaded' => 'false', 'preloaded_amount' => '5', 'seo' => 'false', 'repeater' => 'default', 'theme_repeater' => 'null', 'post_type' => 'post', 'post_format' => '', 'category' => '', 'category__not_in' => '', 'tag' => '', 'tag__not_in' => '', 'taxonomy' => '', 'taxonomy_terms' => '', 'taxonomy_operator' => '', 'meta_key' => '', 'meta_value' => '', 'meta_compare' => '', 'meta_relation' => '', 'year' => '', 'month' => '', 'day' => '', 'author' => '', 'search' => '', 'custom_args' => '', 'post_status' => '', 'order' => 'DESC', 'orderby' => 'date', 'post__in' => '', 'exclude' => '', 'offset' => '0', 'posts_per_page' => '5', 'scroll' => 'true', 'scroll_distance' => '150', 'max_pages' => '5', 'pause' => 'false', 'destroy_after' => '', 'transition' => 'slide', 'images_loaded' => 'false', 'button_label' => __('Older Posts', ALM_NAME), 'css_classes' => ''), $atts)); // Get container elements (ul | div) $container_element = 'ul'; if ($options['_alm_container_type'] == '2') { $container_element = 'div'; } // Get extra classnames $classname = ''; if (isset($options['_alm_classname'])) { $classname = ' ' . $options['_alm_classname']; } // Get button color $btn_color = ''; if (isset($options['_alm_btn_color'])) { $btn_color = ' ' . $options['_alm_btn_color']; } // Get button color $paging_color = ''; if (isset($options['_alm_paging_color'])) { $paging_color = ' paging-' . $options['_alm_paging_color']; } // Get btn classnames $button_classname = ''; if (isset($options['_alm_btn_classname'])) { $button_classname = $options['_alm_btn_classname']; } // Language support $lang = defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : ''; // WPML - http://wpml.org if (function_exists('pll_current_language')) { // Polylang - https://wordpress.org/plugins/polylang/ $lang = pll_current_language(); } if (function_exists('qtrans_getLanguage')) { // qTranslate - https://wordpress.org/plugins/qtranslate/ $lang = qtrans_getLanguage(); } $wp_posts_per_page = get_option('posts_per_page'); // Posts per page - settings -> reading /* If $wp_posts_per_page > than shortcode value then $posts_per_page to $wp_posts_per_page */ if (has_action('alm_seo_installed') && $wp_posts_per_page > $posts_per_page && $seo === 'true') { $posts_per_page = $wp_posts_per_page; } $paging_container_class = ''; if ($paging === 'true') { $paging_container_class = ' alm-paging-wrap'; $preloaded = 'false'; // temporarily set preloaded to false if paging is true } // Start ALM object $ajaxloadmore = '<div id="ajax-load-more" class="ajax-load-more-wrap ' . $btn_color . '' . $paging_color . '">'; // Preload Posts if (has_action('alm_preload_installed') && $preloaded === 'true') { // If SEO then set $preloaded_amount to $posts_per_page if (has_action('alm_seo_installed') && $seo === 'true') { $preloaded_amount = $posts_per_page; } $preloaded_arr = array('post_type' => $post_type, 'post_format' => $post_format, 'category' => $category, 'category__not_in' => $category__not_in, 'tag' => $tag, 'tag__not_in' => $tag__not_in, 'taxonomy' => $taxonomy, 'taxonomy_terms' => $taxonomy_terms, 'taxonomy_operator' => $taxonomy_operator, 'meta_key' => $meta_key, 'meta_value' => $meta_value, 'meta_compare' => $meta_compare, 'meta_relation' => $meta_relation, 'year' => $year, 'month' => $month, 'day' => $day, 'author' => $author, 'post__in' => $post__in, 'search' => $search, 'custom_args' => $custom_args, 'post_status' => $post_status, 'order' => $order, 'orderby' => $orderby, 'exclude' => $exclude, 'offset' => $offset, 'posts_per_page' => $preloaded_amount, 'lang' => $lang, 'css_classes' => $css_classes); $preloaded_type = preg_split('/(?=\\d)/', $repeater, 2); // split $repeater at number to retrieve type $preloaded_type = $preloaded_type[0]; // (default | repeater | template_) // Create $args array and store it in $preloaded_arg_array $args = apply_filters('alm_preload_args', $preloaded_arr); $alm_preload_query = new WP_Query($args); $alm_total_posts = $alm_preload_query->found_posts - $offset; $output = ''; if ($alm_preload_query->have_posts()) { $alm_loop_count = 0; // Count var $alm_page = 0; // Set page to 0 $alm_found_posts = $alm_total_posts; while ($alm_preload_query->have_posts()) { $alm_preload_query->the_post(); $alm_loop_count++; $alm_item = $alm_loop_count; // Get current item in loop if ($theme_repeater != 'null' && has_filter('alm_get_theme_repeater')) { $preloaded_type = null; $output .= apply_filters('alm_preload_inc', $repeater, $preloaded_type, $theme_repeater, $alm_found_posts, $alm_page, $alm_item); } else { $output .= apply_filters('alm_preload_inc', $repeater, $preloaded_type, $theme_repeater, $alm_found_posts, $alm_page, $alm_item); } } wp_reset_query(); } $preloaded_output = '<' . $container_element . ' class="alm-listing alm-preloaded' . $classname . ' ' . $css_classes . '" data-total-posts="' . $alm_total_posts . '">'; $preloaded_output .= $output; $preloaded_output .= '</' . $container_element . '>'; $ajaxloadmore .= $preloaded_output; // Add $preloadeded data to $ajaxloadmore } // End Preload Posts $ajaxloadmore .= '<' . $container_element . ' class="alm-listing alm-ajax' . $paging_container_class . ' ' . $classname . ' ' . $css_classes . '"'; // Build ALM container //Cache Add-on if (has_action('alm_cache_installed') && $cache === 'true') { $cache_return = apply_filters('alm_cache_shortcode', $cache, $cache_id, $options); $ajaxloadmore .= $cache_return; } // Paging Add-on if (has_action('alm_paging_installed') && $paging === 'true') { $paging_return = apply_filters('alm_paging_shortcode', $paging, $paging_controls, $paging_show_at_most, $paging_classes, $options); $ajaxloadmore .= $paging_return; } // Preloaded Add-on if (has_action('alm_preload_installed') && $preloaded === 'true') { $ajaxloadmore .= ' data-preloaded="' . $preloaded . '"'; $ajaxloadmore .= ' data-preloaded-amount="' . $preloaded_amount . '"'; } // SEO Add-on if (has_action('alm_seo_installed') && $seo === 'true') { $seo_return = apply_filters('alm_seo_shortcode', $seo, $preloaded, $options); $ajaxloadmore .= $seo_return; } $ajaxloadmore .= ' data-repeater="' . $repeater . '"'; if ($theme_repeater != 'null') { $ajaxloadmore .= ' data-theme-repeater="' . $theme_repeater . '"'; } $ajaxloadmore .= ' data-post-type="' . $post_type . '"'; $ajaxloadmore .= ' data-post-format="' . $post_format . '"'; $ajaxloadmore .= ' data-category="' . $category . '"'; $ajaxloadmore .= ' data-category-not-in="' . $category__not_in . '"'; $ajaxloadmore .= ' data-tag="' . $tag . '"'; $ajaxloadmore .= ' data-tag-not-in="' . $tag__not_in . '"'; $ajaxloadmore .= ' data-taxonomy="' . $taxonomy . '"'; $ajaxloadmore .= ' data-taxonomy-terms="' . $taxonomy_terms . '"'; $ajaxloadmore .= ' data-taxonomy-operator="' . $taxonomy_operator . '"'; $ajaxloadmore .= ' data-meta-key="' . $meta_key . '"'; $ajaxloadmore .= ' data-meta-value="' . $meta_value . '"'; $ajaxloadmore .= ' data-meta-compare="' . $meta_compare . '"'; $ajaxloadmore .= ' data-meta-relation="' . $meta_relation . '"'; $ajaxloadmore .= ' data-year="' . $year . '"'; $ajaxloadmore .= ' data-month="' . $month . '"'; $ajaxloadmore .= ' data-day="' . $day . '"'; $ajaxloadmore .= ' data-author="' . $author . '"'; $ajaxloadmore .= ' data-post-in="' . $post__in . '"'; $ajaxloadmore .= ' data-exclude="' . $exclude . '"'; $ajaxloadmore .= ' data-search="' . $search . '"'; $ajaxloadmore .= ' data-custom-args="' . $custom_args . '"'; $ajaxloadmore .= ' data-post-status="' . $post_status . '"'; $ajaxloadmore .= ' data-order="' . $order . '"'; $ajaxloadmore .= ' data-orderby="' . $orderby . '"'; $ajaxloadmore .= ' data-offset="' . $offset . '"'; $ajaxloadmore .= ' data-posts-per-page="' . $posts_per_page . '"'; $ajaxloadmore .= ' data-lang="' . $lang . '"'; $ajaxloadmore .= ' data-scroll="' . $scroll . '"'; $ajaxloadmore .= ' data-scroll-distance="' . $scroll_distance . '"'; $ajaxloadmore .= ' data-max-pages="' . $max_pages . '"'; $ajaxloadmore .= ' data-pause="' . $pause . '"'; $ajaxloadmore .= ' data-button-label="' . $button_label . '"'; $ajaxloadmore .= ' data-button-class="' . $button_classname . '"'; $ajaxloadmore .= ' data-destroy-after="' . $destroy_after . '"'; $ajaxloadmore .= ' data-transition="' . $transition . '"'; $ajaxloadmore .= ' data-images-loaded="' . $images_loaded . '"'; $ajaxloadmore .= '></' . $container_element . '>'; $ajaxloadmore .= '</div>'; // End Build ALM container return $ajaxloadmore; }
<div class="grid col-940 fit"> <?php responsive_widgets(); // above widgets hook ?> <div class="widget-wrapper force-transparent force-no-margin more-news-padding"> <div class="textwidget"> <span class="link-more-news"><a href="/<?php echo qtrans_getLanguage(); ?> /more-news/"><?php echo dg_function_get_morenews(); ?> </a></span> </div> </div><!-- end of .widget-wrapper --> <?php responsive_widgets_end();
/** * Returns the current QTranslate language * * @return string|bool * @since 2.2 */ public function getLanguage() { return function_exists('qtrans_getLanguage') ? qtrans_getLanguage() : false; }
function get_translation($slug) { global $translations; return $translations[$slug][qtrans_getLanguage()]; }
if (have_posts()) { while (have_posts()) { the_post(); ?> <div class="container no-float"> <!--header--> <header id="header" class="header clearfix shadow"> <div class="cont-auxi"> <div class="left-auxi"> <a href="javascript:history.back(1);">Volver</a> </div> <div class="right-auxi"> <?php if (qtrans_getLanguage() == 'es') { echo '<a href="' . get_bloginfo('wpurl') . '/inicio/">Inicio</a>'; } elseif (qtrans_getLanguage() == 'en') { echo '<a href="' . get_bloginfo('wpurl') . '/en/inicio/">Inicio</a>'; } ?> </div> </div> <div class="top" id="<?php echo $post->post_name; ?> "> <?php if (get_field('_subir_imagen')) { ?> <img src="<?php the_field('_subir_imagen'); ?>
/** * ajax handle for quering posts */ public function _hw_query_posts() { if (!wp_verify_nonce($_REQUEST['nonce'], "hw_query_posts_nonce")) { exit("hacked!"); } //valid if (!isset($_REQUEST['widget_id_base']) || !isset($_REQUEST['widget_id'])) { return; } //get params $id_base = isset($_REQUEST['widget_id_base']) ? $_REQUEST['widget_id_base'] : ''; $id = isset($_REQUEST['widget_id']) ? $_REQUEST['widget_id'] : ''; //data $args = array('showposts' => '-1'); if (!empty($_REQUEST['widget-' . $id_base][$id])) { $data = $_REQUEST['widget-' . $id_base][$id]; //query posts data if (isset($data['posttype'])) { $args['posttype'] = join(',', $data['posttype']); } //post types if (isset($data['tax'])) { $args['taxonomy'] = $data['tax']; } //filter by taxonomy if (isset($data['cat_']) && isset($args['taxonomy'])) { //filter by taxonomy $args['tax_query'] = array('relation' => 'AND', array('taxonomy' => $args['taxonomy'], 'field' => 'slug', 'terms' => array($data['cat_']), 'operator' => 'IN')); } //filter by author if (isset($data['author'])) { if (is_numeric($data['author']) && $data['author'] != '-1') { $args['author'] = $data['author']; } elseif ($data['author'] == 'logined_user' && is_user_logged_in()) { $args['author'] = get_current_user_id(); } } } if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $result = array(); $data = array(); //query posts $query = new WP_Query($args); while ($query->have_posts()) { $query->the_post(); //get post title if the plugin qtranslate is installed if (function_exists('qtrans_use')) { if (!isset($currentLang)) { $currentLang = qtrans_getLanguage(); } $title = qtrans_use($currentLang, get_the_title(), false); } else { $title = get_the_title(); } $data[get_the_ID()] = $title; } wp_reset_query(); $result['posts'] = $data; $result['args'] = $args; echo json_encode($result); } else { header("Location: " . $_SERVER["HTTP_REFERER"]); } die; }
/** * Get language using settings/WPML/qTrans * */ static function get_language() { // For WPML (wpml.org): set the selected language if it wasn't specified in the options screen if (defined('ICL_LANGUAGE_CODE')) { return ICL_LANGUAGE_CODE; } // For qTranslate, pick up current language from that if (function_exists('qtrans_getLanguage')) { return qtrans_getLanguage(); } return self::$options->language; }