Changeset 1017981
- Timestamp:
- 11/01/2014 06:33:35 PM (11 years ago)
- Location:
- polymer-components
- Files:
-
- 7 added
- 6 edited
-
assets/screenshot-2.png (added)
-
assets/screenshot-3.png (added)
-
trunk/codemirror (added)
-
trunk/codemirror/codemirror.css (added)
-
trunk/codemirror/codemirror.min.js (added)
-
trunk/codemirror/javascript.js (added)
-
trunk/polymer-admin.css (added)
-
trunk/polymer-admin.js (modified) (2 diffs)
-
trunk/polymer-admin.php (modified) (6 diffs)
-
trunk/polymer-components.css (modified) (1 diff)
-
trunk/polymer-components.php (modified) (3 diffs)
-
trunk/polymer-shortcodes.php (modified) (1 diff)
-
trunk/readme.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
polymer-components/trunk/polymer-admin.js
r1015780 r1017981 1 1 /** 2 * Plugin Name: Polymer 2 * Plugin Name: Polymer Components 3 3 * Author: Mattia Roccoberton 4 4 * Author URI: http://blocknot.es … … 9 9 document.getElementById( 'docs_' + group ).href = url + '#' + document.getElementById( 'sel_' + group ).value; 10 10 } 11 12 window.onload = function() { 13 var poly_javascript = document.getElementById( 'poly_javascript' ); 14 if( poly_javascript != null ) 15 { 16 CodeMirror.fromTextArea( poly_javascript, { 17 dragDrop: false, 18 indentWithTabs: true, 19 lineNumbers: true, 20 smartIndent: false 21 }); 22 } 23 }; -
polymer-components/trunk/polymer-admin.php
r1017008 r1017981 1 1 <?php 2 if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 3 4 define( 'PLUGIN_MAIN', 'polymer-components/polymer-components.php' ); 5 2 6 class polymer_admin 3 7 { 8 private $options; 9 4 10 function __construct() 5 11 { … … 7 13 add_action( 'add_meta_boxes', array( &$this, 'add_meta_boxes' ) ); 8 14 add_action( 'admin_init', array( &$this, 'admin_init' ) ); 15 add_action( 'admin_menu', array( $this, 'admin_menu' ) ); 9 16 add_action( 'save_post', array( &$this, 'save_post' ) ); 17 // --- Filters --- 18 add_filter( 'plugin_action_links_' . PLUGIN_MAIN, array( &$this, 'plugin_action_links' ), 10, 1 ); 10 19 } 11 20 … … 17 26 18 27 function admin_init() 28 { // action 29 $this->options = get_option( 'polymer-options' ); 30 wp_enqueue_style( 'poly-admin-style', plugin_dir_url( __FILE__ ) . 'polymer-admin.css' ); 31 wp_enqueue_style( 'poly-admin-codemirror-style', plugin_dir_url( __FILE__ ) . 'codemirror/codemirror.css' ); 32 wp_register_script( 'poly-admin-scripts', plugin_dir_url( __FILE__ ) . 'polymer-admin.js', array() ); 33 wp_register_script( 'poly-admin-codemirror', plugin_dir_url( __FILE__ ) . 'codemirror/codemirror.min.js', array() ); 34 wp_register_script( 'poly-admin-codemirror-js', plugin_dir_url( __FILE__ ) . 'codemirror/javascript.js', array() ); 35 wp_enqueue_script( 'poly-admin-scripts' ); 36 wp_enqueue_script( 'poly-admin-codemirror' ); 37 wp_enqueue_script( 'poly-admin-codemirror-js' ); 38 // Settings 39 register_setting( 40 'polymer-settings-general', 41 'polymer-options' 42 //, array( $this, 'sanitize' ) // Sanitize 43 ); 44 add_settings_section( 45 'polymer-section-general', // ID 46 'General settings', // Title 47 array( $this, 'print_section_info' ), // Callback 48 'polymer-settings' // Page 49 ); 50 add_settings_field( 51 'polymer-js-posts', // ID 52 'JS in posts', // Title 53 array( $this, 'field_js_posts' ), // Callback 54 'polymer-settings', // Page 55 'polymer-section-general' // Section 56 ); 57 add_settings_field( 58 'polymer-js-pages', // ID 59 'JS in pages', // Title 60 array( $this, 'field_js_pages' ), // Callback 61 'polymer-settings', // Page 62 'polymer-section-general' // Section 63 ); 64 } 65 66 function admin_menu() 67 { // action 68 add_options_page( 69 'Settings Admin', 70 'Polymer settings', 71 'manage_options', 72 'polymer-settings', 73 array( $this, 'create_admin_page' ) 74 ); 75 } 76 77 function create_admin_page() 78 { // callback 79 ?> 80 <div id="polymer-settings" class="wrap"> 81 <?php screen_icon(); ?> 82 <h2>Polymer settings</h2> 83 <form method="post" action="options.php"> 84 <?php 85 settings_fields( 'polymer-settings-general' ); 86 do_settings_sections( 'polymer-settings' ); 87 submit_button(); 88 ?> 89 </form> 90 </div> 91 <?php 92 } 93 94 function field_js_pages() 19 95 { 20 wp_register_script( 'poly-admin-scripts', plugin_dir_url( __FILE__ ) . 'polymer-admin.js', array() ); 21 wp_enqueue_script( 'poly-admin-scripts' ); 96 if( $this->options !== FALSE ) 97 { 98 $checked = isset( $this->options['polymer-js-pages'] ) && !empty( $this->options['polymer-js-pages'] ); 99 } 100 else $checked = TRUE; 101 echo '<input type="checkbox" id="polymer-js-pages" name="polymer-options[polymer-js-pages]"', $checked ? ' checked="checked"' : '', '/> <label for="polymer-js-pages">', __('Javascript editor in pages'), '</label>'; 102 } 103 104 function field_js_posts() 105 { 106 if( $this->options !== FALSE ) 107 { 108 $checked = isset( $this->options['polymer-js-posts'] ) && !empty( $this->options['polymer-js-posts'] ); 109 } 110 else $checked = TRUE; 111 echo '<input type="checkbox" id="polymer-js-posts" name="polymer-options[polymer-js-posts]"', $checked ? ' checked="checked"' : '', '/> <label for="polymer-js-posts">', __('Javascript editor in posts'), '</label>'; 112 } 113 114 function plugin_action_links( $links ) 115 { 116 array_unshift( $links, '<a href="' . admin_url( 'options-general.php?page=polymer-settings' ) . '">'. __('Settings') . '</a>' ); 117 return $links; 22 118 } 23 119 … … 47 143 if( $group == 'core' ) $url = 'http://www.polymer-project.org/docs/elements/core-elements.html'; 48 144 else if( $group == 'paper' ) $url = 'http://www.polymer-project.org/docs/elements/paper-elements.html'; 145 else if( $group == 'polymer' ) continue; 49 146 //echo '<h4 style="margin: 10px 0 5px 0">', $group, ':</h4>'; 50 147 echo $sep, '<b>', $group, '</b>: '; … … 57 154 } 58 155 echo "</div>\n"; 59 echo '<div><b>Javascript code</b>:</div>'; 60 $val = get_post_meta( $post->ID, 'poly_javascript', TRUE ); 61 echo '<textarea name="poly_javascript" style="width: 100%" cols="80" rows="6">', stripslashes( $val ), '</textarea>', "\n"; 156 if( $post->post_type == 'post' ) $poly_javascript = isset( $this->options['polymer-js-posts'] ) && !empty( $this->options['polymer-js-posts'] ); 157 else if( $post->post_type == 'page' ) $poly_javascript = isset( $this->options['polymer-js-pages'] ) && !empty( $this->options['polymer-js-pages'] ); 158 else $poly_javascript = FALSE; 159 if( $poly_javascript ) 160 { 161 echo '<div style="border-bottom: 1px solid #aaa; padding-bottom: 5px"><b>Javascript code</b>:</div>'; 162 $val = get_post_meta( $post->ID, 'poly_javascript', TRUE ); 163 echo '<textarea name="poly_javascript" id="poly_javascript" style="width: 100%" cols="80" rows="6">', stripslashes( $val ), '</textarea>', "\n"; 164 } 165 echo "</div>\n"; 62 166 } 167 168 public function print_section_info() { } 63 169 64 170 function save_post( $post_id ) … … 88 194 89 195 if( isset( $_POST['poly_javascript'] ) && !empty( $_POST['poly_javascript'] ) ) update_post_meta( $post_id, 'poly_javascript', addslashes( $_POST['poly_javascript'] ) ); 90 91 //var_dump( $_POST ); exit;92 /* if( isset( $_POST['lq_body_padding_top'] ) )93 {94 $val = intval( $_POST['lq_body_padding_top'] );95 if( $val < 0 ) $val = -1;96 update_post_meta( $post_id, 'lq_body_padding_top', $val );97 } */98 196 } 99 197 } -
polymer-components/trunk/polymer-components.css
r1015780 r1017981 1 1 /** 2 * Plugin Name: Polymer 2 * Plugin Name: Polymer Components 3 3 * Author: Mattia Roccoberton 4 4 * Author URI: http://blocknot.es -
polymer-components/trunk/polymer-components.php
r1017013 r1017981 3 3 * Plugin Name: Polymer Components 4 4 * Plugin URI: http://blocknot.es/ 5 * Description: Add Polymer supportto your website!6 * Version: 1. 0.65 * Description: Add Polymer elements to your website! 6 * Version: 1.1.0 7 7 * Author: Mattia Roccoberton 8 8 * Author URI: http://blocknot.es … … 82 82 'paper-toast' => 'paper-toast/paper-toast.html', 83 83 'paper-toggle-button' => 'paper-toggle-button/paper-toggle-button.html', 84 // misc 85 'polymer-element' => 'polymer/polymer.html', 84 86 ); 85 87 var $requirements = array( … … 102 104 'social-icons' => 'core-icons/social-icons.html', 103 105 ); 106 var $options; 104 107 105 108 function __construct() 106 109 { 110 $this->options = get_option( 'polymer-options' ); 107 111 if( !is_admin() ) 108 112 { -
polymer-components/trunk/polymer-shortcodes.php
r1015780 r1017981 1 1 <?php 2 if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 3 2 4 class polymer_shortcodes 3 5 { -
polymer-components/trunk/readme.txt
r1017020 r1017981 5 5 Requires at least: 3.5.0 6 6 Tested up to: 4.0 7 Stable tag: 1. 0.67 Stable tag: 1.1.0 8 8 License: GPL3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.txt 10 10 11 Add Polymer components to your website!11 Add Polymer elements to your website! 12 12 Polymer brings an implementation of Google Material Design to the web. 13 13 … … 16 16 This plugin allows to add Polymer elements in your posts and pages. The same components used in Android Lollypop. You can use the HTML editor with the Polymer tags or the shortcode *[poly]* for all the elements. The correct HTML libraries will be loaded automatically when you use a Polymer tag. 17 17 Polymer documentation page: http://www.polymer-project.org/ 18 19 Features: 20 21 * Polymer tags directly available (core & paper) in posts and pages with the HTML editor; 22 * [poly] shortcode to access to the Polymer tags; 23 * auto import the necessary HTML components; 24 * Javascript editor in posts / pages admin; 25 * documentation links for each tag. 18 26 19 27 Shortcode syntax: [poly ELEMENT-TAG ELEMENT-OPTIONS] … … 25 33 Examples: 26 34 27 *[poly core-icon icon="favorite"][/poly]28 *[poly paper-checkbox][/poly]29 *[poly paper-button raised style="color: green"]A green button[/poly]30 *[poly paper-item icon="home" label="Test link"]<a href="http://www.google.it" target="_blank"></a>[/poly]35 [poly core-icon icon="favorite"][/poly] 36 [poly paper-checkbox][/poly] 37 [poly paper-button raised style="color: green"]A green button[/poly] 38 [poly paper-item icon="home" label="Test link"]<a href="http://www.google.it" target="_blank"></a>[/poly] 31 39 32 40 == Installation == 33 41 34 1. Install and activate the plugin 42 1. Install the plugin 43 1. Activate it 35 44 1. Edit a post or a page 36 1. Add one or more Polymer tags (in the HTML editor) or use the shortcode45 1. Use the shortcode to add Polymer elements and/or add directly Polymer tags (in the HTML editor) 37 46 38 47 == Frequently Asked Questions == … … 40 49 = How can I interact with the Polymer elements? = 41 50 42 You can add your Javascript code for your page or post , under the content editor there is a textarea in Polymer components meta box.51 You can add your Javascript code for your page or post in the Javascript editor under the content editor - Polymer Components meta box. 43 52 Sample code to open a dialog from a button click: 44 53 … … 49 58 }); 50 59 60 = Can I create my elements? = 61 62 Yes, you can use the *polymer-element* tag in posts and pages included the script block. 63 51 64 == Screenshots == 52 65 53 1. Some Polymer components in a post 66 1. Some Polymer elements in a post 67 2. Polymer Components meta box in post / page editor 68 3. A custom element 54 69 55 70 == Upgrade Notice == 56 71 72 = 1.1.0 = 73 * New settings screen 74 * New settings: JS in pages / posts 75 * Improved Javascript editor 76 * Added polymer-element tag 57 77 = 1.0.6 = 58 78 * Added Javascript textarea to posts and pages … … 64 84 == Changelog == 65 85 86 = 1.1.0 = 87 * New settings screen 88 * New settings: JS in pages / posts 89 * Improved Javascript editor 90 * Added polymer-element tag 66 91 = 1.0.6 = 67 92 * Added Javascript textarea to posts and pages
Note: See TracChangeset
for help on using the changeset viewer.