Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Fix for Cardoza Wordpress Poll

By: a guest on May 29th, 2012  |  syntax: JavaScript  |  size: 2.89 KB  |  views: 43  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Change this block in cardozawppoll.php
  2.  
  3. <?php
  4. /*
  5. Plugin Name: Cardoza Wordpress Poll
  6. Plugin URI: http://fingerfish.com/cardoza-wordpress-poll
  7. Description: Cardoza Wordpress Poll is completely ajax powered polling system. This poll plugin supports both single and multiple selection of answers.
  8. Version: 1.0
  9. Author: Vinoj Cardoza
  10. Author URI: http://fingerfish.com/about-me/
  11. License: GPL2
  12. */
  13. define('CWP_PGN_DIR', plugin_dir_url(__FILE__));
  14.  
  15. require_once 'app/CWPController.class.php';
  16.  
  17. /* To include the stylesheets */
  18. wp_enqueue_style('cwpcss', CWP_PGN_DIR.'public/css/CWPPoll.css');
  19.  
  20. /* To include the javascripts */
  21. wp_enqueue_script('cwp-main', CWP_PGN_DIR.'public/js/CWPPoll.js', array('jquery'));
  22.  
  23. add_action('wp_head','cwppoll_ajaxurl');
  24. add_action('plugins_loaded', 'trigger_init');
  25.  
  26. register_activation_hook  ( __FILE__, 'CWP_Install' );
  27.  
  28. function cwppoll_ajaxurl() {
  29. ?>
  30. <script type="text/javascript">
  31. var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
  32. </script>
  33. <?php
  34. }
  35.  
  36. function trigger_init(){
  37.      
  38.     if(is_admin){
  39.         $cwp = new CWPController();
  40.         $cwp->init();
  41.     }
  42.     register_sidebar_widget(__('Cardoza Wordpress Poll'), 'widget_cardoza_wp_poll');
  43. }
  44.  
  45.  
  46. ========================================================
  47. to
  48. ========================================================
  49.  
  50. <?php
  51. /*
  52. Plugin Name: Cardoza Wordpress Poll
  53. Plugin URI: http://fingerfish.com/cardoza-wordpress-poll
  54. Description: Cardoza Wordpress Poll is completely ajax powered polling system. This poll plugin supports both single and multiple selection of answers.
  55. Version: 1.0
  56. Author: Vinoj Cardoza
  57. Author URI: http://fingerfish.com/about-me/
  58. License: GPL2
  59. */
  60. define('CWP_PGN_DIR', plugin_dir_url(__FILE__));
  61.  
  62. require_once 'app/CWPController.class.php';
  63.  
  64. // add a function to load scripts
  65. add_action( 'admin_init', 'cwppol_scripts');
  66. // add_action('wp_print_styles', 'cwppol_styles');
  67. add_action('admin_head', 'cwppol_styles');
  68.  
  69. function cwppol_styles(){
  70.         /* To include the stylesheets */       
  71.         wp_register_style('cwpcss', CWP_PGN_DIR.'public/css/CWPPoll.css');
  72.         wp_enqueue_style( 'cwpcss');
  73. }
  74.  
  75. function cwppol_scripts(){
  76.         /* To include the javascripts */
  77.         wp_register_script(
  78.                                 'cwp-main',
  79.                                  CWP_PGN_DIR.'public/js/CWPPoll.js',
  80.                                 array( 'jquery'),
  81.                                 false,
  82.                                 true
  83.                         );             
  84.                         // add the script to fill the box
  85.                         wp_enqueue_script('cwp-main');
  86. }
  87.  
  88. add_action('wp_head','cwppoll_ajaxurl');
  89. add_action('plugins_loaded', 'trigger_init');
  90.  
  91. register_activation_hook  ( __FILE__, 'CWP_Install' );
  92.  
  93. function cwppoll_ajaxurl() {
  94. ?>
  95. <script type="text/javascript">
  96. var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
  97. </script>
  98. <?php
  99. }
  100.  
  101. function trigger_init(){
  102.      
  103.     if(is_admin()){
  104.         $cwp = new CWPController();
  105.         $cwp->init();
  106.     }
  107.     wp_register_sidebar_widget('cwppoll', __('Cardoza Wordpress Poll'), 'widget_cardoza_wp_poll');
  108. }