You are here

function _wysiwyg_spellcheck_requirements_ckeditor in Wysiwyg SpellCheck 6

Same name and namespace in other branches
  1. 7 wysiwyg_spellcheck.install \_wysiwyg_spellcheck_requirements_ckeditor()
1 call to _wysiwyg_spellcheck_requirements_ckeditor()
wysiwyg_spellcheck_requirements in ./wysiwyg_spellcheck.install
Implementation of hook_requirements().

File

./wysiwyg_spellcheck.install, line 60
WYSIWYG Spellcheck module install file.

Code

function _wysiwyg_spellcheck_requirements_ckeditor($phase) {
  $requirements = array();
  $t = get_t();
  $name = $t('Wysiwyg CKEditor spellchecker');
  $plugin = $t('CKEditor spellchecker plugin');
  module_load_include('module', 'wysiwyg_spellcheck');
  $plugin_site = 'http://cksource.com/forums/viewtopic.php?p=40830#p40830';
  $path = _wysiwyg_spellcheck_path('ckeditor');
  if (!file_exists($path)) {
    $requirements = array(
      'title' => $name,
      'description' => $t('In order for the %name to work, the %plugin should be downloaded and put in %path directory', array(
        '%name' => $name,
        '%plugin' => $plugin,
        '!settings' => l('settings', 'admin/settings/wysiwyg/spellcheck'),
        '%path' => $path,
      )),
      'severity' => $phase == 'install' ? REQUIREMENT_WARNING : REQUIREMENT_ERROR,
      'value' => $t('Third party !plugin_link software missing', array(
        '!plugin_link' => l($plugin, $plugin_site),
      )),
    );
  }
  elseif (!file_exists("{$path}/plugin.js") || !file_exists("{$path}/spellerpages/server-scripts/spellchecker.php")) {
    $requirements = array(
      'title' => $name,
      'description' => $t('The <code>%path</code> path exists but it appears that the directory structure underneath is incorrect. Please check that <code>%plugin_file</code> and <code>%php</code> exist.', array(
        '%name' => $name,
        '%plugin' => $plugin,
        '%path' => $path,
        '%plugin_file' => "{$path}/plugin.js",
        '%php' => "{$path}/spellerpages/server-scripts/spellchecker.php",
      )),
      'severity' => $phase == 'install' ? REQUIREMENT_WARNING : REQUIREMENT_ERROR,
      'value' => $t('Third party !plugin_link not properly installed', array(
        '!plugin_link' => l($plugin, $plugin_site),
      )),
    );
  }
  elseif ($phase == 'runtime') {
    $requirements = array(
      'title' => $name,
      'severity' => REQUIREMENT_OK,
      'value' => $t('Installed correctly'),
    );
  }
  return $requirements;
}