diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/404.php b/404.php new file mode 100644 index 0000000..61f08f1 --- /dev/null +++ b/404.php @@ -0,0 +1,17 @@ + + +
+
+
+

+
+ +
+ +

+ +
+
+
+ + \ No newline at end of file diff --git a/README.md b/README.md index de5a46d..a8a1bb3 100644 --- a/README.md +++ b/README.md @@ -1 +1,16 @@ -# Pinkoob \ No newline at end of file +# Pinkoob +Pinkoob is a RTL/LTR WordPress theme inspired by Pinterest.com and Unsplash.com. +![Pinkoob 1.5](https://www.skilledup.ir/wp-content/uploads/2018/04/pinkoob.jpg?raw=true) + +# Requirements +- PHP 5.6+ (7.2 is recommended) +- PHP Extension: Curl +- PHP Extension: Dom +- PHP Extension: Mbstring +- PHP Extension: GD/Imagemagick + +# Demo +visti Pinkoob.com + +# Persian Support +visit Skilledup.ir diff --git a/author.php b/author.php new file mode 100644 index 0000000..939dd49 --- /dev/null +++ b/author.php @@ -0,0 +1,449 @@ + +query_vars['author']); + +$blog_cat_id = of_get_option('blog_cat_id'); +if ($blog_cat_id) { + $blog_post_count = $wpdb->get_var( + $wpdb->prepare( + "SELECT COUNT(*) FROM $wpdb->posts + LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id) + LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) + WHERE $wpdb->term_taxonomy.term_id = %d + AND $wpdb->term_taxonomy.taxonomy = 'category' + AND $wpdb->posts.post_status = 'publish' + AND post_author = %d + " + , $blog_cat_id, $user_info->ID + ) + ); +} + +$pins_count = count_user_posts($user_info->ID) - $blog_post_count; +$parent_board_id = get_user_meta($user_info->ID, '_Board Parent ID', true); +$parent_board = get_term_by('id', $parent_board_id, 'board', ARRAY_A); +if ($parent_board_id == '') { + $boards_count = 0; +} else { + $boards = get_terms('board', array('parent' => $parent_board_id, 'hide_empty' => false, 'orderby' => 'id', 'order' => 'DESC')); + $boards_count = count($boards); +} + +$likes_count = get_user_meta($user_info->ID, '_Likes Count', true); +$likes_count = $likes_count ? $likes_count : 0; +$followers_count = get_user_meta($user_info->ID, '_Followers Count', true); +$followers_count = $followers_count ? $followers_count : 0; +$following_count = get_user_meta($user_info->ID, '_Following Count', true); +$following_count = $following_count ? $following_count : 0; + +$profile_cover_id = get_user_meta($user_info->ID, 'pinc_user_cover', true); +if ($profile_cover_id != '') { + $profile_cover = wp_get_attachment_image_src($profile_cover_id, 'full'); + $profile_cover_bg = ' style="background-image: url(\'' . $profile_cover[0] . '\');"'; +} +?> +
+
> +
+
+
+

display_name; ?>

+ +
+
+ ID, '96'); ?> +
+ + ID)) { ?> + # + + + ID)) { ?> + " href=""> # + +
+ +

description; ?>

+
+ + +
+
+
+ +
+ +
+ +

+ +ID || current_user_can('administrator') || current_user_can('editor')) { + $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; + $args = array( + 'author' => $user_info->ID, + 'paged' => $paged + ); + query_posts($args); + } + get_template_part('index', 'masonry'); + + +} else if (isset($_GET['view']) && $_GET['view'] == 'likes') { + $post_likes = get_user_meta($user_info->ID, '_Likes Post ID'); + + if (!empty($post_likes[0])) { + $pnum = isset($_GET['pnum']) ? intval($_GET['pnum']) : 1; + $posts_per_page = get_option('posts_per_page'); + $maxpage = ceil(count($post_likes[0])/$posts_per_page); + $post_likes[0] = array_slice($post_likes[0], ($posts_per_page * ($pnum-1)), $posts_per_page); + if ($post_likes[0]) { + $args = array( + 'post__in' => $post_likes[0], + 'orderby' => 'post__in' + ); + } else { + $args = array( + 'post__in' => array(0) + ); + } + + query_posts($args); + get_template_part('index', 'masonry'); + } else { + ?> +
+
+

+
+
+
+ ID, '_Followers User ID'); + } else if ($_GET['view'] == 'following') { + $followers = get_user_meta($user_info->ID, '_Following User ID'); + } + + if (!empty($followers[0])) { + $pnum = isset($_GET['pnum']) ? intval($_GET['pnum']) : 1; + $followers_per_page = get_option('posts_per_page'); + $maxpage = ceil(count($followers[0])/$followers_per_page); + $followers[0] = array_slice($followers[0], ($followers_per_page * ($pnum-1)), $followers_per_page); + echo '
'; + foreach ($followers[0] as $follower) { + $follower_info = get_user_by('id', $follower); + if ($follower_info) { + ?> +
+ + + + + + + + + + + +
+ + +
'; + } else { + ?> +
+
+ +

+ +

+ +
+
+ + 0) { + ?> +
+ $parent_board_id, 'hide_empty' => false, 'orderby' => 'id', 'order' => 'DESC', 'number' => $boards_per_page, 'offset' => ($pnum - 1) * $boards_per_page)); + + foreach ($boards_paginated as $board) { + $board_id = $board->term_id; + $board_parent_id = $board->parent; + $board_name = $board->name; + $board_count = $board->count; + $board_slug = $board->slug; + + $board_thumbnail_ids = $wpdb->get_col($wpdb->prepare( + " + SELECT v.meta_value + FROM $wpdb->postmeta AS v + INNER JOIN ( + SELECT object_id + FROM $wpdb->term_taxonomy, $wpdb->term_relationships, $wpdb->posts + WHERE $wpdb->term_taxonomy.term_id = %d + AND $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id + AND $wpdb->term_taxonomy.taxonomy = 'board' + AND $wpdb->term_relationships.object_id = $wpdb->posts.ID + AND $wpdb->posts.post_status = 'publish' + ORDER BY $wpdb->term_relationships.object_id DESC + LIMIT 0, 5 + ) AS v2 ON v.post_id = v2.object_id + AND v.meta_key = '_thumbnail_id' + ", + $board_id + )); + ?> +
+ rewrite['slug'] . '/' . sanitize_title($board_name, '_') . '/' . $board_id . '/'); ?>"> +

+
+ + rewrite['slug'] . '/' . sanitize_title($board_name, '_') . '/' . $board_id . '/'); ?>"> +
+ +
+ + +
+ +
+ 0 +
+ +
+ +
+ +
+
+ +
+
+ + ID != $user_ID) { ?> + + + + + + +
+ + + + + +
+
+ + + +
+
+

+
+
+ + \ No newline at end of file diff --git a/bootstrap/bootstrap-tagsinput-angular.js b/bootstrap/bootstrap-tagsinput-angular.js new file mode 100644 index 0000000..adcaccb --- /dev/null +++ b/bootstrap/bootstrap-tagsinput-angular.js @@ -0,0 +1,87 @@ +angular.module('bootstrap-tagsinput', []) +.directive('bootstrapTagsinput', [function() { + + function getItemProperty(scope, property) { + if (!property) + return undefined; + + if (angular.isFunction(scope.$parent[property])) + return scope.$parent[property]; + + return function(item) { + return item[property]; + }; + } + + return { + restrict: 'EA', + scope: { + model: '=ngModel' + }, + template: '', + replace: false, + link: function(scope, element, attrs) { + $(function() { + if (!angular.isArray(scope.model)) + scope.model = []; + + var select = $('select', element); + var typeaheadSourceArray = attrs.typeaheadSource ? attrs.typeaheadSource.split('.') : null; + var typeaheadSource = typeaheadSourceArray ? + (typeaheadSourceArray.length > 1 ? + scope.$parent[typeaheadSourceArray[0]][typeaheadSourceArray[1]] + : scope.$parent[typeaheadSourceArray[0]]) + : null; + + select.tagsinput(scope.$parent[attrs.options || ''] || { + typeahead : { + source : angular.isFunction(typeaheadSource) ? typeaheadSource : null + }, + itemValue: getItemProperty(scope, attrs.itemvalue), + itemText : getItemProperty(scope, attrs.itemtext), + confirmKeys : getItemProperty(scope, attrs.confirmkeys) ? JSON.parse(attrs.confirmkeys) : [13], + tagClass : angular.isFunction(scope.$parent[attrs.tagclass]) ? scope.$parent[attrs.tagclass] : function(item) { return attrs.tagclass; } + }); + + for (var i = 0; i < scope.model.length; i++) { + select.tagsinput('add', scope.model[i]); + } + + select.on('itemAdded', function(event) { + if (scope.model.indexOf(event.item) === -1) + scope.model.push(event.item); + }); + + select.on('itemRemoved', function(event) { + var idx = scope.model.indexOf(event.item); + if (idx !== -1) + scope.model.splice(idx, 1); + }); + + // create a shallow copy of model's current state, needed to determine + // diff when model changes + var prev = scope.model.slice(); + scope.$watch("model", function() { + var added = scope.model.filter(function(i) {return prev.indexOf(i) === -1;}), + removed = prev.filter(function(i) {return scope.model.indexOf(i) === -1;}), + i; + + prev = scope.model.slice(); + + // Remove tags no longer in binded model + for (i = 0; i < removed.length; i++) { + select.tagsinput('remove', removed[i]); + } + + // Refresh remaining tags + select.tagsinput('refresh'); + + // Add new items in model as tags + for (i = 0; i < added.length; i++) { + select.tagsinput('add', added[i]); + } + }, true); + }); + } + }; +}]); diff --git a/bootstrap/bootstrap-tagsinput-angular.min.js b/bootstrap/bootstrap-tagsinput-angular.min.js new file mode 100644 index 0000000..b1372b1 --- /dev/null +++ b/bootstrap/bootstrap-tagsinput-angular.min.js @@ -0,0 +1,7 @@ +/* + * bootstrap-tagsinput v0.6.1 by Tim Schlechter + * + */ + +angular.module("bootstrap-tagsinput",[]).directive("bootstrapTagsinput",[function(){function a(a,b){return b?angular.isFunction(a.$parent[b])?a.$parent[b]:function(a){return a[b]}:void 0}return{restrict:"EA",scope:{model:"=ngModel"},template:"",replace:!1,link:function(b,c,d){$(function(){angular.isArray(b.model)||(b.model=[]);var e=$("select",c),f=d.typeaheadSource?d.typeaheadSource.split("."):null,g=f?f.length>1?b.$parent[f[0]][f[1]]:b.$parent[f[0]]:null;e.tagsinput(b.$parent[d.options||""]||{typeahead:{source:angular.isFunction(g)?g:null},itemValue:a(b,d.itemvalue),itemText:a(b,d.itemtext),confirmKeys:a(b,d.confirmkeys)?JSON.parse(d.confirmkeys):[13],tagClass:angular.isFunction(b.$parent[d.tagclass])?b.$parent[d.tagclass]:function(a){return d.tagclass}});for(var h=0;h'); + this.$input = $('').appendTo(this.$container); + + this.$element.before(this.$container); + + this.build(options); + } + + TagsInput.prototype = { + constructor: TagsInput, + + /** + * Adds the given item as a new tag. Pass true to dontPushVal to prevent + * updating the elements val() + */ + add: function(item, dontPushVal, options) { + var self = this; + + if (self.options.maxTags && self.itemsArray.length >= self.options.maxTags) + return; + + // Ignore falsey values, except false + if (item !== false && !item) + return; + + // Trim value + if (typeof item === "string" && self.options.trimValue) { + item = $.trim(item); + } + + // Throw an error when trying to add an object while the itemValue option was not set + if (typeof item === "object" && !self.objectItems) + throw("Can't add objects when itemValue option is not set"); + + // Ignore strings only containg whitespace + if (item.toString().match(/^\s*$/)) + return; + + // If SELECT but not multiple, remove current tag + if (self.isSelect && !self.multiple && self.itemsArray.length > 0) + self.remove(self.itemsArray[0]); + + if (typeof item === "string" && this.$element[0].tagName === 'INPUT') { + var delimiter = (self.options.delimiterRegex) ? self.options.delimiterRegex : self.options.delimiter; + var items = item.split(delimiter); + if (items.length > 1) { + for (var i = 0; i < items.length; i++) { + this.add(items[i], true); + } + + if (!dontPushVal) + self.pushVal(); + return; + } + } + + var itemValue = self.options.itemValue(item), + itemText = self.options.itemText(item), + tagClass = self.options.tagClass(item), + itemTitle = self.options.itemTitle(item); + + // Ignore items allready added + var existing = $.grep(self.itemsArray, function(item) { return self.options.itemValue(item) === itemValue; } )[0]; + if (existing && !self.options.allowDuplicates) { + // Invoke onTagExists + if (self.options.onTagExists) { + var $existingTag = $(".tag", self.$container).filter(function() { return $(this).data("item") === existing; }); + self.options.onTagExists(item, $existingTag); + } + return; + } + + // if length greater than limit + if (self.items().toString().length + item.length + 1 > self.options.maxInputLength) + return; + + // raise beforeItemAdd arg + var beforeItemAddEvent = $.Event('beforeItemAdd', { item: item, cancel: false, options: options}); + self.$element.trigger(beforeItemAddEvent); + if (beforeItemAddEvent.cancel) + return; + + // register item in internal array and map + self.itemsArray.push(item); + + // add a tag element + + var $tag = $('' + htmlEncode(itemText) + ''); + $tag.data('item', item); + self.findInputWrapper().before($tag); + $tag.after(' '); + + // add