Browse Source

Add upstream includes

master
Sam Black 2 years ago
parent
commit
2db1a60c91
Signed by: samwwwblack GPG Key ID: 0FF0223994EA47D8
  1. 14
      includes/wpc-dashboard.php
  2. 31
      includes/wpc-menu.php

14
includes/wpc-dashboard.php

@ -1,6 +1,6 @@
<?php
if ( ! class_exists( 'WPcleverDashboard' ) ) {
class WPcleverDashboard {
if ( ! class_exists( 'WPCleverDashboard' ) ) {
class WPCleverDashboard {
function __construct() {
add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widget' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
@ -11,7 +11,7 @@ if ( ! class_exists( 'WPcleverDashboard' ) ) {
}
function add_dashboard_widget() {
wp_add_dashboard_widget( 'wpclever_dashboard_widget', 'WPclever.net Plugins', array(
wp_add_dashboard_widget( 'wpclever_dashboard_widget', 'WPClever.net Plugins', array(
&$this,
'dashboard_widget_content'
) );
@ -21,7 +21,7 @@ if ( ! class_exists( 'WPcleverDashboard' ) ) {
if ( false === ( $plugins_arr = get_transient( 'wpclever_plugins' ) ) ) {
$args = (object) array(
'author' => 'wpclever',
'per_page' => '20',
'per_page' => '120',
'page' => '1',
'fields' => array( 'slug', 'name', 'version', 'downloaded', 'active_installs' )
);
@ -48,8 +48,10 @@ if ( ! class_exists( 'WPcleverDashboard' ) ) {
}
if ( is_array( $plugins_arr ) && ( count( $plugins_arr ) > 0 ) ) {
array_multisort( array_column( $plugins_arr, 'active_installs' ), SORT_DESC, $plugins_arr );
$i = 1;
foreach ( $plugins_arr as $pl ) {
echo '<div class="item"><a href="https://wordpress.org/plugins/' . $pl['slug'] . '/"><img src="https://ps.w.org/' . $pl['slug'] . '/assets/icon-128x128.png?t=' . current_time( 'd' ) . '"/><span class="title">' . $pl['name'] . '</span><br/><span class="info">Version ' . $pl['version'] . '</span></a></div>';
echo '<div class="item"><a href="https://wordpress.org/plugins/' . $pl['slug'] . '/"><span class="num">'. $i .'</span><span class="title">' . $pl['name'] . '</span><br/><span class="info">Version ' . $pl['version'] . '</span></a></div>';
$i ++;
}
} else {
echo 'https://wpclever.net';
@ -57,5 +59,5 @@ if ( ! class_exists( 'WPcleverDashboard' ) ) {
}
}
new WPcleverDashboard();
new WPCleverDashboard();
}

31
includes/wpc-menu.php

@ -1,14 +1,14 @@
<?php
if ( ! class_exists( 'WPcleverMenu' ) ) {
class WPcleverMenu {
if ( ! class_exists( 'WPCleverMenu' ) ) {
class WPCleverMenu {
function __construct() {
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
}
function admin_menu() {
add_menu_page(
'WPclever',
'WP⚡clever',
'WPClever',
'WPClever⚡',
'manage_options',
'wpclever',
array( &$this, 'welcome_content' ),
@ -21,11 +21,13 @@ if ( ! class_exists( 'WPcleverMenu' ) ) {
function welcome_content() {
?>
<div class="wpclever_welcome_page wrap">
<h1>WPclever.net</h1>
<h1>WPClever.net</h1>
<div class="card">
<h2 class="title">Welcome</h2>
<h2 class="title">About</h2>
<p>
Thanks for choosing our plugins for your website!
We are a team of passionate developers of plugins for WordPress, whose aspiration is to bring
smart utilities and functionalities to life for WordPress users, especially for those on
WooCommerce platform.
</p>
</div>
<div class="card wpclever_plugins">
@ -34,7 +36,7 @@ if ( ! class_exists( 'WPcleverMenu' ) ) {
if ( false === ( $plugins_arr = get_transient( 'wpclever_plugins' ) ) ) {
$args = (object) array(
'author' => 'wpclever',
'per_page' => '20',
'per_page' => '120',
'page' => '1',
'fields' => array( 'slug', 'name', 'version', 'downloaded', 'active_installs' )
);
@ -65,8 +67,10 @@ if ( ! class_exists( 'WPcleverMenu' ) ) {
}
if ( is_array( $plugins_arr ) && ( count( $plugins_arr ) > 0 ) ) {
array_multisort( array_column( $plugins_arr, 'active_installs' ), SORT_DESC, $plugins_arr );
$i = 1;
foreach ( $plugins_arr as $pl ) {
echo '<div class="item"><a href="https://wordpress.org/plugins/' . $pl['slug'] . '/"><img src="https://ps.w.org/' . $pl['slug'] . '/assets/icon-128x128.png?t=' . current_time( 'd' ) . '"/><span class="title">' . $pl['name'] . '</span><br/><span class="info">Version ' . $pl['version'] . '</span></a></div>';
echo '<div class="item"><a href="https://wordpress.org/plugins/' . $pl['slug'] . '/"><span class="num">' . $i . '</span><span class="title">' . $pl['name'] . '</span><br/><span class="info">Version ' . $pl['version'] . '</span></a></div>';
$i ++;
}
} else {
echo 'https://wpclever.net';
@ -76,9 +80,12 @@ if ( ! class_exists( 'WPcleverMenu' ) ) {
<div class="card">
<h2 class="title">Contact</h2>
<p>
Feel free to contact us via <a href="https://wpclever.net/contact" target="_blank">contact
Feel free to contact us via <a
href="https://wpclever.net/contact?utm_source=contact&utm_medium=menu&utm_campaign=wporg"
target="_blank">contact
page</a> :)<br/>
Website: <a href="https://wpclever.net" target="_blank">https://wpclever.net</a>
Website: <a href="https://wpclever.net?utm_source=visit&utm_medium=menu&utm_campaign=wporg"
target="_blank">https://wpclever.net</a>
</p>
</div>
</div>
@ -86,5 +93,5 @@ if ( ! class_exists( 'WPcleverMenu' ) ) {
}
}
new WPcleverMenu();
new WPCleverMenu();
}
Loading…
Cancel
Save