Changeset 1337683
- Timestamp:
- 01/28/2016 01:07:09 AM (10 years ago)
- Location:
- bcorp-visual-editor/trunk
- Files:
-
- 2 added
- 1 deleted
- 3 edited
-
bcorp_visual_editor.php (modified) (2 diffs)
-
css/bcorp-visual-editor-admin.css (added)
-
css/bcve.css (modified) (2 diffs)
-
includes (deleted)
-
js/bcorp-visual-editor-admin.js (added)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bcorp-visual-editor/trunk/bcorp_visual_editor.php
r1333517 r1337683 4 4 Plugin URI: http://bcorp.com 5 5 Description: Wordpress visual editor for editing BCorp Shortcodes. 6 Version: 0.1 76 Version: 0.18 7 7 Author: Tim Brattberg 8 8 Author URI: http://bcorp.com … … 11 11 */ 12 12 13 require_once 'includes/plugin-activation.php'; 14 add_action( 'tgmpa_register', 'bcorp_visual_editor_required_plugins' ); 15 function bcorp_visual_editor_required_plugins() { 16 $plugins = array( 17 array( 18 'name' => 'BCorp Shortcodes', 19 'slug' => 'bcorp-shortcodes', 20 'required' => true, 13 if(function_exists('bcorp_shortcodes_init')){ 14 add_action( 'bcorp_start_visual_editor', 'bcorp_visual_editor_init' ); // Run after bcorp_shortcodes_init 15 function bcorp_visual_editor_init() { if (is_admin()) new BCorp_Visual_Editor(); } 16 } else { 17 if (is_admin()) { 18 add_action('media_buttons', 'add_bcorp_visual_editor_button'); 19 add_action('admin_enqueue_scripts','bcorp_visual_editor_admin_enqueue_scripts'); 20 } 21 } 22 23 function bcorp_visual_editor_admin_enqueue_scripts() { 24 wp_enqueue_style('bcorp_visual_editor_admin_css',plugins_url( 'css/bcorp-visual-editor-admin.css' , __FILE__ )); 25 wp_enqueue_script('bcorp_visual_editor_admin_js',plugins_url('js/bcorp-visual-editor-admin.js', __FILE__ ),'','',true); 26 $plugins = array_keys(get_plugins()); 27 $myplugin = 'bcorp-shortcodes'; 28 $installed=false; 29 foreach($plugins as $plugin) if(strpos($plugin, $myplugin.'/') === 0) { $installed = true; break; } 30 if ($installed) { 31 $url = wp_nonce_url( self_admin_url('plugins.php?action=activate&plugin='.$plugin), 'activate-plugin_'.$plugin); 32 } else { 33 $plugin = 'bcorp-shortcodes'; 34 $plugin_name = 'BCorp Shortcodes'; 35 $url = wp_nonce_url( 36 add_query_arg( 37 array( 38 'page' => 'bcorp_shortcodes_plugin_activation', 39 'plugin' => $plugin, 40 'plugin_name' => $plugin_name, 41 'plugin_source' => !empty($source) ? urlencode($source) : false, 42 'bcorp-shortcodes-install' => 'install-plugin', 43 ), 44 admin_url( 'plugins.php' ) 45 ), 46 'bcorp-shortcodes-install' 47 ); 48 } 49 wp_localize_script("bcorp_visual_editor_admin_js","bcorp_installer", array('url' => $url,'installed' => $installed)); 50 } 51 52 function add_bcorp_visual_editor_button() { 53 echo '<a href="#" id="bcorp-visual-editor-button" class="button">BCorp Visual Editor</a>'; 54 } 55 56 function bcorp_visual_editor_plugin_activation_page(){ 57 if( !isset( $_GET[ 'bcorp-shortcodes-install' ] ) ) return; 58 59 add_plugins_page( 60 __('Install BCorp Shortcodes Plugin', 'bcorp-visual-editor'), 61 __('Install BCorp Shortcodes Plugin', 'bcorp-visual-editor'), 62 'install_plugins', 63 'bcorp_shortcodes_plugin_activation', 64 'bcorp_visual_editor_shortcodes_installer_page' 65 ); 66 } 67 add_action('admin_menu', 'bcorp_visual_editor_plugin_activation_page'); 68 69 70 function bcorp_visual_editor_shortcodes_installer_page(){ 71 ?> 72 <div class="wrap"> 73 <?php bcorp_visual_editor_shortcodes_install() ?> 74 </div> 75 <?php 76 } 77 78 function bcorp_visual_editor_shortcodes_install(){ 79 if (isset($_GET[sanitize_key('plugin')]) && (isset($_GET[sanitize_key('bcorp-shortcodes-install')]) && 'install-plugin' == $_GET[sanitize_key('bcorp-shortcodes-install')]) && current_user_can('install_plugins')) { 80 check_admin_referer( 'bcorp-shortcodes-install' ); 81 $plugin_name = $_GET['plugin_name']; 82 $plugin_slug = $_GET['plugin']; 83 if(!empty($_GET['plugin_source'])) $plugin_source = $_GET['plugin_source']; else $plugin_source = false; 84 $url = wp_nonce_url( 85 add_query_arg( 86 array( 87 'page' => 'bcorp_shortcodes_plugin_activation', 88 'plugin' => $plugin_slug, 89 'plugin_name' => $plugin_name, 90 'plugin_source' => $plugin_source, 91 'bcorp-shortcodes-install' => 'install-plugin', 92 ), 93 admin_url( 'themes.php' ) 21 94 ), 22 ); 23 $config = array( 24 'dismissable' => false, 25 'is_automatic' => true, 26 'strings' => array( 27 'notice_can_install_required' => _n_noop( 'The BCorp Visual Editor requires the following plugin %1$s to be installed in order to function correctly.', 'This theme requires the following plugins: %1$s.' , 'bcorp-visual-editor'), 28 'notice_can_activate_required' => _n_noop( 'The BCorp Visual Editor plugin requires %1$s to be activated in order to function correctly.', 'The following required plugins are currently inactive: %1$s.' , 'bcorp-visual-editor'), 29 'nag_type' => 'updated' 30 ) 31 ); 32 tgmpa( $plugins, $config ); 95 'bcorp-shortcodes-install' 96 ); 97 $fields = array( sanitize_key( 'bcorp-shortcodes-install' ) ); 98 if (false === ($creds=request_filesystem_credentials($url,'',false,false,$fields))) return true; 99 if (!WP_Filesystem($creds)) { 100 request_filesystem_credentials($url,'', true,false,$fields); 101 return true; 102 } 103 require_once ABSPATH.'wp-admin/includes/plugin-install.php'; 104 require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; 105 $title = sprintf( __('Installing %s', 'bcorp-visual-editor'), $plugin_name ); 106 $url = add_query_arg( array('action' => 'install-plugin','plugin' => urlencode($plugin_slug)),'update.php'); 107 if (isset($_GET['from'])) $url .= add_query_arg('from',urlencode(stripslashes($_GET['from'])),$url); 108 $nonce = 'install-plugin_' . $plugin_slug; 109 $source = !empty( $plugin_source ) ? $plugin_source : 'http://downloads.wordpress.org/plugin/'.urlencode($plugin_slug).'.zip'; 110 $upgrader = new Plugin_Upgrader($skin = new Plugin_Installer_Skin(compact('type','title','url','nonce','plugin','api'))); 111 $upgrader->install($source); 112 wp_cache_flush(); 33 113 } 114 } 34 115 35 add_action( 'bcorp_start_visual_editor', 'bcorp_visual_editor_init' ); // Run after bcorp_shortcodes_init 36 function bcorp_visual_editor_init() { if (is_admin()) new BCorp_Visual_Editor(); } 116 117 118 119 120 121 122 123 124 125 126 37 127 class BCorp_Visual_Editor { 38 128 public function __construct () { -
bcorp-visual-editor/trunk/css/bcve.css
r1333517 r1337683 29 29 .bcve-element { display:inline-block; vertical-align: top; margin-top:12px; margin-bottom:4px;} 30 30 31 .bcve-element-list, .bcve-icon-list {padding-left:3px; position:absolute; top:49px; bottom:0; width:100%; font-size:50px; overflow:scroll;}31 .bcve-element-list, .bcve-icon-list {padding-left:3px; position:absolute; top:49px; bottom:0; right:-14px; padding:4px; width:100%; font-size:50px; overflow-x:hidden; overflow-y:scroll;} 32 32 .bcve-icon-list span { float:left; margin:2px; border:1px solid black; line-height:0.7em;} 33 33 #wp-bcve-text-editor-media-buttons > #bcorp-shortcodes-button {display:none; } … … 90 90 @media screen and (max-width: 1024px) { .bcve-dialog { width:90%; left:5%; } } 91 91 @media screen and (max-width: 767px) { .bcve-dialog { width:96%; left:2%; top:50px; } } 92 .bcve-dialog-tabbed {overflow :scroll; position:absolute; top:45px; bottom:51px; left:0px; right:0px; padding:8px; }92 .bcve-dialog-tabbed {overflow-y:scroll; overflow-x:hidden; position:absolute; top:45px; bottom:51px; left:0px; right:-14px; padding:12px; } 93 93 .bcve-dialog-tabbed label { font-weight:bold; } 94 94 .bcve-dialog-tab ul { margin:0; } -
bcorp-visual-editor/trunk/readme.txt
r1333517 r1337683 5 5 Requires at least: 4.2.0 6 6 Tested up to: 4.4.1 7 Stable tag: 0.1 77 Stable tag: 0.18 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.en.html … … 44 44 == Changelog == 45 45 46 = 0.18 = 47 Replaced the TGM Activation Plugin code with a simpler less annoying method of installing the required BCorp Shortcodes Plugin. 48 46 49 = 0.17 = 47 50 Modified [icon_box] css in admin. … … 62 65 == Upgrade Notice == 63 66 67 = 0.18 = 68 Replaced the TGM Activation Plugin code with a simpler less annoying method of installing the required BCorp Shortcodes Plugin. 69 64 70 = 0.17 = 65 71 Modified [icon_box] css in admin.
Note: See TracChangeset
for help on using the changeset viewer.