Skip to content

Commit

Permalink
First structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
nixtrace committed Jul 9, 2015
1 parent a221def commit d88d617
Show file tree
Hide file tree
Showing 11 changed files with 592 additions and 0 deletions.
339 changes: 339 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

Empty file added assets/css/admin.css
Empty file.
Empty file added assets/css/public.css
Empty file.
3 changes: 3 additions & 0 deletions assets/js/admin.js
@@ -0,0 +1,3 @@
jQuery( document ).ready( function ( e ) {

});
3 changes: 3 additions & 0 deletions assets/js/public.js
@@ -0,0 +1,3 @@
jQuery( document ).ready( function ( e ) {

});
3 changes: 3 additions & 0 deletions index.php
@@ -0,0 +1,3 @@
<?php

// Silence is golden
13 changes: 13 additions & 0 deletions lang/mailpoet.pot
@@ -0,0 +1,13 @@
# Copyright (C) 2014 WordPress Plugin Template
# This file is distributed under the same license as the WordPress Plugin Template package.
msgid ""
msgstr ""
"Project-Id-Version: MailPoet\n"
"Report-Msgid-Bugs-To: http://mailpoet.com\n"
"POT-Creation-Date: 2014-04-07 11:28:06+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
"Last-Translator: MAILPOET <info@mailpoet.com>\n"
"Language-Team: MAILPOET <info@mailpoet.com>\n"
155 changes: 155 additions & 0 deletions lib/mailpoet.php
@@ -0,0 +1,155 @@
<?php
if (!defined('ABSPATH')) exit;

class MailPoet {

public $version;
public $shortname;
public $file;
public $dir;
public $assets_dir;
public $assets_url;


public function __construct ($params = array(
'file' => '',
'version' => '1.0.0'
)) {

$this->version = $params['version'];
$this->shortname = 'mailpoet';
$this->file = $params['file'];
$this->dir = dirname($this->file);
$this->assets_dir = $this->dir . 'assets/';
$this->assets_url = plugins_url(
'/assets/',
$this->file
);

register_activation_hook(
$this->file,
array($this, 'install')
);

// public assets
add_action(
'wp_enqueue_scripts',
array($this, 'public_css'),
10
);
add_action(
'wp_enqueue_scripts',
array($this, 'public_js'),
10
);

// admin assets
add_action(
'admin_enqueue_scripts',
array($this, 'admin_css'),
10,
1
);
add_action(
'admin_enqueue_scripts',
array($this, 'admin_js'),
10,
1
);

// localization
$this->setup_textdomain();
add_action(
'init',
array($this, 'localize'),
0
);
}

public function public_css() {
$name = $this->shortname . '-public';

wp_register_style(
$name,
$this->assets_url . 'css/public.css',
array(),
$this->version
);
wp_enqueue_style($name);
}

public function public_js() {
$name = $this->shortname . '-public';
wp_register_script(
$name,
$this->assets_url . 'js/public.js',
array('jquery'),
$this->version
);
wp_enqueue_script($name);
}

public function admin_css($hook = '') {
$name = $this->shortname . '-admin';
wp_register_style(
$name,
$this->assets_url . 'css/admin.css',
array(), $this->version
);
wp_enqueue_style($name);
}

public function admin_js($hook = '') {
$name = $this->shortname . '-admin';
wp_register_script(
$this->shortname . '-admin',
$this->assets_url . 'js/admin.js',
array('jquery'),
$this->version
);
wp_enqueue_script($name);
}

public function localize() {
load_plugin_textdomain(
$this->shortname,
false,
dirname(plugin_basename($this->file)) . '/lang/'
);
}

public function setup_textdomain() {
$domain = 'mailpoet';
$locale = apply_filters(
'plugin_locale',
get_locale(),
$domain
);

$language_path = WP_LANG_DIR
. '/'
. $domain
. '/'
. $domain
. '-'
. $locale
. '.mo';

load_textdomain($domain, $language_path);
load_plugin_textdomain(
$domain,
false,
dirname(plugin_basename($this->file)) . '/lang/'
);
}

public function install() {
$this->log_version_number();
}

private function log_version_number() {
update_option(
$this->shortname . '_version', $this->version
);
}
}
31 changes: 31 additions & 0 deletions mailpoet.php
@@ -0,0 +1,31 @@
<?php
if (!defined('ABSPATH')) exit;

/*
* Plugin Name: MailPoet
* Version: 1.0
* Plugin URI: http://www.mailpoet.com
* Description: MailPoet Newsletters.
* Author: MailPoet
* Author URI: http://www.mailpoet.com
* Requires at least: 4.0
* Tested up to: 4.0
*
* Text Domain: mailpoet
* Domain Path: /lang/
*
* @package WordPress
* @author MailPoet
* @since 1.0.0
*/

require_once('lib/mailpoet.php');

function mailpoet() {
return new MailPoet(array(
'file' => __FILE__,
'version' => '1.0.0'
));
}

mailpoet();
41 changes: 41 additions & 0 deletions readme.txt
@@ -0,0 +1,41 @@
=== MailPoet ===
Contributors: mailpoet
Donate link: http://mailpoet.com
Tags: wordpress, plugin
Requires at least: 4.0
Tested up to: 4.0
Stable tag: 1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

MailPoet newsletters.

== Description ==

Long description.

== Installation ==

Installation instructions.

== Screenshots ==

Screenshots.

== Frequently Asked Questions ==

= Question? =

Answer.

== Changelog ==

= 1.0 =
* 2020-01-01
* Initial release

== Upgrade Notice ==

= 1.0 =
* 2020-01-01
* Initial release
4 changes: 4 additions & 0 deletions uninstall.php
@@ -0,0 +1,4 @@
<?php
if (!defined('WP_UNINSTALL_PLUGIN')) exit;

// Runs on uninstallation, not on deactivation.

0 comments on commit d88d617

Please sign in to comment.