Floodlight.php
author Dan
Sun, 21 Dec 2008 23:19:03 -0500
changeset 1 c9c49ce179e9
parent 0 4d19ad17b07c
child 2 8d081d3128a2
permissions -rw-r--r--
Minor change to JS code: runs as soon as available, not onload anymore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     1
<?php
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     2
/**!info**
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     3
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     4
  "Plugin Name"  : "Floodlight",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     5
  "Plugin URI"   : "http://enanocms.org/plugin/floodlight",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     6
  "Description"  : "A much broader search than Spotlight. Adds auto-completion to the Search sidebar block.",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     7
  "Author"       : "Dan Fuhry",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     8
  "Version"      : "1.1.5",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     9
  "Author URI"   : "http://enanocms.org/"
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    10
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    11
**!*/
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    12
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    13
$plugins->attachHook('sidebar_fetch_return', 'floodlight_inject_searchflags($return);');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    14
$plugins->attachHook('autofill_json_request', 'floodlight_perform_search($dataset);');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    15
$plugins->attachHook('session_started', 'floodlight_add_js_page();');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    16
$plugins->attachHook('common_post', 'floodlight_intercept_search();');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    17
$plugins->attachHook('compile_template', 'floodlight_add_js();');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    18
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    19
function floodlight_inject_searchflags(&$return)
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    20
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    21
  if ( strstr($return[0], '<input name="q"') )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    22
  {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    23
    $hackme =& $return[0];
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    24
  }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    25
  else if ( strstr($return[1], '<input name="q"') )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    26
  {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    27
    $hackme =& $return[1];
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    28
  }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    29
  else
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    30
  {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    31
    return;
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    32
  }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    33
  $hackme = str_replace('<input name="q"', '<input name="q" autocomplete="off" onkeyup="this.onkeyup = null; this.className = \'autofill floodlight\'; autofill_init_element(this, {});"', $hackme);
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    34
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    35
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    36
function floodlight_perform_search(&$dataset)
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    37
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    38
  global $db, $session, $paths, $template, $plugins; // Common objects
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    39
  if ( $_GET['type'] == 'floodlight' )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    40
  {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    41
    $results = perform_search($_GET['userinput'], $warnings, false, $word_list);
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    42
    if ( count($results) > 5 )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    43
    {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    44
      $results = array_slice($results, 0, 5);
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    45
    }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    46
    foreach ( $results as $result )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    47
    {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    48
      $dataset[] = array(
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    49
          0 => "go:{$paths->nslist[$result['namespace']]}{$result['page_id']}",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    50
          'title' => str_replace(array('<highlight>', '</highlight>'), array('<b>', '</b>'), $result['page_name']),
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    51
          'score' => $result['score'],
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    52
          'type' => $result['page_note'],
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    53
          'size' => $result['page_length'],
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    54
        );
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    55
    }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    56
  }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    57
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    58
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    59
function floodlight_add_js_page()
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    60
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    61
  global $db, $session, $paths, $template, $plugins; // Common objects
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    62
  $paths->add_page(array(
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    63
      'name' => 'Floodlight Javascript',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    64
      'urlname' => 'FloodlightJS',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    65
      'namespace' => 'Special',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    66
      'visible' => 0,
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    67
      'protected' => 0,
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    68
      'comments_on' => 0,
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    69
      'special' => 0
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    70
    ));
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    71
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    72
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    73
function floodlight_intercept_search()
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    74
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    75
  global $db, $session, $paths, $template, $plugins; // Common objects
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    76
  if ( $paths->page_id == 'Search' && $paths->namespace == 'Special' )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    77
  {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    78
    if ( isset($_GET['q']) && preg_match('/^go:/', $_GET['q']) )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    79
    {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    80
      redirect(makeUrl(preg_replace('/^go:/', '', $_GET['q'])), '', '', 0);
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    81
    }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    82
  }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    83
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    84
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    85
function floodlight_add_js()
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    86
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    87
  global $db, $session, $paths, $template, $plugins; // Common objects
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    88
  $template->add_header('<script type="text/javascript" src="' . makeUrlNS('Special', 'FloodlightJS', false, true) . '"></script>');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    89
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    90
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    91
function page_Special_FloodlightJS()
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    92
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    93
  global $db, $session, $paths, $template, $plugins; // Common objects
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    94
  header('Content-type: text/javascript');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    95
  header('ETag: ' . sha1(__FILE__));
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    96
  
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    97
  global $aggressive_optimize_html;
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    98
  $aggressive_optimize_html = false;
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    99
  
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   100
  echo <<<EOF
1
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   101
var autofill_schemas = window.autofill_schemas || {};
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   102
autofill_schemas.floodlight = {
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   103
  init: function(element, fillclass, params)
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   104
  {
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   105
    params = params || {};
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   106
    $(element).autocomplete(makeUrlNS('Special', 'Autofill', 'type=' + fillclass) + '&userinput=', {
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   107
        minChars: 3,
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   108
        formatItem: function(row, _, __)
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   109
        {
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   110
          var type = ( typeof(row.type) == 'string' ) ? row.type : '';
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   111
          var html = '<big>' + row.title + '</big> <small>' + type + '</small>';
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   112
          html += '<br /><small>' + \$lang.get('floodlight_lbl_score') + row.score + '% | ' + row.size + '</small>';
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   113
          return html;
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   114
        },
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   115
        tableHeader: '<tr><th>' + \$lang.get('floodlight_table_heading') + '</th></tr>',
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   116
        showWhenNoResults: true,
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   117
        onItemSelect: function(li)
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   118
        {
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   119
          window.location = makeUrl(li.selectValue.replace(/^go:/, ''));
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   120
        },
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   121
        width: 300,
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   122
        noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + \$lang.get('floodlight_msg_no_results') + '</td></tr>',
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   123
    });
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   124
  }
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   125
};
0
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   126
EOF;
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   127
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   128
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   129
/**!language**
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   130
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   131
The following text up to the closing comment tag is JSON language data.
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   132
It is not PHP code but your editor or IDE may highlight it as such. This
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   133
data is imported when the plugin is loaded for the first time; it provides
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   134
the strings displayed by this plugin's interface.
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   135
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   136
You should copy and paste this block when you create your own plugins so
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   137
that these comments and the basic structure of the language data is
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   138
preserved. All language data is in the same format as the Enano core
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   139
language files in the /language/* directories. See the Enano Localization
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   140
Guide and Enano API Documentation for further information on the format of
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   141
language files.
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   142
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   143
The exception in plugin language file format is that multiple languages
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   144
may be specified in the language block. This should be done by way of making
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   145
the top-level elements each a JSON language object, with elements named
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   146
according to the ISO-639-1 language they are representing. The path should be:
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   147
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   148
  root => language ID => categories array, ( strings object => category \
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   149
  objects => strings )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   150
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   151
All text leading up to first curly brace is stripped by the parser; using
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   152
a code tag makes jEdit and other editors do automatic indentation and
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   153
syntax highlighting on the language data. The use of the code tag is not
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   154
necessary; it is only included as a tool for development.
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   155
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   156
<code>
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   157
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   158
  // english
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   159
  eng: {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   160
    categories: [ 'meta', 'floodlight' ],
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   161
    strings: {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   162
      meta: {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   163
        floodlight: 'Floodlight plugin'
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   164
      },
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   165
      floodlight: {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   166
        table_heading: 'Search results',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   167
        msg_no_results: 'No results',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   168
        lbl_score: 'Relevance: ',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   169
      }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   170
    }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   171
  }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   172
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   173
</code>
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   174
**!*/