Sindbad~EG File Manager
<?php
/*
Plugin Name: moZable plugin
Description: Wordpress mobile app generator
Author: Digitalborder
Version: 3.5
*/
if (!defined('ABSPATH')) {
exit;
}
class Mozable
{
public function __construct()
{
}
public static function register()
{
global $wpdb;
$table_name = $wpdb->prefix . "moz_push";
add_action('admin_menu', array(__CLASS__, 'mozable_setup_menu'));
register_activation_hook(__FILE__, array(__CLASS__, 'activate'));
register_deactivation_hook(__FILE__, array(__CLASS__, 'deactivate'));
}
/**
* Method to run when the plugin is activated by a user in the
* WordPress Dashboard admin screen.
*
*
* @return void
*/
public static function activate()
{
self::installDbSchema();
}
function installDbSchema()
{
global $wpdb;
$charset_collate = $wpdb->get_charset_collate();
$push_table = $wpdb->prefix . "moz_push";
$sql = "CREATE TABLE IF NOT EXISTS `$push_table` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`title` varchar(255) NOT NULL,
`message` text NOT NULL,
`api_key` text NOT NULL,
PRIMARY KEY (id)
) $charset_collate;";
$apps_table = $wpdb->prefix . "moz_apps";
$sql2 = "CREATE TABLE IF NOT EXISTS `$apps_table` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`server_id` int(11),
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`name` varchar(255) NOT NULL,
`packagename` varchar(255) NOT NULL,
`platform` varchar(255) NOT NULL,
`version` varchar(255) NOT NULL,
`status` varchar(255) NOT NULL,
`download_link` text NOT NULL,
`error_message` text NOT NULL,
PRIMARY KEY (id)
) $charset_collate;";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
dbDelta($sql2);
}
public static function mozable_setup_menu()
{
add_menu_page('moZable Apps Generator', 'moZable App', 'manage_options', 'moz-plugin', array(__CLASS__, 'moz_init'));
}
public static function moz_init()
{
$mozable_version = 3.5;
$plugin_direcotory = plugin_dir_path(__FILE__);
wp_register_script('prefix_jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js');
wp_enqueue_script('prefix_jquery');
wp_register_script('prefix_bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js');
wp_enqueue_script('prefix_bootstrap');
wp_register_style('prefix_bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
wp_enqueue_style('prefix_bootstrap');
wp_register_style('prefix_fontawesome', '//use.fontawesome.com/releases/v5.3.1/css/all.css');
wp_enqueue_style('prefix_fontawesome');
wp_register_script('custom-script', plugins_url('/assets/websocket.js?version=' . $mozable_version, __FILE__), array(), null, false);
wp_enqueue_script('custom-script');
wp_register_script('push-script', plugins_url('/assets/push.js?version=' . $mozable_version, __FILE__), array(), null, false);
wp_enqueue_script('push-script');
//wp_register_style('prefix_custom', plugins_url( '/assets/moz_custom.css', __FILE__ ));
wp_register_style('custom_wp_admin_css', plugins_url('/assets/moz_custom.css', __FILE__), false, '1.0.0');
wp_enqueue_style('custom_wp_admin_css');
if (file_exists($plugin_direcotory . "auth.json")) {
$check = file_get_contents($plugin_direcotory . "auth.json");
$json = json_decode($check, true);
if ($json['code']) {
include($plugin_direcotory . 'form.php');
} else {
include($plugin_direcotory . 'activation.php');
}
} else {
include($plugin_direcotory . 'activation.php');
}
}
/**
* Method to run when the plugin is deactivated by a user in the
* WordPress Dashboard admin screen.
*
* @return void
*/
function deactivate()
{
global $wpdb;
$table_name = $wpdb->prefix . "moz_push";
$sql = "DROP TABLE $table_name;";
$wpdb->query($sql);
$table_name = $wpdb->prefix . "moz_apps";
$sql = "DROP TABLE $table_name;";
$wpdb->query($sql);
}
}
Mozable::register();
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists