Commit 27b0ba82 authored by Varun Sridharan's avatar Varun Sridharan

* Changes By Varun

* Added Function To Get Overrided Template Names
* CleandUp class-admin-init.php
* Added 2 News Menus (Sys Info, Tools)
* Removed Unwanted Files (8)
* Added Table Listing Of System View
* Minor Bug Fix
parent a8e3d7d4
<?php
/**
* Posts List Table class.
*
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
* @access private
*/
class WC_Quick_Donation_Listing_Table extends WP_List_Table {
protected $hierarchical_display;
protected $comment_pending_count;
private $user_posts_count;
private $sticky_posts_count = 0;
private $post_query;
public function __construct($query) {
global $post_type_object, $wpdb;
parent::__construct( array(
'plural' => 'posts',
'screen' => get_current_screen(),
) );
$this->screen->post_type = 'shop_order';
$post_type = $this->screen->post_type;
$post_type_object = get_post_type_object( $post_type );
$this->user_posts_count = 0;
$this->sticky_posts_count = 0;
$this->post_query = $query;
}
public function ajax_user_can() {
return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts );
}
public function prepare_items() {
global $avail_post_stati, $per_page, $mode;
$avail_post_stati = wp_edit_posts_query();
$this->hierarchical_display = ( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' == $this->post_query->query['orderby'] );
$total_items = $this->hierarchical_display ? $this->post_query->post_count : $this->post_query->found_posts;
$post_type = $this->screen->post_type;
$per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
/** This filter is documented in wp-admin/includes/post.php */
$per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
if ( $this->hierarchical_display )
$total_pages = ceil( $total_items / $per_page );
else
$total_pages = $this->post_query->max_num_pages;
if ( ! empty( $_REQUEST['mode'] ) ) {
$mode = $_REQUEST['mode'] == 'excerpt' ? 'excerpt' : 'list';
set_user_setting ( 'posts_list_mode', $mode );
} else {
$mode = get_user_setting ( 'posts_list_mode', 'list' );
}
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
$this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] == 'trash';
$this->set_pagination_args( array(
'total_items' => $total_items,
'total_pages' => $total_pages,
'per_page' => $per_page
) );
}
public function has_items() {
return have_posts();
}
public function no_items() {
if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] )
echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash;
else
echo get_post_type_object( $this->screen->post_type )->labels->not_found;
}
protected function get_views() {
global $locked_post_status, $avail_post_stati;
$post_type = $this->screen->post_type;
if ( !empty($locked_post_status) )
return array();
$status_links = array();
$num_posts = wp_count_posts( $post_type, 'readable' );
$class = '';
$allposts = '';
$current_user_id = get_current_user_id();
if ( $this->user_posts_count ) {
if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user_id ) )
$class = ' class="current"';
$status_links['mine'] = "<a href='edit.php?post_type=$post_type&author=$current_user_id'$class>" . sprintf( _nx( 'Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $this->user_posts_count, 'posts' ), number_format_i18n( $this->user_posts_count ) ) . '</a>';
$allposts = '&all_posts=1';
}
$total_posts = array_sum( (array) $num_posts );
// Subtract post types that are not included in the admin all list.
foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
$total_posts -= $num_posts->$state;
$class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
$status_links['all'] = "<a href='edit.php?post_type=$post_type{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
$class = '';
$status_name = $status->name;
if ( !in_array( $status_name, $avail_post_stati ) )
continue;
if ( empty( $num_posts->$status_name ) )
continue;
if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )
$class = ' class="current"';
$status_links[$status_name] = "<a href='edit.php?post_status=$status_name&amp;post_type=$post_type'$class>" . sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
}
if ( ! empty( $this->sticky_posts_count ) ) {
$class = ! empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
$sticky_link = array( 'sticky' => "<a href='edit.php?post_type=$post_type&amp;show_sticky=1'$class>" . sprintf( _nx( 'Sticky <span class="count">(%s)</span>', 'Sticky <span class="count">(%s)</span>', $this->sticky_posts_count, 'posts' ), number_format_i18n( $this->sticky_posts_count ) ) . '</a>' );
// Sticky comes after Publish, or if not listed, after All.
$split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) );
$status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
}
return $status_links;
}
protected function get_bulk_actions() {
$actions = array();
$post_type_obj = get_post_type_object( $this->screen->post_type );
if ( $this->is_trash ) {
$actions['untrash'] = __( 'Restore' );
} else {
$actions['edit'] = __( 'Edit' );
}
if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) {
$actions['delete'] = __( 'Delete Permanently' );
} else {
$actions['trash'] = __( 'Move to Trash' );
}
}
return $actions;
}
/**
* @global int $cat
* @param string $which
*/
protected function extra_tablenav( $which ) {
global $cat;
?>
<div class="alignleft actions">
<?php
if ( 'top' == $which && !is_singular() ) {
$this->months_dropdown( $this->screen->post_type );
if ( is_object_in_taxonomy( $this->screen->post_type, 'category' ) ) {
$dropdown_options = array(
'show_option_all' => __( 'All categories' ),
'hide_empty' => 0,
'hierarchical' => 1,
'show_count' => 0,
'orderby' => 'name',
'selected' => $cat
);
echo '<label class="screen-reader-text" for="cat">' . __( 'Filter by category' ) . '</label>';
wp_dropdown_categories( $dropdown_options );
}
$this->get_donation_projects();
/**
* Fires before the Filter button on the Posts and Pages list tables.
*
* The Filter button allows sorting by date and/or category on the
* Posts list table, and sorting by date on the Pages list table.
*
* @since 2.1.0
*/
do_action( 'restrict_manage_posts' );
submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
}
if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) {
submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
}
?>
</div>
<?php
}
public function get_donation_projects(){
$args = array(
'post_type' => WC_QD_PT,
'post_status' => 'publish',
'ignore_sticky_posts' => 0,
'posts_per_page' => '0',
'fields' => 'ids'
);
$products = new WP_Query($args);
echo '<select name="dproj" id="donation_project" class="enhanced">';
echo '<option value=""> '.__('Donation Project',WC_QD_TXT).'</option>';
foreach($products->get_posts() as $id){
echo '<option value="'.$id.'"> '.get_the_title($id).'</option>';
}
echo '</select>';
}
public function current_action() {
if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
return 'delete_all';
return parent::current_action();
}
/**
* @global string $mode
* @param string $which
*/
protected function pagination( $which ) {
global $mode;
parent::pagination( $which );
if ( 'top' == $which && ! is_post_type_hierarchical( $this->screen->post_type ) )
$this->view_switcher( $mode );
}
protected function get_table_classes() {
return array( 'widefat', 'fixed', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
}
public function get_columns() {
$post_type = $this->screen->post_type;
$posts_columns = array();
$posts_columns['cb'] = '<input type="checkbox" />';
/* translators: manage posts column name */
$posts_columns['title'] = _x( 'Title', 'column name' );
if ( post_type_supports( $post_type, 'author' ) ) {
$posts_columns['author'] = __( 'Author' );
}
$taxonomies = get_object_taxonomies( $post_type, 'objects' );
$taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' );
/**
* Filter the taxonomy columns in the Posts list table.
*
* The dynamic portion of the hook name, `$post_type`, refers to the post
* type slug.
*
* @since 3.5.0
*
* @param array $taxonomies Array of taxonomies to show columns for.
* @param string $post_type The post type.
*/
$taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type );
$taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
foreach ( $taxonomies as $taxonomy ) {
if ( 'category' == $taxonomy )
$column_key = 'categories';
elseif ( 'post_tag' == $taxonomy )
$column_key = 'tags';
else
$column_key = 'taxonomy-' . $taxonomy;
$posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
}
$post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) )
$posts_columns['comments'] = '<span class="vers"><span title="' . esc_attr__( 'Comments' ) . '" class="comment-grey-bubble"></span></span>';
$posts_columns['date'] = __( 'Date' );
if ( 'page' == $post_type ) {
/**
* Filter the columns displayed in the Pages list table.
*
* @since 2.5.0
*
* @param array $post_columns An array of column names.
*/
$posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
} else {
/**
* Filter the columns displayed in the Posts list table.
*
* @since 1.5.0
*
* @param array $posts_columns An array of column names.
* @param string $post_type The post type slug.
*/
$posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
}
/**
* Filter the columns displayed in the Posts list table for a specific post type.
*
* The dynamic portion of the hook name, `$post_type`, refers to the post type slug.
*
* @since 3.0.0
*
* @param array $post_columns An array of column names.
*/
$posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
return $posts_columns;
}
protected function get_sortable_columns() {
return array(
'title' => 'title',
'parent' => 'parent',
'comments' => 'comment_count',
'date' => array( 'date', true )
);
}
/**
* @global WP_Query $wp_query
* @global int $per_page
* @param array $posts
* @param int $level
*/
public function display_rows( $posts = array(), $level = 0 ) {
global $wp_query, $per_page;
if ( empty( $posts ) )
$posts = $this->post_query->posts;
add_filter( 'the_title', 'esc_html' );
if ( $this->hierarchical_display ) {
$this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page );
} else {
$this->_display_rows( $posts, $level );
}
}
/**
* @global string $mode
* @param array $posts
* @param int $level
*/
private function _display_rows( $posts, $level = 0 ) {
global $mode;
// Create array of post IDs.
$post_ids = array();
foreach ( $posts as $a_post )
$post_ids[] = $a_post->ID;
$this->comment_pending_count = get_pending_comments_num( $post_ids );
foreach ( $posts as $post )
$this->single_row( $post, $level );
}
/**
* @global wpdb $wpdb
* @param array $pages
* @param int $pagenum
* @param int $per_page
* @return bool|null
*/
private function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
global $wpdb;
$level = 0;
if ( ! $pages ) {
$pages = get_pages( array( 'sort_column' => 'menu_order' ) );
if ( ! $pages )
return false;
}
/*
* Arrange pages into two parts: top level pages and children_pages
* children_pages is two dimensional array, eg.
* children_pages[10][] contains all sub-pages whose parent is 10.
* It only takes O( N ) to arrange this and it takes O( 1 ) for subsequent lookup operations
* If searching, ignore hierarchy and treat everything as top level
*/
if ( empty( $_REQUEST['s'] ) ) {
$top_level_pages = array();
$children_pages = array();
foreach ( $pages as $page ) {
// Catch and repair bad pages.
if ( $page->post_parent == $page->ID ) {
$page->post_parent = 0;
$this->post_query->update( $this->post_query->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) );
clean_post_cache( $page );
}
if ( 0 == $page->post_parent )
$top_level_pages[] = $page;
else
$children_pages[ $page->post_parent ][] = $page;
}
$pages = &$top_level_pages;
}
$count = 0;
$start = ( $pagenum - 1 ) * $per_page;
$end = $start + $per_page;
foreach ( $pages as $page ) {
if ( $count >= $end )
break;
if ( $count >= $start ) {
echo "\t";
$this->single_row( $page, $level );
}
$count++;
if ( isset( $children_pages ) )
$this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
}
// If it is the last pagenum and there are orphaned pages, display them with paging as well.
if ( isset( $children_pages ) && $count < $end ){
foreach ( $children_pages as $orphans ){
foreach ( $orphans as $op ) {
if ( $count >= $end )
break;
if ( $count >= $start ) {
echo "\t";
$this->single_row( $op, 0 );
}
$count++;
}
}
}
}
/**
* Given a top level page ID, display the nested hierarchy of sub-pages
* together with paging support
*
* @since 3.1.0 (Standalone function exists since 2.6.0)
*
* @param array $children_pages
* @param int $count
* @param int $parent
* @param int $level
* @param int $pagenum
* @param int $per_page
*/
private function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
if ( ! isset( $children_pages[$parent] ) )
return;
$start = ( $pagenum - 1 ) * $per_page;
$end = $start + $per_page;
foreach ( $children_pages[$parent] as $page ) {
if ( $count >= $end )
break;
// If the page starts in a subtree, print the parents.
if ( $count == $start && $page->post_parent > 0 ) {
$my_parents = array();
$my_parent = $page->post_parent;
while ( $my_parent ) {
$my_parent = get_post( $my_parent );
$my_parents[] = $my_parent;
if ( !$my_parent->post_parent )
break;
$my_parent = $my_parent->post_parent;
}
$num_parents = count( $my_parents );
while ( $my_parent = array_pop( $my_parents ) ) {
echo "\t";
$this->single_row( $my_parent, $level - $num_parents );
$num_parents--;
}
}
if ( $count >= $start ) {
echo "\t";
$this->single_row( $page, $level );
}
$count++;
$this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
}
unset( $children_pages[$parent] ); //required in order to keep track of orphans
}
/**
* @global string $mode
* @staticvar string $alternate
* @param WP_Post $post
* @param int $level
*/
public function single_row( $post, $level = 0 ) {
global $mode;
static $alternate;
$global_post = get_post();
$GLOBALS['post'] = $post;
setup_postdata( $post );
$edit_link = get_edit_post_link( $post->ID );
$title = _draft_or_post_title();
$post_type_object = get_post_type_object( $post->post_type );
$can_edit_post = current_user_can( 'edit_post', $post->ID );
$alternate = 'alternate' == $alternate ? '' : 'alternate';
$classes = $alternate . ' iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
$lock_holder = wp_check_post_lock( $post->ID );
if ( $lock_holder ) {
$classes .= ' wp-locked';
$lock_holder = get_userdata( $lock_holder );
}
if ( $post->post_parent ) {
$count = count( get_post_ancestors( $post->ID ) );
$classes .= ' level-'. $count;
} else {
$classes .= ' level-0';
}
?>
<tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
<?php
list( $columns, $hidden ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) {
$class = "class=\"$column_name column-$column_name\"";
$style = '';
if ( in_array( $column_name, $hidden ) )
$style = ' style="display:none;"';
$attributes = "$class$style";
switch ( $column_name ) {
case 'cb':
?>
<th scope="row" class="check-column">
<?php
if ( $can_edit_post ) {
?>
<label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php printf( __( 'Select %s' ), $title ); ?></label>
<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
<div class="locked-indicator"></div>
<?php
}
?>
</th>
<?php
break;
case 'title':
$attributes = 'class="post-title page-title column-title"' . $style;
if ( $this->hierarchical_display ) {
if ( 0 == $level && (int) $post->post_parent > 0 ) {
// Sent level 0 by accident, by default, or because we don't know the actual level.
$find_main_page = (int) $post->post_parent;
while ( $find_main_page > 0 ) {
$parent = get_post( $find_main_page );
if ( is_null( $parent ) )
break;
$level++;
$find_main_page = (int) $parent->post_parent;
if ( !isset( $parent_name ) ) {
/** This filter is documented in wp-includes/post-template.php */
$parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
}
}
}
}
$pad = str_repeat( '&#8212; ', $level );
echo "<td $attributes><strong>";
if ( $format = get_post_format( $post->ID ) ) {
$label = get_post_format_string( $format );
echo '<a href="' . esc_url( add_query_arg( array( 'post_format' => $format, 'post_type' => $post->post_type ), 'edit.php' ) ) . '" class="post-state-format post-format-icon post-format-' . $format . '" title="' . $label . '">' . $label . ":</a> ";
}
if ( $can_edit_post && $post->post_status != 'trash' ) {
echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . $pad . $title . '</a>';
} else {
echo $pad . $title;
}
_post_states( $post );
if ( isset( $parent_name ) )
echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
echo "</strong>\n";
if ( $can_edit_post && $post->post_status != 'trash' ) {
if ( $lock_holder ) {
$locked_avatar = get_avatar( $lock_holder->ID, 18 );
$locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
} else {
$locked_avatar = $locked_text = '';
}
echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
}
if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
the_excerpt();
$actions = array();
if ( $can_edit_post && 'trash' != $post->post_status ) {
$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
}
if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( 'trash' == $post->post_status )
$actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
elseif ( EMPTY_TRASH_DAYS )
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
}
if ( $post_type_object->public ) {
if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
if ( $can_edit_post ) {
$preview_link = set_url_scheme( get_permalink( $post->ID ) );
/** This filter is documented in wp-admin/includes/meta-boxes.php */
$preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
$actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
}
} elseif ( 'trash' != $post->post_status ) {
$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
}
}
if ( is_post_type_hierarchical( $post->post_type ) ) {
/**
* Filter the array of row action links on the Pages list table.
*
* The filter is evaluated only for hierarchical post types.
*
* @since 2.8.0
*
* @param array $actions An array of row action links. Defaults are
* 'Edit', 'Quick Edit', 'Restore, 'Trash',
* 'Delete Permanently', 'Preview', and 'View'.
* @param WP_Post $post The post object.
*/
$actions = apply_filters( 'page_row_actions', $actions, $post );
} else {
/**
* Filter the array of row action links on the Posts list table.
*
* The filter is evaluated only for non-hierarchical post types.
*
* @since 2.8.0
*
* @param array $actions An array of row action links. Defaults are
* 'Edit', 'Quick Edit', 'Restore, 'Trash',
* 'Delete Permanently', 'Preview', and 'View'.
* @param WP_Post $post The post object.
*/
$actions = apply_filters( 'post_row_actions', $actions, $post );
}
echo $this->row_actions( $actions );
get_inline_data( $post );
echo '</td>';
break;
case 'date':
if ( '0000-00-00 00:00:00' == $post->post_date ) {
$t_time = $h_time = __( 'Unpublished' );
$time_diff = 0;
} else {
$t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
$m_time = $post->post_date;
$time = get_post_time( 'G', true, $post );
$time_diff = time() - $time;
if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS )
$h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
else
$h_time = mysql2date( __( 'Y/m/d' ), $m_time );
}
echo '<td ' . $attributes . '>';
if ( 'excerpt' == $mode ) {
/**
* Filter the published time of the post.
*
* If $mode equals 'excerpt', the published time and date are both displayed.
* If $mode equals 'list' (default), the publish date is displayed, with the
* time and date together available as an abbreviation definition.
*
* @since 2.5.1
*
* @param array $t_time The published time.
* @param WP_Post $post Post object.
* @param string $column_name The column name.
* @param string $mode The list display mode ('excerpt' or 'list').
*/
echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
} else {
/** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
}
echo '<br />';
if ( 'publish' == $post->post_status ) {
_e( 'Published' );
} elseif ( 'future' == $post->post_status ) {
if ( $time_diff > 0 )
echo '<strong class="attention">' . __( 'Missed schedule' ) . '</strong>';
else
_e( 'Scheduled' );
} else {
_e( 'Last Modified' );
}
echo '</td>';
break;
case 'comments':
?>
<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
<?php
$pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
$this->comments_bubble( $post->ID, $pending_comments );
?>
</div></td>
<?php
break;
case 'author':
?>
<td <?php echo $attributes ?>><?php
printf( '<a href="%s">%s</a>',
esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
get_the_author()
);
?></td>
<?php
break;
default:
if ( 'categories' == $column_name )
$taxonomy = 'category';
elseif ( 'tags' == $column_name )
$taxonomy = 'post_tag';
elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
$taxonomy = substr( $column_name, 9 );
else
$taxonomy = false;
if ( $taxonomy ) {
$taxonomy_object = get_taxonomy( $taxonomy );
echo '<td ' . $attributes . '>';
if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
$out = array();
foreach ( $terms as $t ) {
$posts_in_term_qv = array();
if ( 'post' != $post->post_type )
$posts_in_term_qv['post_type'] = $post->post_type;
if ( $taxonomy_object->query_var ) {
$posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
} else {
$posts_in_term_qv['taxonomy'] = $taxonomy;
$posts_in_term_qv['term'] = $t->slug;
}
$out[] = sprintf( '<a href="%s">%s</a>',
esc_url( add_query_arg( $posts_in_term_qv, 'edit.php' ) ),
esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
);
}
/* translators: used between list items, there is a space after the comma */
echo join( __( ', ' ), $out );
} else {
echo '&#8212;';
}
echo '</td>';
break;
}
?>
<td <?php echo $attributes ?>><?php
if ( is_post_type_hierarchical( $post->post_type ) ) {
/**
* Fires in each custom column on the Posts list table.
*
* This hook only fires if the current post type is hierarchical,
* such as pages.
*
* @since 2.5.0
*
* @param string $column_name The name of the column to display.
* @param int $post_id The current post ID.
*/
do_action( 'manage_pages_custom_column', $column_name, $post->ID );
} else {
/**
* Fires in each custom column in the Posts list table.
*
* This hook only fires if the current post type is non-hierarchical,
* such as posts.
*
* @since 1.5.0
*
* @param string $column_name The name of the column to display.
* @param int $post_id The current post ID.
*/
do_action( 'manage_posts_custom_column', $column_name, $post->ID );
}
/**
* Fires for each custom column of a specific post type in the Posts list table.
*
* The dynamic portion of the hook name, `$post->post_type`, refers to the post type.
*
* @since 3.1.0
*
* @param string $column_name The name of the column to display.
* @param int $post_id The current post ID.
*/
do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
?></td>
<?php
break;
}
}
?>
</tr>
<?php
$GLOBALS['post'] = $global_post;
}
/**
* Outputs the hidden row displayed when inline editing
*
* @since 3.1.0
*/
public function inline_edit() {
global $mode;
$screen = $this->screen;
$post = get_default_post_to_edit( $screen->post_type );
$post_type_object = get_post_type_object( $screen->post_type );
$taxonomy_names = get_object_taxonomies( $screen->post_type );
$hierarchical_taxonomies = array();
$flat_taxonomies = array();
foreach ( $taxonomy_names as $taxonomy_name ) {
$taxonomy = get_taxonomy( $taxonomy_name );
if ( !$taxonomy->show_ui )
continue;
if ( $taxonomy->hierarchical )
$hierarchical_taxonomies[] = $taxonomy;
else
$flat_taxonomies[] = $taxonomy;
}
$m = ( isset( $mode ) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
$can_publish = current_user_can( $post_type_object->cap->publish_posts );
$core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
?>
<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
<?php
$hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';
$bulk = 0;
while ( $bulk < 2 ) { ?>
<tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-" . $screen->post_type;
echo $bulk ? " bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}" : " quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}";
?>" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
<fieldset class="inline-edit-col-left"><div class="inline-edit-col">
<h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
<?php
if ( post_type_supports( $screen->post_type, 'title' ) ) :
if ( $bulk ) : ?>
<div id="bulk-title-div">
<div id="bulk-titles"></div>
</div>
<?php else : // $bulk ?>
<label>
<span class="title"><?php _e( 'Title' ); ?></span>
<span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
</label>
<label>
<span class="title"><?php _e( 'Slug' ); ?></span>
<span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
</label>
<?php endif; // $bulk
endif; // post_type_supports title ?>
<?php if ( !$bulk ) : ?>
<label><span class="title"><?php _e( 'Date' ); ?></span></label>
<div class="inline-edit-date">
<?php touch_time( 1, 1, 0, 1 ); ?>
</div>
<br class="clear" />
<?php endif; // $bulk
if ( post_type_supports( $screen->post_type, 'author' ) ) :
$authors_dropdown = '';
if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
$users_opt = array(
'hide_if_only_one_author' => false,
'who' => 'authors',
'name' => 'post_author',
'class'=> 'authors',
'multi' => 1,
'echo' => 0
);
if ( $bulk )
$users_opt['show_option_none'] = __( '&mdash; No Change &mdash;' );
if ( $authors = wp_dropdown_users( $users_opt ) ) :
$authors_dropdown = '<label class="inline-edit-author">';
$authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
$authors_dropdown .= $authors;
$authors_dropdown .= '</label>';
endif;
endif; // authors
?>
<?php if ( !$bulk ) echo $authors_dropdown;
endif; // post_type_supports author
if ( !$bulk && $can_publish ) :
?>
<div class="inline-edit-group">
<label class="alignleft">
<span class="title"><?php _e( 'Password' ); ?></span>
<span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
</label>
<em style="margin:5px 10px 0 0" class="alignleft">
<?php
/* translators: Between password field and private checkbox on post quick edit interface */
echo __( '&ndash;OR&ndash;' );
?>
</em>
<label class="alignleft inline-edit-private">
<input type="checkbox" name="keep_private" value="private" />
<span class="checkbox-title"><?php echo __( 'Private' ); ?></span>
</label>
</div>
<?php endif; ?>
</div></fieldset>
<?php if ( count( $hierarchical_taxonomies ) && !$bulk ) : ?>
<fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
<span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
<input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
<ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist">
<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
</ul>
<?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>
</div></fieldset>
<?php endif; // count( $hierarchical_taxonomies ) && !$bulk ?>
<fieldset class="inline-edit-col-right"><div class="inline-edit-col">
<?php
if ( post_type_supports( $screen->post_type, 'author' ) && $bulk )
echo $authors_dropdown;
if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :
if ( $post_type_object->hierarchical ) :
?>
<label>
<span class="title"><?php _e( 'Parent' ); ?></span>
<?php
$dropdown_args = array(
'post_type' => $post_type_object->name,
'selected' => $post->post_parent,
'name' => 'post_parent',
'show_option_none' => __( 'Main Page (no parent)' ),
'option_none_value' => 0,
'sort_column' => 'menu_order, post_title',
);
if ( $bulk )
$dropdown_args['show_option_no_change'] = __( '&mdash; No Change &mdash;' );
/**
* Filter the arguments used to generate the Quick Edit page-parent drop-down.
*
* @since 2.7.0
*
* @see wp_dropdown_pages()
*
* @param array $dropdown_args An array of arguments.
*/
$dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
wp_dropdown_pages( $dropdown_args );
?>
</label>
<?php
endif; // hierarchical
if ( !$bulk ) : ?>
<label>
<span class="title"><?php _e( 'Order' ); ?></span>
<span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
</label>
<?php endif; // !$bulk
if ( 'page' == $screen->post_type ) :
?>
<label>
<span class="title"><?php _e( 'Template' ); ?></span>
<select name="page_template">
<?php if ( $bulk ) : ?>
<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
<?php endif; // $bulk ?>
<?php
/** This filter is documented in wp-admin/includes/meta-boxes.php */
$default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'quick-edit' );
?>
<option value="default"><?php echo esc_html( $default_title ); ?></option>
<?php page_template_dropdown() ?>
</select>
</label>
<?php
endif; // page post_type
endif; // page-attributes
?>
<?php if ( count( $flat_taxonomies ) && !$bulk ) : ?>
<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
<?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?>
<label class="inline-edit-tags">
<span class="title"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
<textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr( $taxonomy->name )?>]" class="tax_input_<?php echo esc_attr( $taxonomy->name )?>"></textarea>
</label>
<?php endif; ?>
<?php endforeach; //$flat_taxonomies as $taxonomy ?>
<?php endif; // count( $flat_taxonomies ) && !$bulk ?>
<?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
if ( $bulk ) : ?>
<div class="inline-edit-group">
<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
<label class="alignleft">
<span class="title"><?php _e( 'Comments' ); ?></span>
<select name="comment_status">
<option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
<option value="open"><?php _e( 'Allow' ); ?></option>
<option value="closed"><?php _e( 'Do not allow' ); ?></option>
</select>
</label>
<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
<label class="alignright">
<span class="title"><?php _e( 'Pings' ); ?></span>
<select name="ping_status">
<option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
<option value="open"><?php _e( 'Allow' ); ?></option>
<option value="closed"><?php _e( 'Do not allow' ); ?></option>
</select>
</label>
<?php endif; ?>
</div>
<?php else : // $bulk ?>
<div class="inline-edit-group">
<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
<label class="alignleft">
<input type="checkbox" name="comment_status" value="open" />
<span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
</label>
<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
<label class="alignleft">
<input type="checkbox" name="ping_status" value="open" />
<span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
</label>
<?php endif; ?>
</div>
<?php endif; // $bulk
endif; // post_type_supports comments or pings ?>
<div class="inline-edit-group">
<label class="inline-edit-status alignleft">
<span class="title"><?php _e( 'Status' ); ?></span>
<select name="_status">
<?php if ( $bulk ) : ?>
<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
<?php endif; // $bulk ?>
<?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
<option value="publish"><?php _e( 'Published' ); ?></option>
<option value="future"><?php _e( 'Scheduled' ); ?></option>
<?php if ( $bulk ) : ?>
<option value="private"><?php _e( 'Private' ) ?></option>
<?php endif; // $bulk ?>
<?php endif; ?>
<option value="pending"><?php _e( 'Pending Review' ); ?></option>
<option value="draft"><?php _e( 'Draft' ); ?></option>
</select>
</label>
<?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
<?php if ( $bulk ) : ?>
<label class="alignright">
<span class="title"><?php _e( 'Sticky' ); ?></span>
<select name="sticky">
<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
<option value="sticky"><?php _e( 'Sticky' ); ?></option>
<option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
</select>
</label>
<?php else : // $bulk ?>
<label class="alignleft">
<input type="checkbox" name="sticky" value="sticky" />
<span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
</label>
<?php endif; // $bulk ?>
<?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?>
</div>
<?php
if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) {
$post_formats = get_theme_support( 'post-formats' );
?>
<label class="alignleft" for="post_format">
<span class="title"><?php _ex( 'Format', 'post format' ); ?></span>
<select name="post_format">
<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
<option value="0"><?php echo get_post_format_string( 'standard' ); ?></option>
<?php
foreach ( $post_formats[0] as $format ) {
?>
<option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option>
<?php
}
?>
</select></label>
<?php
}
?>
</div></fieldset>
<?php
list( $columns ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) {
if ( isset( $core_columns[$column_name] ) )
continue;
if ( $bulk ) {
/**
* Fires once for each column in Bulk Edit mode.
*
* @since 2.7.0
*
* @param string $column_name Name of the column to edit.
* @param WP_Post $post_type The post type slug.
*/
do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type );
} else {
/**
* Fires once for each column in Quick Edit mode.
*
* @since 2.7.0
*
* @param string $column_name Name of the column to edit.
* @param WP_Post $post_type The post type slug.
*/
do_action( 'quick_edit_custom_box', $column_name, $screen->post_type );
}
}
?>
<p class="submit inline-edit-save">
<a accesskey="c" href="#inline-edit" class="button-secondary cancel alignleft"><?php _e( 'Cancel' ); ?></a>
<?php if ( ! $bulk ) {
wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
?>
<a accesskey="s" href="#inline-edit" class="button-primary save alignright"><?php _e( 'Update' ); ?></a>
<span class="spinner"></span>
<?php } else {
submit_button( __( 'Update' ), 'button-primary alignright', 'bulk_edit', false, array( 'accesskey' => 's' ) );
} ?>
<input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
<input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
<?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) { ?>
<input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
<?php } ?>
<span class="error" style="display:none"></span>
<br class="clear" />
</p>
</td></tr>
<?php
$bulk++;
}
?>
</tbody></table></form>
<?php
}
}
function tt_render_list_page($shop){
$wc_qd_donation_orders_listing = new WC_Quick_Donation_Listing_Table($shop);
$wc_qd_donation_orders_listing->prepare_items();
?>
<div class="wrap">
<div id="icon-users" class="icon32"><br/></div>
<h2>Donations</h2>
<form id="movies-filter" method="get">
<input type="hidden" name="post_type" value="<?php echo $_REQUEST['post_type'] ?>" />
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
<?php $wc_qd_donation_orders_listing->display() ?>
</form>
</div>
<?php } ?>
\ No newline at end of file
......@@ -70,5 +70,38 @@ class WooCommerce_Quick_Donation_Admin_Function {
}
}
return $actions;
}
}
public function get_OverRided(){
$template_files = WC_QD_INSTALL::get_template_list();
$overrided = array();
if(is_array($template_files)){
foreach($template_files as $file){
$theme_file = false;
if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
$theme_file = get_stylesheet_directory() . '/' . $file;
} elseif ( file_exists( get_stylesheet_directory() . WC_QD_THEME_TEMPLATE . $file ) ) {
$theme_file = get_stylesheet_directory() . WC_QD_THEME_TEMPLATE . $file;
} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
$theme_file = get_template_directory() . '/' . $file;
} elseif( file_exists( get_template_directory() . WC_QD_THEME_TEMPLATE . $file ) ) {
$theme_file = get_template_directory() . WC_QD_THEME_TEMPLATE . $file;
}
if ( $theme_file !== false ) {
$core_version = WC_Admin_Status::get_file_version(WC_QD_TEMPLATE.$file);
$theme_version = WC_Admin_Status::get_file_version( $theme_file );
if ( $core_version && $theme_version && version_compare( $theme_version, $core_version, '<' ) ) {
$overrided[] = array('file' => $file,'corev' => $core_version , 'themev' => $theme_version, 'is_old' => true);
} else {
$overrided[] = array('file' => $file,'corev' => $core_version , 'themev' => $theme_version, 'is_old' => false);
}
}
}
}
return $overrided;
}
}
\ No newline at end of file
......@@ -26,11 +26,19 @@ class WooCommerce_Quick_Donation_Admin {
$this->init_hooks();
}
public function add_notice(){
wc_qd_notice(sprintf('<p>%s</p> <p class="submit"><a id="WCQDShowTXT" class="button-primary debug-report" href="javascript:;">%s</a></p>',
__('Please copy and paste this information in your ticket when contacting support:',WC_QD_TXT),
__('Get System Report',WC_QD_TXT))
,'update',array('wraper' => false));
}
public function load_required_files(){
WC_QD()->load_files(WC_QD_ADMIN.'metabox_framework/meta-box.php');
}
public function init_hooks(){
add_action( 'current_screen', array( $this, 'admin_screen' ));
add_action( 'admin_menu', array( $this, 'sub_donation_order_menu' ) );
add_action( 'admin_menu', array($this,'add_donation_notification_bubble'),99);
......@@ -43,6 +51,14 @@ class WooCommerce_Quick_Donation_Admin {
}
public function admin_screen(){
if($this->sys_info == $this->current_screen()){
if(!WC_QD()->is_request('ajax')){
$this->add_notice();
}
}
}
public function sub_donation_order_menu(){
$this->order_menu_slug = add_submenu_page('edit.php?post_type=wcqd_project',
......@@ -59,10 +75,16 @@ class WooCommerce_Quick_Donation_Admin {
'wc_qd_donors',
array($this,'donors_listing_page'));
$this->tools = add_submenu_page('edit.php?post_type=wcqd_project',
$this->sys_info = add_submenu_page('edit.php?post_type=wcqd_project',
__('System Tools',WC_QD_TXT),
__('System Tools',WC_QD_TXT),
'administrator',
'wc_qd_sys_info',
array($this,'system_tools'));
$this->tools = add_submenu_page('edit.php?post_type=wcqd_project',
__('',WC_QD_TXT),
__('',WC_QD_TXT),
'administrator',
'wc_qd_tools',
array($this,'system_tools'));
}
......@@ -70,11 +92,9 @@ class WooCommerce_Quick_Donation_Admin {
public function reorder_donation_menu ($menu_ord ) {
global $submenu;
//echo '<pre>'.print_r($submenu,true).'</pre>'; exit;
$name = 'edit.php?post_type='.WC_QD_PT;
if(empty($submenu)){return $submenu;}
$arr = array();
$arr[] = $submenu[$name][18];
$arr[] = $submenu[$name][19];
$arr[] = $submenu[$name][5];
......@@ -93,9 +113,7 @@ class WooCommerce_Quick_Donation_Admin {
$c = $this->get_status_count();
if(isset($submenu['edit.php?post_type='.WC_QD_PT])){
foreach($submenu['edit.php?post_type='.WC_QD_PT] as $menuK => $menu){
if($menu[2] == 'wc_qd_orders' ){
$submenu['edit.php?post_type='.WC_QD_PT][$menuK][0] .= "<span class='update-plugins count-1'>
<span class='update-count'>$c</span></span>";
}
......@@ -134,10 +152,6 @@ class WooCommerce_Quick_Donation_Admin {
public function system_tools(){
require(WC_QD_ADMIN.'/views/tools.php');
//require(WC_QD_ADMIN.'/sysinfo/sysinfo.php');
//$sysinfo = new WooCommerce_Quick_Donation_SysInfo;
//$sysinfo->setup();
//$sysinfo->render_info();
}
public function donation_orders_page(){
......@@ -182,7 +196,7 @@ class WooCommerce_Quick_Donation_Admin {
wp_enqueue_style(WC_QD_SLUG.'_settings_style',WC_QD_CSS.'admin-settings-style.css' , array(), WC_QD()->version, 'all' );
}
if('wcqd_project_page_wc_qd_tools' == $this->current_screen()){
if($this->sys_info == $this->current_screen()){
wp_enqueue_style(WC_QD_SLUG.'_sysinfo_style',WC_QD_CSS.'sysinfo.css' , array(), WC_QD()->version, 'all' );
}
......@@ -199,7 +213,7 @@ class WooCommerce_Quick_Donation_Admin {
if(in_array($this->current_screen() , $this->get_screen_ids())) {
wp_enqueue_script(WC_QD_SLUG.'_core_script', WC_QD_JS.'admin-script.js', array('jquery'), WC_QD()->version, false );
}
if('wcqd_project_page_wc_qd_tools' == $this->current_screen()){
if($this->sys_info == $this->current_screen()){
wp_register_script(WC_QD_SLUG.'_sysinfo_script', WC_QD_JS.'sysinfo.js', array( 'jquery' ), WC_QD()->version,false );
wp_localize_script(WC_QD_SLUG.'_sysinfo_script', 'systemInfoAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
wp_enqueue_script(WC_QD_SLUG.'_sysinfo_script');
......@@ -213,7 +227,8 @@ class WooCommerce_Quick_Donation_Admin {
$screen[] = 'wcqd_project_page_WC_QD_settings';
$screen[] = $this->order_menu_slug;
$screen[] = $this->donors_list;
$screen[] = $this->tools;
$screen[] = $this->sys_info;
$screen[] = $this->tools;
return $screen;
}
......@@ -239,7 +254,8 @@ class WooCommerce_Quick_Donation_Admin {
$screen_ids[] = $this->order_menu_slug;
$screen_ids[] = $this->order_menu_slug;
$screen_ids[] = $this->donors_list;
$screen_ids[] = $this->tools;
$screen_ids[] = $this->sys_info;
$screen_ids[] = $this->tools;
return $screen_ids;
}
......
<?php
// Example plugin class.
class WooCommerce_Quick_Donation_Admin_Settings {
private $page_hook;
private $settings;
private $settings_pages;
private $settings_section;
private $settings_fields;
function __construct($page_hook) {
$this->page_hook = $page_hook;
$this->settings_pages = array();
$this->settings_section = array();
$this->settings_fields = array();
$this->settings = new WooCommerce_Quick_Donation_Settings_Page();
}
/**
* Gets Settings Tab For Settings Page
* @return [[Type]] [[Description]]
*/
public function get_settings_page(){
$this->settings_pages[] = array('name' => __( 'Tab 2',WC_QD_TXT), 'type' => 'heading');
$this->settings_pages[] = array('name' => __( 'Tab 2',WC_QD_TXT), 'type' => 'heading');
$this->settings_pages = apply_filters('wc_quick_donation_settings_tab',$this->settings_pages);
return $this->settings_pages;
}
private function get_settings_section(){
$this->settings_section['example_page'] = array(
array('id'=> 'first_section',
'title'=> __('First Section',WC_QD_TXT),
'validate_callback' => array($this,'validate_section')
),
array('id'=> 'second_section',
'title' => __( 'Second Section.', WC_QD_TXT )
),
);
$this->settings_section['second_page'] = array(
array('id'=> 'second_page_first_section',
'title' => __( 'Welcome to the second page', WC_QD_TXT)
)
);
$this->settings_section = apply_filters('wc_quick_donation_settings_section',$this->settings_section);
return $this->settings_section;
}
private function get_settings_fields(){
$this->settings_fields['example_page']['first_section'] = array(array(
'id' => 'section_one_text', // required
'type' => 'text', // required
'label' => __( 'Text field label (required)', WC_QD_TXT),
'default' => 'default text',
'desc' => __( 'This is a required field.', WC_QD_TXT),
'attr' => array( 'class' => 'my_class' )
));
$this->settings_fields = apply_filters('wc_quick_donation_settings_fields',$this->settings_fields);
return $this->settings_fields;
}
function admin_init() {
$pages = $this->settings->add_pages($this->get_settings_page());
$sections = $this->get_settings_section();
$fields = $this->get_settings_fields();
foreach($sections as $section_id => $section){
$pages = $this->settings->add_sections($section_id,$section);
}
foreach($fields as $page_id => $fields){
foreach($fields as $section_id => $field){
$pages = $this->settings->add_fields($page_id, $section_id, $field );
}
}
$this->settings->init( $pages, $this->page_hook );
}
function admin_page() {
echo '<div class="wrap">';
settings_errors();
$this->settings->render_header( __( 'WP Settings Example', 'plugin-text-domain' ) );
//echo $this->settings->debug;
// Use the function get_settings() to get all the settings.
$settings = $this->settings->get_settings();
// Use the function get get_current_admin_page() to check what page you're on
// $page = $this->settings->get_current_admin_page();
// $current_page = $page['id'];
// Display the form(s).
$this->settings->render_form();
echo '</div>';
}
function validate_section( $fields ) {
// Validation of the section_one_text text input.
// Show an error if it's empty.
// to check the section that's being validated you can check the 'section_id'
// that was added with a hidden field in the admin page form.
//
// example
// if( 'first_section' === $fields['section_id'] ) { // do stuff }
if ( empty( $fields['section_one_text'] ) ) {
// Use add_settings_error() to show an error messages.
add_settings_error(
'section_one_text', // Form field id.
'texterror', // Error id.
__( 'Error: please enter some text.', 'plugin-text-domain' ), // Error message.
'error' // Type of message. Use 'error' or 'updated'.
);
}
// Don't forget to return the fields
return $fields;
}
} // end of class
?>
\ No newline at end of file
<?php
/**
*
* This file runs when the plugin in uninstalled (deleted).
* This will not run when the plugin is deactivated.
* Ideally you will add all your clean-up scripts here
* that will clean-up unused meta, options, etc. in the database.
*
*/
// If plugin is not being uninstalled, exit (do nothing)
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// Do something here if plugin is being uninstalled.
\ No newline at end of file
......@@ -228,14 +228,28 @@ Client IP Address: <?php echo sss_get_ip() . "\n"; ?>
Simple Donation Product Exist : <?php echo WC_QD()->donation_product_exist_public(); ?>
<?php
$settings = WC_QD()->settings()->get_settings();
foreach($settings as $id => $setting){
$value = $setting;
if(is_array($setting)){$value = json_encode($setting);}
echo $id .' : '.$value."\n";
}
foreach(WC_QD()->settings()->settings_field as $setting){
foreach($setting as $setK => $set){
echo "\n ".'-- '.$setK.' Settings'. " \n";
foreach($set as $s){
$value = WC_QD()->settings()->get_option($s['id']);
if(is_array($value)) {$value = json_encode($value);}
if(empty($value)){$value = 'null';}
echo $s['id'].' : '.$value." \n";
}
}
}
?>
## Template Override Information
<?php
$override = WC_QD()->admin()->functions->get_OverRided();
foreach($override as $temp){
$is_old = '';
if($temp['is_old']) { $is_old = '[You are using an outdated version. kindly update it]'; }
echo "".$temp['file']." || Core Version ".$temp['corev']." || Theme Version".$temp['themev']." $is_old". " \n";
}
?>
### End WooCommerce Quick Donation Status ###
\ No newline at end of file
<table cellspacing="0" class="wc_status_table widefat" id="status">
<thead><tr> <th colspan="2">WordPress Environment</th> </tr></thead>
<tbody>
<tr> <td > Home URL: </td><td> <?php echo home_url(); ?></td> </tr>
<tr> <td > Site URL: </td><td> <?php echo site_url(); ?></td> </tr>
<tr> <td > WP Version: </td><td> <?php echo get_bloginfo( 'version' ); ?></td> </tr>
<tr> <td > WP_DEBUG: </td><td> <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ?></td> </tr>
<tr> <td > WP Language: </td><td><?php echo ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ); ?><td></tr>
<tr> <td > Multisite: </td><td><?php echo is_multisite() ? 'Yes' : 'No' ?><td></tr>
<tr> <td > WP Memory Limit: </td><td><?php echo ( self::let_to_num( WP_MEMORY_LIMIT )/( 1024 ) )."MB"; ?><?php ; ?><td></tr>
<tr> <td > WP Memory Limit Status:</td><td><?php if ((WP_MEMORY_LIMIT)/(1024)>63){echo 'OK'; }else{echo 'Not OK - Recommended Memory Limit is 64MB'."\n";} ?><td></tr>
<tr> <td > WP Table Prefix: </td><td><?php echo $wpdb->prefix ?><td></tr>
<tr> <td > WP Table Prefix Length:</td><td><?php echo strlen( $wpdb->prefix ) ?><td></tr>
<tr> <td > WP Table Prefix Status:</td><td><?php if ( strlen( $wpdb->prefix ) > 16 ) { echo 'ERROR: Too Long'; } else { echo 'Acceptable'; } ; ?><td></tr>
<tr> <td > WP Timezone: </td><td><?php echo get_option('timezone_string') . ', GMT: ' . get_option('gmt_offset'); ?><td></tr>
<tr> <td > WP Remote Post: </td><td><?php echo $WP_REMOTE_POST; ?><td></tr>
<tr> <td > Permalink Structure: </td><td><?php echo get_option( 'permalink_structure' ); ?><td></tr>
<tr> <td > Registered Post Stati: </td><td><?php echo implode( ' <br/> ', get_post_stati() ); ?><td></tr>
<tr> <td > Show On Front: </td><td><?php echo get_option( 'show_on_front' ) ?><td></tr>
<?php
if( get_option( 'show_on_front' ) == 'page' ) {
$front_page_id = get_option( 'page_on_front' );
$blog_page_id = get_option( 'page_for_posts' );
?>
<tr> <td > Page On Front: </td><td><?php ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ); ?><td></tr>
<tr> <td > Page For Posts: </td><td><?php ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ); ?><td></tr>
<?php } ?>
</tbody>
</table>
/**
* Get User IP
*
* Returns the IP address of the current visitor
*
* @since 1.0.8.2
* @return string $ip User's IP address
*/
function sss_get_ip() {
$ip = '127.0.0.1';
if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
//check ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
//to check ip is pass from proxy
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} elseif( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
$ip = $_SERVER['REMOTE_ADDR'];
}
return apply_filters( 'edd_get_ip', $ip );
}
/**
* Get user host
*
* Returns the webhost this site is using if possible
*
* @since 2.0
* @return mixed string $host if detected, false otherwise
*/
function sss_get_host() {
$host = false;
if( defined( 'WPE_APIKEY' ) ) {
$host = 'WP Engine';
} elseif( defined( 'PAGELYBIN' ) ) {
$host = 'Pagely';
} elseif( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
$host = 'ICDSoft';
} elseif( DB_HOST == 'mysqlv5' ) {
$host = 'NetworkSolutions';
} elseif( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
$host = 'iPage';
} elseif( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
$host = 'IPower';
} elseif( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
$host = 'MediaTemple Grid';
} elseif( strpos( DB_HOST, '.pair.com' ) !== false ) {
$host = 'pair Networks';
} elseif( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
$host = 'Rackspace Cloud';
} elseif( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
$host = 'SysFix.eu Power Hosting';
} elseif( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
$host = 'Flywheel';
} else {
// Adding a general fallback for data gathering
$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
}
return $host;
} ?>
### Begin WooCommerce Quick Donation Status ###
-- WordPress Environment
Home URL: <?php echo home_url() . "\n"; ?>
Site URL: <?php echo site_url() . "\n"; ?>
WP Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?>
WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?>
WP Language: <?php echo ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; ?>
Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?>
WP Memory Limit: <?php echo ( self::let_to_num( WP_MEMORY_LIMIT )/( 1024 ) )."MB"; ?><?php echo "\n"; ?>
WP Memory Limit Status: <?php if (( WP_MEMORY_LIMIT )/( 1024 ) > 63) { echo 'OK'. "\n"; } else {echo 'Not OK - Recommended Memory Limit is 64MB'."\n";} ?>
WP Table Prefix: <?php echo $wpdb->prefix. "\n"; ?>
WP Table Prefix Length: <?php echo strlen( $wpdb->prefix ). "\n"; ?>
WP Table Prefix Status: <?php if ( strlen( $wpdb->prefix ) > 16 ) { echo 'ERROR: Too Long'; } else { echo 'Acceptable'; } echo "\n"; ?>
WP Timezone: <?php echo get_option('timezone_string') . ', GMT: ' . get_option('gmt_offset') . "\n"; ?>
WP Remote Post: <?php echo $WP_REMOTE_POST; ?>
Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; ?>
Registered Post Stati: <?php echo implode( ', ', get_post_stati() ) . "\n"; ?>
Show On Front: <?php echo get_option( 'show_on_front' ) . "\n" ?>
<?php if( get_option( 'show_on_front' ) == 'page' ) {
$front_page_id = get_option( 'page_on_front' );
$blog_page_id = get_option( 'page_for_posts' ); ?>
Page On Front: <?php ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; ?>
Page For Posts: <?php ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; ?>
<?php } ?>
## Theme Information ##
<?php $active_theme = wp_get_theme(); ?>
Theme Name: <?php echo $active_theme->Name . "\n"; ?>
Theme Version: <?php echo $active_theme->Version . "\n"; ?>
Theme Author: <?php echo $active_theme->get('Author') . "\n"; ?>
Theme Author URI: <?php echo $active_theme->get('AuthorURI') . "\n"; ?>
Is Child Theme: <?php echo is_child_theme() ? 'Yes' . "\n" : 'No' . "\n"; if( is_child_theme() ) { $parent_theme = wp_get_theme( $active_theme->Template ); ?>
Parent Theme: <?php echo $parent_theme->Name ?>
Parent Theme Version: <?php echo $parent_theme->Version . "\n"; ?>
Parent Theme URI: <?php echo $parent_theme->get('ThemeURI') . "\n"; ?>
Parent Theme Author URI: <?php echo $parent_theme->{'Author URI'} . "\n"; ?>
<table cellspacing="0" class="wc_status_table widefat" id="status">
<thead><tr> <th colspan="2">Theme Information</th> </tr></thead>
<tbody>
<tr> <td > Theme Name: </td><td> <?php echo $active_theme->Name; ?></td> </tr>
<tr> <td > Theme Version: </td><td> <?php echo $active_theme->Version; ?></td> </tr>
<tr> <td > Theme Author: </td><td> <?php echo $active_theme->get('Author'); ?></td> </tr>
<tr> <td > Theme Author URI: </td><td> <?php echo $active_theme->get('AuthorURI'); ?></td> </tr>
<tr> <td > Is Child Theme: </td><td> <?php echo is_child_theme() ? 'Yes' : 'No'; ?> </td> </tr>
<?php if( is_child_theme() ) { $parent_theme = wp_get_theme( $active_theme->Template ); ?>
<tr> <td > Parent Theme: </td><td> <?php echo $parent_theme->Name ?> </td> </tr>
<tr> <td > Parent Theme Version: </td><td> <?php echo $parent_theme->Version; ?></td> </tr>
<tr> <td > Parent Theme URI: </td><td> <?php echo $parent_theme->get('ThemeURI'); ?></td> </tr>
<tr> <td > Parent Theme Author URI:</td><td> <?php echo $parent_theme->{'Author URI'}; ?></td> </tr>
<?php } ?>
## Plugins Information ##
</tbody>
</table>
<?php
$muplugins = wp_get_mu_plugins();
$plugin_output = '';
$plugin_output .= '<tr> <th colspan="2">Must-Use Plugins</th></tr>';
$muplugins = wp_get_mu_plugins();
if( count( $muplugins > 0 ) ) {
echo "\n" . '-- Must-Use Plugins' . "\n\n";
foreach( $muplugins as $plugin => $plugin_data ) {
echo $plugin['Name'] . ': {V : ' . $plugin['Version'] . ' || A : ' .$plugin['Author'] .' } ' .$plugin['PluginURI'] ."\n";
$plugin_output .= '<tr> <td colspan="2"><a href="'.$plugin['PluginURI'].'" >'.$plugin['Name'].' </a>: || Version ' . $plugin['Version'] . ' || Author : ' .$plugin['Author']."</td> </tr>";
}
}
// WordPress active plugins
echo "\n" . '-- WordPress Active Plugins' . "\n\n";
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; }
$plugin_output .= '<tr> <th colspan="2"> </th></tr>';
$plugin_output .= '<tr> <th colspan="2">WordPress Active Plugins</th></tr>';
$plugins = get_plugins();
$active_plugins = get_option( 'active_plugins', array() );
......@@ -131,111 +66,126 @@ $muplugins = wp_get_mu_plugins();
if( !in_array( $plugin_path, $active_plugins ) )
continue;
echo $plugin['Name'] . ' : {V : ' . $plugin['Version'] . ' || A : ' .$plugin['Author'] .' } ' .$plugin['PluginURI'] ."\n";
$plugin_output .= '<tr> <td colspan="2"><a href="'.$plugin['PluginURI'].'" >'.$plugin['Name'].' </a>: || Version ' . $plugin['Version'] . ' || Author : ' .$plugin['Author']."</td> </tr>";
}
// WordPress inactive plugins
echo "\n" . '-- WordPress Inactive Plugins' . "\n\n";
$plugin_output .= '<tr> <th colspan="2"> </th></tr>';
$plugin_output .= '<tr> <th colspan="2">WordPress Inactive Plugins</th></tr>';
foreach( $plugins as $plugin_path => $plugin ) {
if( in_array( $plugin_path, $active_plugins ) )
continue;
echo $plugin['Name'] . ' : {V : ' . $plugin['Version'] . ' || A : ' .$plugin['Author'] .' } ' .$plugin['PluginURI'] ."\n";
$plugin_output .= '<tr> <td colspan="2"><a href="'.$plugin['PluginURI'].'" >'.$plugin['Name'].' </a>: || Version ' . $plugin['Version'] . ' || Author : ' .$plugin['Author']."</td> </tr>";
}
if( is_multisite() ) {
// WordPress Multisite active plugins
echo "\n" . '-- Network Active Plugins' . "\n\n";
$plugin_output .= '<tr> <th colspan="2"> </th></tr>';
$plugin_output .= '<tr> <th colspan="2">Network Active Plugins</th></tr>';
$plugins = wp_get_active_network_plugins();
$active_plugins = get_site_option( 'active_sitewide_plugins', array() );
foreach( $plugins as $plugin_path ) {
$plugin_base = plugin_basename( $plugin_path );
if( !array_key_exists( $plugin_base, $active_plugins ) )
continue;
$plugin = get_plugin_data( $plugin_path );
echo $plugin['Name'] . ': ' . $plugin['Version'] . ' ' .$plugin['Author'] .' ' .$plugin['PluginURI'] ."\n";
$plugin_output .= '<tr> <td colspan="2"><a href="'.$plugin['PluginURI'].'" >'.$plugin['Name'].' </a>: || Version ' . $plugin['Version'] . ' || Author : ' .$plugin['Author']."</td> </tr>";
}
}
?>
## Server Environment ##
Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
Host: <?php echo sss_get_host() . "\n"; ?>
Default Timezone: <?php echo date_default_timezone_get() . "\n"; ?>
<table cellspacing="0" class="wc_status_table widefat" id="status"> <thead><tr> <th colspan="2">Plugins Information</th> </tr></thead><tbody><?php echo $plugin_output; ?></tbody></table>
<?php if ( $wpdb->use_mysqli ) { $mysql_ver = @mysqli_get_server_info( $wpdb->dbh ); } else { $mysql_ver = @mysql_get_server_info(); } ?>
<table cellspacing="0" class="wc_status_table widefat" id="status">
<thead><tr> <th colspan="2">Server Environment</th> </tr></thead>
<tbody>
<tr> <td> Server Info: </td><td> <?php echo $_SERVER['SERVER_SOFTWARE']; ?></td></tr>
<tr> <td> Host: </td><td> <?php echo sss_get_host(); ?></td></tr>
<tr> <td> Default Timezone: </td><td> <?php echo date_default_timezone_get(); ?></td></tr>
<tr> <td> MySQL Version: </td> <td> <?php echo $mysql_ver; ?></td></tr>
<tr> <td></td></tr>
<tr> <td colspan="2">PHP Configuration</td></tr>
<tr> <td>PHP Version: </td><td> <?php echo PHP_VERSION; ?></td></tr>
<tr> <td>PHP Post Max Size: </td><td> <?php echo ini_get( 'post_max_size' ); ?></td></tr>
<tr> <td>PHP Time Limit: </td><td> <?php echo ini_get( 'max_execution_time' ); ?></td></tr>
<tr> <td>PHP Max Input Vars: </td><td> <?php echo ini_get( 'max_input_vars' ); ?></td></tr>
<tr> <td>PHP Safe Mode: </td><td> <?php echo ini_get( 'safe_mode' ) ? "Yes" : "No\n"; ?></td></tr>
<tr> <td>PHP Memory Limit: </td><td> <?php echo ini_get( 'memory_limit' ); ?></td></tr>
<tr> <td>PHP Upload Max Size: </td><td> <?php echo ini_get( 'upload_max_filesize' ); ?></td></tr>
<tr> <td>PHP Upload Max Filesize: </td><td> <?php echo ini_get( 'upload_max_filesize' ); ?></td></tr>
<tr> <td>PHP Arg Separator: </td><td> <?php echo ini_get( 'arg_separator.output' ); ?></td></tr>
<tr> <td>PHP Allow URL File Open: </td><td> <?php echo ini_get( 'allow_url_fopen' ) ? "Yes". "\n" : "No"; ?></td></tr>
<tr> <td colspan="2">PHP Extentions</td></tr>
<tr><td> DISPLAY ERRORS:</td><td><?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php ; ?></td></tr>
<tr><td> FSOCKOPEN: </td><td><?php echo ( function_exists( 'fsockopen' ) ) ? 'Your server supports fsockopen.' : 'Your server does not support fsockopen.'; ?><?php ; ?></td></tr>
<tr><td> cURL: </td><td><?php echo ( function_exists( 'curl_init' ) ) ? 'Your server supports cURL.' : 'Your server does not support cURL.'; ?><?php ; ?></td></tr>
<tr><td> SOAP Client: </td><td><?php echo ( class_exists( 'SoapClient' ) ) ? 'Your server has the SOAP Client enabled.' : 'Your server does not have the SOAP Client enabled.'; ?><?php ; ?></td></tr>
<tr> <td> SUHOSIN: </td><td><?php echo ( extension_loaded( 'suhosin' ) ) ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.'; ?><?php ; ?></td></tr>
<tr> <td colspan="2">Session Configuration</td></tr>
<tr><td>Session: </td><td><?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php ; ?></td></tr>
<tr><td>Session Name: </td><td><?php echo esc_html( ini_get( 'session.name' ) ); ?><?php ; ?></td></tr>
<tr><td>Cookie Path: </td><td><?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php ; ?></td></tr>
<tr><td>Save Path: </td><td><?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php ; ?></td></tr>
<tr><td>Use Cookies: </td><td><?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php ; ?></td></tr>
<tr><td>Use Only Cookies: </td><td><?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php ; ?></td></tr>
<tr> <td colspan="2">Client Details</td></tr>
<?php echo '<tr><td>Browser</td><td>'; ?>
<?php echo $browser ; ?>
<?php echo "</td></tr>"; ?>
<tr><td> Client IP Address: </td><td> <?php echo sss_get_ip(); ?></td></tr>
</tbody>
</table>
<table cellspacing="0" class="wc_status_table widefat" id="status">
<thead><tr> <th colspan="2">Plugin Settings Information</th> </tr></thead>
<tbody>
<tr>
<td>Simple Donation Product Exist</td>
<td><?php echo WC_QD()->donation_product_exist_public(); ?></td>
</tr>
<?php
if ( $wpdb->use_mysqli ) {
$mysql_ver = @mysqli_get_server_info( $wpdb->dbh );
} else {
$mysql_ver = @mysql_get_server_info();
//$settings = WC_QD()->settings()->get_settings();
//foreach($settings as $id => $setting){
// $value = $setting;
// if(is_array($setting)){$value = json_encode($setting);}
// echo '<tr><td>'.$id .' </td><td> '.$value."</td></tr>";
//}
foreach(WC_QD()->settings()->settings_field as $setting){
foreach($setting as $setK => $set){
echo '<tr> <th colspan="2">'.$setK.' Settings</th> </tr>';
foreach($set as $s){
$value = WC_QD()->settings()->get_option($s['id']);
if(is_array($value)) {$value = json_encode($value);}
if(empty($value)){$value = 'null';}
echo '<tr> <td colspan="1">'.$s['id'].'</td> <td>'.$value.'</td></tr>';
}
}
}
?>
MySQL Version: <?php echo $mysql_ver . "\n"; ?>
-- PHP Configuration
PHP Version: <?php echo PHP_VERSION . "\n"; ?>
PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?>
PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?>
PHP Max Input Vars: <?php echo ini_get( 'max_input_vars' ) . "\n"; ?>
PHP Safe Mode: <?php echo ini_get( 'safe_mode' ) ? "Yes" : "No\n"; ?>
PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?>
PHP Upload Max Size: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
PHP Upload Max Filesize: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
PHP Arg Separator: <?php echo ini_get( 'arg_separator.output' ) . "\n"; ?>
PHP Allow URL File Open: <?php echo ini_get( 'allow_url_fopen' ) ? "Yes". "\n" : "No" . "\n"; ?>
-- PHP Extentions
DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?>
FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? 'Your server supports fsockopen.' : 'Your server does not support fsockopen.'; ?><?php echo "\n"; ?>
cURL: <?php echo ( function_exists( 'curl_init' ) ) ? 'Your server supports cURL.' : 'Your server does not support cURL.'; ?><?php echo "\n"; ?>
SOAP Client: <?php echo ( class_exists( 'SoapClient' ) ) ? 'Your server has the SOAP Client enabled.' : 'Your server does not have the SOAP Client enabled.'; ?><?php echo "\n"; ?>
SUHOSIN: <?php echo ( extension_loaded( 'suhosin' ) ) ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.'; ?><?php echo "\n"; ?>
-- Session Configuration
Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?>
Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?>
Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?>
Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?>
Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
-- Client Details:
<?php if ( isset( $_GET['simple_system_status'] ) ) {
echo '// Browser of Current Viewer //';
echo "\r\n\r\n";
} ?>
<?php echo $browser ; ?>
<?php if ( isset( $_GET['simple_system_status'] ) ) {
echo "\r\n";
echo '// End Browser of Current Viewer //';
echo "\r\n\r\n";
} ?>
Client IP Address: <?php echo sss_get_ip() . "\n"; ?>
## WC Qucik Donation Settings Information ##
Simple Donation Product Exist : <?php echo WC_QD()->donation_product_exist_public(); ?>
<?php
$settings = WC_QD()->settings()->get_settings();
foreach($settings as $id => $setting){
$value = $setting;
if(is_array($setting)){$value = json_encode($setting);}
echo $id .' : '.$value."\n";
<tr> <th colspan="2"> </th> </tr>
<tr> <th colspan="2">Template Override Information</th> </tr>
<tr> <th> Template Name</th> <th> Version Info</th></tr>
<?php
$override = WC_QD()->admin()->functions->get_OverRided();
foreach($override as $temp){
$is_old = '';
$cls = '';
if($temp['is_old']) {
$is_old = '<small style="color:red; margin-left:10px; font-weight:bold;">You are using an outdated version. kindly update it</small>';
$cls = 'style="color:red; font-weight:bold;"';
}
echo '<tr> <td '.$cls.' >'.$temp['file'].'</td> <td> Core Version : <code>'.$temp['corev'].'</code>
Theme Version : <code>'.$temp['themev'].' </code> '.$is_old.' </td> </tr>';
}
?>
### End WooCommerce Quick Donation Status ###
\ No newline at end of file
</tbody>
</table>
\ No newline at end of file
<?php
require(WC_QD_ADMIN.'/sysinfo/sysinfo.php');
$sysinfo = new WooCommerce_Quick_Donation_SysInfo;
$sysinfo->setup();
?>
<textarea style="display:none;"
readonly="readonly"
onclick="this.focus();this.select()"
id="wcqdssstextarea"
name="simple-system-status-textarea"
title="<?php _e( 'To copy the System Status, click below then press Ctrl + C (PC) or Cmd + C (Mac)',WC_QD_TXT);?>"><?php echo $sysinfo::display(); ?> </textarea>
<?php echo $sysinfo::display('table'); ?>
\ No newline at end of file
<?php
require(WC_QD_ADMIN.'/sysinfo/sysinfo.php');
$sysinfo = new WooCommerce_Quick_Donation_SysInfo;
$sysinfo->setup();
echo $sysinfo::display('table');
?>
<table cellspacing="0" id="status" class="wc_status_table widefat">
<thead>
<tr>
<th data-export-label="WordPress Environment" colspan="3">WordPress Environment</th>
</tr>
</thead>
<tbody>
<tr>
<td data-export-label="Home URL">Home URL:</td>
<td class="help"><a class="help_tip" href="#">[?]</a></td>
<td>http://localhost/wpdev</td>
</tr>
<tr>
<td data-export-label="Language">Language:</td>
<td class="help"><a class="help_tip" href="#">[?]</a></td>
<td>en_US</td>
</tr>
</tbody>
</table>
\ No newline at end of file
<div class="wrap woocommerce">
<?php
$active = 'sysinfo';
if(isset($_REQUEST['ntab'])){$active == $_GET['ntab'];}
$active = 'wc_qd_sys_info';
if(isset($_GET['page'])){$active = $_GET['page'];}
$pageToOpen = str_replace('wc_qd_','',$active);
$pages= array();
$pages['sysinfo'] = __('System Status',WC_QD_TXT);
$pages['tools'] = __('Tools',WC_QD_TXT);
$url = menu_page_url('wc_qd_tools', false );
$pages['wc_qd_sys_info'] = __('System Status',WC_QD_TXT);
$pages['wc_qd_tools'] = __('Tools',WC_QD_TXT);
$links = '';
foreach($pages as $pageid => $page){
$class = 'nav-tab ';
$url = menu_page_url($pageid, false );
if($active == $pageid){$class .= ' nav-tab-active'; }
$links .= '<a class="'.$class.'" href="'.$url.'&ntba='.$pageid.'">'.$page.'</a>';
$links .= '<a class="'.$class.'" href="'.$url.'">'.$page.'</a>';
}
?>
<h2 class="nav-tab-wrapper woo-nav-tab-wrapper"><?php echo $links; ?></h2>
<?php require(WC_QD_ADMIN.'views/'.$active.'-view.php'); ?>
<h2 class="nav-tab-wrapper woo-nav-tab-wrapper"><?php echo $links; ?></h2>
<?php require(WC_QD_ADMIN.'views/'.$pageToOpen.'_view.php'); ?>
</div>
\ No newline at end of file
......@@ -490,7 +490,7 @@ if(!has_action('init', array('WP_Admin_Notices', 'getInstance'))){
if ( ! function_exists( 'wc_qd_notice' ) ) {
function wc_qd_notice( $message, $type = 'update',$args = array()) {
$notice = '';
$defaults = array('times' => 11,'screen' => array(),'users' => array(), 'wraper' => true);
$defaults = array('times' => 1,'screen' => array(),'users' => array(), 'wraper' => true);
$args = wp_parse_args( $args, $defaults );
extract($args);
if($type == 'error'){$notice = new WP_Error_Notice($message,$times, $screen, $users);}
......
......@@ -23,8 +23,9 @@ p.submit {
text-align: left;
}
textarea#sss-textarea {
height: 500px;
textarea#wcqdssstextarea {
height: 450px;
width: 100%;
font-family: Menlo,Monaco,monospace;
background: 0 0;
white-space: pre;
......
jQuery(document).ready(function(){
jQuery('#wcqdssstextarea').hide();
jQuery('#WCQDShowTXT').click(function(){
jQuery('#wcqdssstextarea').slideToggle();
});
});
\ No newline at end of file
......@@ -55,7 +55,7 @@ if(! function_exists('wcqd_get_project_name')){
* @return int / boolean [returns project id if exist or returns false]
*/
function wcqd_get_project_name($order_id = '', $default_title = ''){
$project_id = wcqd_get_project($order_id);
$project_id = wcqd_get_project_from_order($order_id);
$title = get_the_title($project_id);
if(empty($title)){return $default_title;}
return $title;
......
<?php
/**
* Cart Page
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.3.8
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
wc_print_notices();
do_action( 'woocommerce_before_cart' ); ?>
<form action="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" method="post">
<?php do_action( 'woocommerce_before_cart_table' ); ?>
<table class="shop_table cart" cellspacing="0">
<thead>
<tr>
<th class="product-remove">&nbsp;</th>
<th class="product-thumbnail">&nbsp;</th>
<th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
<th class="product-price"><?php _e( 'Price', 'woocommerce' ); ?></th>
<th class="product-quantity"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
<th class="product-subtotal"><?php _e( 'Total', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php do_action( 'woocommerce_before_cart_contents' ); ?>
<?php
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
?>
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
<td class="product-remove">
<?php
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf(
'<a href="%s" class="remove" title="%s" data-product_id="%s" data-product_sku="%s">&times;</a>',
esc_url( WC()->cart->get_remove_url( $cart_item_key ) ),
__( 'Remove this item', 'woocommerce' ),
esc_attr( $product_id ),
esc_attr( $_product->get_sku() )
), $cart_item_key );
?>
</td>
<td class="product-thumbnail">
<?php
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
if ( ! $_product->is_visible() ) {
echo $thumbnail;
} else {
printf( '<a href="%s">%s</a>', esc_url( $_product->get_permalink( $cart_item ) ), $thumbnail );
}
?>
</td>
<td class="product-name">
<?php
if ( ! $_product->is_visible() ) {
echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ) . '&nbsp;';
} else {
echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s </a>', esc_url( $_product->get_permalink( $cart_item ) ), $_product->get_title() ), $cart_item, $cart_item_key );
}
// Meta data
echo WC()->cart->get_item_data( $cart_item );
// Backorder notification
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
echo '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>';
}
?>
</td>
<td class="product-price">
<?php
echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
?>
</td>
<td class="product-quantity">
<?php
if ( $_product->is_sold_individually() ) {
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
} else {
$product_quantity = woocommerce_quantity_input( array(
'input_name' => "cart[{$cart_item_key}][qty]",
'input_value' => $cart_item['quantity'],
'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(),
'min_value' => '0'
), $_product, false );
}
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );
?>
</td>
<td class="product-subtotal">
<?php
echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );
?>
</td>
</tr>
<?php
}
}
do_action( 'woocommerce_cart_contents' );
?>
<tr>
<td colspan="6" class="actions">
<?php if ( WC()->cart->coupons_enabled() ) { ?>
<div class="coupon">
<label for="coupon_code"><?php _e( 'Coupon', 'woocommerce' ); ?>:</label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" /> <input type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply Coupon', 'woocommerce' ); ?>" />
<?php do_action( 'woocommerce_cart_coupon' ); ?>
</div>
<?php } ?>
<input type="submit" class="button" name="update_cart" value="<?php esc_attr_e( 'Update Cart', 'woocommerce' ); ?>" />
<?php do_action( 'woocommerce_cart_actions' ); ?>
<?php wp_nonce_field( 'woocommerce-cart' ); ?>
</td>
</tr>
<?php do_action( 'woocommerce_after_cart_contents' ); ?>
</tbody>
</table>
<?php do_action( 'woocommerce_after_cart_table' ); ?>
</form>
<div class="cart-collaterals">
<?php do_action( 'woocommerce_cart_collaterals' ); ?>
</div>
<?php do_action( 'woocommerce_after_cart' ); ?>
<?php
/**
* Donation Tracking
*
* @author Varun Sridharan
* @package WooCommerce Quick Donation/Templates/order
* @version 0.1
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
global $post;
?>
<form action="<?php echo esc_url( get_permalink( $post->ID ) ); ?>" method="post" class="track_order">
<p><?php _e( 'To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received.', 'woocommerce' ); ?></p>
<p class="form-row form-row-first"><label for="orderid"><?php _e( 'Order ID', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="orderid" id="orderid" placeholder="<?php esc_attr_e( 'Found in your order confirmation email.', 'woocommerce' ); ?>" /></p>
<p class="form-row form-row-last"><label for="order_email"><?php _e( 'Billing Email', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="order_email" id="order_email" placeholder="<?php esc_attr_e( 'Email you used during checkout.', 'woocommerce' ); ?>" /></p>
<div class="clear"></div>
<p class="form-row"><input type="submit" class="button" name="track" value="<?php esc_attr_e( 'Track', 'woocommerce' ); ?>" /></p>
<?php wp_nonce_field( 'woocommerce-order_tracking' ); ?>
</form>
\ No newline at end of file
<?php
/**
* Donate Again
*
* @author Varun Sridharan
* @package WooCommerce Quick Donation/Templates/order
* @version 0.1
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<p class="order-again">
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'order_again', $order->id ) , 'woocommerce-order_again' ) ); ?>" class="button"><?php _e( 'Order Again', 'woocommerce' ); ?></a>
</p>
<?php
/**
* Donation tracking
*
* @author Varun Sridharan
* @package WooCommerce Quick Donation/Templates/order
* @version 0.1
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
$order_status_text = sprintf( __( 'Order #%s which was made %s has the status &ldquo;%s&rdquo;', 'woocommerce' ), $order->get_order_number(), human_time_diff( strtotime( $order->order_date ), current_time( 'timestamp' ) ) . ' ' . __( 'ago', 'woocommerce' ), wc_get_order_status_name( $order->get_status() ) );
if ( $order->has_status( 'completed' ) ) $order_status_text .= ' ' . __( 'and was completed', 'woocommerce' ) . ' ' . human_time_diff( strtotime( $order->completed_date ), current_time( 'timestamp' ) ) . __( ' ago', 'woocommerce' );
$order_status_text .= '.';
echo wpautop( esc_attr( apply_filters( 'woocommerce_order_tracking_status', $order_status_text, $order ) ) );
$notes = $order->get_customer_order_notes();
if ( $notes ) : ?>
<h2><?php _e( 'Order Updates', 'woocommerce' ); ?></h2>
<ol class="commentlist notes">
<?php foreach ( $notes as $note ) : ?>
<li class="comment note">
<div class="comment_container">
<div class="comment-text">
<p class="meta"><?php echo date_i18n( __( 'l jS \o\f F Y, h:ia', 'woocommerce' ), strtotime( $note->comment_date ) ); ?></p>
<div class="description">
<?php echo wpautop( wptexturize( wp_kses_post( $note->comment_content ) ) ); ?>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</li>
<?php endforeach; ?>
</ol>
<?php endif; ?>
<?php do_action( 'woocommerce_view_order', $order->id ); ?>
......@@ -267,7 +267,7 @@ class WooCommerce_Quick_Donation {
* string $type ajax, frontend or admin
* @return bool
*/
private function is_request( $type ) {
public function is_request( $type ) {
switch ( $type ) {
case 'admin' :
return is_admin();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment