Skip to content

Commit

Permalink
Code indenting, mostly
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Amundson <[email protected]>
sewmyheadon committed Dec 20, 2012
1 parent 8f63d97 commit a6509db
Showing 5 changed files with 230 additions and 230 deletions.
16 changes: 8 additions & 8 deletions posts-in-page/assets/post-page_scripts.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
jQuery( 'document' ).ready( function( $ ){
$( '#posts-in-page-settings .top-menu li a' ).click( function(){
var toshow = $( this ).attr( 'href' ).replace( '#', '' );
$( '.top-menu li' ).removeClass( 'current-menu-tab' );
$( this ).parent( 'li' ).addClass( 'current-menu-tab' );
$( '.group' ).hide().removeClass( 'current-tab' );
$( '.' + toshow ).show().addClass( 'current-tab' );
return false;
} );
$( '#posts-in-page-settings .top-menu li a' ).click( function(){
var toshow = $( this ).attr( 'href' ).replace( '#', '' );
$( '.top-menu li' ).removeClass( 'current-menu-tab' );
$( this ).parent( 'li' ).addClass( 'current-menu-tab' );
$( '.group' ).hide().removeClass( 'current-tab' );
$( '.' + toshow ).show().addClass( 'current-tab' );
return false;
} );
});
264 changes: 132 additions & 132 deletions posts-in-page/assets/post-page_styles.css
Original file line number Diff line number Diff line change
@@ -1,234 +1,234 @@
#posts-in-page-settings h2 span {
display:block;
width: 150px;
float: right;
display:block;
width: 150px;
float: right;
}
#side-sortables {
min-height: 300px;
padding: 0;
width: 280px;
color: #333333;
min-height: 300px;
padding: 0;
width: 280px;
color: #333333;
}
.postbox {
background-color: #F5F5F5;
background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
border-color: #DFDFDF;
border-radius: 3px 3px 3px 3px;
box-shadow: 0 1px 0 #FFFFFF inset;
min-width: 255px;
position: relative;
border-style: solid;
border-width: 1px;
line-height: 1;
margin-bottom: 20px;
padding: 0;
background-color: #F5F5F5;
background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
border-color: #DFDFDF;
border-radius: 3px 3px 3px 3px;
box-shadow: 0 1px 0 #FFFFFF inset;
min-width: 255px;
position: relative;
border-style: solid;
border-width: 1px;
line-height: 1;
margin-bottom: 20px;
padding: 0;
}
.postbox .handlediv {
cursor: pointer;
float: right;
height: 30px;
width: 27px;
cursor: pointer;
float: right;
height: 30px;
width: 27px;
}
.postbox h3 {
font-size: 15px;
font-weight: normal;
line-height: 1;
margin: 0;
padding: 7px 10px;
color: #464646;
font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
text-shadow: 0 1px 0 #FFFFFF;
background-color: #F1F1F1;
background-image: -moz-linear-gradient(center top , #F9F9F9, #ECECEC);
border-bottom-color: #DFDFDF;
box-shadow: 0 1px 0 #FFFFFF;
font-size: 15px;
font-weight: normal;
line-height: 1;
margin: 0;
padding: 7px 10px;
color: #464646;
font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
text-shadow: 0 1px 0 #FFFFFF;
background-color: #F1F1F1;
background-image: -moz-linear-gradient(center top , #F9F9F9, #ECECEC);
border-bottom-color: #DFDFDF;
box-shadow: 0 1px 0 #FFFFFF;
}
.postbox h4 {
font-size: 14px;
font-weight: bold;
line-height: 1;
margin: 0;
padding: 7px 0px;
color: #464646;
text-align: left;
text-shadow: 0 1px 0 #FFFFFF;
font-size: 14px;
font-weight: bold;
line-height: 1;
margin: 0;
padding: 7px 0;
color: #464646;
text-align: left;
text-shadow: 0 1px 0 #FFFFFF;
}
.postbox .inside {
margin: 6px 0 8px;
position: relative;
line-height: 1.4em;
padding:0 ;
margin: 6px 0 8px;
position: relative;
line-height: 1.4em;
padding:0 ;
}

.postbox .inside_wrap{
margin:0 15px;
margin:0 15px;
}
.postbox .inside_wrap ul,
.postbox .inside_wrap p {
margin-top:0;
font-size:13px;margin-bottom:0.7em;
margin-top:0;
font-size:13px;margin-bottom:0.7em;
}
.postbox .inside_wrap ul {
list-style:disc;
margin-left:15px;
list-style:disc;
margin-left:15px;

}
.postbox ul{
list-style-type: none;
padding: 0;
margin-top: 0;
list-style-type: none;
padding: 0;
margin-top: 0;
}
.postbox ul li.img{
text-align: center;
background: #ffffff;
padding: 10px 0 ;
text-align: center;
background: #ffffff;
padding: 10px 0 ;
}
.postbox a{
color: #628C29;
text-decoration: none;
color: #628C29;
text-decoration: none;
}
.postbox a:hover{
color: #8EC73C;
color: #8EC73C;
}

.postbox .ivy_social li {
list-style-type:none;
text-indent:-9999px;
display:inline;
list-style-type:none;
text-indent:-9999px;
display:inline;
}
.postbox .ivy_social li a {
display:block;
float:left;
width:16px;
height:16px;
margin:0 12px;
display:block;
float:left;
width:16px;
height:16px;
margin:0 12px;
}
.postbox .ivy_social li.ic_fb a {
background: url("facebook.png") no-repeat top left;
background: url("facebook.png") no-repeat top left;
}
.postbox .ivy_social li.ic_tw a {
background: url("twitter.png") no-repeat top left;
background: url("twitter.png") no-repeat top left;
}
.postbox .ivy_social li.ic_li a {
background: url("linkedin.png") no-repeat top left;
background: url("linkedin.png") no-repeat top left;
}
.postbox .ivy_social li.ic_mc a {
background: url("email.png") no-repeat top left;
background: url("email.png") no-repeat top left;
}
.postbox .ivy_social li.ic_rss a {
background: url("feed.png") no-repeat top left;
background: url("feed.png") no-repeat top left;
}
#body-wrap {
margin-top: 25px;
margin-top: 25px;
}
#body-wrap inside {
padding: 10px;
padding: 10px;
}
#body-wrap .hndle h3 ul {
margin-bottom: 0;
margin-bottom: 0;
}
#body-wrap .hndle{
margin-bottom: 10px;
margin-bottom: 10px;
}
#body-wrap .hndle a{
font-size: 18px;
font-size: 18px;
}
#body-wrap .hndle li.current-menu-tab a{
font-size: 21px;
font-weight: bold;
font-size: 21px;
font-weight: bold;
}
#posts-in-page-settings #body-wrap{
width: 55%;
float:left;
width: 55%;
float:left;
}
#posts-in-page-settings #sidebar-wrap{
width: 35%;
float:left;
margin: 25px 0 0 20px;
width: 35%;
float:left;
margin: 25px 0 0 20px;
}
#posts-in-page-settings .top-menu{
width: 100%;
width: 100%;
}

#posts-in-page-settings .top-menu li{
margin-bottom: 0px;
text-align: center;
margin-bottom: 0px;
text-align: center;
}
#posts-in-page-settings .settings{
padding: 10px;
padding: 10px;
}
#posts-in-page-settings .help{
margin-top: 20px;
padding: 10px;
margin-top: 20px;
padding: 10px;
}
.clearfix:before, .clearfix:after {
content: ""; display: table;
}
content: ""; display: table;
}
.clearfix:after {
clear: both;
}
clear: both;
}
.clearfix {
*zoom: 1;
}
*zoom: 1;
}
#ivycat_donate form input[type="image"] {
margin:0 auto;
display:block;
}
margin:0 auto;
display:block;
}

/* MailChimp Form Embed Code - Slim - 08/17/2011 */
#mc_embed_signup form {
display:block; position:relative; text-align:left; padding:10px 0 10px 0;width: 250px;
}
display:block; position:relative; text-align:left; padding:10px 0 10px 0;width: 250px;
}
#mc_embed_signup h2 {
font-weight:bold; padding:0; margin:15px 0; font-size:1.4em;
}
font-weight:bold; padding:0; margin:15px 0; font-size:1.4em;
}
#mc_embed_signup input {
border:1px solid #999; -webkit-appearance:none;
border:1px solid #999; -webkit-appearance:none;
}
#mc_embed_signup input[type=checkbox] {
-webkit-appearance:checkbox;
-webkit-appearance:checkbox;
}
#mc_embed_signup input[type=radio] {
-webkit-appearance:radio;
-webkit-appearance:radio;
}
#mc_embed_signup input:focus {
border-color:#333;
border-color:#333;
}
#mc_embed_signup .button {
clear:both; background-color: #aaa; border: 0 none; border-radius:4px; color: #FFFFFF; cursor: pointer; display: inline-block; font-size:15px; font-weight: bold; height: 32px; line-height: 32px; margin: 0 5px 10px 0; padding:0; text-align: center; text-decoration: none; vertical-align: top; white-space: nowrap; width: auto;
}
clear:both; background-color: #aaa; border: 0 none; border-radius:4px; color: #FFFFFF; cursor: pointer; display: inline-block; font-size:15px; font-weight: bold; height: 32px; line-height: 32px; margin: 0 5px 10px 0; padding:0; text-align: center; text-decoration: none; vertical-align: top; white-space: nowrap; width: auto;
}
#mc_embed_signup .button:hover {
background-color:#777;
background-color:#777;
}
#mc_embed_signup .small-meta {
font-size: 11px;
}
font-size: 11px;
}
#mc_embed_signup .nowrap {
white-space:nowrap;
}
white-space:nowrap;
}
#mc_embed_signup label {
display:block; font-size:14px; padding-bottom:10px; font-weight:bold;color:#464646
}
display:block; font-size:14px; padding-bottom:10px; font-weight:bold;color:#464646
}
#mc_embed_signup input.email {
display:block; padding:8px 0; margin:0 0 10px 0; text-indent:5px; width:58%; min-width:130px;float:left;
}
display:block; padding:8px 0; margin:0 0 10px 0; text-indent:5px; width:58%; min-width:130px;float:left;
}
#mc_embed_signup input.button {
display:block; clear:none; background:#628C29; width:35%; margin:0 0 10px 0; min-width:90px;float:right;text-shadow:0 1px 0 #666;
}
display:block; clear:none; background:#628C29; width:35%; margin:0 0 10px 0; min-width:90px;float:right;text-shadow:0 1px 0 #666;
}
#mc_embed_signup div#mce-responses {
float:left; top:-1.4em; padding:0em .5em 0em .5em; overflow:hidden; width:90%;margin: 0 5%; clear: both;}
float:left; top:-1.4em; padding:0em .5em 0em .5em; overflow:hidden; width:90%;margin: 0 5%; clear: both;}
#mc_embed_signup div.response {
margin:1em 0; padding:1em .5em .5em 0; font-weight:bold; float:left; top:-1.5em; z-index:1; width:80%;
}
margin:1em 0; padding:1em .5em .5em 0; font-weight:bold; float:left; top:-1.5em; z-index:1; width:80%;
}
#mc_embed_signup #mce-error-response {
display:none;
}
display:none;
}
#mc_embed_signup #mce-success-response {
color:#529214; display:none;
}
color:#529214; display:none;
}
#mc_embed_signup label.error {
display:block; float:none; width:auto; margin-left:1.05em; text-align:left; padding:.5em 0;
}
display:block; float:none; width:auto; margin-left:1.05em; text-align:left; padding:.5em 0;
}


110 changes: 55 additions & 55 deletions posts-in-page/lib/page_posts.php
Original file line number Diff line number Diff line change
@@ -10,15 +10,15 @@ class ICPagePosts {

protected $args = array(
'post_type' => 'post',
'post_status' => 'publish',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'paginate' => false,
'template' => false
); // set defaults for wp_parse_args

public function __construct( $atts ) {
self::set_args( $atts );
self::set_args( $atts );
}

/**
@@ -29,19 +29,19 @@ public function __construct( $atts ) {
public function output_posts() {
if ( !$this->args )
return '';
$page_posts = apply_filters( 'posts_in_page_results', new WP_Query( $this->args ) ); // New WP_Query object
$output = '';
if ( $page_posts->have_posts( ) ):
$page_posts = apply_filters( 'posts_in_page_results', new WP_Query( $this->args ) ); // New WP_Query object
$output = '';
if ( $page_posts->have_posts( ) ):
while ( $page_posts->have_posts( ) ):
$output .= self::add_template_part( $page_posts );
endwhile;
$output .= ( $this->args['paginate'] ) ? '<div class="pip-nav">' . apply_filters( 'posts_in_page_paginate',
$this->paginate_links( $page_posts )
) . '</div>' : '';
endif;
wp_reset_postdata( );
return $output;
}
wp_reset_postdata( );
return $output;
}

protected function paginate_links( $posts ){
global $wp_query;
@@ -61,11 +61,11 @@ protected function paginate_links( $posts ){
*
* @param array $atts Attritubes for building the $args array.
*/
protected function set_args( $atts ) {
global $wp_query;
protected function set_args( $atts ) {
global $wp_query;
$this->args['posts_per_page'] = get_option( 'posts_per_page' );
// parse the arguments using the defaults
$this->args = wp_parse_args( $atts, $this->args );
$this->args = wp_parse_args( $atts, $this->args );

// multiple post types are indicated, pass as an array
if( preg_match( '`,`', $this->args['post_type'] ) ){
@@ -74,47 +74,47 @@ protected function set_args( $atts ) {
}

// Show specific posts by ID
if ( isset( $atts['ids'] ) ) {
$post_ids = explode( ',', $atts['ids'] );
$this->args['post__in'] = $post_ids;
$this->args['posts_per_page'] = count( $post_ids );
}
if ( isset( $atts['ids'] ) ) {
$post_ids = explode( ',', $atts['ids'] );
$this->args['post__in'] = $post_ids;
$this->args['posts_per_page'] = count( $post_ids );
}

// Use a specified template
if ( isset( $atts['template'] ) )
if ( isset( $atts['template'] ) )
$this->args['template'] = $atts['template'];
// get posts in a certain category by name (slug)
if ( isset( $atts['category'] ) ) {
$this->args['category_name'] = $atts['category'];
} elseif ( isset( $atts['cats'] ) ) { // get posts in a certain category by id
$this->args['cat'] = $atts['cats'];
}
$this->args['category_name'] = $atts['category'];
} elseif ( isset( $atts['cats'] ) ) { // get posts in a certain category by id
$this->args['cat'] = $atts['cats'];
}

// Do a tex query, tax and term a required.
if( isset( $atts['tax'] ) ) {
if( isset( $atts['term'] ) ){
$terms = explode( ',', $atts['term'] );
$this->args['tax_query'] = array(
array( 'taxonomy' => $atts['tax'], 'field' => 'slug', 'terms' => ( count( $terms ) > 1 ) ? $terms : $atts['term'] )
);
}
}
if( isset( $atts['tax'] ) ) {
if( isset( $atts['term'] ) ){
$terms = explode( ',', $atts['term'] );
$this->args['tax_query'] = array(
array( 'taxonomy' => $atts['tax'], 'field' => 'slug', 'terms' => ( count( $terms ) > 1 ) ? $terms : $atts['term'] )
);
}
}

// get posts with a certain tag
if ( isset( $atts['tag'] ) ) {
$tags = explode( ',', $atts['tag'] );
$this->args['tag'] = ( count( $tags ) > 1 ) ? $tags : $atts['tag'];
}
if ( isset( $atts['tag'] ) ) {
$tags = explode( ',', $atts['tag'] );
$this->args['tag'] = ( count( $tags ) > 1 ) ? $tags : $atts['tag'];
}

// show number of posts (default is 10, showposts or posts_per_page are both valid, only one is needed)
if ( isset( $atts['showposts'] ) )
if ( isset( $atts['showposts'] ) )
$this->args[ 'posts_per_page' ] = $atts['showposts'];

// handle pagination (for code, template pagination is in the template)
if ( isset( $wp_query->query_vars['page'] ) && $wp_query->query_vars['page'] > 1 ) {
$this->args['paged'] = $wp_query->query_vars['page'];
}
if ( isset( $wp_query->query_vars['page'] ) && $wp_query->query_vars['page'] > 1 ) {
$this->args['paged'] = $wp_query->query_vars['page'];
}

if ( ! isset( $this->args['ignore_sticky_posts'] ) ) {
$this->args['post__not_in'] = get_option( 'sticky_posts' );
@@ -125,41 +125,41 @@ protected function set_args( $atts ) {
}

$this->args = apply_filters( 'posts_in_page_args', $this->args );
}
}
/**
* Tests if a theme has a theme template file that exists
*
* @return true if template exists, false otherwise.
*/
protected function has_theme_template( ) {
$template_file = ( $this->args['template'] )
protected function has_theme_template( ) {
$template_file = ( $this->args['template'] )
? get_stylesheet_directory( ) . '/' . $this->args['template'] // use specified template file
: get_stylesheet_directory( ) . '/posts_loop_template.php'; // use default template file
return ( file_exists( $template_file ) ) ? $template_file : false;
}
return ( file_exists( $template_file ) ) ? $template_file : false;
}
/**
* Retrieves the post loop template and returns the output
*
* @return string results of the output
*/
protected function add_template_part( $ic_posts, $singles=false ) {
if ( $singles ) {
setup_postdata( $ic_posts );
} else {
$ic_posts->the_post( );
}
if ( $singles ) {
setup_postdata( $ic_posts );
} else {
$ic_posts->the_post( );
}
$output = '';
ob_start( );
ob_start( );
$output .= apply_filters( 'posts_in_page_pre_loop', '' );
require ( $file_path = self::has_theme_template( ) )
require ( $file_path = self::has_theme_template( ) )
? $file_path // use template file in theme
: POSTSPAGE_DIR . '/posts_loop_template.php'; // use default plugin template file
$output .= ob_get_contents( );
$output .= ob_get_contents( );
$output .= apply_filters( 'posts_in_page_post_loop', '' );
return ob_get_clean( );
return ob_get_clean( );
}

}
68 changes: 34 additions & 34 deletions posts-in-page/posts_in_page.php
Original file line number Diff line number Diff line change
@@ -41,73 +41,73 @@
require_once 'lib/page_posts.php';

class ICAddPostsToPage {
public function __construct( ) {
add_shortcode( 'ic_add_posts', array( &$this, 'posts_in_page' ) );
add_shortcode( 'ic_add_post', array( &$this, 'post_in_page' ) );
add_action( 'admin_menu', array( &$this, 'plugin_page_init' ) );
add_filter( 'plugin_action_links_'. plugin_basename( __FILE__ ), array( &$this, 'plugin_action_links' ), 10, 4 );
}
public function __construct( ) {
add_shortcode( 'ic_add_posts', array( &$this, 'posts_in_page' ) );
add_shortcode( 'ic_add_post', array( &$this, 'post_in_page' ) );
add_action( 'admin_menu', array( &$this, 'plugin_page_init' ) );
add_filter( 'plugin_action_links_'. plugin_basename( __FILE__ ), array( &$this, 'plugin_action_links' ), 10, 4 );
}
/**
* Add settings link on plugins page.
*/
public function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) {
if ( is_plugin_active( $plugin_file ) )
$actions[] = '<a href="' . admin_url('options-general.php?page=posts_in_page') . '">' . __( ' Help', 'posts_in_page' ) . '</a>';
return apply_filters( 'post_in_page_actions', $actions );
}
public function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) {
if ( is_plugin_active( $plugin_file ) )
$actions[] = '<a href="' . admin_url('options-general.php?page=posts_in_page') . '">' . __( ' Help', 'posts_in_page' ) . '</a>';
return apply_filters( 'post_in_page_actions', $actions );
}

/**
* Main Shortcode
*
* @param array $atts An array of shortcode parameters. None required
*/
public function posts_in_page( $atts ) {
$posts = new ICPagePosts( $atts );
public function posts_in_page( $atts ) {
$posts = new ICPagePosts( $atts );
return $posts->output_posts( );
}
}

/**
* Deprecated Shortcode (routing to posts in page function now )
*
* @todo Remove this depreciated function.
*/
public function post_in_page( $atts ) {
return self::posts_in_page( $atts );
return self::posts_in_page( $atts );
}

/**
* Init Plugin, add menu page and setup hooks to load assets on the plugin options page
*/
public function plugin_page_init() {
if ( ! current_user_can( 'administrator' ) )
public function plugin_page_init() {
if ( ! current_user_can( 'administrator' ) )
return;

$hooks = array( );
$hooks[] = add_options_page( __( 'Posts In Page' ), __( 'Posts In Page' ), 'read', 'posts_in_page',
array( $this, 'plugin_page' ) );
$hooks = array( );
$hooks[] = add_options_page( __( 'Posts In Page' ), __( 'Posts In Page' ), 'read', 'posts_in_page',
array( $this, 'plugin_page' ) );

foreach ( $hooks as $hook ) {
add_action( "admin_print_styles-{$hook}", array( $this, 'load_assets' ) );
}
}
foreach ( $hooks as $hook ) {
add_action( "admin_print_styles-{$hook}", array( $this, 'load_assets' ) );
}
}

/**
* Enqueue Plugin Assets (Scripts and Styles)
*/
public function load_assets( ) {
wp_enqueue_style( 'postpagestyle', POSTPAGE_URL. '/assets/post-page_styles.css' );
wp_enqueue_script( 'postpagescript', POSTPAGE_URL. '/assets/post-page_scripts.js' );
}
public function load_assets( ) {
wp_enqueue_style( 'postpagestyle', POSTPAGE_URL. '/assets/post-page_styles.css' );
wp_enqueue_script( 'postpagescript', POSTPAGE_URL. '/assets/post-page_scripts.js' );
}

/**
* Plugin Setting page - includes view for the page
*/
public function plugin_page( ) {
require_once 'assets/posts_in_page_help_view.php';
}
public function plugin_page( ) {
require_once 'assets/posts_in_page_help_view.php';
}
}

/**
2 changes: 1 addition & 1 deletion posts-in-page/posts_loop_template.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Note: if you make changes to this file, move it to your current theme's
<!-- NOTE: if you make changes to this file, move it to your current theme's
directory so this file won't be overwritten when the plugin is upgraded. -->

<!-- Start of Post Wrap -->

0 comments on commit a6509db

Please sign in to comment.