These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | |||
4 | /** |
||
5 | * @author Nicolaas [at] sunnysideup.co.nz |
||
6 | * |
||
7 | * |
||
8 | **/ |
||
9 | |||
10 | |||
11 | class SiteMapPage extends Page |
||
12 | { |
||
13 | private static $db = array( |
||
0 ignored issues
–
show
|
|||
14 | "ShowAllPages" => "Boolean" |
||
15 | ); |
||
16 | |||
17 | private static $description = "Sitemap Page: shows all the pages of a site in a tree format"; |
||
0 ignored issues
–
show
|
|||
18 | |||
19 | private static $add_action = 'Site Map Page'; |
||
0 ignored issues
–
show
|
|||
20 | |||
21 | private static $icon = 'sitemappage/images/treeicons/SiteMapPage'; |
||
0 ignored issues
–
show
|
|||
22 | |||
23 | public function canCreate($member = null) |
||
24 | { |
||
25 | return ! SiteMapPage::get()->count(); |
||
26 | } |
||
27 | |||
28 | public function getCMSFields() |
||
29 | { |
||
30 | $fields = parent::getCMSFields(); |
||
31 | $fields->addFieldToTab("Root.Display", new CheckboxField("ShowAllPages", "Show all pages from the start")); |
||
32 | return $fields; |
||
33 | } |
||
34 | } |
||
35 | |||
36 | class SiteMapPage_Controller extends Page_Controller |
||
37 | { |
||
38 | public function init() |
||
39 | { |
||
40 | parent::init(); |
||
41 | if (!$this->ShowAllPages) { |
||
42 | Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); |
||
43 | Requirements::javascript('sitemappage/javascript/SiteMapPage.js'); |
||
44 | Requirements::themedCSS('SiteMapPage', "sitemappage"); |
||
45 | } else { |
||
46 | Requirements::themedCSS('SiteMapPageOpen', "sitemappage"); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | public function LevelOneSiteMapPages() |
||
51 | { |
||
52 | $homePage = SiteTree::get()->filter(array("ParentID" => 0))->first(); |
||
53 | return $homePage->SiteMapPages($noParent = true); |
||
54 | } |
||
55 | } |
||
56 |
This check marks private properties in classes that are never used. Those properties can be removed.