includes/plugins.php
changeset 555 ac4c6a7f01d8
parent 536 218a627eb53e
child 560 8981dcf7d485
equal deleted inserted replaced
554:e87390b1f9b0 555:ac4c6a7f01d8
   809     
   809     
   810     endswitch;
   810     endswitch;
   811     
   811     
   812     return $return;
   812     return $return;
   813   }
   813   }
       
   814   
       
   815   /**
       
   816    * Re-imports the language strings from a plugin.
       
   817    * @param string File name
       
   818    * @return array Enano JSON response protocol
       
   819    */
       
   820   
       
   821   function reimport_plugin_strings($filename, $plugin_list = null)
       
   822   {
       
   823     global $db, $session, $paths, $template, $plugins; // Common objects
       
   824     global $lang;
       
   825     
       
   826     if ( !$plugin_list )
       
   827       $plugin_list = $this->get_plugin_list();
       
   828     
       
   829     switch ( true ): case true:
       
   830     
       
   831     // is the plugin in the directory and already installed?
       
   832     if ( !isset($plugin_list[$filename]) || (
       
   833         isset($plugin_list[$filename]) && !$plugin_list[$filename]['installed']
       
   834       ))
       
   835     {
       
   836       $return = array(
       
   837         'mode' => 'error',
       
   838         'error' => 'Invalid plugin specified.',
       
   839       );
       
   840       break;
       
   841     }
       
   842     // get plugin data
       
   843     $dataset =& $plugin_list[$filename];
       
   844     
       
   845     $result = $lang->import_plugin(ENANO_ROOT . '/plugins/' . $filename);
       
   846     if ( $result )
       
   847     {
       
   848       return array(
       
   849         'success' => true
       
   850       );
       
   851     }
       
   852     else
       
   853     {
       
   854       return array(
       
   855         'mode' => 'error',
       
   856         'error' => 'Language API returned error'
       
   857       );
       
   858     }
       
   859     
       
   860     endswitch;
       
   861   }
   814 }
   862 }
   815 
   863 
   816 ?>
   864 ?>