Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
snippet_keyword_replace.inc
1 <?php
18 global $ROOT_PATH;
19 include_once($ROOT_PATH.'wysiwyg_plugin.inc');
20 
21 
33 class Snippet_Keyword_Replace extends WYSIWYG_Plugin
34 {
35 
41  var $keyword_tag = '';
42 
52  var $keywords = Array();
53 
54 
60  function Snippet_Keyword_Replace(&$wysiwyg)
61  {
62  $this->_add_button('addsnippetkeyword','','','','');
63  $this->_add_button('snippethelp','snippethelp','Snippet Keyword Information','true','0');
64 
65  }//end constructor
66 
67 
74  function print_plugin_vars()
75  {
76  ?>
77  this.config.snippetkeywords = Array(
78  <?php
79  $string = '';
80  foreach ($this->keywords as $keyword => $name) {
81  $keyword = str_replace(Array('"', "\r", "\n"), Array('\"', '\r', '\n'), $keyword);
82  if (empty($name)) {
83  $name = ucwords(str_replace('_', ' ', $keyword));
84  } else {
85  $name = str_replace(Array('"', "\r", "\n"), Array('\"', '\r', '\n'), $name);
86 
87  }
88  $string .= "\n".'Array("'.$this->keyword_tag.$keyword.$this->keyword_tag.'", "'.$name.'"),';
89  }
90  echo trim($string, ', ');
91  ?>
92  );
93  <?php
94 
95  }//end print_plugin_vars()
96 
97 
105  {
106  ?>
107  case "addsnippetkeyword":
108  options = Array();
109  options["-- select snippet keyword --"] = "";
110  for (var i in editor.config.snippetkeywords) {
111  var keyword = editor.config.snippetkeywords[i];
112  options[keyword[1]] = keyword[0];
113  }
114  cmd = txt;
115  break;
116  <?php
117 
118  }//end print_plugin_create_select()
119 
120 
128  {
129  ?>
130  case "addsnippetkeyword":
131  if (value != "") {
132  this.insertHTML(value);
133  el.selectedIndex = 0;
134  }
135  break;
136  <?php
137 
138  }//end print_plugin_combo_selected()
139 
140 
148  {
149 
150  ?>
151  case "snippethelp":
152  strPage = "<?php echo $this->get_popup_href('snippet_info_popup.php'); ?>";
153  this._popupDialog("snippetInfo", strPage, 790, 500, true, function() {}, 0);
154  break;
155  <?php
156 
157  }//end print_plugin_button_click()
158 
159 
160 }//end class()
161 ?>