You are here

function _wysiwyg_spellcheck_requirements_tinymce in Wysiwyg SpellCheck 6

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

File

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

Code

function _wysiwyg_spellcheck_requirements_tinymce($phase) {
  $requirements = array();
  $t = get_t();
  $name = $t('Wysiwyg TinyMCE spellchecker');
  $plugin = $t('TinyMCE spellchecker plugin');
  module_load_include('module', 'wysiwyg_spellcheck');
  $plugin_site = 'http://tinymce.moxiecode.com/download.php';
  $path = _wysiwyg_spellcheck_path('tinymce');
  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}/editor_plugin.js") || !file_exists("{$path}/config.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>%config</code> exist.', array(
        '%name' => $name,
        '%plugin' => $plugin,
        '%path' => $path,
        '%plugin_file' => "{$path}/editor_plugin.js",
        '%config' => "{$path}/config.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;
}