Skip to content

Commit

Permalink
Remove Old coding structure and use wpbp file and directory structure…
Browse files Browse the repository at this point in the history
… and follow coding standard
  • Loading branch information
Satyanarayan Verma authored and Satyanarayan Verma committed Sep 23, 2015
1 parent b8920c6 commit 86f2586
Show file tree
Hide file tree
Showing 46 changed files with 1,577 additions and 339 deletions.
Binary file modified .DS_Store
Binary file not shown.
339 changes: 339 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions README.md

This file was deleted.

277 changes: 277 additions & 0 deletions admin/class-Boilerplate-admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
<?php

/**
* The admin-specific functionality of the plugin.
*
* @link http://www.matictechnology.com
* @since 1.0.0
*
* @package Boilerplate
* @subpackage Boilerplate/admin
*/

/**
* The admin-specific functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package Boilerplate
* @subpackage Boilerplate/admin
* @author Your Name <http://www.matictechnology.com>
*/
class Boilerplate_Admin {

/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $boilerplate The ID of this plugin.
*/
private $boilerplate;

/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;

/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $boilerplate The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $boilerplate, $version ) {
$this->boilerplate = $boilerplate;
$this->version = $version;

}

/**
* Register the stylesheets for the admin area.
*
* @since 1.0.0
*/
public function enqueue_styles() {

/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Plugin_Name_Loader as all of the hooks are defined
* in that particular class.
*
* The Plugin_Name_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/

wp_enqueue_style( $this->boilerplate, plugin_dir_url( __FILE__ ) . 'css/Boilerplate-admin.css', array(), $this->version, 'all' );
}

/**
* Register the JavaScript for the admin area.
*
* @since 1.0.0
*/
public function enqueue_scripts() {

/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Boilerplate_Loader as all of the hooks are defined
* in that particular class.
*
* The Boilerplate_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_script( $this->boilerplate, plugin_dir_url( __FILE__ ) . 'js/Boilerplate-admin.js', array( 'jquery' ), $this->version, false );
wp_enqueue_script( $this->boilerplate."1", plugin_dir_url( __FILE__ ) . 'js/jquery.min.js', array( 'jquery' ), $this->version, false );
wp_enqueue_script( $this->boilerplate."2", plugin_dir_url( __FILE__ ) . 'js/datepiker1/jquery.js', array( 'jquery' ), $this->version, false );
wp_enqueue_script( $this->boilerplate."3", plugin_dir_url( __FILE__ ) . 'js/datepiker1/jquery.datetimepicker.js', array( 'jquery' ), $this->version, false );
wp_enqueue_script( $this->boilerplate."4", plugin_dir_url( __FILE__ ) . 'js/datepiker1/custom.js', array( 'jquery' ), $this->version, false );


}


public function admin_init()
{
// TODO:Something here
} // END public static function activate


/**
* hook into WP's init action hook
*/
public function plugin_init()
{

/* TODO: Register our stylesheet. */
// wp_register_style( 'boilerplate-style', plugins_url('fullcalendar.css', __FILE__) );
// wp_register_style( 'boilerplate-style-print', plugins_url('fullcalendar.print.css', __FILE__) );
// TODO:Something here

} // END public static function activate

/**
* add a menu
*/
public function add_menu()
{
add_options_page('Boilerplate Plugin Settings', 'Boilerplate Plugin', 'manage_options', 'Boilerplate_Plugin', array(&$this, 'plugin_settings_page'));
} // END public function add_menu()


/**
* Menu Callback
*/
public function plugin_settings_page()
{
if(!current_user_can('manage_options'))
{
wp_die(__('You do not have sufficient permissions to access this page.'));
}

// TODO:Something here
// Render the settings template
include(sprintf("%s/templates/settings.php", dirname(__FILE__)));

} // END public function plugin_settings_page()



public function event_calender_callback($atts)
{
?>
<script>
jQuery(document).ready(function() {
jQuery('#calendar').fullCalendar({
defaultDate: new Date(),
editable: true,
eventLimit: true, // allow "more" link when too many events
events: <?php
include(sprintf("%s/templates/get-events.php", dirname(__FILE__)));
?>
});

});
</script>
<div id='calendar'></div>
<?php
} // END function

//Add meta fields

public function add_custom_meta_box( $post_type ){
$post_types = array( 'bp_calender' );
if ( in_array( $post_type, $post_types )) {
add_meta_box("event_start_date", "Create Event", array(&$this, "create_start_box"), $post_type, 'side', 'high' );
}

}//END fundtion

//show meta fields
public function create_start_box( $post ){
wp_nonce_field(basename(__FILE__), "meta-box-nonce");

// if(get_post_meta($post->ID, '_bp_calender_title', true) ){
// $meta_box_title = get_post_meta( $post->ID, '_bp_calender_title', true );
// }
// else{
// $meta_box_title = "";
// }

if(get_post_meta($post->ID, '_bp_calender_start_date', true) ){
$meta_box_start_date = get_post_meta( $post->ID, '_bp_calender_start_date', true );
}
else{
$meta_box_start_date = "";
}

if(get_post_meta($post->ID, '_bp_calender_end_date', true ) ){
$meta_box_end_date = get_post_meta( $post->ID, '_bp_calender_end_date', true );
}
else{
$meta_box_end_date = "";
}

if(get_post_meta($post->ID, '_bpj_calender_end_date', true) ){
$meta_box_url = get_post_meta( $post->ID, '_bp_calender_url', true );
}
else{
$meta_box_url = "";
}

// Use get_post_meta to retrieve an existing value from the database.
?>
<table>
<!--<tr>
<td><label>Event :&nbsp;</label></td><td><input type="text" size="14px" name="meta_box_title" id="meta_box_title" value="<?php if($meta_box_title){ echo $meta_box_title; } ?>" /></td>
</tr>-->
<tr>
<td><label>Start From :&nbsp;</label></td><td><input type="text" name="meta_box_start_date" id="meta_box_start_date" size="14px" value="<?php echo $meta_box_start_date; ?>" /></td>
</tr>
<tr>
<td><label>Open Till :&nbsp;</label></td><td><input type="text" name="meta_box_end_date" id="meta_box_end_date" size="14px" value="<?php echo $meta_box_end_date; ?>"/></td>
</tr>
<tr>
<td><label>URL :&nbsp;</label></td><td><input type="text" name="meta_box_url" id="meta_box_url" size="14px" value="<?php echo $meta_box_url; ?>" placeholder="http://"/></td>
</tr>
</table>
<?php
}//END fundtion

//save mata fields
function save_created_meta_box( $post_id ){
if ( array_key_exists('meta_box_title', $_POST ) ) {
update_post_meta( $post_id,
'_bp_calender_title',
$_POST['meta_box_title']
);
}
if ( array_key_exists('meta_box_start_date', $_POST ) ) {
update_post_meta( $post_id,
'_bp_calender_start_date',
$_POST['meta_box_start_date']
);
}
if ( array_key_exists('meta_box_end_date', $_POST ) ) {
update_post_meta( $post_id,
'_bp_calender_end_date',
$_POST['meta_box_end_date']
);
}
if ( array_key_exists('meta_box_url', $_POST ) ) {
update_post_meta( $post_id,
'_bp_calender_url',
$_POST['meta_box_url']
);
}
}//END function


// Create Custom post type for calender
function create_posttype_calander() {
register_post_type( 'bp_calender',
array(
'labels' => array(
'name' => __( 'Calenders' ),
'singular_name' => __( 'Calnder' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'calenders'),
)
);
}

}
4 changes: 4 additions & 0 deletions admin/css/Boilerplate-admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* All of the CSS for your admin-specific functionality should be
* included in this file.
*/
Empty file added admin/index.php
Empty file.
32 changes: 32 additions & 0 deletions admin/js/Boilerplate-admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(function( $ ) {
'use strict';

/**
* All of the code for your admin-specific JavaScript source
* should reside in this file.
*
* Note that this assume you're going to use jQuery, so it prepares
* the $ function reference to be used within the scope of this
* function.
*
* From here, you're able to define handlers for when the DOM is
* ready:
*
* $(function() {
*
* });
*
* Or when the window is loaded:
*
* $( window ).load(function() {
*
* });
*
* ...and so on.
*
* Remember that ideally, we should not attach any more than a single DOM-ready or window-load handler
* for any particular page. Though other scripts in WordPress core, other plugins, and other themes may
* be doing this, we should try to minimize doing that in our own work.
*/

})( jQuery );
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions admin/partials/plugin-name-admin-display.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/**
* Provide a admin area view for the plugin
*
* This file is used to markup the admin-facing aspects of the plugin.
*
* @link http://example.com
* @since 1.0.0
*
* @package Plugin_Name
* @subpackage Plugin_Name/admin/partials
*/
?>

<!-- This file should primarily consist of HTML with a little bit of PHP. -->
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 86f2586

Please sign in to comment.