Plugin Directory

Changeset 2321105


Ignore:
Timestamp:
06/09/2020 07:41:45 PM (6 years ago)
Author:
beyondsoftware
Message:

Version 2.1.19

Location:
beyondconnect/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • beyondconnect/trunk/assets/beyondconnect_backend.css

    r2315249 r2321105  
    1616    padding: 14px 16px;
    1717    font-size: 17px;
    18     width: 25%;
     18    width: 20%;
    1919}
    2020
  • beyondconnect/trunk/beyondConnect.php

    r2315249 r2321105  
    77Plugin URI: https://support.beyond-sw.com/hc/de/categories/360002442180
    88Description: beyondConnect connects WordPress with the beyond software services.
    9 Version: 2.1.18
     9Version: 2.1.19
    1010Author: Felix Stadelmann, beyond software
    1111Author URI: https://beyond-sw.com
  • beyondconnect/trunk/inc/Api/Callbacks/SettingsCallbacks.php

    r2176871 r2321105  
    1313        _e( 'Set the connection details which you get from beyond software to connect your WordPress with the service', 'beyondconnect' );
    1414    }
     15    public function setPaymentgatewaysText()
     16    {
     17        _e( 'Set the details for your payment gateway which you get from Six Payment Services', 'beyondconnect' );
     18    }
    1519    public function setWidgetsText()
    1620    {
     
    2024    {
    2125        _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' );
    2230    }
    2331    public function SettingsPage()
     
    2937        $output = array();
    3038
     39
     40        //Widget Setting Fields
    3141        foreach ( $this->widgets as $key => $value ) {
    3242            $output[$key] = isset( $input[$key] ) ? true : false;
    3343        }
    3444
     45        //Shortcode Setting Fields
    3546        foreach ( $this->shortcodes as $key => $value ) {
    3647            $output[$key] = isset( $input[$key] ) ? true : false;
    3748        }
    3849
     50        //Connection Setting Fields
    3951        $output['Url'] = isset( $input['Url'] ) ? rtrim($input['Url'], '/') . '/' : "";
    4052        $output['Username'] = isset( $input['Username'] ) ? $input['Username'] : "";
    4153        $output['Key'] = isset( $input['Key'] ) ? $input['Key'] : "";
    4254
     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
    4363        return $output;
    4464    }
  • beyondconnect/trunk/inc/Base/CallbacksBaseController.php

    r2027374 r2321105  
    2323        $name = $args['label_for'];
    2424        $option_name = $args['option_name'];
     25        $required = $args['required'];
    2526        $input = get_option( $option_name );
    2627        $value = isset($input[$name]) ? $input[$name] : "";
    2728
    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' : '') .  '>';
    2940    }
    3041}
  • beyondconnect/trunk/inc/Base/NinjaFormsController.php

    r2185115 r2321105  
    2424        add_filter( 'ninja_forms_register_fields', array($this, 'register_fields'));
    2525        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 );
    2627    }
    2728
     
    3940        return $fields;
    4041    }
     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    }
    4165}
  • beyondconnect/trunk/inc/Base/NinjaFormsFields_List.php

    r2218955 r2321105  
    2323        $this->_settings[ 'options' ][ 'group' ] = '';
    2424
    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 );
    2626    }
    2727
     
    105105                $valuefield = 'lehrerId';
    106106                break;
    107             case 'TeacherLastname':
    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');
    110110                $valuefield = 'lehrerId';
    111111                break;
  • beyondconnect/trunk/inc/Base/ShortcodesBaseController.php

    r2315249 r2321105  
    105105
    106106        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
    110111        return $source;
    111112    }
    112113
     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('&#34;', '"', $decodedcontent);
     124                $decodedcontent = str_replace('&#8220;', '"', $decodedcontent);
     125                $decodedcontent = str_replace('&#8221;', '"', $decodedcontent);
     126                $decodedcontent = str_replace('&#8216;', '\'', $decodedcontent);
     127                $decodedcontent = str_replace('&#8217;', '\'', $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    }
    113140
    114141    protected function replaceFieldValues($content, $record, $prefix) {
     
    280307        foreach ($wp_session['bc_' . $elementname . '_list_element_array'] as $element_attr_array) {
    281308            $headtitle = $element_attr_array['title'];
    282             $headcustomclass = $element_attr_array['customclass'];
     309            $headcustomclass = isset($element_attr_array['customclass']) ? $element_attr_array['customclass'] : '';
    283310
    284311            $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  
    4242
    4343        $o = $this->execDBShortcode($content, $wporg_atts, 'kurse(\'' . $wporg_atts['kursid'] . '\')');
     44        $o = $this->replaceFormula($o);
    4445        return $o;
    4546    }
     
    4849
    4950        $o = $this->execElementShortcode($content, $wporg_atts, 'bc_element courses', 'title');
     51
     52        $o = $this->replaceFormula($o);
     53
    5054        return $o;
    5155    }
     
    6973
    7074        $o = $this->execDBShortcode($content, $wporg_atts, 'kursGruppen(\'' . $wporg_atts['gruppenid'] . '\')', 'subKursGruppen');
     75        $o = $this->replaceFormula($o);
    7176        return $o;
    7277    }
     
    7681
    7782        $o = $this->execDBShortcode($content, $wporg_atts, 'kursGruppen(\'' . $wporg_atts['gruppenid'] . '\')');
     83        $o = $this->replaceFormula($o);
    7884        return $o;
    7985    }
     
    8288
    8389        $o = $this->execElementShortcode($content, $wporg_atts, 'bc_element courses_groups', 'title');
     90        $o = $this->replaceFormula($o);
    8491        return $o;
    8592    }
     
    9097
    9198        $o = $this->execDBShortcode($content, $wporg_atts, 'kursDaten', 'value');
     99        $o = $this->replaceFormula($o);
    92100        return $o;
    93101    }
     
    97105
    98106        $o = $this->execElementShortcode($content, $wporg_atts, 'bc_element courses_dates', 'title');
     107        $o = $this->replaceFormula($o);
    99108        return $o;
    100109    }
     
    102111    public function beyondconnect_courses_list($atts = [], $content = null, $tag = '') {
    103112        $o = $this->execListShortcode($atts, $content, $tag, 'courses', 'kurse', 'kursid');
     113        $o = $this->replaceFormula($o);
    104114        return $o;
    105115    }
     
    108118
    109119        global $wp_session;
     120
    110121        $wp_session['bc_courses_list_element_array'][] = array_merge($wporg_atts, array('content' => trim(do_shortcode($content))));
     122
    111123        return '';
    112124    }
     
    120132        $o .= do_shortcode($content);
    121133
     134        $o = $this->replaceFormula($o);
    122135        return $o;
    123136    }
     
    131144        $o .= do_shortcode($content);
    132145
     146        $o = $this->replaceFormula($o);
    133147        return $o;
    134148    }
    135149    public function beyondconnect_coursdates_list($atts = [], $content = null, $tag = '') {
    136150        $o = $this->execListShortcode($atts, $content, $tag, 'coursdates', 'kursDaten', 'kursdatenrowguid');
     151        $o = $this->replaceFormula($o);
    137152        return $o;
    138153    }
     
    153168        $o .= do_shortcode($content);
    154169
     170        $o = $this->replaceFormula($o);
    155171        return $o;
    156172    }
     
    164180        $o .= do_shortcode($content);
    165181
     182        $o = $this->replaceFormula($o);
    166183        return $o;
    167184    }
  • beyondconnect/trunk/inc/Base/ShortcodesHelpersController.php

    r2315249 r2321105  
    2121        $this->codes = array(
    2222            'beyondconnect_setglobals',
    23             'beyondconnect_getglobals'
     23            'beyondconnect_getglobals',
    2424        );
    2525    }
     
    2828        global $bc_shortcode;
    2929
    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
    3140        $content = do_shortcode($content, false);
    3241
     
    4251            return "please define param";
    4352
    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            }
    4561
    4662        if(!isset($c))
  • beyondconnect/trunk/inc/Beyond.php

    r2315249 r2321105  
    248248        }
    249249    }
     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    }
    250259}
  • beyondconnect/trunk/inc/Pages/Settings.php

    r2315249 r2321105  
    6969                'page' => 'beyondconnect_connection_page'
    7070            ),
     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            ),
    7177            array(
    7278                'id' => 'beyondconnect_widgets_section',
     
    8086                'callback' => array( $this->callbacks, 'setShortcodesText' ),
    8187                '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'
    8294            )
    8395        );
     
    90102        $args = array();
    91103
     104        //Widget Setting Fields
    92105        foreach ( $this->widgets as $key => $value ) {
    93106            $args[] = array(
     
    104117            );
    105118        }
     119
     120        //Shortcode Setting Fields
    106121        foreach ( $this->shortcodes as $key => $value ) {
    107122            $args[] = array(
     
    119134        }
    120135
     136        //Connection Setting Fields
    121137        $args[] = array(
    122138                'id' => 'Url',
     
    127143                'args' => array(
    128144                    'option_name' => 'beyondconnect_option',
    129                     'label_for' => 'Url'
     145                    'label_for' => 'Url',
     146                    'required' => true
    130147            )
    131148        );
     
    138155                'args' => array(
    139156                    'option_name' => 'beyondconnect_option',
    140                     'label_for' => 'Username'
    141             )
    142         );
    143 
     157                    'label_for' => 'Username',
     158                    'required' => true
     159            )
     160        );
    144161        $args[] = array(
    145162                'id' => 'Key',
    146163                'title' => __( 'Key/Password', 'beyondconnect' ),
    147                 'callback' => array( $this->callbacks, 'textField' ),
     164                'callback' => array( $this->callbacks, 'passwordField' ),
    148165                'page' => 'beyondconnect_connection_page',
    149166                'section' => 'beyondconnect_connection_section',
    150167                'args' => array(
    151168                    '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'
    153223            )
    154224        );
  • beyondconnect/trunk/readme.txt

    r2315249 r2321105  
    66Tested up to: 5.4.1
    77Requires PHP: 7.0
    8 Stable tag: 2.1.18
     8Stable tag: 2.1.19
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2929
    3030== 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)
    3135= 2.1.18 =
    3236* Temporary fix for SSL-Error removed
  • beyondconnect/trunk/templates/settings.php

    r2315249 r2321105  
    33    <h1><?php _e( 'Settings', 'beyondconnect' )?></h1>
    44    <?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>
    810
    911    <form method="post" action="options.php">
    1012        <div id="Connection" class="tabcontent">
    1113            <?php
    12             settings_fields( 'beyondconnect_connection_settings' );
     14            settings_fields( 'beyondconnect_components_settings' );
    1315            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' );
    1424            submit_button();
    1525            ?>
     
    3141            ?>
    3242        </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>
    3351    </form>
    3452</div>
Note: See TracChangeset for help on using the changeset viewer.