Changeset 2044909
- Timestamp:
- 03/06/2019 12:37:08 AM (7 years ago)
- Location:
- xo-for-angular
- Files:
-
- 7 edited
- 13 copied
-
tags/1.0.1 (copied) (copied from xo-for-angular/trunk)
-
tags/1.0.1/Includes/Api/Abstract/Objects/Menu.class.php (modified) (4 diffs)
-
tags/1.0.1/Includes/Api/Controllers/PostsController.class.php (modified) (3 diffs)
-
tags/1.0.1/Includes/Options/Tabs/General/AcfTab.class.php (copied) (copied from xo-for-angular/trunk/Includes/Options/Tabs/General/AcfTab.class.php)
-
tags/1.0.1/Includes/Options/Tabs/General/ApiTab.class.php (copied) (copied from xo-for-angular/trunk/Includes/Options/Tabs/General/ApiTab.class.php)
-
tags/1.0.1/Includes/Options/Tabs/General/IndexTab.class.php (copied) (copied from xo-for-angular/trunk/Includes/Options/Tabs/General/IndexTab.class.php)
-
tags/1.0.1/Includes/Options/Tabs/General/PostsTab.class.php (copied) (copied from xo-for-angular/trunk/Includes/Options/Tabs/General/PostsTab.class.php)
-
tags/1.0.1/Includes/Options/Tabs/General/RoutingTab.class.php (copied) (copied from xo-for-angular/trunk/Includes/Options/Tabs/General/RoutingTab.class.php)
-
tags/1.0.1/Includes/Options/Tabs/General/TemplatesTab.class.php (copied) (copied from xo-for-angular/trunk/Includes/Options/Tabs/General/TemplatesTab.class.php)
-
tags/1.0.1/Includes/Options/Tabs/Tools/ExportTab.class.php (copied) (copied from xo-for-angular/trunk/Includes/Options/Tabs/Tools/ExportTab.class.php)
-
tags/1.0.1/Includes/Options/Tabs/Tools/ProfileTab.class.php (copied) (copied from xo-for-angular/trunk/Includes/Options/Tabs/Tools/ProfileTab.class.php)
-
tags/1.0.1/Includes/Options/Tabs/Tools/ToolsTab.class.php (copied) (copied from xo-for-angular/trunk/Includes/Options/Tabs/Tools/ToolsTab.class.php)
-
tags/1.0.1/Includes/Services/Classes/AdminNotice.class.php (copied) (copied from xo-for-angular/trunk/Includes/Services/Classes/AdminNotice.class.php)
-
tags/1.0.1/Includes/Xo.php (copied) (copied from xo-for-angular/trunk/Includes/Xo.php)
-
tags/1.0.1/readme.txt (copied) (copied from xo-for-angular/trunk/readme.txt) (1 diff)
-
tags/1.0.1/xo-angular.php (modified) (1 diff)
-
trunk/Includes/Api/Abstract/Objects/Menu.class.php (modified) (4 diffs)
-
trunk/Includes/Api/Controllers/PostsController.class.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/xo-angular.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
xo-for-angular/tags/1.0.1/Includes/Api/Abstract/Objects/Menu.class.php
r2042983 r2044909 3 3 /** 4 4 * An abstract class that extends post and used to construct a fully formed menu object. 5 * 5 * 6 6 * @since 1.0.0 7 7 */ … … 10 10 /** 11 11 * Additional css classes that may be used in the front-end. 12 * 12 * 13 13 * @since 1.0.0 14 * 14 * 15 15 * @var string 16 16 */ … … 18 18 19 19 /** 20 * Target for the anchor link. 21 * 22 * @since 1.0.1 23 * 24 * @var string 25 */ 26 public $target; 27 28 /** 20 29 * Generate a fully formed menu object. 21 * 30 * 22 31 * @since 1.0.0 23 * 32 * 24 33 * @param WP_Post $menu The base menu object. 25 34 * @param bool $terms Optionally include terms in menu object. … … 35 44 $this->classes = $menu->classes; 36 45 $this->parent = $menu->menu_item_parent; 46 $this->target = $menu->target; 37 47 38 48 // Set the relative url of the menu 39 $this->url = wp_make_link_relative($menu->url); 49 if ($this->target == '_blank') { 50 $this->url = $menu->url; 51 } else { 52 $this->url = wp_make_link_relative($menu->url); 53 } 40 54 } 41 55 } -
xo-for-angular/tags/1.0.1/Includes/Api/Controllers/PostsController.class.php
r2042983 r2044909 108 108 : (($search) ? get_post_types(array('public' => true)) : 'post')); 109 109 $curPage = ((!empty($params['currentPage'])) ? $params['currentPage'] : 1); 110 $perPage = ((!empty($params['postsPerPage'])) ? intval($params['postsPerPage']) : -1); 110 $perPage = intval(((!empty($params['postsPerPage'])) 111 ? $params['postsPerPage'] 112 : $this->Xo->Services->Options->GetOption('posts_per_page'))); 111 113 $offset = (($perPage) ? (($curPage - 1) * $perPage) : 0); 112 114 $orderBy = ((!empty($params['orderby'])) ? $params['orderby'] : ''); 113 115 114 // Construct base arguments for get posts 116 // Construct base arguments for get posts$default_posts_per_page = get_option( 'posts_per_page' ); 115 117 $baseargs = array( 116 118 'post_status' => 'publish', … … 146 148 147 149 // Get posts from search 148 if (($search) && ($keywords = explode(' ', trim($search))) && (count($keywords))) 149 for ($i = (count($keywords) - 1); $i >= 0; $i--) 150 $postids = array_merge($postids, get_posts(array_merge($baseargs, array( 151 's' => $keywords[$i], 152 'post__not_in' => array_merge($excludeids, $postids) 153 )))); 154 155 // Check if posts should be ordered by weight 156 if ($orderBy == 'weight') { 157 // Get all posts using the base args and reset fields to return full wordpress post object 158 $posts = get_posts(array_merge($baseargs, array( 159 'fields' => '' 160 ))); 161 162 // Iterate through posts in the collection 163 $weighted = array(); 164 foreach ($posts as $post) 165 // Set a new weighted value using menu order plus some randomness 166 $weighted[$post->ID] = ((min($post->menu_order, 10) / 10) + (mt_rand(0, 32767) / 32767)); 167 168 // Sort the posts by the new weighted value 169 arsort($weighted); 170 171 // Add the new weighted post ids to collection 172 $postids = array_merge($postids, array_keys($weighted)); 150 if ($search) { 151 $keywords = explode(' ', trim($search)); 152 153 if (count($keywords)) { 154 for ($i = (count($keywords) - 1); $i >= 0; $i--) { 155 $postids = array_merge($postids, get_posts(array_merge($baseargs, array( 156 's' => $keywords[$i], 157 'post__not_in' => array_merge($excludeids, $postids) 158 )))); 159 } 160 } 161 162 // Otherwise get all posts for the current parameters 173 163 } else { 174 164 $postids = array_merge($postids, get_posts(array_merge($baseargs, array( … … 176 166 )))); 177 167 } 168 169 // Return an error if no posts were found 170 if (empty($postids)) 171 return new XoApiAbstractPostsFilterResponse(false, __('Unable to locate posts.', 'xo')); 178 172 179 173 // Get the wordpress post objects for the collected post ids -
xo-for-angular/tags/1.0.1/readme.txt
r2043256 r2044909 34 34 == Changelog == 35 35 36 = 1.0.1 = 37 * Added link target to menu item output 38 * Fix for posts filter api returning results when there is no match 39 36 40 = 1.0.0 = 37 41 * Xo for Angular initial release. -
xo-for-angular/tags/1.0.1/xo-angular.php
r2042983 r2044909 4 4 Plugin URI: https://angularxo.io 5 5 Description: Angular theme development in WordPress with templates and a powerful API. 6 Version: 1.0. 06 Version: 1.0.1 7 7 Author: Travis Brown 8 8 Author URI: http://www.xodustech.com -
xo-for-angular/trunk/Includes/Api/Abstract/Objects/Menu.class.php
r2042983 r2044909 3 3 /** 4 4 * An abstract class that extends post and used to construct a fully formed menu object. 5 * 5 * 6 6 * @since 1.0.0 7 7 */ … … 10 10 /** 11 11 * Additional css classes that may be used in the front-end. 12 * 12 * 13 13 * @since 1.0.0 14 * 14 * 15 15 * @var string 16 16 */ … … 18 18 19 19 /** 20 * Target for the anchor link. 21 * 22 * @since 1.0.1 23 * 24 * @var string 25 */ 26 public $target; 27 28 /** 20 29 * Generate a fully formed menu object. 21 * 30 * 22 31 * @since 1.0.0 23 * 32 * 24 33 * @param WP_Post $menu The base menu object. 25 34 * @param bool $terms Optionally include terms in menu object. … … 35 44 $this->classes = $menu->classes; 36 45 $this->parent = $menu->menu_item_parent; 46 $this->target = $menu->target; 37 47 38 48 // Set the relative url of the menu 39 $this->url = wp_make_link_relative($menu->url); 49 if ($this->target == '_blank') { 50 $this->url = $menu->url; 51 } else { 52 $this->url = wp_make_link_relative($menu->url); 53 } 40 54 } 41 55 } -
xo-for-angular/trunk/Includes/Api/Controllers/PostsController.class.php
r2042983 r2044909 108 108 : (($search) ? get_post_types(array('public' => true)) : 'post')); 109 109 $curPage = ((!empty($params['currentPage'])) ? $params['currentPage'] : 1); 110 $perPage = ((!empty($params['postsPerPage'])) ? intval($params['postsPerPage']) : -1); 110 $perPage = intval(((!empty($params['postsPerPage'])) 111 ? $params['postsPerPage'] 112 : $this->Xo->Services->Options->GetOption('posts_per_page'))); 111 113 $offset = (($perPage) ? (($curPage - 1) * $perPage) : 0); 112 114 $orderBy = ((!empty($params['orderby'])) ? $params['orderby'] : ''); 113 115 114 // Construct base arguments for get posts 116 // Construct base arguments for get posts$default_posts_per_page = get_option( 'posts_per_page' ); 115 117 $baseargs = array( 116 118 'post_status' => 'publish', … … 146 148 147 149 // Get posts from search 148 if (($search) && ($keywords = explode(' ', trim($search))) && (count($keywords))) 149 for ($i = (count($keywords) - 1); $i >= 0; $i--) 150 $postids = array_merge($postids, get_posts(array_merge($baseargs, array( 151 's' => $keywords[$i], 152 'post__not_in' => array_merge($excludeids, $postids) 153 )))); 154 155 // Check if posts should be ordered by weight 156 if ($orderBy == 'weight') { 157 // Get all posts using the base args and reset fields to return full wordpress post object 158 $posts = get_posts(array_merge($baseargs, array( 159 'fields' => '' 160 ))); 161 162 // Iterate through posts in the collection 163 $weighted = array(); 164 foreach ($posts as $post) 165 // Set a new weighted value using menu order plus some randomness 166 $weighted[$post->ID] = ((min($post->menu_order, 10) / 10) + (mt_rand(0, 32767) / 32767)); 167 168 // Sort the posts by the new weighted value 169 arsort($weighted); 170 171 // Add the new weighted post ids to collection 172 $postids = array_merge($postids, array_keys($weighted)); 150 if ($search) { 151 $keywords = explode(' ', trim($search)); 152 153 if (count($keywords)) { 154 for ($i = (count($keywords) - 1); $i >= 0; $i--) { 155 $postids = array_merge($postids, get_posts(array_merge($baseargs, array( 156 's' => $keywords[$i], 157 'post__not_in' => array_merge($excludeids, $postids) 158 )))); 159 } 160 } 161 162 // Otherwise get all posts for the current parameters 173 163 } else { 174 164 $postids = array_merge($postids, get_posts(array_merge($baseargs, array( … … 176 166 )))); 177 167 } 168 169 // Return an error if no posts were found 170 if (empty($postids)) 171 return new XoApiAbstractPostsFilterResponse(false, __('Unable to locate posts.', 'xo')); 178 172 179 173 // Get the wordpress post objects for the collected post ids -
xo-for-angular/trunk/readme.txt
r2043256 r2044909 4 4 Requires at least: 4.9 5 5 Tested up to: 5.0.3 6 Stable tag: 1.0. 06 Stable tag: 1.0.1 7 7 Requires PHP: 7.0.0 8 8 License: GPLv2 or later … … 34 34 == Changelog == 35 35 36 = 1.0.1 = 37 * Added link target to menu item output 38 * Fix for posts filter api returning results when there is no match 39 36 40 = 1.0.0 = 37 41 * Xo for Angular initial release. -
xo-for-angular/trunk/xo-angular.php
r2042983 r2044909 4 4 Plugin URI: https://angularxo.io 5 5 Description: Angular theme development in WordPress with templates and a powerful API. 6 Version: 1.0. 06 Version: 1.0.1 7 7 Author: Travis Brown 8 8 Author URI: http://www.xodustech.com
Note: See TracChangeset
for help on using the changeset viewer.