示例#1
0
 static function loadTextDomain()
 {
     $locale = Apply_Filters('plugin_locale', Get_Locale(), self::$textdomain);
     $language_folder = Core::$plugin_folder . '/languages';
     Load_TextDomain(self::$textdomain, "{$language_folder}/{$locale}.mo");
     Load_Plugin_TextDomain(self::$textdomain);
     self::$loaded = True;
 }
示例#2
0
 static function getGlossaryTypes()
 {
     # Type definition
     $arr_types = array('lexicon' => (object) array('label' => I18n::t('Словник'), 'slug' => I18n::t('lexicon', 'URL slug')));
     # Run filter
     $arr_types = Apply_Filters('glossary_types', $arr_types);
     return $arr_types;
 }
示例#3
0
 static function getFilters($prefix = '', $taxonomy_term = Null)
 {
     global $wpdb;
     $prefix_length = MB_StrLen($prefix) + 1;
     $tables = array($wpdb->posts . ' AS posts');
     $where = array('posts.post_status  =     "publish"', 'posts.post_type    =     "' . Post_Type::$post_type_name . '"', 'posts.post_title   !=    ""', 'posts.post_title   LIKE  "' . $prefix . '%"');
     if ($taxonomy_term) {
         $tables[] = $wpdb->term_relationships . ' AS term_relationships';
         $where[] = 'term_relationships.object_id = posts.id';
         $where[] = 'term_relationships.term_taxonomy_id = ' . $taxonomy_term->term_taxonomy_id;
     }
     $stmt = 'SELECT   LOWER(SUBSTRING(posts.post_title,1,' . $prefix_length . ')) subword
          FROM     ' . Join($tables, ',') . '
          WHERE    ' . Join($where, ' AND ') . '
          GROUP BY subword
          ORDER BY subword ASC';
     $arr_filter = $wpdb->Get_Col($stmt);
     $arr_filter = Apply_Filters('glossary_available_prefix_filters', $arr_filter, $prefix, $taxonomy_term);
     return $arr_filter;
 }
 function Widget($args, $settings)
 {
     // Load options
     $this->load_options($settings);
     unset($settings);
     // Check if the Taxonomy is alive
     if (!Taxonomy_Exists($this->Get_Option('taxonomy'))) {
         return False;
     }
     // Display Widget
     echo $args['before_widget'];
     echo $args['before_title'] . Apply_Filters('widget_title', $this->get_option('title'), $settings, $this->id_base) . $args['after_title'];
     echo '<ul>';
     WP_List_Categories(array('taxonomy' => $this->Get_Option('taxonomy'), 'show_count' => $this->Get_Option('count'), 'number' => $this->Get_Option('number'), 'order' => $this->Get_Option('order'), 'orderby' => $this->Get_Option('orderby'), 'exclude' => $this->Get_Option('exclude'), 'title_li' => ''));
     echo '</ul>';
     echo $args['after_widget'];
 }
示例#5
0
 function Load_TextDomain()
 {
     $locale = Apply_Filters('plugin_locale', get_locale(), __CLASS__);
     Load_TextDomain(__CLASS__, DirName(__FILE__) . '/contribution_' . $locale . '.mo');
 }
示例#6
0
 static function loadTextDomain()
 {
     $locale = Apply_Filters('plugin_locale', Get_Locale(), self::$textdomain);
     Load_TextDomain(self::$textdomain, Core::$plugin_folder . '/language/' . $locale . '.mo');
     self::$textdomain_loaded = True;
 }
 function Widget($args, $settings)
 {
     // Load options
     $this->load_options($settings);
     unset($settings);
     // Get random images
     $arr_images = $this->Get_Fancy_Images('ID', 'RAND', $this->get_option('limit'));
     if (empty($arr_images)) {
         return False;
     } else {
         foreach ($arr_images as &$image) {
             $include .= $image->ID . ',';
             $this->Get_Option('link_target') == 'gallery' ? $image->href = Get_Permalink($image->gallery_id) : '';
         }
     }
     // Generate Attributes
     $attributes = $this->fancy_gallery->Generate_Gallery_Attributes(array('include' => $include, 'thumb_width' => $this->Get_Option('thumb_width'), 'thumb_height' => $this->Get_Option('thumb_height'), 'thumb_grayscale' => $this->Get_Option('thumb_grayscale'), 'thumb_negate' => $this->Get_Option('thumb_negate')));
     // Build Gallery
     $this->fancy_gallery->Build_Gallery($arr_images, $attributes);
     // Display Widget
     echo $args['before_widget'];
     echo $args['before_title'] . Apply_Filters('widget_title', $this->get_option('title'), $settings, $this->id_base) . $args['after_title'];
     echo $this->fancy_gallery->Render_Gallery($this->get_option('template'));
     echo $args['after_widget'];
 }
 function Widget($args, $settings)
 {
     # Load options
     $this->load_options($settings);
     unset($settings);
     # Check if the Taxonomy is alive
     if (!Taxonomy_Exists($this->Get_Option('taxonomy'))) {
         return False;
     }
     # Display Widget
     echo $args['before_widget'];
     echo $args['before_title'] . Apply_Filters('widget_title', $this->get_option('title'), $this->arr_option, $this->id_base) . $args['after_title'];
     echo '<ul>';
     WP_Tag_Cloud(array('taxonomy' => $this->Get_Option('taxonomy'), 'number' => $this->Get_Option('number'), 'order' => $this->Get_Option('order'), 'orderby' => $this->Get_Option('orderby'), 'exclude' => $this->Get_Option('exclude')));
     echo '</ul>';
     echo $args['after_widget'];
 }
示例#9
0
 static function getTagRelatedTerms($arguments = Null)
 {
     global $wpdb, $post;
     $arguments = Is_Array($arguments) ? $arguments : array();
     # Load default arguments
     $arguments = (object) Array_Merge(array('term_id' => $post->ID, 'number' => 10, 'taxonomy' => 'glossary-tag'), $arguments);
     # apply filter
     $arguments = Apply_Filters('glossary_tag_related_terms_arguments', $arguments);
     # Get the Tags
     $arr_tags = WP_Get_Post_Terms($arguments->term_id, $arguments->taxonomy);
     if (empty($arr_tags)) {
         return False;
     }
     # Get term IDs
     $arr_term_ids = array();
     foreach ($arr_tags as $taxonomy) {
         $arr_term_ids[] = $taxonomy->term_taxonomy_id;
     }
     $str_tag_list = Implode(',', $arr_term_ids);
     # The Query to get the related posts
     $stmt = " SELECT posts.*,\n                     COUNT(term_relationships.object_id) AS common_tag_count\n              FROM   {$wpdb->term_relationships} AS term_relationships,\n                     {$wpdb->posts} AS posts\n              WHERE  term_relationships.object_id = posts.id\n              AND    term_relationships.term_taxonomy_id IN({$str_tag_list})\n              AND    posts.id != {$arguments->term_id}\n              AND    posts.post_status = 'publish'\n              GROUP  BY term_relationships.object_id\n              ORDER  BY common_tag_count DESC,\n                     posts.post_date_gmt DESC\n              LIMIT  0, {$arguments->number}";
     # Put it in a WP_Query
     $query = new WP_Query();
     $query->posts = $wpdb->Get_Results($stmt);
     $query->post_count = Count($query->posts);
     $query->Rewind_Posts();
     # return
     if ($query->post_count == 0) {
         return False;
     } else {
         return $query;
     }
 }
示例#10
0
 public function Render_Gallery($template_file)
 {
     # Uses template filter
     $template_file = Apply_Filters('fancy_gallery_template', $template_file);
     # If there is no valid template file we bail out
     if (!Is_File($template_file)) {
         $template_file = $this->Get_Default_Template();
     }
     # Load template
     Ob_Start();
     include $template_file;
     $code = Ob_Get_Clean();
     # Strip Whitespaces
     $code = PReg_Replace('/\\s+/', ' ', $code);
     $code = Str_Replace('> <', '><', $code);
     $code = Trim($code);
     # Return
     return $code;
 }
示例#11
0
 public function Load_TextDomain()
 {
     $locale = Apply_Filters('plugin_locale', Get_Locale(), __CLASS__);
     Load_TextDomain(__CLASS__, DirName(__FILE__) . '/language/' . $locale . '.mo');
 }