| 1 |
<?php |
| 2 |
|
| 3 |
////////////////////////////////////////////////////////////// |
| 4 |
//=========================================================== |
| 5 |
// license.php |
| 6 |
//=========================================================== |
| 7 |
// PAGELAYER |
| 8 |
// Inspired by the DESIRE to be the BEST OF ALL |
| 9 |
// ---------------------------------------------------------- |
| 10 |
// Started by: Pulkit Gupta |
| 11 |
// Date: 23rd Jan 2017 |
| 12 |
// Time: 23:00 hrs |
| 13 |
// Site: http://pagelayer.com/wordpress (PAGELAYER) |
| 14 |
// ---------------------------------------------------------- |
| 15 |
// Please Read the Terms of use at http://pagelayer.com/tos |
| 16 |
// ---------------------------------------------------------- |
| 17 |
//=========================================================== |
| 18 |
// (c)Pagelayer Team |
| 19 |
//=========================================================== |
| 20 |
////////////////////////////////////////////////////////////// |
| 21 |
|
| 22 |
// Are we being accessed directly ? |
| 23 |
if(!defined('PAGELAYER_VERSION')) { |
| 24 |
exit('Hacking Attempt !'); |
| 25 |
} |
| 26 |
|
| 27 |
// The Pagelayer Settings Header |
| 28 |
function pagelayer_page_header($title = 'Pagelayer Editor'){ |
| 29 |
|
| 30 |
wp_enqueue_script( 'pagelayer-admin', PAGELAYER_JS.'/pagelayer-admin.js', array('jquery'), PAGELAYER_VERSION); |
| 31 |
wp_enqueue_style( 'pagelayer-admin', PAGELAYER_CSS.'/pagelayer-admin.css', array(), PAGELAYER_VERSION); |
| 32 |
|
| 33 |
echo '<div style="margin: 10px 20px 0 2px;"> |
| 34 |
<div class="metabox-holder columns-2"> |
| 35 |
<div class="postbox-container"> |
| 36 |
<div id="top-sortables" class="meta-box-sortables ui-sortable"> |
| 37 |
|
| 38 |
<table cellpadding="2" cellspacing="1" width="100%" class="fixed" border="0"> |
| 39 |
<tr> |
| 40 |
<td valign="top"><h1>'.$title.'</h1></td> |
| 41 |
<td align="right"><a target="_blank" class="button button-primary" href="https://wordpress.org/support/view/plugin-reviews/pagelayer">Review Pagelayer</a></td> |
| 42 |
<td align="right" width="40"><a target="_blank" href="https://twitter.com/pagelayer"><img src="'.PAGELAYER_URL.'/images/twitter.png" /></a></td> |
| 43 |
<td align="right" width="40"><a target="_blank" href="https://www.facebook.com/pagelayer/"><img src="'.PAGELAYER_URL.'/images/facebook.png" /></a></td> |
| 44 |
</tr> |
| 45 |
</table> |
| 46 |
<hr /> |
| 47 |
|
| 48 |
<!--Main Table--> |
| 49 |
<table cellpadding="8" cellspacing="1" width="100%" class="fixed"> |
| 50 |
<tr> |
| 51 |
<td valign="top">'; |
| 52 |
|
| 53 |
} |
| 54 |
|
| 55 |
// The Pagelayer Settings footer |
| 56 |
function pagelayer_page_footer(){ |
| 57 |
|
| 58 |
echo ' |
| 59 |
</td> |
| 60 |
<td width="200" valign="top" id="pagelayer-right-bar">'; |
| 61 |
|
| 62 |
if(!defined('PAGELAYER_PREMIUM')){ |
| 63 |
|
| 64 |
echo ' |
| 65 |
<div class="postbox" style="min-width:0px !important;"> |
| 66 |
<h2 class="hndle ui-sortable-handle"> |
| 67 |
<span><a target="_blank" href="'.PAGELAYER_PRO_URL.'"><img src="'.PAGELAYER_URL.'/images/pagelayer_product.png" width="100%" /></a></span> |
| 68 |
</h2> |
| 69 |
<div class="inside"> |
| 70 |
<i>Upgrade to the premium version and get the following features </i>:<br> |
| 71 |
<ul class="pagelayer-right-ul"> |
| 72 |
<li>60+ Premium Widgets</li> |
| 73 |
<li>400+ Premium Sections</li> |
| 74 |
<li>Theme Builder</li> |
| 75 |
<li>WooCommerce Builder</li> |
| 76 |
<li>Theme Creator and Exporter</li> |
| 77 |
<li>Form Builder</li> |
| 78 |
<li>And many more ...</li> |
| 79 |
</ul> |
| 80 |
<center><a class="button button-primary" target="_blank" href="'.PAGELAYER_PRO_URL.'">Upgrade</a></center> |
| 81 |
</div> |
| 82 |
</div>'; |
| 83 |
|
| 84 |
} |
| 85 |
|
| 86 |
echo ' |
| 87 |
<div class="postbox" style="min-width:0px !important;"> |
| 88 |
<h2 class="hndle ui-sortable-handle"> |
| 89 |
<span><a target="_blank" href="https://wpcentral.co/?from=pagelayer-plugin"><img src="'.PAGELAYER_URL.'/images/wpcentral_product.png" width="100%" /></a></span> |
| 90 |
</h2> |
| 91 |
<div class="inside"> |
| 92 |
<i>Manage all your WordPress sites from <b>1 dashboard</b> </i>:<br> |
| 93 |
<ul class="pagelayer-right-ul"> |
| 94 |
<li>1-click Admin Access</li> |
| 95 |
<li>Update WordPress</li> |
| 96 |
<li>Update Themes</li> |
| 97 |
<li>Update Plugins</li> |
| 98 |
<li>Backup your WordPress Site</li> |
| 99 |
<li>Plugins & Theme Management</li> |
| 100 |
<li>Post Management</li> |
| 101 |
<li>And many more ...</li> |
| 102 |
</ul> |
| 103 |
<center><a class="button button-primary" target="_blank" href="https://wpcentral.co/?from=pagelayer-plugin">Visit wpCentral</a></center> |
| 104 |
</div> |
| 105 |
</div> |
| 106 |
|
| 107 |
</td> |
| 108 |
</tr> |
| 109 |
</table> |
| 110 |
<br /> |
| 111 |
<div style="width:45%;background:#FFF;padding:15px; margin:auto"> |
| 112 |
<b>Let your followers know that you use Pagelayer to build your website :</b> |
| 113 |
<form method="get" action="https://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);"> |
| 114 |
<textarea name="text" cols="45" row="3" style="resize:none;">I easily built my #WordPress #site using @pagelayer</textarea> |
| 115 |
<input type="submit" value="Tweet!" class="button button-primary" onsubmit="return false;" id="twitter-btn" style="margin-top:20px;"/> |
| 116 |
</form> |
| 117 |
|
| 118 |
</div> |
| 119 |
<br /> |
| 120 |
|
| 121 |
<script> |
| 122 |
function dotweet(ele){ |
| 123 |
window.open(jQuery("#"+ele.id).attr("action")+"?"+jQuery("#"+ele.id).serialize(), "_blank", "scrollbars=no, menubar=no, height=400, width=500, resizable=yes, toolbar=no, status=no"); |
| 124 |
return false; |
| 125 |
} |
| 126 |
</script> |
| 127 |
|
| 128 |
<hr /> |
| 129 |
<a href="'.PAGELAYER_WWW_URL.'" target="_blank">Pagelayer</a> v'.PAGELAYER_VERSION.'. You can report any bugs <a href="http://wordpress.org/support/plugin/pagelayer" target="_blank">here</a>. |
| 130 |
|
| 131 |
</div> |
| 132 |
</div> |
| 133 |
</div> |
| 134 |
</div>'; |
| 135 |
|
| 136 |
} |
| 137 |
|
| 138 |
// The License Page |
| 139 |
function pagelayer_license(){ |
| 140 |
|
| 141 |
global $pl_error; |
| 142 |
|
| 143 |
if(!empty($_REQUEST['install_pro'])){ |
| 144 |
pagelayer_install_pro(); |
| 145 |
return; |
| 146 |
} |
| 147 |
|
| 148 |
// Is there a license key ? |
| 149 |
if(isset($_POST['save_pl_license'])){ |
| 150 |
|
| 151 |
$license = pagelayer_optpost('pagelayer_license'); |
| 152 |
|
| 153 |
// Check if its a valid license |
| 154 |
if(empty($license)){ |
| 155 |
$pl_error['lic_invalid'] = __('The license key was not submitted', 'pagelayer'); |
| 156 |
return pagelayer_license_T(); |
| 157 |
} |
| 158 |
|
| 159 |
$resp = wp_remote_get(PAGELAYER_API.'license.php?license='.$license, array('timeout' => 30)); |
| 160 |
|
| 161 |
if(is_array($resp)){ |
| 162 |
$json = json_decode($resp['body'], true); |
| 163 |
//print_r($json); |
| 164 |
}else{ |
| 165 |
|
| 166 |
$pl_error['resp_invalid'] = __('The response was malformed<br>'.var_export($resp, true), 'pagelayer'); |
| 167 |
return pagelayer_license_T(); |
| 168 |
|
| 169 |
} |
| 170 |
|
| 171 |
// Save the License |
| 172 |
if(empty($json['license'])){ |
| 173 |
|
| 174 |
$pl_error['lic_invalid'] = __('The license key is invalid', 'pagelayer'); |
| 175 |
return pagelayer_license_T(); |
| 176 |
|
| 177 |
}else{ |
| 178 |
|
| 179 |
update_option('pagelayer_license', $json); |
| 180 |
|
| 181 |
// Load license |
| 182 |
pagelayer_load_license(); |
| 183 |
|
| 184 |
// Mark as saved |
| 185 |
$GLOBALS['pl_saved'] = true; |
| 186 |
} |
| 187 |
|
| 188 |
} |
| 189 |
|
| 190 |
pagelayer_license_T(); |
| 191 |
|
| 192 |
} |
| 193 |
|
| 194 |
// The License Page - THEME |
| 195 |
function pagelayer_license_T(){ |
| 196 |
|
| 197 |
global $pagelayer, $pl_error; |
| 198 |
|
| 199 |
pagelayer_page_header('Pagelayer License'); |
| 200 |
|
| 201 |
// Saved ? |
| 202 |
if(!empty($GLOBALS['pl_saved'])){ |
| 203 |
echo '<div id="message" class="updated"><p>'. __('The settings were saved successfully', 'pagelayer'). '</p></div><br />'; |
| 204 |
} |
| 205 |
|
| 206 |
// If the license is active and you are the free version, then suggest to install the pro |
| 207 |
if(!empty($pagelayer->license['status']) && !defined('PAGELAYER_PREMIUM') && empty($_REQUEST['install_pro'])){ |
| 208 |
echo '<div class="updated"><p>'. __('You have activated the license, but are using the Free version ! <a href="'.admin_url('admin.php?page=pagelayer_license&install_pro=1').'" class="button button-primary">Install Pro Now</a>', 'pagelayer'). '</p></div><br />'; |
| 209 |
} |
| 210 |
|
| 211 |
if(date('Ymd') <= 20200331 && !defined('PAGELAYER_PREMIUM')){ |
| 212 |
echo '<div class="updated"><p><span style="font-size: 14px"><b>Promotional Offer</b></span> : If you buy <a href="'.PAGELAYER_PRO_URL.'"><b>Pagelayer Pro</b></a> before <b>31st March, 2020</b> then you will get an additional year free and your license will expire on <b>31st March, 2022</b></p></div><br />.'; |
| 213 |
} |
| 214 |
|
| 215 |
// Any errors ? |
| 216 |
if(!empty($pl_error)){ |
| 217 |
pagelayer_report_error($pl_error);echo '<br />'; |
| 218 |
} |
| 219 |
|
| 220 |
?> |
| 221 |
|
| 222 |
<div class="postbox"> |
| 223 |
|
| 224 |
<button class="handlediv button-link" aria-expanded="true" type="button"> |
| 225 |
<span class="screen-reader-text">Toggle panel: System Information</span> |
| 226 |
<span class="toggle-indicator" aria-hidden="true"></span> |
| 227 |
</button> |
| 228 |
|
| 229 |
<h2 class="hndle ui-sortable-handle"> |
| 230 |
<span><?php echo __('System Information', 'pagelayer'); ?></span> |
| 231 |
</h2> |
| 232 |
|
| 233 |
<div class="inside"> |
| 234 |
|
| 235 |
<form action="" method="post" enctype="multipart/form-data"> |
| 236 |
<?php wp_nonce_field('pagelayer-options'); ?> |
| 237 |
<table class="wp-list-table fixed striped users" cellspacing="1" border="0" width="95%" cellpadding="10" align="center"> |
| 238 |
<?php |
| 239 |
echo ' |
| 240 |
<tr> |
| 241 |
<th align="left" width="25%">'.__('Pagelayer Version', 'pagelayer').'</th> |
| 242 |
<td>'.PAGELAYER_VERSION.(defined('PAGELAYER_PREMIUM') ? ' (PRO Version)' : '').'</td> |
| 243 |
</tr>'; |
| 244 |
|
| 245 |
echo ' |
| 246 |
<tr> |
| 247 |
<th align="left" valign="top">'.__('Pagelayer License', 'pagelayer').'</th> |
| 248 |
<td align="left"> |
| 249 |
'.(defined('PAGELAYER_PREMIUM') && empty($pagelayer->license) ? '<span style="color:red">Unlicensed</span> ' : '').' |
| 250 |
<input type="text" name="pagelayer_license" value="'.(empty($pagelayer->license) ? '' : $pagelayer->license['license']).'" size="30" placeholder="e.g. PAGEL-11111-22222-33333-44444" style="width:300px;" /> |
| 251 |
<input name="save_pl_license" class="button button-primary" value="Update License" type="submit" />'; |
| 252 |
|
| 253 |
if(!empty($pagelayer->license)){ |
| 254 |
|
| 255 |
$expires = $pagelayer->license['expires']; |
| 256 |
$expires = substr($expires, 0, 4).'/'.substr($expires, 4, 2).'/'.substr($expires, 6); |
| 257 |
|
| 258 |
echo '<div style="margin-top:10px;">License Status : '.(empty($pagelayer->license['status_txt']) ? 'N.A.' : $pagelayer->license['status_txt']).' |
| 259 |
License Expires : '.($pagelayer->license['expires'] <= date('Ymd') ? '<span style="color:red">'.$expires.'</span>' : $expires).' |
| 260 |
</div>'; |
| 261 |
} |
| 262 |
|
| 263 |
|
| 264 |
echo |
| 265 |
'</td> |
| 266 |
</tr>'; |
| 267 |
|
| 268 |
echo '<tr> |
| 269 |
<th align="left">'.__('URL', 'pagelayer').'</th> |
| 270 |
<td>'.get_site_url().'</td> |
| 271 |
</tr> |
| 272 |
<tr> |
| 273 |
<th align="left">'.__('Path', 'pagelayer').'</th> |
| 274 |
<td>'.ABSPATH.'</td> |
| 275 |
</tr> |
| 276 |
<tr> |
| 277 |
<th align="left">'.__('Server\'s IP Address', 'pagelayer').'</th> |
| 278 |
<td>'.$_SERVER['SERVER_ADDR'].'</td> |
| 279 |
</tr> |
| 280 |
<tr> |
| 281 |
<th align="left">'.__('wp-config.php is writable', 'pagelayer').'</th> |
| 282 |
<td>'.(is_writable(ABSPATH.'/wp-config.php') ? '<span style="color:red">Yes</span>' : '<span style="color:green">No</span>').'</td> |
| 283 |
</tr>'; |
| 284 |
|
| 285 |
if(file_exists(ABSPATH.'/.htaccess')){ |
| 286 |
echo ' |
| 287 |
<tr> |
| 288 |
<th align="left">'.__('.htaccess is writable', 'pagelayer').'</th> |
| 289 |
<td>'.(is_writable(ABSPATH.'/.htaccess') ? '<span style="color:red">Yes</span>' : '<span style="color:green">No</span>').'</td> |
| 290 |
</tr>'; |
| 291 |
|
| 292 |
} |
| 293 |
|
| 294 |
?> |
| 295 |
</table> |
| 296 |
</form> |
| 297 |
|
| 298 |
</div> |
| 299 |
</div> |
| 300 |
|
| 301 |
<?php |
| 302 |
|
| 303 |
pagelayer_page_footer(); |
| 304 |
|
| 305 |
} |
| 306 |
|
| 307 |
// The Pagelayer Admin Dashbaoard |
| 308 |
function pagelayer_dashboard_T(){ |
| 309 |
|
| 310 |
global $pl_error; |
| 311 |
|
| 312 |
pagelayer_page_header('Pagelayer License'); |
| 313 |
|
| 314 |
echo '<script src="'.PAGELAYER_API.(defined('PAGELAYER_PREMIUM') ? 'news_pro.js' : 'news.js').'"></script><br>'; |
| 315 |
|
| 316 |
// Saved ? |
| 317 |
if(!empty($GLOBALS['pl_saved'])){ |
| 318 |
echo '<div id="message" class="updated"><p>'. __('The settings were saved successfully', 'pagelayer'). '</p></div><br />'; |
| 319 |
} |
| 320 |
|
| 321 |
// Any errors ? |
| 322 |
if(!empty($pl_error)){ |
| 323 |
pagelayer_report_error($pl_error);echo '<br />'; |
| 324 |
} |
| 325 |
|
| 326 |
pagelayer_page_footer(); |
| 327 |
|
| 328 |
} |