BMLT Drupal Module
/home/travis/build/bmlt-enabled/bmlt-drupal/bmlt.module
Go to the documentation of this file.
1 <?php
2 /**
3  // $Id$
4  \file bmlt.module
5  \brief The implementation of the Drupal BMLT satellite server module.
6  \version 3.10.0
7 
8  This file is part of the Basic Meeting List Toolbox (BMLT).
9 
10  Find out more at: http://magshare.org/bmlt
11 
12  BMLT is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  BMLT is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this code. If not, see <http://www.gnu.org/licenses/>.
24 */
25 require_once( dirname( __FILE__ ) . '/bmlt-drupal-satellite-plugin.php' );
26 
27 /***********************************************/
28 /**
29  \brief This displays the actual BMLT content if the
30  text contains the BMLT shortcodes or HTML comments.
31 */
32 function bmlt_filter( $op = 'list',
33  $delta = 0,
34  $format = -1,
35  $text = '',
36  $cache_id = 0
37  )
38  {
39  global $BMLTPluginOp;
40 
41  switch( $op )
42  {
43  case 'list':
44  $text = array( $BMLTPluginOp->process_text( $BMLTPluginOp->local_strings['en']['add_instance'] ) );
45  break;
46 
47  case 'no cache':
48  return true;
49  break;
50 
51  case 'description':
52  $text = $BMLTPluginOp->process_text( $BMLTPluginOp->local_strings['en']['add_instance'] );
53  break;
54 
55  case 'prepare':
56  $text = _bmlt_prepare( $text );
57  break;
58 
59  case 'process':
60  $text = _bmlt_process( $text );
61  break;
62  }
63 
64  return $text;
65  }
66 
67 /***********************************************/
68 /**
69  \brief Sets up the menu for the BMLT
70 */
71 function bmlt_menu( )
72  {
73  global $BMLTPluginOp;
74 
75  $items = array('admin/settings/bmlt' => array(
76  'title' => $BMLTPluginOp->process_text( $BMLTPluginOp->local_strings['en']['bmlt_settings'] ),
77  'description' => $BMLTPluginOp->process_text( $BMLTPluginOp->local_strings['en']['describe_admin'] ),
78  'page callback' => 'bmlt_admin_form',
79  'access arguments' => array( $BMLTPluginOp->process_text( $BMLTPluginOp->local_strings['en']['access_admin'] ) )
80  )
81  );
82  return $items;
83  }
84 
85 /***********************************************/
86 /**
87  \brief This function returns the HTML for the BMLT admin.
88 */
89 function bmlt_admin_form( )
90  {
91  global $BMLTPluginOp;
92  $BMLTPluginOp->admin_ajax_handler();
93  $BMLTPluginOp->admin_head();
94  return $BMLTPluginOp->return_admin_page();
95  }
96 
97 /***********************************************/
98 /**
99  \brief This function sets up the header for the module.
100 */
101 function bmlt_boot( )
102  {
103  global $BMLTPluginOp;
104 
105  $BMLTPluginOp->ajax_router();
106  }
107 
108 /***********************************************/
109 /**
110  \brief This tells Drupal 7 about our filter.
111 */
113  {
114  global $BMLTPluginOp;
115 
116  return array( 'bmlt' => array( 'title' => $BMLTPluginOp->process_text( $BMLTPluginOp->local_strings['en']['add_instance'] ),
117  'prepare callback' => '_bmlt_prepare',
118  'process callback' => '_bmlt_process',
119  'cache' => false
120  )
121  );
122  }
123 
124 /***********************************************/
125 /**
126  \brief
127 */
128 function _bmlt_prepare($in_text,
129  $in_filter = null
130  )
131 {
132  global $BMLTPluginOp;
133 
134  if ( $BMLTPluginOp->get_shortcode ( $in_text, 'bmlt' )
135  || $BMLTPluginOp->get_shortcode ( $in_text, 'simple_search_list' )
136  || $BMLTPluginOp->get_shortcode ( $in_text, 'bmlt_map' )
137  || $BMLTPluginOp->get_shortcode ( $in_text, 'bmlt_simple' )
138  || $BMLTPluginOp->get_shortcode ( $in_text, 'bmlt_mobile' )
139  || $BMLTPluginOp->get_shortcode ( $in_text, 'bmlt_table' )
140  || $BMLTPluginOp->get_shortcode ( $in_text, 'bmlt_quicksearch' )
141  )
142  {
143  $BMLTPluginOp->standard_head( $in_text );
144  }
145 
146  return $in_text;
147 }
148 
149 /***********************************************/
150 /**
151  \brief
152 */
153 function _bmlt_process($in_text,
154  $in_filter = null
155  )
156 {
157  global $BMLTPluginOp;
158 
159  return $BMLTPluginOp->content_filter( $in_text );
160 }
bmlt_boot()
This function sets up the header for the module.
Definition: bmlt.module:101
bmlt_menu()
Sets up the menu for the BMLT.
Definition: bmlt.module:71
bmlt_admin_form()
This function returns the HTML for the BMLT admin.
Definition: bmlt.module:89
bmlt_filter_info()
This tells Drupal 7 about our filter.
Definition: bmlt.module:112
bmlt_filter($op= 'list', $delta=0, $format=-1, $text= '', $cache_id=0)
This displays the actual BMLT content if the text contains the BMLT shortcodes or HTML comments...
Definition: bmlt.module:32