#335 new
touchy

Javascript loads on all admin pages

Reported by touchy | July 22nd, 2010 @ 10:06 AM

Hello,

The plugin loads JS on all admin pages, and that create conflicts with some others plugins (for example, WPTouch Pro).
Here is the fix, please can you include this in your next release ? :)

Original code:

/*
    Called when WP-o-Matic admin pages initialize.
   
   
   */
  function adminInit()
  {

auth_redirect();

// force display of a certain section
$this->section = ($this->setup) ? ((isset($_REQUEST['s']) && $_REQUEST['s']) ? $_REQUEST['s'] : $this->sections[0]) : 'setup';

if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
  die('Please switch to Firefox / Safari');

wp_enqueue_script('prototype');
wp_enqueue_script('wpoadmin', $this->tplpath . '/admin.js', array('prototype'), $this->version);

if($this->section == 'list')
  wp_enqueue_script('listman');

if(WPOTools::isAjax())
{
  $this->admin();
  exit;
}



}

Fixed code:

/*
    Called when WP-o-Matic admin pages initialize.
   
   
   */
  function adminInit()
  {

auth_redirect();

// force display of a certain section
$this->section = ($this->setup) ? ((isset($_REQUEST['s']) && $_REQUEST['s']) ? $_REQUEST['s'] : $this->sections[0]) : 'setup';

if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
  die('Please switch to Firefox / Safari');

$is_wpomatic_page = ( strpos( $_SERVER['REQUEST_URI'], 'wpomatic' ) !== false );

if ( $is_wpomatic_page ) {
    wp_enqueue_script('prototype');
    wp_enqueue_script('wpoadmin', $this->tplpath . '/admin.js', array('prototype'), $this->version);

    if($this->section == 'list')
      wp_enqueue_script('listman');

    if(WPOTools::isAjax())
    {
      $this->admin();
      exit;
    }
 }



}

Thanks !

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

WP-o-Matic project.

People watching this ticket

Pages