Changeset 543123
- Timestamp:
- 05/11/2012 09:59:31 PM (14 years ago)
- Location:
- dell-cloud-connect/trunk
- Files:
-
- 2 edited
-
.gitignore (modified) (1 diff)
-
connect.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dell-cloud-connect/trunk/.gitignore
r543084 r543123 2 2 node_modules 3 3 .DS_Store 4 plugin.php -
dell-cloud-connect/trunk/connect.php
r543121 r543123 1 1 <?php 2 /*3 Plugin Name: Dell Cloud Connect4 Plugin URI: http://marketing.dell.com/cloudcomputing-widget5 Description: Adds a widget to display the latest news and information from the most influential cloud computing blogs.6 Version: 0.2.07 Author: Dell8 Author URI: http://www.dell.com9 10 11 Installing12 1. Copy cloud_connect folder to your plugins folder /wp-content/plugins/13 2. Activate it through the plugin management screen.14 3. Go to Appearance->Widgets and drag and drop the widget to wherever you want to show it.15 */16 17 2 18 3 // Define Actions 19 4 // ============================================ 20 5 21 register_activation_hook(__FILE__,' edu_connect_install');22 register_deactivation_hook(__FILE__, ' edu_connect_uninstall');23 24 add_action( 'wp_print_scripts', ' edu_connect_scripts' );25 add_action( 'wp_print_styles', ' edu_connect_styles' );26 add_action( 'widgets_init', ' edu_connect_load_widgets' );27 add_action( 'admin_menu', ' edu_connect_admin_menu' );28 add_action( 'wp_ajax_edu_connect_showlink', ' edu_connect_admin_ajax_showlink' );6 register_activation_hook(__FILE__,'dell_connect_install'); 7 register_deactivation_hook(__FILE__, 'dell_connect_uninstall'); 8 9 add_action( 'wp_print_scripts', 'dell_connect_scripts' ); 10 add_action( 'wp_print_styles', 'dell_connect_styles' ); 11 add_action( 'widgets_init', 'dell_connect_load_widgets' ); 12 add_action( 'admin_menu', 'dell_connect_admin_menu' ); 13 add_action( 'wp_ajax_edu_connect_showlink', 'dell_connect_admin_ajax_showlink' ); 29 14 //add_action( 'admin_notices', 'edu_connect_admin_notice' ); 30 15 … … 33 18 34 19 //Define Environment if not defined 35 if(!defined(' EDU_CONNECT_ENV')) {36 define(' EDU_CONNECT_ENV', 'production');37 } 38 define('EDU_PLUGIN_PATH', WP_CONTENT_DIR.'/plugins/'.plugin_basename(dirname(__FILE__))); 39 define(' EDU_PLUGIN_URL', WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__)));40 define('EDU_DIVISION', 'cloudcomputing'); 20 if(!defined('DELL_CONNECT_ENV')) { 21 define('DELL_CONNECT_ENV', 'production'); 22 } 23 24 define('DELL_CONNECT_PLUGIN_URL', WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__))); 25 41 26 42 27 //Define constants based on environment 43 if( EDU_CONNECT_ENV == 'development') {44 define(' EDU_CONNECT_SERVICE_URL','http://11.0.0.1:9001');45 } 46 elseif ( EDU_CONNECT_ENV == 'staging') {47 define(' EDU_CONNECT_SERVICE_URL','http://staging.dell.system-11.com');28 if(DELL_CONNECT_ENV == 'development') { 29 define('DELL_CONNECT_SERVICE_URL','http://11.0.0.1:9001'); 30 } 31 elseif (DELL_CONNECT_ENV == 'staging') { 32 define('DELL_CONNECT_SERVICE_URL','http://staging.dell.system-11.com'); 48 33 } 49 34 else { 50 define(' EDU_CONNECT_SERVICE_URL','http://dell.system-11.com');35 define('DELL_CONNECT_SERVICE_URL','http://dell.system-11.com'); 51 36 } 52 37 … … 54 39 * Register the widget 55 40 */ 56 function edu_connect_load_widgets() {41 function dell_connect_load_widgets() { 57 42 register_widget( 'Edu_Connect_Widget' ); 58 43 } … … 61 46 * Plugin Install/Activation Script 62 47 */ 63 function edu_connect_install() {48 function dell_connect_install() { 64 49 65 50 //Check to make sure PHP config supports urls in file_get_contents … … 72 57 73 58 //Set global default option 74 $settings = file_get_contents( EDU_CONNECT_SERVICE_URL . '/client/add?division=' . EDU_DIVISION .'&url=' . urlencode(home_url()) . '&ajaxurl=' . urlencode(EDU_PLUGIN_URL . '/ajax.php') . '&clientid=' . $clientId);59 $settings = file_get_contents(DELL_CONNECT_SERVICE_URL . '/client/add?division=' . DELL_CONNECT_DIVISION .'&url=' . urlencode(home_url()) . '&ajaxurl=' . urlencode(DELL_CONNECT_PLUGIN_URL . '/ajax.php') . '&clientid=' . $clientId); 75 60 $settings = json_decode($settings); 76 61 77 62 if(!$settings->result) { 78 file_get_contents( EDU_CONNECT_SERVICE_URL . '/client/error?url=' . urlencode(home_url()) . '&error=' . urlencode($settings->error));63 file_get_contents(DELL_CONNECT_SERVICE_URL . '/client/error?url=' . urlencode(home_url()) . '&error=' . urlencode($settings->error)); 79 64 die("Sorry, there was a problem activating your blog. Please contact support+dell@system-11.com"); 80 65 } … … 86 71 } 87 72 88 function edu_connect_uninstall() {73 function dell_connect_uninstall() { 89 74 $clientId = get_option('edu_connect_clientid', null); 90 $settings = file_get_contents( EDU_CONNECT_SERVICE_URL . '/client/deactivate?clientid=' . $clientId);75 $settings = file_get_contents(DELL_CONNECT_SERVICE_URL . '/client/deactivate?clientid=' . $clientId); 91 76 $settings = json_decode($settings); 92 77 } … … 108 93 //Default data as constants 109 94 110 $this->url = EDU_CONNECT_SERVICE_URL . "/feed";95 $this->url = DELL_CONNECT_SERVICE_URL . "/feed"; 111 96 //Set defaults 112 97 $widget_ops = array(); … … 194 179 <script> 195 180 var _dec = _dec || []; 196 <?php if( EDU_CONNECT_ENV == 'development' || EDU_CONNECT_ENV == 'staging'):?>181 <?php if(DELL_CONNECT_ENV == 'development' || DELL_CONNECT_ENV == 'staging'):?> 197 182 _dec.push(['enableDebug']); 198 183 <?php endif; ?> 199 _dec.push(['setBaseUrl', '<?php echo EDU_CONNECT_SERVICE_URL ?>']);184 _dec.push(['setBaseUrl', '<?php echo DELL_CONNECT_SERVICE_URL ?>']); 200 185 _dec.push(['setClientId', '<?php echo get_option("edu_connect_clientid")?>']); 201 _dec.push(['setDivision', '<?php echo EDU_DIVISION ?>']);186 _dec.push(['setDivision', '<?php echo DELL_CONNECT_DIVISION ?>']); 202 187 _dec.push(['getFeed',<?php echo (int)$count_items; ?>,<?php echo (($show_descriptions)?'true':'false'); ?>]); 203 188 </script> … … 209 194 210 195 211 function edu_connect_scripts() {196 function dell_connect_scripts() { 212 197 if (!is_admin()) { 213 if( EDU_CONNECT_ENV == 'production') {198 if(DELL_CONNECT_ENV == 'production') { 214 199 wp_enqueue_script( $handle = 'edu_connect_ender', $src = 'https://s3.amazonaws.com/system11-dell/ender.min.js', array(), $ver = 1, $in_footer = false ); 215 200 wp_enqueue_script( $handle = 'edu_connect_js', $src = 'https://s3.amazonaws.com/system11-dell/dell.min.js', array(), $ver = 1, $in_footer = false ); 216 201 } 217 202 else { 218 wp_enqueue_script( $handle = 'edu_connect_ender', $src = WP_PLUGIN_URL . '/edu-connect/assets/js/ender.js', array(), $ver = 1, $in_footer = false );219 wp_enqueue_script( $handle = 'edu_connect_js', $src = WP_PLUGIN_URL . '/edu-connect/assets/js/dell.js', array(), $ver = 1, $in_footer = false );203 wp_enqueue_script( $handle = 'edu_connect_ender', $src = DELL_CONNECT_PLUGIN_URL . '/assets/js/ender.js', array(), $ver = 1, $in_footer = false ); 204 wp_enqueue_script( $handle = 'edu_connect_js', $src = DELL_CONNECT_PLUGIN_URL . '/assets/js/dell.js', array(), $ver = 1, $in_footer = false ); 220 205 } 221 206 } 222 207 } 223 208 224 function edu_connect_styles() {209 function dell_connect_styles() { 225 210 if (!is_admin()) { 226 wp_enqueue_style( $handle = 'edu_connect_css', $src = WP_PLUGIN_URL . '/edu-connect/assets/css/styles.css', array(), $ver = 1 );211 wp_enqueue_style( $handle = 'edu_connect_css', $src = DELL_CONNECT_PLUGIN_URL . '/edu-connect/assets/css/styles.css', array(), $ver = 1 ); 227 212 } 228 213 } … … 236 221 } 237 222 238 function edu_connect_admin_menu() {223 function dell_connect_admin_menu() { 239 224 //add_menu_page( 'Dell Services', 'Dell Services', 'manage_options', 'dell-services', null, WP_PLUGIN_URL . '/edu-connect/assets/img/dellecomicon.png', null ); 240 225 //$dell_news_page = add_submenu_page( 'dell-services', 'News', 'News', 'manage_options', 'dell-news', 'dell_admin_page' ); 241 $edu_connect_page = add_options_page(' Dell Cloud Connect', 'Dell Cloud Connect', 'manage_options', 'edu-connect', 'edu_connect_admin_page' );226 $edu_connect_page = add_options_page('<?php echo DELL_CONNECT_PLUGIN_NAME ?>', '<?php echo DELL_CONNECT_PLUGIN_NAME ?>', 'manage_options', 'edu-connect', 'edu_connect_admin_page' ); 242 227 remove_submenu_page( 'dell-services', 'dell-services' ); 243 228 … … 246 231 247 232 function edu_connect_admin_scripts() { 248 wp_enqueue_style( $handle = 'edu_connect_admin_css', $src = WP_PLUGIN_URL . '/edu-connect/assets/css/admin-styles.css', array(), $ver = 1 );233 wp_enqueue_style( $handle = 'edu_connect_admin_css', $src = DELL_CONNECT_PLUGIN_URL . '/assets/css/admin-styles.css', array(), $ver = 1 ); 249 234 wp_enqueue_script( 'jquery-ui-core' ); 250 235 wp_enqueue_script( 'jquery-ui-tabs' ); 251 wp_enqueue_script( $handle = 'edu_connect_plugins', $src = WP_PLUGIN_URL . '/edu-connect/assets/js/plugins.js', array(), $ver = 1, $in_footer = false );236 wp_enqueue_script( $handle = 'edu_connect_plugins', $src = DELL_CONNECT_PLUGIN_URL . '/assets/js/plugins.js', array(), $ver = 1, $in_footer = false ); 252 237 253 if( EDU_CONNECT_ENV == 'production') {238 if(DELL_CONNECT_ENV == 'production') { 254 239 wp_enqueue_script( $handle = 'edu_connect_ender', $src = 'https://s3.amazonaws.com/system11-dell/ender.min.js', array(), $ver = 1, $in_footer = false ); 255 240 wp_enqueue_script( $handle = 'edu_connect_js', $src = 'https://s3.amazonaws.com/system11-dell/dell.min.js', array(), $ver = 1, $in_footer = false ); 256 241 } 257 242 else { 258 wp_enqueue_script( $handle = 'edu_connect_ender', $src = WP_PLUGIN_URL . '/edu-connect/assets/js/ender.js', array(), $ver = 1, $in_footer = false );259 wp_enqueue_script( $handle = 'edu_connect_js', $src = WP_PLUGIN_URL . '/edu-connect/assets/js/dell.js', array(), $ver = 1, $in_footer = false );243 wp_enqueue_script( $handle = 'edu_connect_ender', $src = DELL_CONNECT_PLUGIN_URL . '/assets/js/ender.js', array(), $ver = 1, $in_footer = false ); 244 wp_enqueue_script( $handle = 'edu_connect_js', $src = DELL_CONNECT_PLUGIN_URL . '/assets/js/dell.js', array(), $ver = 1, $in_footer = false ); 260 245 } 261 246 … … 271 256 <div class="wrap"> 272 257 <div id="icon-options-general" class="icon32"><br></div> 273 <h2> Dell Cloud Connect Settings</h2>258 <h2><?php echo DELL_CONNECT_PLUGIN_NAME ?></h2> 274 259 <div id="tabs"> 275 260 <h2 class="nav-tab-wrapper"> … … 289 274 <script> 290 275 var _dec = _dec || []; 291 <?php if( EDU_CONNECT_ENV == 'development' || EDU_CONNECT_ENV == 'staging'):?>276 <?php if(DELL_CONNECT_ENV == 'development' || DELL_CONNECT_ENV == 'staging'):?> 292 277 _dec.push(['enableDebug']); 293 278 <?php endif; ?> 294 _dec.push(['setBaseUrl', '<?php echo EDU_CONNECT_SERVICE_URL ?>']);279 _dec.push(['setBaseUrl', '<?php echo DELL_CONNECT_SERVICE_URL ?>']); 295 280 _dec.push(['setClientId', '<?php echo get_option("edu_connect_clientid")?>']); 296 _dec.push(['setDivision', '<?php echo EDU_DIVISION ?>']);281 _dec.push(['setDivision', '<?php echo DELL_CONNECT_DIVISION ?>']); 297 282 _dec.push(['getBlogList']); 298 283 </script> … … 327 312 } 328 313 329 function edu_connect_admin_ajax_showlink() {314 function dell_connect_admin_ajax_showlink() { 330 315 global $wpdb; 331 316 $showSponsoredLink = isset($_POST['backlinkActive'])?true:false;
Note: See TracChangeset
for help on using the changeset viewer.