Changeset 45322

Show
Ignore:
Timestamp:
05/12/08 01:16:09 (2 months ago)
Author:
Aaron Harun
Message:

Added actual class support with new globals and lots of this keywords.
Hopefully cleaner now.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ajaxd-wordpress/trunk/aWP.php

    r45246 r45322  
    7171            /*Load modules. If we restore defaults, no modules are needed.*/ 
    7272            if ( is_array($awp_mods) && $_POST["action"] != "restoredefaults") { 
     73                  $awp_init = array(); 
    7374                  foreach ($awp_mods as $mod) { 
    7475                        if ('' != $mod && file_exists(ABSPATH . PLUGINDIR . AWP_MODULES. '/' . $mod)) 
    7576                        include_once(ABSPATH . PLUGINDIR . AWP_MODULES . '/' . $mod); 
     77                  } 
     78                  if(count($awp_init) > 0){ // loop once to set up the classes and once to initiate them. 
     79                        foreach($awp_init as $class){ 
     80                              $$class = null; 
     81                              global $$class; 
     82                              $$class = new $class; 
     83                        } 
     84                        reset($awp_init); 
     85                        foreach($awp_init as $class){ 
     86                              $$class->init(); 
     87                        } 
    7688                  } 
    7789            } 
  • ajaxd-wordpress/trunk/control/aWP-admin.php

    r45246 r45322  
    99*/ 
    1010 
     11$AWP_admin = new AWP_admin(); 
     12 
    1113if(!$_REQUEST['custom_options_menu']) 
    12       add_action('awp_build_menu',array('AWP_admin','admin_panel')); 
     14      add_action('awp_build_menu',array($AWP_admin,'admin_panel')); 
     15 
     16 
    1317 
    1418add_action('awp_admin_overall', 'admin_panel_overall'); 
     
    113117 
    114118            if(is_array($marray[menus])){ 
    115                   AWP_admin::admin_panel_menu($marray[menus][menu]); 
     119                  $this->admin_panel_menu($marray[menus][menu]); 
    116120            }elseif(is_array($marray[menu])){ 
    117                   AWP_admin::admin_panel_menu($marray[menu]); 
     121                  $this->admin_panel_menu($marray[menu]); 
    118122            }elseif(is_array($marray[submenu])){ 
    119                   AWP_admin::admin_panel_sub($marray[submenu]); 
     123                  $this->admin_panel_sub($marray[submenu]); 
    120124            }elseif(is_array($marray[item])){ 
    121                   AWP_admin::admin_panel_item($marray[item]); 
     125                  $this->admin_panel_item($marray[item]); 
    122126            } 
    123127      } 
     
    160164                        $e_id = ($id)? ' id="'.$id.'"' : '' ; 
    161165                        echo '<div '.$class.$e_id.'>'; 
    162                               AWP_admin::admin_panel_sub($m[submenu]); 
     166                              $this->admin_panel_sub($m[submenu]); 
    163167                              if($m[action]) 
    164168                                    do_action($m[action]); 
     
    185189                  if(is_array($menu[item])){ 
    186190                        echo '<ul class="def">'; 
    187                               AWP_admin::admin_panel_item($menu[item]); 
     191                              $this->admin_panel_item($menu[item]); 
    188192                              if($menu[action]) 
    189193                                    do_action($menu[action]); 
     
    475479                        continue; 
    476480 
    477                   $modules_data = AWP_admin::get_modules_data( "$modules_root/$modules_file" ); 
     481                  $modules_data = $this->get_modules_data( "$modules_root/$modules_file" ); 
    478482 
    479483                  if ( empty ( $modules_data['Name'] ) ) 
     
    591595      global $awpall, $aWP, $wp_version; 
    592596 
    593             $aWP[modules] = AWP_admin::get_modules(); 
     597            $aWP[modules] = $this->get_modules(); 
    594598            $messages = get_option('awp_messages'); 
    595599            if(count($messages) > 1){ 
  • ajaxd-wordpress/trunk/control/aWP-admin_panel.php

    r44986 r45322  
    11<?php 
    2 global $aWP, $awpall
    3       AWP_admin::start_panel(); 
     2global $aWP, $awpall,$AWP_admin
     3      $AWP_admin->start_panel(); 
    44 
    55 
     
    8585                                          <p><?php _e('AJAXed Wordpress is made up of many smaller plugins called modules.', 'awp'); ?> <?php _e('You may disable or enable modules here.', 'awp'); ?> <?php _e('Some modules may need to have some of their features explicitly enabled after activation.', 'awp'); ?></p> 
    8686 
    87                                           <?php echo AWP_admin::print_modules();?> 
     87                                          <?php echo $AWP_admin->print_modules();?> 
    8888                                    </div> 
    8989                              </fieldset> 
  • ajaxd-wordpress/trunk/modules/ajaxnav/ajaxnav.php

    r45279 r45322  
    1010*/ 
    1111 
     12 
     13$awp_init[] = 'AWP_ajaxnav'; 
     14 
     15register_activation_hook(__file__,array('AWP_ajaxnav','set_defaults')); 
     16Class AWP_ajaxnav{ 
     17 
     18      function init(){ 
     19      global $awpall; 
    1220            if(strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false){ 
    13                   add_action('awp_admin_more_menus',array('AWP_nav','admin')); 
    14                   add_action('awp_admin_more_menu_links',array('AWP_nav','admin_link')); 
    15                   add_filter('awp_get_options',array('AWP_nav','awp_get_options')); 
     21                  add_action('awp_admin_more_menus',array($this,'admin')); 
     22                  add_action('awp_admin_more_menu_links',array($this,'admin_link')); 
     23                  add_filter('awp_get_options',array($this,'awp_get_options')); 
    1624            }elseif($awpall['ajaxnav'] == 'Enabled'){ 
    17                   add_action('awp_ajax_type_nav', array('AWP_nav', 'AJAX')); 
    18                   add_action('loop_end', array('AWP_nav', 'loop_end')); 
    19                   add_action('loop_start', array('AWP_nav', 'loop_start')); 
    20                   add_action('awp_js_start',array('AWP_nav','awp_js_start')); 
     25                  add_action('awp_ajax_type_nav', array($this, 'AJAX')); 
     26                  add_action('loop_end', array($this, 'loop_end')); 
     27                  add_action('loop_start', array($this, 'loop_start')); 
     28                  add_action('awp_js_start',array($this,'awp_js_start')); 
    2129 
    2230                  /*Template Functions*/ 
    23                   add_action('awp_nav_bar_single', array('AWP_nav','post_nav_bar')); 
    24                   add_action('awp_nav_bar', array('AWP_nav','nav_bar')); 
    25  
    26  
    27                   add_filter('aWP_JS', array('AWP_nav','addJS')); 
    28  
    29                   add_action('awp_nav_single_onclick', array('AWP_nav','single_post_add_onclick')); 
     31                  add_action('awp_nav_bar_single', array($this,'post_nav_bar')); 
     32                  add_action('awp_nav_bar', array($this,'nav_bar')); 
     33 
     34 
     35                  add_filter('aWP_JS', array($this,'addJS')); 
     36 
     37                  add_action('awp_nav_single_onclick', array($this,'single_post_add_onclick')); 
    3038 
    3139                  if($awpall['ajax_nav_pages']) 
    32                         add_filter('wp_list_pages', array('AWP_nav','pages_add_onclick')); 
     40                        add_filter('wp_list_pages', array($this,'pages_add_onclick')); 
    3341 
    3442                  if($awpall['ajax_nav_categories']) 
    35                         add_filter('wp_list_categories', array('AWP_nav','cats_add_onclick')); 
    36  
    37             } 
    38  
    39 register_activation_hook(__file__,array('AWP_nav','set_defaults')); 
    40 Class AWP_nav{ 
     43                        add_filter('wp_list_categories', array($this,'cats_add_onclick')); 
     44            } 
     45      } 
    4146 
    4247      function addJS(){ 
    4348            echo "\n"."\n".'/* start AJAX nav UnFocus */'."\n var historyKeeper; \n var unFocus;"; 
    4449            include(ABSPATH . PLUGINDIR . AWP_MODULES . '/ajaxnav/unFocus-History-p.js'); 
    45             awp_nav::unfocus(); 
     50            $this->unfocus(); 
    4651      } 
    4752 
     
    120125<?php 
    121126 
    122             AWP_nav::search_form(); 
     127            $this->search_form(); 
    123128} 
    124129 
     
    274279 
    275280                  if(is_single() && $awpall[ajax_nav_single] && $awpall[ajax_nav_single_links] == 'above'){ 
    276                         AWP_nav::post_nav_bar(); 
     281                        $this->post_nav_bar(); 
    277282                  }elseif(!$awpall[ajax_nav_home_loop] && is_home() && ($awpall[ajax_nav_home_links] == 'above' || $awpall[ajax_nav_home_links] == 'both')){ 
    278                         AWP_nav::nav_bar(); 
     283                        $this->nav_bar(); 
    279284                  } 
    280285            } 
     
    285290            if(!is_feed()){ 
    286291                  if(is_single() && $awpall[ajax_nav_single] && $awpall[ajax_nav_single_links] == 'below'){ 
    287                         AWP_nav::post_nav_bar(); 
     292                        $this->post_nav_bar(); 
    288293                  }elseif(!$awpall[ajax_nav_home_loop] && is_home() && ($awpall[ajax_nav_home_links] == 'below' || $awpall[ajax_nav_home_links] == 'both')){ 
    289                         AWP_nav::nav_bar(); 
     294                        $this->nav_bar(); 
    290295                  } 
    291296 
     
    335340 
    336341      function pages_add_onclick($pages) { 
    337             return preg_replace_callback('!(<li class="page_item page-item-([0-9]*)"><a([^>]*)>)!ims', array('AWP_nav','pages_add_onclick_finish'), $pages); 
     342            return preg_replace_callback('!(<li class="page_item page-item-([0-9]*)"><a([^>]*)>)!ims', array($this,'pages_add_onclick_finish'), $pages); 
    338343      } 
    339344 
     
    350355 
    351356      function cats_add_onclick($cats) { 
    352             return preg_replace_callback('!(<li class="cat-item cat-item-([0-9]*)">[\s\S]*?<a([^>]*)>)!ims', array('AWP_nav','cats_add_onclick_finish'), $cats); 
     357            return preg_replace_callback('!(<li class="cat-item cat-item-([0-9]*)">[\s\S]*?<a([^>]*)>)!ims', array($this,'cats_add_onclick_finish'), $cats); 
    353358      } 
    354359 
     
    518523                  } 
    519524                  if ( $max_num_pages > 1 ) { 
    520                         AWP_nav::previous_posts($prelabel); 
     525                        $this->previous_posts($prelabel); 
    521526                        echo preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $sep); 
    522                         AWP_nav::next_posts($nxtlabel); 
     527                        $this->next_posts($nxtlabel); 
    523528                  } 
    524529            } 
     
    531536      function single_post_add_onclick(){ 
    532537            global $id; 
    533             echo AWP_nav::single_post_onclick($id); 
     538            echo $this->single_post_onclick($id); 
    534539      } 
    535540 
     
    552557 
    553558            if($awpall[ajax_nav_single]) 
    554                   $string .= AWP_nav::single_post_onclick($post->ID); 
     559                  $string .= $this->single_post_onclick($post->ID); 
    555560 
    556561            $string .= '>'; 
     
    575580 
    576581            if($awpall[ajax_nav_single]) 
    577                   $string .= AWP_nav::single_post_onclick($post->ID); 
     582                  $string .= $this->single_post_onclick($post->ID); 
    578583 
    579584            $string .= '>'; 
     
    589594 
    590595      function awp_posts_nav_link($sep=' &#8212; ', $prelabel='&laquo; Previous Page', $nxtlabel='Next Page &raquo;') { 
    591             AWP_nav::posts_nav($sep, $prelabel, $nxtlabel); 
     596            $this->posts_nav($sep, $prelabel, $nxtlabel); 
    592597      } 
    593598 
    594599 
    595600      function awp_previous_posts_link($label='&laquo; Previous Page') { 
    596             AWP_nav::previous_posts($label); 
     601            $this->previous_posts($label); 
    597602      } 
    598603 
    599604      function awp_next_posts_link($label='Next Page &raquo;', $max_page=0) { 
    600             AWP_nav::next_posts($label, $max_page); 
     605            $this->next_posts($label, $max_page); 
    601606      } 
    602607 
    603608      function awp_previous_post_link($format='&laquo; %link', $link='%title', $in_same_cat=false, $excluded_categories = '') { 
    604             AWP_nav::previous_post($format, $link, $in_same_cat, $excluded_categories); 
     609            $this->previous_post($format, $link, $in_same_cat, $excluded_categories); 
    605610      } 
    606611 
    607612      function awp_next_post_link($format='%link &raquo;', $link='%title', $in_same_cat = false, $excluded_categories = '') { 
    608             AWP_nav::next_post($format, $link, $in_same_cat, $excluded_categories); 
     613            $this->next_post($format, $link, $in_same_cat, $excluded_categories); 
    609614      } 
    610615?> 
  • ajaxd-wordpress/trunk/modules/awp-edit-comments.php

    r37571 r45322  
    2121 
    2222      function init(){ 
    23  
    2423            if(class_exists('WPrapAjaxEditComments')) 
    2524                  WPrapAjaxEditComments::JS(); 
    26  
    2725      } 
    28  
    2926 
    3027      function update_aecomments($actions){ 
  • ajaxd-wordpress/trunk/modules/awpcache.php

    r42761 r45322  
    99      Author URI: http://anthologyoi.com/ 
    1010*/ 
    11       if(strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false){ 
    12             add_action('awp_admin_other',array('AWP_Cache','admin')); 
    13             add_filter('awp_get_options',array('AWP_Cache','awp_get_options')); 
    14             add_action('awp_admin_update',array('AWP_Cache','delete')); 
    15       }elseif($awpall['cache'] == 'Enabled'){ 
    16             add_action('init', array('AWP_Cache','init')); 
    17       } 
    1811 
    19 register_activation_hook(__file__,array('AWP_Cache','set_defaults')); 
     12$awp_init[] = "AWP_Cache"; 
     13register_activation_hook(__file__,array($this,'set_defaults')); 
    2014class AWP_Cache { 
    2115 
    2216      function init(){ 
    23       global $awpall, $aWP; 
    24             if(AWP::enabled('inlineposts')){ 
     17      global $awpall, $aWP,$AWP_inlineposts; 
     18            if(strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false){ 
     19            add_action('awp_admin_other',array($this,'admin')); 
     20            add_filter('awp_get_options',array($this,'awp_get_options')); 
     21            add_action('awp_admin_update',array($this,'delete')); 
     22            }elseif($awpall['cache'] == 'Enabled'){ 
     23                  if(AWP::enabled('inlineposts')){ 
    2524 
    26                   remove_action('awp_paginate', array('AWP_inlineposts', 'paginate')); 
    27                   add_action('awp_paginate', array('AWP_Cache', 'post_paginate')); 
     25                        remove_action('awp_paginate', array($AWP_inlineposts, 'paginate')); 
     26                        add_action('awp_paginate', array($AWP_inlineposts, 'post_paginate')); 
     27                  } 
    2828 
    29       //          remove_action('awp_pages',array('AWP_inlineposts','pages')); 
    30       //          add_action('awp_pages',array('AWP_Cache','post_pages')); 
     29                  if(AWP::enabled('inlinecomments')){ 
    3130 
     31                        $aWP['basic_comments'] = 1; 
     32                        remove_action('awp_comments_do', array('AWP_inlinecomments','comments')); 
     33                        add_action('awp_comments_do', array($this,'comments_comments')); 
     34 
     35                  } 
     36 
     37                  add_action('publish_post', array($this,'remove_post_cache'), 1); 
     38                  add_action('edit_post', array($this,'remove_post_cache'), 1); 
     39                  add_action('delete_post', array($this,'remove_post_cache'), 1); 
     40                  add_action('publish_phone', array($this,'remove_post_cache'), 1); 
     41                  add_action('delete_comment', array($this,'delete_comment_cache'), 1); 
     42                  // these we check for validity before invalidating the cache 
     43                  add_action('trackback_post', array($this,'remove_comment_cache'), 1); 
     44                  add_action('pingback_post', array($this,'remove_comment_cache'), 1); 
     45                  add_action('comment_post', array($this,'remove_comment_cache'), 1); 
     46                  add_action('edit_comment', array($this,'remove_comment_cache'), 1); 
     47                  add_action('wp_set_comment_status', array($this,'remove_comment_cache'), 1); 
     48 
     49 
     50                  do_action('awp_cache_init'); 
    3251            } 
    3352 
    34             if(AWP::enabled('inlinecomments')){ 
    35  
    36                   $aWP['basic_comments'] = 1; 
    37                   remove_action('awp_comments_do', array('AWP_inlinecomments','comments')); 
    38                   add_action('awp_comments_do', array('AWP_Cache','comments_comments')); 
    39  
    40             } 
    41  
    42             add_action('publish_post', array('AWP_Cache','remove_post_cache'), 1); 
    43             add_action('edit_post', array('AWP_Cache','remove_post_cache'), 1); 
    44             add_action('delete_post', array('AWP_Cache','remove_post_cache'), 1); 
    45             add_action('publish_phone', array('AWP_Cache','remove_post_cache'), 1); 
    46             add_action('delete_comment', array('AWP_Cache','delete_comment_cache'), 1); 
    47             // these we check for validity before invalidating the cache 
    48             add_action('trackback_post', array('AWP_Cache','remove_comment_cache'), 1); 
    49             add_action('pingback_post', array('AWP_Cache','remove_comment_cache'), 1); 
    50             add_action('comment_post', array('AWP_Cache','remove_comment_cache'), 1); 
    51             add_action('edit_comment', array('AWP_Cache','remove_comment_cache'), 1); 
    52             add_action('wp_set_comment_status', array('AWP_Cache','remove_comment_cache'), 1); 
    53  
    54  
    55             do_action('awp_cache_init'); 
    5653 
    5754      } 
    5855 
    5956      function comments_comments(){ 
    60       global $id
    61             $cache = AWP_Cache::fetch('comments_'.$id); 
     57      global $id, $AWP_inlinecomments
     58            $cache = $this->fetch('comments_'.$id); 
    6259            if(!$cache){ 
    6360                  ob_start(); 
    64                   AWP_inlinecomments::comments(); 
     61                  $AWP_inlinecomments->comments(); 
    6562                  $cache = ob_get_contents(); 
    6663                  ob_end_clean(); 
    67                   AWP_Cache::store('comments_'.$id, $cache); 
     64                  $this->store('comments_'.$id, $cache); 
    6865            } 
    6966 
     
    7370      function post_paginate(){ 
    7471      global $id,$pages; 
    75             $cache = AWP_Cache::fetch('post_'.$id); 
     72            $cache = $this->fetch('post_'.$id); 
    7673            if(!$cache){ 
    77                   $cache = AWP_inlineposts::paginate(); 
    78                   AWP_Cache::store('post_'.$id, $cache); 
     74                  $cache = $AWP_inlineposts->paginate(); 
     75                  $this->store('post_'.$id, $cache); 
    7976            } 
    8077            $pages = $cache; 
     
    8380      function post_pages(){ 
    8481      global $id; 
    85             $cache = AWP_Cache::fetch('post_pages_'.$id); 
     82            $cache = $this->fetch('post_pages_'.$id); 
    8683            if(!$cache){ 
    87                   $cache = AWP_inlineposts::pages(); 
    88                   AWP_Cache::store('post_pages_'.$id, $cache); 
     84                  $cache = $AWP_inlineposts->pages(); 
     85                  $this->store('post_pages_'.$id, $cache); 
    8986            } 
    9087      return $cache; 
     
    9289 
    9390      function clear_cache($id) { 
    94             AWP_Cache::remove_cache('post_'.$id); 
    95             AWP_Cache::remove_cache('post_'.$id); 
    96             AWP_Cache::remove_cache('comments_'.$id); 
     91            $this->remove_cache('post_'.$id); 
     92            $this->remove_cache('post_'.$id); 
     93            $this->remove_cache('comments_'.$id); 
    9794      } 
    9895 
     
    10097 
    10198            $comment = get_commentdata($comment_id, 1, true); 
    102             AWP_Cache::remove_cache('comments_'.$comment['comment_post_ID']); 
     99            $this->remove_cache('comments_'.$comment['comment_post_ID']); 
    103100      } 
    104101 
    105102      function remove_post_cache($id) { 
    106             AWP_Cache::remove_cache('post_'.$id); 
    107             AWP_Cache::remove_cache('post_pages_'.$id); 
     103            $this->remove_cache('post_'.$id); 
     104            $this->remove_cache('post_pages_'.$id); 
    108105      } 
    109106 
     
    114111                  return; 
    115112            }else{ 
    116                   AWP_Cache::remove_cache('comments_'.$comment['comment_post_ID']); 
     113                  $this->remove_cache('comments_'.$comment['comment_post_ID']); 
    117114            } 
    118115      } 
  • ajaxd-wordpress/trunk/modules/core_cache/core_cache.php

    r42761 r45322  
    1010*/ 
    1111 
    12       if(strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false){ 
    13             add_action('awp_admin_other',array('AWP_corecache','admin')); 
    14             add_filter('awp_get_options',array('AWP_corecache','awp_get_options')); 
    15             add_action('awp_admin_update',array('AWP_corecache','recacheJS')); 
    16             add_action('awp_admin_update',array('AWP_corecache','recacheCSS')); 
    17       }elseif(AWP::enabled('corecache')){ 
    18             add_filter('awp_jscore', array('AWP_corecache','switchjs')); 
    19             add_filter('awp_csscore', array('AWP_corecache','switchcss')); 
    20       } 
    2112 
     13$awp_init[] = 'AWP_corecache'; 
    2214register_activation_hook(__file__,array('AWP_corecache','set_defaults')); 
    2315class AWP_corecache { 
    2416 
     17      function init(){ 
     18            if(strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false){ 
     19                  add_action('awp_admin_other',array($this,'admin')); 
     20                  add_filter('awp_get_options',array($this,'awp_get_options')); 
     21                  add_action('awp_admin_update',array($this,'recacheJS')); 
     22                  add_action('awp_admin_update',array($this,'recacheCSS')); 
     23            }elseif(AWP::enabled('corecache')){ 
     24                  add_filter('awp_jscore', array($this,'switchjs')); 
     25                  add_filter('awp_csscore', array($this,'switchcss')); 
     26            } 
     27      } 
    2528      function switchjs($file){ 
    2629            $home = get_settings('siteurl'); 
     
    4447      } 
    4548      function recache(){ 
    46             AWP_corecache::recacheJS(); 
    47             AWP_corecache::recacheCSS(); 
     49            $this->recacheJS(); 
     50            $this->recacheCSS(); 
    4851      } 
    4952 
     
    112115 
    113116      function set_defaults(){ 
    114             global $awpall
     117            global $awpall,$AWP_corecache
    115118            $awpall[corecache] = 'Enabled'; 
    116             AWP_corecache::recache(); 
     119            $AWP_corecache = new AWP_corecache(); 
     120            $AWP_corecache->recache(); 
    117121            update_option('awp',$awpall); 
    118122      } 
  • ajaxd-wordpress/trunk/modules/customoptions.php

    r34720 r45322  
    1313            require_once('../../../../wp-config.php'); 
    1414            nocache_headers(); 
    15             AWP_customoptions::update_custom(); 
    16       }elseif(strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false){ 
    17  
    18                   add_action('awp_admin_main_options',array('AWP_customoptions','admin')); 
    19                   add_filter('awp_get_options',array('AWP_customoptions','awp_get_options')); 
    20                   if($_GET['post']){ 
    21                         add_filter('dbx_page_advanced', array('AWP_customoptions', 'customUI')); 
    22                         add_filter('dbx_post_advanced', array('AWP_customoptions', 'customUI')); 
    23                         add_action('init', array('AWP_customoptions','init')); 
    24                   } 
    25       }elseif($awpall['allow_custom'] == 'Enabled' ){ 
    26             add_filter('awp_options', array('AWP_customoptions', 'get_custom')); 
    27       } 
    28  
     15            $AWP_customoptions = new AWP_customoptions(); 
     16            $AWP_customoptions->update_custom(); 
     17      } 
     18 
     19$awp_init[] = 'AWP_customoptions'; 
    2920register_activation_hook(__file__,array('AWP_customoptions','set_defaults')); 
    30 //register_deactivation_hook(__file__,array('AWP_customoptions','rm_options')); 
     21//register_deactivation_hook(__file__,array($this,'rm_options')); 
    3122 
    3223Class AWP_customoptions{ 
     24      function init(){ 
     25            if(strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false){ 
     26 
     27                        add_action('awp_admin_main_options',array($this,'admin')); 
     28                        add_filter('awp_get_options',array($this,'awp_get_options')); 
     29                        if($_GET['post']){ 
     30                              add_filter('dbx_page_advanced', array($this, 'customUI')); 
     31                              add_filter('dbx_post_advanced', array($this, 'customUI')); 
     32                              add_action('init', array($this,'init')); 
     33                        } 
     34            }elseif($awpall['allow_custom'] == 'Enabled' ){ 
     35                  add_filter('awp_options', array($this, 'get_custom')); 
     36            } 
     37      } 
    3338 
    3439function get_char_map_html(){ 
     
    5156      global $aWP; 
    5257            remove_action('awp_build_menu',array('AWP_admin','admin_panel'),10); 
    53             add_action('awp_build_menu',array('AWP_customoptions','options_panel')); 
     58            add_action('awp_build_menu',array($this,'options_panel')); 
    5459            $aWP[custom_menu][items]['checkbox'][] = array('disable_awp',0); 
    5560 
     
    154159 
    155160            if(is_array($marray[menus])){ 
    156                   AWP_customoptions::admin_panel_menu($marray[menus][menu]); 
     161                  $this->admin_panel_menu($marray[menus][menu]); 
    157162            }elseif(is_array($marray[menu])){ 
    158                   AWP_customoptions::admin_panel_menu($marray[menu]); 
     163                  $this->admin_panel_menu($marray[menu]); 
    159164            }elseif(is_array($marray[submenu])){ 
    160                   AWP_customoptions::admin_panel_sub($marray[submenu]); 
     165                  $this->admin_panel_sub($marray[submenu]); 
    161166            }elseif(is_array($marray[item])){ 
    162                   AWP_customoptions::admin_panel_item($marray[item]); 
     167                  $this->admin_panel_item($marray[item]); 
    163168            } 
    164169      } 
     
    175180 
    176181                   if($m[submenu]){ 
    177                               AWP_customoptions::admin_panel_sub($m[submenu]); 
     182                              $this->admin_panel_sub($m[submenu]); 
    178183                              if($m[action]) 
    179184                                    do_action($m[action]); 
     
    186191            foreach($smenu as $menu){ 
    187192                  if(is_array($menu[item])){ 
    188                         AWP_customoptions::admin_panel_item($menu[item]); 
     193                        $this->admin_panel_item($menu[item]); 
    189194 
    190195                        if($menu[action]) 
     
    301306                  $marray = AWP::XML($menu); 
    302307                  if(is_array($marray[menus])){ 
    303                         AWP_customoptions::admin_panel_menu($marray[menus][menu]); 
     308                        $this->admin_panel_menu($marray[menus][menu]); 
    304309                  }elseif(is_array($marray[menu])){ 
    305                         AWP_customoptions::admin_panel_menu($marray[menu]); 
     310                        $this->admin_panel_menu($marray[menu]); 
    306311                  }elseif(is_array($marray[submenu])){ 
    307                         AWP_customoptions::admin_panel_sub($marray[submenu]); 
     312                        $this->admin_panel_sub($marray[submenu]); 
    308313                  }elseif(is_array($marray[item])){ 
    309                         AWP_customoptions::admin_panel_item($marray[item]); 
     314                        $this->admin_panel_item($marray[item]); 
    310315                  } 
    311316 
     
    369374                              </script> 
    370375 
    371                               <?php AWP_customoptions::print_menu()?> 
     376                              <?php $this->print_menu()?> 
    372377 
    373378                        </div> 
  • ajaxd-wordpress/trunk/modules/embeddedposts.php

    r42761 r45322  
    2626 
    2727      function AJAX(){ 
    28       global $awpall, $id, $pages, $post
     28      global $awpall, $id, $pages, $post,$AWP_inlineposts
    2929 
    3030            // we remove the filter so the function doesn't call itself 
    3131            if($awpall['simple_posts'] == 1){ 
    32                   remove_filter('the_content', array('AWP_inlineposts','filter'),-10,1); 
    33                   add_filter('the_content',array('AWP_inlineposts','break_content'),99999); 
     32                  remove_filter('the_content', array($AWP_inlineposts,'filter'),-10,1); 
     33                  add_filter('the_content',array($AWP_inlineposts,'break_content'),99999); 
    3434            } 
    3535 
  • ajaxd-wordpress/trunk/modules/inlinecommentform/inlinecommentform.php

    r43005 r45322  
    1010*/ 
    1111 
    12       if(strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false){ 
    13             add_action('awp_admin_commentform',array('AWP_commentform','admin')); 
    14             add_filter('awp_get_options',array('AWP_commentform','awp_get_options')); 
    15       }elseif(AWP::enabled('commentform')){ 
    16             /*Template Functions*/ 
    17             add_action('awp_commentform', array('AWP_commentform','div')); 
    18             add_action('awp_commentform_link', array('AWP_commentform','links')); 
    19             add_action('awp_commentform_quickclose', array('AWP_commentform','quickclose')); 
    20  
    21             /*Internal Functions*/ 
    22             add_action('awp_commentform_before_comment', array('AWP_commentform','integrate')); 
    23             add_filter('awp_commentform_on_submit', array('AWP_commentform','on_submit')); 
    24             add_action('awp_ajax_type_submit_commentform', array('AWP_commentform', 'submit_form')); 
    25             add_action('awp_ajax_type_commentform', array('AWP_commentform', 'AJAX')); 
    26             add_action('awp_simple_comments_last', array('AWP_commentform','div')); 
    27             add_action('awp_js_start',array('AWP_commentform','awp_js_start')); 
    28             add_action('awp_js_toggle',array('AWP_commentform','awp_js_toggle')); 
    29             add_action('awp_js_finish',array('AWP_commentform','awp_js_finish')); 
    30             add_filter('awp_input_suffix',array('AWP_commentform','input_suffix')); 
    31       } 
    32  
     12$awp_init[] = 'AWP_commentform'; 
    3313register_activation_hook(__file__,array('AWP_commentform','set_defaults')); 
    34 //register_deactivation_hook(__file__,array('AWP_commentform','rm_options')); 
     14//register_deactivation_hook(__file__,array($this,'rm_options')); 
    3515 
    3616class AWP_commentform{ 
     17 
     18      function init(){ 
     19 
     20            if(strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false){ 
     21                  add_action('awp_admin_commentform',array($this,'admin')); 
     22                  add_filter('awp_get_options',array($this,'awp_get_options')); 
     23            }elseif(AWP::enabled('commentform')){ 
     24                  /*Template Functions*/ 
     25                  add_action('awp_commentform', array($this,'div')); 
     26                  add_action('awp_commentform_link', array($this,'links')); 
     27                  add_action('awp_commentform_quickclose', array($this,'quickclose')); 
     28 
     29                  /*Internal Functions*/ 
     30                  add_action('awp_commentform_before_comment', array($this,'integrate')); 
     31                  add_filter('awp_commentform_on_submit', array($this,'on_submit')); 
     32                  add_action('awp_ajax_type_submit_commentform', array($this, 'submit_form')); 
     33                  add_action('awp_ajax_type_commentform', array($this, 'AJAX')); 
     34                  add_action('awp_simple_comments_last', array($this,'div')); 
     35                  add_action('awp_js_start',array($this,'awp_js_start')); 
     36                  add_action('awp_js_toggle',array($this,'awp_js_toggle')); 
     37                  add_action('awp_js_finish',array($this,'awp_js_finish')); 
     38                  add_filter('awp_input_suffix',array($this,'input_suffix')); 
     39            } 
     40 
     41      } 
    3742 
    3843      function awp_js_finish(){ 
     
    235240      function submit_form(){ 
    236241      global $wpdb, $post,$id,$awpall,$wp_actions, $user_ID; 
    237             add_filter('comment_post_redirect', array('AWP_commentform', 'remove_redirect')); 
     242            add_filter('comment_post_redirect', array($this, 'remove_redirect')); 
    238243 
    239244             $wp_actions[] = 'admin_head'; //Yay for hacking Wordpress. 
     
    244249 
    245250            if(!$_POST['comment_parent']) 
    246                   $vars = AWP_commentform::get_link_texts(); 
     251                  $vars = $this->get_link_texts(); 
    247252 
    248253            if($awpall[nomove]) 
     
    307312 
    308313            if ( comments_open() ) { 
    309                   $links = AWP_commentform::get_link_texts(); 
     314                  $links = $this->get_link_texts(); 
    310315 
    311316                  $anchor = $links[show]; 
     
    344349      function quickclose(){ 
    345350      global $id; 
    346             $links = AWP_commentform::get_link_texts(); 
     351            $links = $this->get_link_texts(); 
    347352            $ops[_class] = "commentform_link"; 
    348353            $ops[id] = 'awpcommentform_link0_'.$id; 
  • ajaxd-wordpress/trunk/modules/inlinecomments/inlinecomments.php

    r44811 r45322  
    1010*/ 
    1111 
     12$awp_init[] = 'AWP_inlinecomments'; 
     13register_activation_hook(__file__,array($this,'set_defaults')); 
     14 
     15class AWP_inlinecomments{ 
     16 
     17      function init(){ 
    1218      if(strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false){ 
    13             add_action('awp_admin_comments',array('AWP_inlinecomments','admin')); 
    14             add_filter('awp_get_options',array('AWP_inlinecomments','awp_get_options')); 
     19            add_action('awp_admin_comments',array($this,'admin')); 
     20            add_filter('awp_get_options',array($this,'awp_get_options')); 
    1521      }elseif(AWP::enabled('inlinecomments')){ 
    1622            $awp_link_count = array(); 
    17             AWP_inlinecomments::awp_live(); 
    18             add_action('awp_die',array('AWP_inlinecomments','awp_die')); 
    19             add_action('awp_live',array('AWP_inlinecomments','awp_live')); 
     23            $this->awp_live(); 
     24            add_action('awp_die',array($this,'awp_die')); 
     25            add_action('awp_live',array($this,'awp_live')); 
    2026 
    2127            /*Template Functions*/ 
    22             add_action('awp_comments', array('AWP_inlinecomments','div')); 
    23             add_action('awp_comments_link', array('AWP_inlinecomments','links')); 
     28            add_action('awp_comments', array($this,'div')); 
     29            add_action('awp_comments_link', array($this,'links')); 
    2430 
    2531            /*Internal Functions*/ 
    26             add_action('awp_comments_do', array('AWP_inlinecomments','comments')); 
    27             add_action('awp_ajax_type_comments', array('AWP_inlinecomments', 'AJAX')); 
    28             add_action('awp_js_start',array('AWP_inlinecomments','awp_js_start')); 
    29             add_action('awp_print_comments',array('AWP_inlinecomments','the_comments')); 
    30       } 
    31  
    32       AWP_inlinecomments::default_options(); 
    33  
    34  
    35 register_activation_hook(__file__,array('AWP_inlinecomments','set_defaults')); 
    36  
    37 class AWP_inlinecomments{ 
     32            add_action('awp_comments_do', array($this,'comments')); 
     33            add_action('awp_ajax_type_comments', array($this, 'AJAX')); 
     34            add_action('awp_js_start',array($this,'awp_js_start')); 
     35            add_action('awp_print_comments',array($this,'the_comments')); 
     36      } 
     37 
     38      $this->default_options(); 
     39 
     40 
     41      } 
    3842 
    3943      function awp_die(){ 
    4044      global $awpall; 
    4145                  if($awpall['simple_comments'] == 1){ 
    42                         remove_filter('comments_template', array('AWP_inlinecomments','filter'),1); 
     46                        remove_filter('comments_template', array($this,'filter'),1); 
    4347                  } 
    4448      } 
     
    5054            if(!$started || $aWP['die']){ /* We do not want to do this several times.*/ 
    5155                  if($awpall['simple_comments'] == 1){ 
    52                         add_filter('comments_template', array('AWP_inlinecomments','filter'),1); 
     56                        add_filter('comments_template', array($this,'filter'),1); 
    5357                  } 
    5458            } 
     
    6771            $actions[] = '_p[i].hide = _d[i].hide'; 
    6872 
    69             $vars