Changeset 1026695
- Timestamp:
- 11/16/2014 09:40:28 AM (11 years ago)
- Location:
- polymer-components
- Files:
-
- 2 added
- 9 edited
-
assets/banner-772x250.png (modified) (previous)
-
assets/screenshot-1.png (modified) (previous)
-
assets/screenshot-2.png (modified) (previous)
-
assets/screenshot-3.png (modified) (previous)
-
trunk/codemirror/css.js (added)
-
trunk/conf.php (modified) (1 diff)
-
trunk/polymer-admin.js (modified) (2 diffs)
-
trunk/polymer-admin.php (modified) (8 diffs)
-
trunk/polymer-components.php (modified) (7 diffs)
-
trunk/polymer-template.php (added)
-
trunk/readme.txt (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
polymer-components/trunk/conf.php
r1025830 r1026695 1 1 <?php 2 define( 'POLYMER_VERSION', '0.4.2' ); 3 2 4 define( 'POLYMER_COMPONENTS_MAIN', 'polymer-components/polymer-components.php' ); 3 5 -
polymer-components/trunk/polymer-admin.js
r1018331 r1026695 18 18 indentWithTabs: true, 19 19 lineNumbers: true, 20 mode: 'javascript', 21 smartIndent: false 22 }); 23 } 24 25 var poly_styles = document.getElementById( 'poly_styles' ); 26 if( poly_styles != null ) 27 { 28 CodeMirror.fromTextArea( poly_styles, { 29 dragDrop: false, 30 indentWithTabs: true, 31 lineNumbers: true, 32 mode: 'css', 20 33 smartIndent: false 21 34 }); … … 32 45 indentWithTabs: true, 33 46 lineNumbers: true, 47 mode: 'html', 34 48 smartIndent: false 35 49 }); -
polymer-components/trunk/polymer-admin.php
r1025830 r1026695 39 39 wp_register_script( 'poly-admin-codemirror', plugin_dir_url( __FILE__ ) . 'codemirror/codemirror.min.js', array() ); 40 40 wp_register_script( 'poly-admin-codemirror-js', plugin_dir_url( __FILE__ ) . 'codemirror/javascript.js', array() ); 41 wp_register_script( 'poly-admin-codemirror-css', plugin_dir_url( __FILE__ ) . 'codemirror/css.js', array() ); 41 42 wp_enqueue_script( 'poly-admin-scripts' ); 42 43 wp_enqueue_script( 'poly-admin-codemirror' ); 43 44 wp_enqueue_script( 'poly-admin-codemirror-js' ); 45 wp_enqueue_script( 'poly-admin-codemirror-css' ); 44 46 // Settings 45 47 register_setting( … … 88 90 <h2>Polymer Components</h2> 89 91 <hr/> 92 <div>Polymer version provided: <b><?php echo POLYMER_VERSION; ?></b></div> 90 93 <form method="post" action="options.php"> 91 94 <?php … … 120 123 $val = get_post_meta( $post->ID, 'poly_iconsets', TRUE ); 121 124 $iconsets = !empty( $val ) ? unserialize( $val ) : array(); 125 $autop = get_post_meta( $post->ID, 'poly_autop', TRUE ); 126 $template = get_post_meta( $post->ID, 'poly_template', TRUE ); 122 127 $groups = array(); 123 128 foreach( $polycomponents->tags as $tag => $file ) … … 126 131 if( $pos > 0 ) $groups[substr( $tag, 0, $pos )][] = $tag; 127 132 } 128 echo '<div id="poly_page_options">', "\n"; 129 echo '<div><b>Iconsets</b>: <span style="font-size: 9pt">'; 130 foreach( $polycomponents->iconsets as $iconset => $file ) 131 { 132 echo '<span style="padding-right: 18px"><input type="checkbox" id="chk_', $iconset, '" name="', $iconset, '"', in_array( $iconset, $iconsets ) ? ' checked="checked"' : '',' />'; 133 echo '<label for="chk_', $iconset, '">', $iconset, '</label></span> '; 134 } 135 $sep = ''; 136 echo "</span></div>\n<div style=\"padding-top: 10px; padding-bottom: 10px\">\n"; 133 // --- Docs --- 134 echo '<div style="padding-top: 10px">'; 137 135 foreach( $groups as $group => $tags ) 138 136 { … … 151 149 } 152 150 echo "</div>\n"; 151 // --- Options --- 152 echo '<div id="poly_page_options">', "\n"; 153 echo '<div style="padding-top: 10px">'; 154 echo '<label for="poly_autop"><b>Enable autop</b>:</label> <input type="checkbox" id="poly_autop" name="poly_autop"', empty( $autop ) ? '' : ' checked="checked"', '/> – '; 155 echo '<label for="poly_template"><b>Override template</b>:</label> <input type="checkbox" id="poly_template" name="poly_template"', empty( $template ) ? '' : ' checked="checked"', '/>'; 156 echo '</div><div style="padding-top: 10px"><b>Import iconsets</b>: <span style="font-size: 9pt">'; 157 foreach( $polycomponents->iconsets as $iconset => $file ) 158 { 159 echo '<span style="padding-right: 18px"><input type="checkbox" id="chk_', $iconset, '" name="', $iconset, '"', in_array( $iconset, $iconsets ) ? ' checked="checked"' : '',' />'; 160 echo '<label for="chk_', $iconset, '">', $iconset, '</label></span> '; 161 } 162 $sep = ''; 163 echo "</span></div>\n"; 164 // --- JS editor --- 153 165 if( $post->post_type == 'post' ) $poly_javascript = isset( $this->options['polymer-js-posts'] ) && !empty( $this->options['polymer-js-posts'] ); 154 166 else if( $post->post_type == 'page' ) $poly_javascript = isset( $this->options['polymer-js-pages'] ) && !empty( $this->options['polymer-js-pages'] ); … … 156 168 if( $poly_javascript ) 157 169 { 158 echo '<div style="border-bottom: 1px solid #aaa; padding- bottom: 5px"><b>Javascript code</b>:</div>';170 echo '<div style="border-bottom: 1px solid #aaa; padding-top: 10px; padding-bottom: 5px"><b>Javascript code</b>:</div>'; 159 171 $val = get_post_meta( $post->ID, 'poly_javascript', TRUE ); 160 172 echo '<textarea name="poly_javascript" id="poly_javascript" style="width: 100%" cols="80" rows="6">', stripslashes( $val ), '</textarea>', "\n"; 161 173 } 174 // --- CSS editor --- 175 echo '<div style="border-bottom: 1px solid #aaa; padding-top: 10px; padding-bottom: 5px"><b>Styles</b>:</div>'; 176 $val = get_post_meta( $post->ID, 'poly_styles', TRUE ); 177 echo '<textarea name="poly_styles" id="poly_styles" style="width: 100%" cols="80" rows="6">', stripslashes( $val ), '</textarea>', "\n"; 162 178 echo "</div>\n"; 163 179 } … … 188 204 //update_post_meta( $post_id, 'poly_tags', sanitize_text_field( array_keys( $meta ) ) ); 189 205 206 update_post_meta( $post_id, 'poly_autop', isset( $_POST['poly_autop'] ) && !empty( $_POST['poly_autop'] ) ); 207 update_post_meta( $post_id, 'poly_template', isset( $_POST['poly_template'] ) && !empty( $_POST['poly_template'] ) ); 208 190 209 $iconsets = array(); 191 210 foreach( $polycomponents->iconsets as $iconset => $file ) … … 194 213 } 195 214 update_post_meta( $post_id, 'poly_iconsets', serialize( $iconsets ) ); 196 197 update_post_meta( $post_id, 'poly_ javascript', addslashes( $_POST['poly_javascript'] ));215 update_post_meta( $post_id, 'poly_javascript', ( isset( $_POST['poly_javascript'] ) && !empty( $_POST['poly_javascript'] ) ) ? addslashes( $_POST['poly_javascript'] ) : '' ); 216 update_post_meta( $post_id, 'poly_styles', ( isset( $_POST['poly_styles'] ) && !empty( $_POST['poly_styles'] ) ) ? addslashes( $_POST['poly_styles'] ) : '' ); 198 217 } 199 218 } -
polymer-components/trunk/polymer-components.php
r1025830 r1026695 4 4 * Plugin URI: http://blocknot.es/ 5 5 * Description: Add Polymer elements to your website! 6 * Version: 1.2. 06 * Version: 1.2.5 7 7 * Author: Mattia Roccoberton 8 8 * Author URI: http://blocknot.es … … 107 107 ); 108 108 var $options; 109 var $import = array(); 109 110 110 111 function __construct() … … 115 116 $this->options = unserialize( POLYMER_OPTIONS ); 116 117 } 117 if( !is_admin() ) add_action( 'wp_enqueue_scripts', array( &$this, 'wp_enqueue_scripts' ) ); 118 if( !is_admin() ) 119 { 120 add_filter( 'template_include', array( &$this, 'template_include' ), 99, 1 ); 121 add_action( 'wp_enqueue_scripts', array( &$this, 'wp_enqueue_scripts' ) ); 122 add_action( 'wp_head', array( &$this, 'wp_head' ) ); 123 } 118 124 add_filter( 'is_protected_meta', array( &$this, 'is_protected_meta' ), 10, 2 ); // Hide internal meta 119 125 remove_filter( 'the_content', 'wpautop' ); // >>> Disable automatic formatting inside WordPress shortcodes 120 add_filter( 'the_content', 'wpautop' , 99 );121 126 add_filter( 'the_content', 'shortcode_unautop', 100 ); 122 127 //add_filter( 'no_texturize_shortcodes', array( &$this, 'no_texturize_shortcodes' ), 10, 4 ); // <<< … … 137 142 //} 138 143 144 function template_include( $template ) 145 { 146 global $post; 147 if( is_singular() ) 148 { 149 $poly_template = get_post_meta( $post->ID, 'poly_template', TRUE ); 150 if( !empty( $poly_template ) ) return plugin_dir_path( __FILE__ ) . 'polymer-template.php'; 151 } 152 return $template; 153 } 154 139 155 function widgets_init() 140 156 { … … 146 162 global $post; 147 163 wp_enqueue_script( 'polymer-platform-script', plugin_dir_url( __FILE__ ) . 'components/platform/platform.js', array() ); 148 $list = array();149 164 if( is_singular() ) 150 165 { // Single posts and pages 166 // --- autop --- 167 $poly_autop = get_post_meta( $post->ID, 'poly_autop', TRUE ); 168 if( !empty( $poly_autop ) ) add_filter( 'the_content', 'wpautop' , 99 ); 169 // --- Poly import --- 151 170 $poly_tags = get_post_meta( $post->ID, 'poly_tags', TRUE ); 152 171 if( !empty( $poly_tags ) ) … … 155 174 foreach( $tags as $tag ) 156 175 { 157 if( isset( $this->tags[$tag] ) ) $ list[$tag] = $this->tags[$tag];158 else if( isset( $this->extra[$tag] ) ) $ list[$tag] = $this->extra[$tag];176 if( isset( $this->tags[$tag] ) ) $this->import[$tag] = $this->tags[$tag]; 177 else if( isset( $this->extra[$tag] ) ) $this->import[$tag] = $this->extra[$tag]; 159 178 } 160 179 } 180 // --- Poly iconsets --- 161 181 $poly_iconsets = get_post_meta( $post->ID, 'poly_iconsets', TRUE ); 162 182 if( !empty( $poly_iconsets ) ) 163 183 { 164 184 $iconsets = unserialize( $poly_iconsets ); 165 foreach( $iconsets as $iconset ) if( isset( $this->iconsets[$iconset] ) ) echo '<link rel="import" href="', plugin_dir_url( __FILE__ ), 'components/', $this->iconsets[$iconset], "\" />\n";185 foreach( $iconsets as $iconset ) if( isset( $this->iconsets[$iconset] ) ) $this->import[$iconset] = $this->iconsets[$iconset]; 166 186 } 167 $ poly_javascript = get_post_meta( $post->ID, 'poly_javascript', TRUE );168 if( !empty( $poly_javascript ) ) echo "<script type=\"text/javascript\">\n", stripslashes( $poly_javascript ), "\n</script>\n";187 $this->javascript = get_post_meta( $post->ID, 'poly_javascript', TRUE ); 188 $this->styles = get_post_meta( $post->ID, 'poly_styles', TRUE ); 169 189 } 170 190 //var_dump( is_active_sidebar( is_active_widget( FALSE, FALSE, 'polymer_widget' ) ) ); … … 180 200 foreach( $tags as $tag ) 181 201 { 182 if( isset( $this->tags[$tag] ) ) $ list[$tag] = $this->tags[$tag];183 else if( isset( $this->extra[$tag] ) ) $ list[$tag] = $this->extra[$tag];202 if( isset( $this->tags[$tag] ) ) $this->import[$tag] = $this->tags[$tag]; 203 else if( isset( $this->extra[$tag] ) ) $this->import[$tag] = $this->extra[$tag]; 184 204 } 185 205 } 186 206 } 187 207 } 188 foreach( $list as $tag => $import ) echo '<link rel="import" href="', plugin_dir_url( __FILE__ ), 'components/', $import, "\" />\n"; 208 } 209 210 function wp_head() 211 { 212 foreach( $this->import as $tag => $import ) echo '<link rel="import" href="', plugin_dir_url( __FILE__ ), 'components/', $import, "\" />\n"; 213 if( isset( $this->javascript ) && !empty( $this->javascript ) ) echo "<script type=\"text/javascript\">\n", stripslashes( $this->javascript ), "\n</script>\n"; 214 if( isset( $this->styles ) && !empty( $this->styles ) ) echo "<style type=\"text/css\">\n", stripslashes( $this->styles ), "\n</style>\n"; 189 215 } 190 216 } -
polymer-components/trunk/readme.txt
r1025830 r1026695 5 5 Requires at least: 3.5.0 6 6 Tested up to: 4.0 7 Stable tag: 1.2. 07 Stable tag: 1.2.5 8 8 License: GPL3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.txt … … 17 17 Polymer documentation page: http://www.polymer-project.org/ 18 18 19 Notice: Polymer is still in developer preview so some constructs may change in future and a modern browser is required to run Polymer apps. 20 19 21 Features: 20 22 21 23 * Polymer tags directly available (core & paper) in posts and pages with the HTML editor; 24 * Polymer widget; 22 25 * [poly] shortcode to access to the Polymer tags; 23 26 * auto import the necessary HTML components; 24 27 * Javascript editor in posts / pages admin; 28 * CSS editor in posts / pages admin; 29 * autop on/off option; 30 * template override on/off option; 25 31 * documentation links for each tag. 26 32 … … 37 43 [poly paper-button raised style="color: green"]A green button[/poly] 38 44 [poly paper-item icon="home" label="Test link"]<a href="http://www.google.it" target="_blank"></a>[/poly] 45 46 Notes: 47 48 * autop option: the autop() Wordpress function adds p and br tags to the post content when a newline is found, but this can break the Polymer tags. That's why I have added this option that disable by default the autop function 49 * template override option: if this option is enabled this plugin will load a special template which provides only the required components to run a Polymer app. This is useful if you want a "fullscreen" Polymer app 39 50 40 51 == Installation == … … 60 71 = Can I create my elements? = 61 72 62 Yes, you can use the *polymer-element* tag in posts and pages included the script block.73 Yes, you can use the *polymer-element* tag in posts and pages also with script blocks. 63 74 64 75 == Screenshots == … … 70 81 == Upgrade Notice == 71 82 83 = 1.2.5 = 84 * New CSS editor for posts / pages 85 * New options: autop, override template 86 * Internal improvements 72 87 = 1.2.0 = 73 88 * New widget … … 78 93 = 1.1.0 = 79 94 * New settings screen 80 * New settings: JS in p ages / posts95 * New settings: JS in posts / pages 81 96 * Improved Javascript editor 82 97 * Added polymer-element tag 83 = 1.0.6 =84 * Added Javascript textarea to posts and pages85 98 86 99 == Changelog == 87 100 101 = 1.2.5 = 102 * New CSS editor for posts / pages 103 * New options: autop, override template 104 * Internal improvements 88 105 = 1.2.0 = 89 106 * New widget … … 94 111 = 1.1.0 = 95 112 * New settings screen 96 * New settings: JS in p ages / posts113 * New settings: JS in posts / pages 97 114 * Improved Javascript editor 98 115 * Added polymer-element tag 99 116 = 1.0.6 = 100 * Added Javascript textarea to posts andpages117 * New Javascript editor for posts / pages 101 118 = 1.0.2 = 102 119 * Small fix for admin docs
Note: See TracChangeset
for help on using the changeset viewer.