Skip to content

Commit

Permalink
Main structure
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchatfield committed Sep 20, 2013
0 parents commit cba25fd
Show file tree
Hide file tree
Showing 182 changed files with 14,581 additions and 0 deletions.
217 changes: 217 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
node_modules

#################
## Eclipse
#################

*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath


#################
## Visual Studio
#################

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml
*.pubxml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
App_Data/*.mdf
App_Data/*.ldf

#############
## Windows detritus
#############

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac crap
.DS_Store


#############
## Python
#############

*.py[co]

# Packages
*.egg
*.egg-info
dist/
build/
eggs/
parts/
var/
sdist/
develop-eggs/
.installed.cfg

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox

#Translations
*.mo

#Mr Developer
.mr.developer.cfg
Empty file added README
Empty file.
55 changes: 55 additions & 0 deletions admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
if( !class_exists('VPBackupAdmin') ) {

final class VPBackupAdmin {
private $namespace;

public function __construct() {
$this->namespace = 'vpbackup';
add_action('admin_menu', array($this, 'addMenuPages'), 0);
// Make sure the helper functions have been included.
require_once(dirname(__file__) . '/helpers.php');
}

public function addMenuPages() {
// Register the main page (that appears in the sidebar)
$page_title = __('Volcanic Pixels Backup', 'vpbackup');
$menu_title = __('VP Backup', 'vpbackup');
$capability = 'manage_options';
$menu_slug = $this->namespace;
$function = array($this, 'mainPage');
add_menu_page(
$page_title,
$menu_title,
$capability,
$menu_slug,
$function
);
}

// Dispatches to relevant page depending on whether the plugin is
// configured or not.
// ?plugin_installed - shows the helpful getting started guide
public function mainPage() {
$getting_started = true;

if (array_key_exists('plugin_installed', $_GET)) {
$getting_started = true;
}

if ($getting_started) {
return $this->gettingStartedPage();
}
}


/**
* Displays the "Getting started" page that asks the user whether
* they want to "setup backup", "restore from a backup" or "try the plugin".
*/
public function gettingStartedPage() {
$page = new VPBackup_Pages_GettingStarted();
$page->render();
}
}
}
22 changes: 22 additions & 0 deletions autoloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
class VPBackup_Autoloader {
public static function register() {
spl_autoload_register(array(new self, 'autoload'));
}

public static function autoload($class) {
if(0 !== strpos($class, 'VPBackup')) {
return;
}

$class = str_replace('VPBackup', '', $class);
$class = str_replace('_', '/', $class);
$class = strtolower($class);

$file = dirname(__FILE__) . $class . '/index.php';

if (is_file($file)) {
require($file);
}
}
}
45 changes: 45 additions & 0 deletions gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
gruntfile: {
src: 'gruntfile.js'
}
},
less: {
admin: {
options: {
sourceMap: true,
outputSourceFiles: true,
strictMath: true,
compress: true
},
files: {
"assets/styles.css": "index.less"
}
}
},
watch: {
gruntfile: {
files: 'gruntfile.js',
tasks: ['jshint:gruntfile']
},
less: {
files: ['/**/*.less'],
tasks: ['less']
}
}
});

// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');

// Default task(s).
grunt.registerTask('default', ['jshint', 'less']);
grunt.registerTask('test', ['jshint']);

};
26 changes: 26 additions & 0 deletions helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
// Provides various helper functions

/**
* Loads a php file relative to the plugin root.
* @param string $path The path relative to the current directory.
* Should start with a forward slash.
*/
function vp_load_file($path) {
require_once(dirname(__file__) . $path);
}

function vp_load_module($path) {
return vp_load_file('/' . $path . '/index.php');
}


/**
* Helper to render a template
* @param [type] $template the template e.g. pages/gettingstarted
* @param array $vars vars to pass to the template
* @return string the rendered template
*/
function vp_render_template($template, $vars = array()) {
return VPBackup::getTwig()->render($template, $vars);
}
11 changes: 11 additions & 0 deletions index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Stylesheet for wordpress-backup plugin by Volcanic Pixels
*
* For a maxified version browse to /wordpress-backup/index.less
*
* Copyright (c) 2013 Daniel Chatfield
*/

// Pages
@import "pages/base/style";

Loading

0 comments on commit cba25fd

Please sign in to comment.