| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
This program is free software; you can redistribute it and/or |
| 5 |
modify it under the terms of the GNU General Public License |
| 6 |
as published by the Free Software Foundation; either version 2 |
| 7 |
of the License, or (at your option) any later version. |
| 8 |
|
| 9 |
This program is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public License |
| 15 |
along with this program; if not, write to the Free Software |
| 16 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 |
|
| 18 |
Copyright 2017 Buttonizer |
| 19 |
*/ |
| 20 |
namespace Buttonizer\Admin; |
| 21 |
|
| 22 |
# No script kiddies |
| 23 |
defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); |
| 24 |
class PageCategories |
| 25 |
{ |
| 26 |
private $aSavedData = array() ; |
| 27 |
private $aAllPages = array() ; |
| 28 |
private $iButtonCount ; |
| 29 |
public function __construct() |
| 30 |
{ |
| 31 |
$this->loadData(); |
| 32 |
$this->loadCategories(); |
| 33 |
} |
| 34 |
|
| 35 |
private function loadData() |
| 36 |
{ |
| 37 |
$this->aSavedData = (array) get_option( 'buttonizer_page_categories' ); |
| 38 |
$this->aAllPages = get_pages(); |
| 39 |
} |
| 40 |
|
| 41 |
private function loadCategories() |
| 42 |
{ |
| 43 |
// Get buttons |
| 44 |
$aCategories = ( isset( $this->aSavedData['categorieOrder'] ) && is_array( $this->aSavedData['categorieOrder'] ) ? $this->aSavedData['categorieOrder'] : array( |
| 45 |
0 => '-1', |
| 46 |
) ); |
| 47 |
if ( $aCategories[0] != '-1' ) { |
| 48 |
$aCategories[-1] = '-1'; |
| 49 |
} |
| 50 |
echo '<div id="page-categories">' ; |
| 51 |
// Not removable button row |
| 52 |
echo '<div class="button-row"> |
| 53 |
<div class="row-info"> |
| 54 |
<span><i class="fa fa-file-text-o"></i> All pages</span> |
| 55 |
<a href="javascript:void(0)" class="delete-button" style="opacity: 0.5">Delete <i class="fa fa-trash-o"></i></a> |
| 56 |
</div> |
| 57 |
|
| 58 |
<div class="button-data"> |
| 59 |
When a button is set on \'All pages\', the button will shown on all pages. <br /> |
| 60 |
<br /> |
| 61 |
You cannot edit the \'All pages\' item. |
| 62 |
</div> |
| 63 |
</div>' ; |
| 64 |
echo '<script>jQuery("h2 #new-button").click(buttonizer.proInfoWindow);</script><div class="buttonizer-pro-text"><i class="fa fa-lock"></i> You are missing the fun! When upgrading to <a href="admin.php?page=Buttonizer-pricing">Buttonizer Pro</a> you will unlock page categories.</div>' ; |
| 65 |
echo '</div>' ; |
| 66 |
} |
| 67 |
|
| 68 |
private function loadIndividialCategoryRow( $sCategoryKey, $iCategoryId, $bDisabled ) |
| 69 |
{ |
| 70 |
} |
| 71 |
|
| 72 |
} |