Changeset 2321105
- Timestamp:
- 06/09/2020 07:41:45 PM (6 years ago)
- Location:
- beyondconnect/trunk
- Files:
-
- 13 edited
-
assets/beyondconnect_backend.css (modified) (1 diff)
-
beyondConnect.php (modified) (1 diff)
-
inc/Api/Callbacks/SettingsCallbacks.php (modified) (3 diffs)
-
inc/Base/CallbacksBaseController.php (modified) (1 diff)
-
inc/Base/NinjaFormsController.php (modified) (2 diffs)
-
inc/Base/NinjaFormsFields_List.php (modified) (2 diffs)
-
inc/Base/ShortcodesBaseController.php (modified) (2 diffs)
-
inc/Base/ShortcodesCoursesController.php (modified) (13 diffs)
-
inc/Base/ShortcodesHelpersController.php (modified) (3 diffs)
-
inc/Beyond.php (modified) (1 diff)
-
inc/Pages/Settings.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
-
templates/settings.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
beyondconnect/trunk/assets/beyondconnect_backend.css
r2315249 r2321105 16 16 padding: 14px 16px; 17 17 font-size: 17px; 18 width: 2 5%;18 width: 20%; 19 19 } 20 20 -
beyondconnect/trunk/beyondConnect.php
r2315249 r2321105 7 7 Plugin URI: https://support.beyond-sw.com/hc/de/categories/360002442180 8 8 Description: beyondConnect connects WordPress with the beyond software services. 9 Version: 2.1.1 89 Version: 2.1.19 10 10 Author: Felix Stadelmann, beyond software 11 11 Author URI: https://beyond-sw.com -
beyondconnect/trunk/inc/Api/Callbacks/SettingsCallbacks.php
r2176871 r2321105 13 13 _e( 'Set the connection details which you get from beyond software to connect your WordPress with the service', 'beyondconnect' ); 14 14 } 15 public function setPaymentgatewaysText() 16 { 17 _e( 'Set the details for your payment gateway which you get from Six Payment Services', 'beyondconnect' ); 18 } 15 19 public function setWidgetsText() 16 20 { … … 20 24 { 21 25 _e( 'Manage the Shortcodes of this Plugin by activating the checkboxes from the following list.', 'beyondconnect' ); 26 } 27 public function setOptionsText() 28 { 29 _e( 'Manage the Options of this Plugin by activating the checkboxes.', 'beyondconnect' ); 22 30 } 23 31 public function SettingsPage() … … 29 37 $output = array(); 30 38 39 40 //Widget Setting Fields 31 41 foreach ( $this->widgets as $key => $value ) { 32 42 $output[$key] = isset( $input[$key] ) ? true : false; 33 43 } 34 44 45 //Shortcode Setting Fields 35 46 foreach ( $this->shortcodes as $key => $value ) { 36 47 $output[$key] = isset( $input[$key] ) ? true : false; 37 48 } 38 49 50 //Connection Setting Fields 39 51 $output['Url'] = isset( $input['Url'] ) ? rtrim($input['Url'], '/') . '/' : ""; 40 52 $output['Username'] = isset( $input['Username'] ) ? $input['Username'] : ""; 41 53 $output['Key'] = isset( $input['Key'] ) ? $input['Key'] : ""; 42 54 55 // Paymentgateways Setting Fields 56 $output['PG_Url'] = isset( $input['PG_Url'] ) ? rtrim($input['PG_Url'], '/') . '/' : ""; 57 $output['PG_Username'] = isset( $input['PG_Username'] ) ? $input['PG_Username'] : ""; 58 $output['PG_Password'] = isset( $input['PG_Password'] ) ? $input['PG_Password'] : ""; 59 60 // Options Setting Fields 61 $output['ActivateUserManagement'] = isset( $input['ActivateUserManagement'] ) ? true : false; 62 43 63 return $output; 44 64 } -
beyondconnect/trunk/inc/Base/CallbacksBaseController.php
r2027374 r2321105 23 23 $name = $args['label_for']; 24 24 $option_name = $args['option_name']; 25 $required = $args['required']; 25 26 $input = get_option( $option_name ); 26 27 $value = isset($input[$name]) ? $input[$name] : ""; 27 28 28 echo '<input type="text" class="regular-text" id="' . $name . '" name="' . $option_name . '[' . $name . ']" value="' . $value . '" required>'; 29 echo '<input type="text" class="regular-text" id="' . $name . '" name="' . $option_name . '[' . $name . ']" value="' . $value . '" ' . ($required ? 'required' : '') . '>'; 30 } 31 public function passwordField( $args ) 32 { 33 $name = $args['label_for']; 34 $option_name = $args['option_name']; 35 $required = $args['required']; 36 $input = get_option( $option_name ); 37 $value = isset($input[$name]) ? $input[$name] : ""; 38 39 echo '<input type="password" class="regular-text" id="' . $name . '" name="' . $option_name . '[' . $name . ']" value="' . $value . '" ' . ($required ? 'required' : '') . '>'; 29 40 } 30 41 } -
beyondconnect/trunk/inc/Base/NinjaFormsController.php
r2185115 r2321105 24 24 add_filter( 'ninja_forms_register_fields', array($this, 'register_fields')); 25 25 add_filter( 'ninja_forms_register_actions', array($this, 'register_actions')); 26 add_filter( 'ninja_forms_render_default_value', array($this, 'render_default_value'), 10, 3 ); 26 27 } 27 28 … … 39 40 return $fields; 40 41 } 42 43 public function render_default_value( $default_value, $field_type, $field_settings ) { 44 //Assign global variables to form fields 45 46 global $bc_shortcode; 47 48 $field_key = $field_settings[ 'key' ]; 49 $field_strip = str_replace('beyondconnect_globals_', '', $field_key, $count ); 50 51 if (!isset($bc_shortcode)) 52 return $default_value; 53 54 foreach ($bc_shortcode as $key => $value) 55 { 56 if ($key == $field_strip && $count == 1) 57 $default_value = $value; 58 } 59 60 if (isset($bc_shortcode[$field_strip]) && $count == 1) 61 $default_value = $bc_shortcode[$field_strip]; 62 63 return $default_value; 64 } 41 65 } -
beyondconnect/trunk/inc/Base/NinjaFormsFields_List.php
r2218955 r2321105 23 23 $this->_settings[ 'options' ][ 'group' ] = ''; 24 24 25 add_filter( 'ninja_forms_render_options_' . $this->_type, array( $this, 'filter_options'), 10, 2 );25 add_filter( 'ninja_forms_render_options_' . $this->_type, array( $this, 'filter_options'), 10, 2 ); 26 26 } 27 27 … … 105 105 $valuefield = 'lehrerId'; 106 106 break; 107 case 'Teacher Lastname':108 $querystring = Beyond::getODataQueryString('Lehrer', ('lehrerId, nachname'), '', '', '', '', 'nachname');109 $labelfields = array(' nachname');107 case 'TeacherFirstnameLastname': 108 $querystring = Beyond::getODataQueryString('Lehrer', ('lehrerId,vorname,nachname'), '', '', '', '', 'vorname, nachname'); 109 $labelfields = array('vorname', 'nachname'); 110 110 $valuefield = 'lehrerId'; 111 111 break; -
beyondconnect/trunk/inc/Base/ShortcodesBaseController.php
r2315249 r2321105 105 105 106 106 foreach ($bc_shortcode as $key => $value) { 107 $source = str_ireplace('{' . $key . '}', urldecode($value), $source); 108 $source = str_ireplace('{global_' . $key . '}', urldecode($value), $source); 109 } 107 $source = str_ireplace('{' . $key . '}', urldecode($value), $source); 108 $source = str_ireplace('{global_' . $key . '}', urldecode($value), $source); 109 } 110 110 111 return $source; 111 112 } 112 113 114 protected function replaceFormula($content) { 115 116 while (!empty(Beyond::getStringBetween($content, '%(', ')%'))) 117 { 118 $tocalccontent = Beyond::getStringBetween($content, '%(', ')%'); 119 $calcedcontent = ''; 120 if (!empty($tocalccontent) && !strpos($tocalccontent, '%')) 121 { 122 $decodedcontent = $tocalccontent; 123 $decodedcontent = str_replace('"', '"', $decodedcontent); 124 $decodedcontent = str_replace('“', '"', $decodedcontent); 125 $decodedcontent = str_replace('”', '"', $decodedcontent); 126 $decodedcontent = str_replace('‘', '\'', $decodedcontent); 127 $decodedcontent = str_replace('’', '\'', $decodedcontent); 128 129 //echo "<pre><code>". "" . htmlspecialchars($tocalccontent, ENT_QUOTES) ."</code></pre>"; 130 131 eval ('$calcedcontent = ' . $decodedcontent . ';'); 132 } 133 134 if (!empty($calcedcontent)) 135 $content = str_replace('%(' . $tocalccontent . ')%', $calcedcontent, $content); 136 } 137 138 return $content; 139 } 113 140 114 141 protected function replaceFieldValues($content, $record, $prefix) { … … 280 307 foreach ($wp_session['bc_' . $elementname . '_list_element_array'] as $element_attr_array) { 281 308 $headtitle = $element_attr_array['title']; 282 $headcustomclass = $element_attr_array['customclass'];309 $headcustomclass = isset($element_attr_array['customclass']) ? $element_attr_array['customclass'] : ''; 283 310 284 311 $o .= '<' . ($wporg_atts['rendermode'] == "div" ? "div" : "th") . ' class="bc_list_head_element ' . $elementname . (empty($headcustomclass) ? '' : (' ' . $headcustomclass)) . ' '. esc_attr($headtitle) . '">' . $headtitle . '</' . ($wporg_atts['rendermode'] == "div" ? "div" : "th") . '>'; -
beyondconnect/trunk/inc/Base/ShortcodesCoursesController.php
r2315249 r2321105 42 42 43 43 $o = $this->execDBShortcode($content, $wporg_atts, 'kurse(\'' . $wporg_atts['kursid'] . '\')'); 44 $o = $this->replaceFormula($o); 44 45 return $o; 45 46 } … … 48 49 49 50 $o = $this->execElementShortcode($content, $wporg_atts, 'bc_element courses', 'title'); 51 52 $o = $this->replaceFormula($o); 53 50 54 return $o; 51 55 } … … 69 73 70 74 $o = $this->execDBShortcode($content, $wporg_atts, 'kursGruppen(\'' . $wporg_atts['gruppenid'] . '\')', 'subKursGruppen'); 75 $o = $this->replaceFormula($o); 71 76 return $o; 72 77 } … … 76 81 77 82 $o = $this->execDBShortcode($content, $wporg_atts, 'kursGruppen(\'' . $wporg_atts['gruppenid'] . '\')'); 83 $o = $this->replaceFormula($o); 78 84 return $o; 79 85 } … … 82 88 83 89 $o = $this->execElementShortcode($content, $wporg_atts, 'bc_element courses_groups', 'title'); 90 $o = $this->replaceFormula($o); 84 91 return $o; 85 92 } … … 90 97 91 98 $o = $this->execDBShortcode($content, $wporg_atts, 'kursDaten', 'value'); 99 $o = $this->replaceFormula($o); 92 100 return $o; 93 101 } … … 97 105 98 106 $o = $this->execElementShortcode($content, $wporg_atts, 'bc_element courses_dates', 'title'); 107 $o = $this->replaceFormula($o); 99 108 return $o; 100 109 } … … 102 111 public function beyondconnect_courses_list($atts = [], $content = null, $tag = '') { 103 112 $o = $this->execListShortcode($atts, $content, $tag, 'courses', 'kurse', 'kursid'); 113 $o = $this->replaceFormula($o); 104 114 return $o; 105 115 } … … 108 118 109 119 global $wp_session; 120 110 121 $wp_session['bc_courses_list_element_array'][] = array_merge($wporg_atts, array('content' => trim(do_shortcode($content)))); 122 111 123 return ''; 112 124 } … … 120 132 $o .= do_shortcode($content); 121 133 134 $o = $this->replaceFormula($o); 122 135 return $o; 123 136 } … … 131 144 $o .= do_shortcode($content); 132 145 146 $o = $this->replaceFormula($o); 133 147 return $o; 134 148 } 135 149 public function beyondconnect_coursdates_list($atts = [], $content = null, $tag = '') { 136 150 $o = $this->execListShortcode($atts, $content, $tag, 'coursdates', 'kursDaten', 'kursdatenrowguid'); 151 $o = $this->replaceFormula($o); 137 152 return $o; 138 153 } … … 153 168 $o .= do_shortcode($content); 154 169 170 $o = $this->replaceFormula($o); 155 171 return $o; 156 172 } … … 164 180 $o .= do_shortcode($content); 165 181 182 $o = $this->replaceFormula($o); 166 183 return $o; 167 184 } -
beyondconnect/trunk/inc/Base/ShortcodesHelpersController.php
r2315249 r2321105 21 21 $this->codes = array( 22 22 'beyondconnect_setglobals', 23 'beyondconnect_getglobals' 23 'beyondconnect_getglobals', 24 24 ); 25 25 } … … 28 28 global $bc_shortcode; 29 29 30 $bc_shortcode = $atts; 30 foreach ($atts as $key => $value) 31 { 32 $value = $this->replaceQueryStringValues($value); 33 } 34 35 if (!isset($bc_shortcode)) 36 $bc_shortcode = $atts; 37 else 38 $bc_shortcode = array_replace($bc_shortcode, $atts); 39 31 40 $content = do_shortcode($content, false); 32 41 … … 42 51 return "please define param"; 43 52 44 $c = $bc_shortcode[$p]; 53 if (!isset($bc_shortcode)) 54 return "param " . $p . " not found"; 55 56 foreach ($bc_shortcode as $key => $value) 57 { 58 if ($key == $p) 59 $c = $value; 60 } 45 61 46 62 if(!isset($c)) -
beyondconnect/trunk/inc/Beyond.php
r2315249 r2321105 248 248 } 249 249 } 250 251 public static function getStringBetween(string $string, string $start, string $end){ 252 $string = ' ' . $string; 253 $ini = strpos($string, $start); 254 if ($ini == 0) return ''; 255 $ini += strlen($start); 256 $len = strpos($string, $end, $ini) - $ini; 257 return substr($string, $ini, $len); 258 } 250 259 } -
beyondconnect/trunk/inc/Pages/Settings.php
r2315249 r2321105 69 69 'page' => 'beyondconnect_connection_page' 70 70 ), 71 array( 72 'id' => 'beyondconnect_paymentgateways_section', 73 'title' => __( 'Payment Gateways Settings', 'beyondconnect' ), 74 'callback' => array( $this->callbacks, 'setPaymentgatewaysText' ), 75 'page' => 'beyondconnect_paymentgateways_page' 76 ), 71 77 array( 72 78 'id' => 'beyondconnect_widgets_section', … … 80 86 'callback' => array( $this->callbacks, 'setShortcodesText' ), 81 87 'page' => 'beyondconnect_shortcodes_page' 88 ), 89 array( 90 'id' => 'beyondconnect_options_section', 91 'title' => __( 'Options Settings', 'beyondconnect' ), 92 'callback' => array( $this->callbacks, 'setOptionsText' ), 93 'page' => 'beyondconnect_options_page' 82 94 ) 83 95 ); … … 90 102 $args = array(); 91 103 104 //Widget Setting Fields 92 105 foreach ( $this->widgets as $key => $value ) { 93 106 $args[] = array( … … 104 117 ); 105 118 } 119 120 //Shortcode Setting Fields 106 121 foreach ( $this->shortcodes as $key => $value ) { 107 122 $args[] = array( … … 119 134 } 120 135 136 //Connection Setting Fields 121 137 $args[] = array( 122 138 'id' => 'Url', … … 127 143 'args' => array( 128 144 'option_name' => 'beyondconnect_option', 129 'label_for' => 'Url' 145 'label_for' => 'Url', 146 'required' => true 130 147 ) 131 148 ); … … 138 155 'args' => array( 139 156 'option_name' => 'beyondconnect_option', 140 'label_for' => 'Username' 141 ) 142 );143 157 'label_for' => 'Username', 158 'required' => true 159 ) 160 ); 144 161 $args[] = array( 145 162 'id' => 'Key', 146 163 'title' => __( 'Key/Password', 'beyondconnect' ), 147 'callback' => array( $this->callbacks, ' textField' ),164 'callback' => array( $this->callbacks, 'passwordField' ), 148 165 'page' => 'beyondconnect_connection_page', 149 166 'section' => 'beyondconnect_connection_section', 150 167 'args' => array( 151 168 'option_name' => 'beyondconnect_option', 152 'label_for' => 'Key' 169 'label_for' => 'Key', 170 'required' => true 171 ) 172 ); 173 174 // Paymentgateways Setting Fields 175 $args[] = array( 176 'id' => 'PG_Url', 177 'title' => 'Url', 178 'callback' => array( $this->callbacks, 'textField' ), 179 'page' => 'beyondconnect_paymentgateways_page', 180 'section' => 'beyondconnect_paymentgateways_section', 181 'args' => array( 182 'option_name' => 'beyondconnect_option', 183 'label_for' => 'PG_Url', 184 'required' => false 185 ) 186 ); 187 $args[] = array( 188 'id' => 'PG_Username', 189 'title' => __( 'Username', 'beyondconnect' ), 190 'callback' => array( $this->callbacks, 'textField' ), 191 'page' => 'beyondconnect_paymentgateways_page', 192 'section' => 'beyondconnect_paymentgateways_section', 193 'args' => array( 194 'option_name' => 'beyondconnect_option', 195 'label_for' => 'PG_Username', 196 'required' => false 197 ) 198 ); 199 $args[] = array( 200 'id' => 'PG_Password', 201 'title' => __( 'Password', 'beyondconnect' ), 202 'callback' => array( $this->callbacks, 'passwordField' ), 203 'page' => 'beyondconnect_paymentgateways_page', 204 'section' => 'beyondconnect_paymentgateways_section', 205 'args' => array( 206 'option_name' => 'beyondconnect_option', 207 'label_for' => 'PG_Password', 208 'required' => false 209 ) 210 ); 211 212 //Options Setting Fields 213 $args[] = array( 214 'id' => 'ActivateUserManagement', 215 'title' => __( 'User Management', 'beyondconnect' ), 216 'callback' => array( $this->callbacks, 'checkboxField' ), 217 'page' => 'beyondconnect_options_page', 218 'section' => 'beyondconnect_options_section', 219 'args' => array( 220 'option_name' => 'beyondconnect_option', 221 'label_for' => 'ActivateUserManagement', 222 'class' => 'ui-toggle' 153 223 ) 154 224 ); -
beyondconnect/trunk/readme.txt
r2315249 r2321105 6 6 Tested up to: 5.4.1 7 7 Requires PHP: 7.0 8 Stable tag: 2.1.1 88 Stable tag: 2.1.19 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 29 29 30 30 == Changelog == 31 = 2.1.19 = 32 * Support for global variables in Ninja Forms added 33 * Calculations for shortcodes added 34 * Bug fixes (BC Liste: Teacher - Firstname Lastname) 31 35 = 2.1.18 = 32 36 * Temporary fix for SSL-Error removed -
beyondconnect/trunk/templates/settings.php
r2315249 r2321105 3 3 <h1><?php _e( 'Settings', 'beyondconnect' )?></h1> 4 4 <?php settings_errors(); ?> 5 <button class="tablink" onclick="openPage('Connection', this)" id="defaultOpen"><?php _e( 'Connection Settings', 'beyondconnect' )?></button> 6 <button class="tablink" onclick="openPage('Widgets', this)"><?php _e( 'Widgets Settings', 'beyondconnect' )?></button> 7 <button class="tablink" onclick="openPage('Shortcodes', this)"><?php _e( 'Shortcodes Settings', 'beyondconnect' )?></button> 5 <button class="tablink" onclick="openPage('Connection', this)" id="defaultOpen"><?php _e( 'Connection', 'beyondconnect' )?></button> 6 <button class="tablink" onclick="openPage('Paymentgateways', this)"><?php _e( 'Payment Gateways', 'beyondconnect' )?></button> 7 <button class="tablink" onclick="openPage('Widgets', this)"><?php _e( 'Widgets', 'beyondconnect' )?></button> 8 <button class="tablink" onclick="openPage('Shortcodes', this)"><?php _e( 'Shortcodes', 'beyondconnect' )?></button> 9 <button class="tablink" onclick="openPage('Options', this)"><?php _e( 'Options', 'beyondconnect' )?></button> 8 10 9 11 <form method="post" action="options.php"> 10 12 <div id="Connection" class="tabcontent"> 11 13 <?php 12 settings_fields( 'beyondconnect_co nnection_settings' );14 settings_fields( 'beyondconnect_components_settings' ); 13 15 do_settings_sections( 'beyondconnect_connection_page' ); 16 submit_button(); 17 ?> 18 </div> 19 20 <div id="Paymentgateways" class="tabcontent"> 21 <?php 22 settings_fields( 'beyondconnect_components_settings' ); 23 do_settings_sections( 'beyondconnect_paymentgateways_page' ); 14 24 submit_button(); 15 25 ?> … … 31 41 ?> 32 42 </div> 43 44 <div id="Options" class="tabcontent"> 45 <?php 46 settings_fields( 'beyondconnect_components_settings' ); 47 do_settings_sections( 'beyondconnect_options_page' ); 48 submit_button(); 49 ?> 50 </div> 33 51 </form> 34 52 </div>
Note: See TracChangeset
for help on using the changeset viewer.