PluginProbe
CSS & JavaScript Toolbox / 11.3
CSS & JavaScript Toolbox v11.3
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
css-javascript-toolbox / models / block / assignmentpanel / postbase.php

postbase.php in CSS & JavaScript Toolbox 11.3, at models/block/assignmentpanel/postbase.php

54 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 /**
7 *
8 */
9 abstract class CJT_Models_Block_Assignmentpanel_Postbase
10 extends CJT_Models_Block_Assignmentpanel_Wordpress {
11
12 /**
13 * put your comment there...
14 *
15 * @var mixed
16 */
17 protected $args = array(
18 'order' => 'ASC',
19 'orderby' => 'title',
20 'suppress_filters' => true,
21 'update_post_term_cache' => false,
22 'update_post_meta_cache' => false
23 );
24
25 /**
26 * put your comment there...
27 *
28 * @param mixed $key
29 * @param mixed $item
30 */
31 protected function prepareItem($key, & $item) {
32 // Initialize.
33 $typeParams =& $this->getTypeParams();
34 // Get only 'ID' and 'Title', 'parent' fields.
35 $preItem['id'] = $item->ID;
36 $preItem['title'] = $item->post_title;
37 $preItem['parent'] = $item->post_parent;
38 // Get permalink.
39 $preItem['link'] = get_permalink($preItem['id']);
40 /// Flag if term has child terms!
41 // Query childs.
42 $args = $this->args;
43 $args['post_parent'] = $preItem['id'];
44 $args['post_type'] = $typeParams['type'];
45 $args['numberposts'] = 1;
46 $childPosts = get_posts($args);
47 // Flag it!
48 $preItem['hasChilds'] = !empty($childPosts);
49 // Re-Reference.
50 $item = $preItem;
51 }
52
53 } // End class.
54