Changeset 1494768
- Timestamp:
- 09/12/2016 08:06:39 PM (10 years ago)
- Location:
- hana-block/trunk
- Files:
-
- 5 edited
-
hana-block.php (modified) (6 diffs)
-
inc/class-block-action.php (modified) (1 diff)
-
inc/class-grid.php (modified) (11 diffs)
-
inc/lib-choices.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hana-block/trunk/hana-block.php
r1472274 r1494768 3 3 * Plugin Name: Hana Block 4 4 * Plugin URI: http://rewindcreation.com/hana-block 5 * Description: A simple and powerful lplugin that allows to create content block and display anywhere.5 * Description: A simple and powerful plugin that allows to create content block and display anywhere. 6 6 * Author: RewindCreation 7 * Version: 1.0. 17 * Version: 1.0.2 8 8 * License: GNU General Public License v3 or later 9 9 * License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 27 27 private function __construct() { 28 28 $this->setup_globals(); 29 $this->includes(); 30 $this->actions(); 31 $this->shortcodes(); 29 add_action( 'after_setup_theme', array( $this, 'includes' ), -90 ); //Before Theme after Hana Core 30 add_action( 'after_setup_theme', array( $this, 'actions' ), 13 ); // After core setup 31 add_action( 'init', array( $this, 'add_post_type' ) ); 32 add_action( 'plugins_loaded', array( $this, 'loaded' ) ); 33 add_action( 'admin_menu', array( $this, 'metabox' ) ); 34 35 add_filter( 'manage_edit-hana_block_columns', array( $this, 'add_columns' ) ); 36 add_action( 'admin_head', array( $this, 'column_width' ) ); 37 add_action( 'manage_posts_custom_column', array( $this, 'display_columns' ), 10, 2 ); 32 38 } 33 39 34 40 private function setup_globals() { 35 41 /** Versions **********************************************************/ 36 $this->version = '1.0. 0';42 $this->version = '1.0.2'; 37 43 /** Paths *************************************************************/ 38 44 $this->file = __FILE__; … … 51 57 52 58 public function includes() { 53 59 add_theme_support( 'post-thumbnails' ); 54 60 if ( is_admin() ) { 55 61 require_once( $this->plugin_dir . 'inc/lib-choices.php' ); … … 60 66 } 61 67 62 private function actions() { 63 add_action( 'init', array( $this, 'add_post_type' ) ); 64 add_action( 'plugins_loaded', array( $this, 'loaded' ) ); 65 add_action( 'admin_menu', array( $this, 'metabox' ) ); 66 67 add_filter( 'manage_edit-hana_block_columns', array( $this, 'add_columns' ) ); 68 add_action( 'admin_head', array( $this, 'column_width' ) ); 69 add_action( 'manage_posts_custom_column', array( $this, 'display_columns' ), 10, 2 ); 70 } 71 72 private function shortcodes() { 73 add_shortcode( 'content-block', array( $this, 'content_block' ) ); 74 } 75 76 public function loaded() { //Actions after plugin loaded 77 load_plugin_textdomain( 'hana-block' ); 78 79 if ( ! is_admin() ) { 80 add_action('wp_enqueue_scripts', array( $this, 'frontend_styles') ); 81 82 $query = array( 68 public function actions() { 69 $query = array( 83 70 'post_type' => 'hana_block', 84 71 'post_status' => 'publish', … … 91 78 ) 92 79 ) 93 ); 94 $blocks = get_posts( $query ); 95 foreach ( $blocks as $block ) { 96 new Hana_Block_Action( $block->ID ); 97 } 80 ); 81 $blocks = get_posts( $query ); 82 foreach ( $blocks as $block ) { 83 new Hana_Block_Action( $block->ID ); 84 } 85 } 86 public function loaded() { //Actions after plugin loaded 87 load_plugin_textdomain( 'hana-block' ); 88 add_shortcode( 'content-block', array( $this, 'content_block' ) ); 89 90 if ( ! is_admin() ) { 91 add_action('wp_enqueue_scripts', array( $this, 'frontend_styles') ); 92 98 93 } else { 99 94 add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts') ); … … 218 213 ), $atts ) ); 219 214 215 $block = NULL; 220 216 if ( $slug ) 221 217 $block = get_page_by_path( $slug, OBJECT, $this->allowed_types ); 222 else 218 elseif ( $id ) 223 219 $block = get_post( $id ); 224 220 225 226 221 if( $block ) { 227 222 setup_postdata( $block ); 228 229 223 ob_start(); 230 224 $type = get_post_meta( $block->ID, '_hana_block_type', true); -
hana-block/trunk/inc/class-block-action.php
r1472265 r1494768 1 1 <?php 2 2 /** 3 * Class Meta Box3 * Class Block Action 4 4 * @package hanacore 5 5 * @since 1.0 -
hana-block/trunk/inc/class-grid.php
r1472265 r1494768 26 26 27 27 private function __construct() { 28 // Core uses the own defaults if theme do not add them in customizer28 // Core uses the own defaults if theme do not use it 29 29 $this->grid['grid_width'] = absint(get_theme_mod( 'grid_width', $this->grid['grid_width'] )); 30 30 $this->grid['fluid_grid'] = absint(get_theme_mod( 'fluid_grid', $this->grid['fluid_grid'] )); … … 34 34 $this->grid['sidebar1_column'] = absint(get_theme_mod( 'sidebar1_column', $this->grid['sidebar1_column'] )); 35 35 $this->grid['sidebar2_column'] = absint(get_theme_mod( 'sidebar2_column', $this->grid['sidebar2_column'] )); 36 $this->grid['sidebar_bbp'] = absint(get_theme_mod( 'sidebar_bbp', $this->grid['sidebar_bbp'] )); 36 $this->grid['sidebar_bbp'] = absint(get_theme_mod( 'sidebar_bbp', $this->grid['sidebar_bbp'] )); 37 37 } 38 38 … … 48 48 } 49 49 $class = apply_filters( 'hanagrid_main_class', $class ); 50 $imp_class = implode( ' ', $class ); 51 if ( $echo ) 52 echo esc_attr( $imp_class ); 50 $class = array_map("sanitize_html_class", $class); 51 $imp_class = implode( ' ', $class ); 52 if ( $echo ) 53 echo $imp_class; 53 54 else 54 55 return $imp_class; … … 63 64 $class[] = 'expanded'; 64 65 $class = apply_filters( 'hanagrid_row_class', $class ); 65 $imp_class = implode( ' ', $class ); 66 if ( $echo ) 67 echo esc_attr( $imp_class ); 66 $class = array_map("sanitize_html_class", $class); 67 $imp_class = implode( ' ', $class ); 68 if ( $echo ) 69 echo $imp_class; 68 70 else 69 71 return $imp_class; … … 76 78 $class[] = 'expanded'; 77 79 $class = apply_filters( 'hanagrid_header_row_class', $class ); 78 $imp_class = implode( ' ', $class ); 79 if ( $echo ) 80 echo esc_attr( $imp_class ); 80 $class = array_map("sanitize_html_class", $class); 81 $imp_class = implode( ' ', $class ); 82 if ( $echo ) 83 echo $imp_class; 81 84 else 82 85 return $imp_class; … … 110 113 $class[] = 'columns'; 111 114 $class = apply_filters( 'hanagrid_content_class', $class ); 112 $imp_class = implode( ' ', $class ); 113 if ( $echo ) 114 echo esc_attr( $imp_class ); 115 $class = array_map("sanitize_html_class", $class); 116 $imp_class = implode( ' ', $class ); 117 if ( $echo ) 118 echo $imp_class; 115 119 else 116 120 return $imp_class; … … 162 166 $class[] = 'columns'; 163 167 $class = apply_filters( 'hanagrid_sidebartwo_class', $class ); 164 } 165 $imp_class = implode( ' ', $class ); 166 if ( $echo ) 167 echo esc_attr( $imp_class ); 168 } 169 $class = array_map("sanitize_html_class", $class); 170 $imp_class = implode( ' ', $class ); 171 if ( $echo ) 172 echo $imp_class; 168 173 else 169 174 return $imp_class; … … 174 179 $class[] = 'large-' . $this->grid['grid_column']; 175 180 $class[] = 'columns'; 176 $imp_class = implode( ' ', $class ); 177 if ( $echo ) 178 echo esc_attr( $imp_class ); 181 $class = array_map("sanitize_html_class", $class); 182 $imp_class = implode( ' ', $class ); 183 if ( $echo ) 184 echo $imp_class; 179 185 else 180 186 return $imp_class; … … 189 195 $class[] = 'small-' . $small_col; 190 196 $class[] = 'columns'; 191 $imp_class = implode( ' ', $class ); 192 if ( $echo ) 193 echo esc_attr( $imp_class ); 197 $class = array_map("sanitize_html_class", $class); 198 $imp_class = implode( ' ', $class ); 199 if ( $echo ) 200 echo $imp_class; 194 201 else 195 202 return $imp_class; … … 200 207 201 208 $width = $this->grid['grid_column'] - $this->grid['sidebar_bbp']; 202 $class[] = 'large-' . $width;203 209 $class[] = 'medium-' . $width; 204 210 $class[] = 'columns'; 205 211 $class = apply_filters( 'hanagrid_bbp_content_class', $class ); 206 $imp_class = implode( ' ', $class ); 207 if ( $echo ) 208 echo esc_attr( $imp_class ); 212 $class = array_map("sanitize_html_class", $class); 213 $imp_class = implode( ' ', $class ); 214 if ( $echo ) 215 echo $imp_class; 209 216 else 210 217 return $imp_class; … … 214 221 $class = array(); 215 222 216 $class[] = 'large-' . $this->grid['sidebar_bbp'];217 223 $class[] = 'medium-' . $this->grid['sidebar_bbp']; 218 224 $class[] = 'columns'; 219 225 $class = apply_filters( 'hanagrid_bbp_sidebar_class', $class ); 220 $imp_class = implode( ' ', $class ); 221 if ( $echo ) 222 echo esc_attr( $imp_class ); 226 $class = array_map("sanitize_html_class", $class); 227 $imp_class = implode( ' ', $class ); 228 if ( $echo ) 229 echo $imp_class; 223 230 else 224 231 return $imp_class; -
hana-block/trunk/inc/lib-choices.php
r1472265 r1494768 107 107 } 108 108 endif; 109 110 // Sidebar Positions 111 if ( ! function_exists( 'hana_sidebar_postion_choices' ) ) : 112 function hana_sidebar_postion_choices() { 113 $choices = array( 114 'right' => esc_html__('Right Sidebar', 'hana'), 115 'left' => esc_html__('Left Sidebar', 'hana'), 116 'both' => esc_html__('Left & Right Sidebar', 'hana'), 117 'none' => esc_html__('No Sidebar', 'hana') 118 ); 119 return apply_filters( 'hana_sidebar_postion_choices', $choices ); 120 } 121 endif; -
hana-block/trunk/readme.txt
r1472274 r1494768 4 4 Tags: content block 5 5 Requires at least: 4.5 6 Tested up to: 4. 5.37 Stable tag: 1.0. 16 Tested up to: 4.6.1 7 Stable tag: 1.0.2 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 15 15 <a href="http://rewindcreation.com/hana-block">Hana Block</a> is a very simple and yet powerful plugin. 16 16 17 * Custom post type `hana_block` is created to manage content block using **use theWYSIWYG editor**17 * Custom post type `hana_block` is created to manage content block using the **WYSIWYG editor** 18 18 * There are 2 types of content blocks: Layout and Content. 19 19 * The content block can be included in post, page and text widget using short code `[content-block]` 20 20 * The content block can be included in any theme supported action hooks. 21 21 22 Support is provided at <a href="http://rewindcreation.com/support">support forums</a>.22 For documentation, please visit <a href="http://rewindcreation.com/hana-block">RewindCreation</a>. 23 23 24 24 == Installation ==
Note: See TracChangeset
for help on using the changeset viewer.