/** * Reports the supported options * * @return array */ function getOptionsSupported() { /* The option definitions are stored in a multidimensional array. There are several predefine option types. Options types are the same for plugins and themes. */ $options = array(gettext_pl('Radio buttons option', 'zenphoto_demoplugin') => array('key' => 'demoplugin_radiobuttons', 'type' => OPTION_TYPE_RADIO, 'order' => 7, 'buttons' => array(gettext_pl('Suboption 1-a', 'zenphoto_demoplugin') => 'suboption1-a', gettext_pl('Suboption 1-b', 'zenphoto_demoplugin') => 'suboption1-b', gettext_pl('Suboption 1-c', 'zenphoto_demoplugin') => 'suboption1-c'), 'desc' => gettext_pl('Description', 'zenphoto_demoplugin')), gettext_pl('Checkbox array list option', 'zenphoto_demoplugin') => array('key' => 'demoplugin_checkbox_array', 'type' => OPTION_TYPE_CHECKBOX_ARRAY, 'order' => 0, 'checkboxes' => array(gettext_pl('Suboption 2-a', 'zenphoto_demoplugin') => 'suboption2-a', gettext_pl('Suboption 2-b', 'zenphoto_demoplugin') => 'suboption2-b', gettext_pl('Suboption 2-c', 'zenphoto_demoplugin') => 'suboption2-c'), 'desc' => gettext_pl('Description', 'zenphoto_demoplugin')), gettext_pl('Checkbox list', 'zenphoto_demoplugin') => array('key' => 'demoplugin_checkbox_list', 'type' => OPTION_TYPE_CHECKBOX_UL, 'order' => 0, 'checkboxes' => array(gettext_pl('Suboption 3-a', 'zenphoto_demoplugin') => 'suboption3-a', gettext_pl('Suboption 3-b', 'zenphoto_demoplugin') => 'suboption3-b', gettext_pl('Suboption 3-c', 'zenphoto_demoplugin') => 'suboption3-c'), 'desc' => gettext_pl('Description', 'zenphoto_demoplugin')), gettext_pl('One Checkbox option only', 'zenphoto_demoplugin') => array('key' => 'demoplugin_checkbox', 'type' => OPTION_TYPE_CHECKBOX, 'order' => 2, 'desc' => gettext_pl('Description', 'zenphoto_demoplugin')), gettext_pl('Input text field option', 'zenphoto_demoplugin') => array('key' => 'demoplugin_textbox', 'type' => OPTION_TYPE_TEXTBOX, 'multilingual' => 1, 'order' => 9, 'desc' => gettext_pl('Description', 'zenphoto_demoplugin')), gettext_pl('Password input field option', 'zenphoto_demoplugin') => array('key' => 'demoplugin_input_password', 'type' => OPTION_TYPE_PASSWORD, 'order' => 9, 'desc' => gettext_pl('Description', 'zenphoto_demoplugin')), gettext_pl('Cleartext input field option', 'zenphoto_demoplugin') => array('key' => 'demoplugin_input_cleartext', 'type' => OPTION_TYPE_CLEARTEXT, 'order' => 9, 'desc' => gettext_pl('Description', 'zenphoto_demoplugin')), gettext_pl('Textarea field option', 'zenphoto_demoplugin') => array('key' => 'demoplugin_textarea', 'type' => OPTION_TYPE_TEXTAREA, 'texteditor' => 1, 'multilingual' => 1, 'order' => 9, 'desc' => gettext_pl('Description', 'zenphoto_demoplugin')), gettext_pl('Dropdown selector option', 'zenphoto_demoplugin') => array('key' => 'demoplugin_selector', 'type' => OPTION_TYPE_SELECTOR, 'order' => 1, 'selections' => array(gettext_pl('Suboption1', 'zenphoto_demoplugin') => 'suboption1', gettext_pl('Suboption2', 'zenphoto_demoplugin') => 'suboption2', gettext_pl('Suboption3', 'zenphoto_demoplugin') => 'suboption3'), 'null_selection' => gettext_pl('Disabled', 'zenphoto_demoplugin'), 'desc' => gettext_pl('Description.', 'zenphoto_demoplugin')), gettext_pl('jQuery color picker option', 'zenphoto_demoplugin') => array('key' => 'demoplugin_colorpicker', 'type' => OPTION_TYPE_COLOR_PICKER, 'desc' => gettext_pl('Description', 'zenphoto_demoplugin')), gettext_pl('Custom option', 'zenphoto_demoplugin') => array('key' => 'demoplugin_customoption', 'type' => OPTION_TYPE_CUSTOM, 'desc' => gettext_pl('Custom option if none of the above standard ones fit your purpose. You define what to do and show within the method handleOption(). In this case we mask the input which in actuality is shown in the field below.', 'zenphoto_demoplugin'), getOption('demoplugin_customoption'))); /* Sometimes you might want to put out notes for example if someone tries to run the plugin but its server lacks support. Then there is an option type for notes only. You can add them like this: */ if (!extensionEnabled('zenphoto_demoplugin')) { // whatever you need to check (in this case that the plugin is enabled) $options['note'] = array('key' => 'demoplugin_note', 'type' => OPTION_TYPE_NOTE, 'order' => 25, 'desc' => gettext_pl('<p class="notebox">Sometimes you might want to put out notes for example if someone tries to run the plugin but its server lacks support. Then there is an option type for notes only</p>', 'zenphoto_demoplugin')); } return $options; }
static function getJS() { $message = gettext_pl('This website uses cookies. By continuing to browse the site, you agree to our use of cookies.', 'zp_cookieconsent'); if (getOption('zpcookieconsent_message')) { $message = get_language_string(getOption('zpcookieconsent_message')); } $dismiss = gettext_pl('Agree', 'zp_cookieconsent'); if (getOption('zpcookieconsent_buttonagree')) { $dismiss = get_language_string(getOption('zpcookieconsent_buttonagree')); } $learnmore = gettext_pl('More info', 'zp_cookieconsent'); if (getOption('zpcookieconsent_buttonlearnmore')) { $learnmore = get_language_string(getOption('zpcookieconsent_buttonlearnmore')); } $link = getOption('zpcookieconsent_buttonlearnmorelink'); $theme = ''; if (getOption('zpcookieconsent_theme')) { $theme = FULLWEBPATH . '/' . USER_PLUGIN_FOLDER . '/zp_cookieconsent/styles/' . getOption('zpcookieconsent_theme') . '.css'; } $domain = ''; if (getOption('zpcookieconsent_domain')) { $domain = getOption('zpcookieconsent_domain'); } $DoC = false; if (getOption('zpcookieconsent_dismissonclick')) { $DoC = true; } $DoS = false; if (getOption('zpcookieconsent_dismissonscroll') & !strpos($link, $_SERVER['REQUEST_URI'])) { // false in Cookie Policy Page $DoS = true; } ?> <script> window.cookieconsent_options = { message: '<?php echo js_encode($message); ?> ', dismiss: '<?php echo js_encode($dismiss); ?> ', learnMore: '<?php echo $learnmore; ?> ', theme: '<?php echo $theme; ?> ', link: '<?php echo html_encode($link); ?> ', domain: '<?php echo $domain; ?> ', expiryDays: <?php echo getOption('zpcookieconsent_expirydays'); ?> }; <?php if ($DoC || $DoS) { // dismiss on-click or on-scroll if ($DoC) { // dismiss on-click ?> $('a').not('[href*=#]').on('click', DismissOnClick); function DismissOnClick() { var isInternalLink = new RegExp('/' + window.location.host + '/'); if ( isInternalLink.test(this.href)) { fatto(0); } } <?php } if ($DoS) { // Dismiss on-scroll ?> var IniScroll, noHurry; $(window).load(function (){ if(noHurry) { window.clearTimeout(noHurry); } noHurry = window.setTimeout(function() { IniScroll = $(window).scrollTop(); $(window).on("scroll",DismissOnScroll); }, 500); }); function DismissOnScroll() { var NewScroll = $(window).scrollTop(); if (Math.abs(NewScroll - IniScroll) > <?php echo getOption('zpcookieconsent_scrollrange'); ?> ) { fatto(1); } } <?php } // Unbind and simulate dismiss button ?> function fatto (FromScroll) { <?php if ($DoC) { ?> $('a').off('click', DismissOnClick); if ($('.cc_btn_accept_all').length &! FromScroll) { $('.cc_btn_accept_all')[0].click(); } <?php } if ($DoS) { ?> $(window).off("scroll", DismissOnScroll); if ($('.cc_btn_accept_all').length && FromScroll) { fadeOut(document.querySelector(".cc_banner-wrapper")); } function fadeOut(el){ el.style.opacity = 1; (function fade() { if ((el.style.opacity -= 1/25) < 0) { $('.cc_btn_accept_all')[0].click(); } else if (window.requestAnimationFrame){ requestAnimationFrame(fade); } else { $('.cc_btn_accept_all')[0].click(); } })(); } <?php } ?> } <?php } ?> </script> <script src="<?php echo FULLWEBPATH . '/' . USER_PLUGIN_FOLDER; ?> /zp_cookieconsent/cookieconsent.min.js"></script> <?php }
static function getJS() { $message = gettext_pl('This website uses cookies. By continuing to browse the site, you agree to our use of cookies.', 'zp_cookieconsent'); if (getOption('zpcookieconsent_message')) { $message = get_language_string(getOption('zpcookieconsent_message')); } $dismiss = gettext_pl('Agree', 'zp_cookieconsent'); if (getOption('zpcookieconsent_buttonagree')) { $dismiss = get_language_string(getOption('zpcookieconsent_buttonagree')); } $learnmore = gettext_pl('More info', 'zp_cookieconsent'); if (getOption('zpcookieconsent_buttonlearnmore')) { $learnmore = get_language_string(getOption('zpcookieconsent_buttonlearnmore')); } $link = getOption('zpcookieconsent_buttonlearnmorelink'); $theme = ''; if (getOption('zpcookieconsent_theme')) { $theme = FULLWEBPATH . '/' . USER_PLUGIN_FOLDER . '/zp_cookieconsent/styles/' . getOption('zpcookieconsent_theme') . '.css'; } $domain = ''; if (getOption('zpcookieconsent_domain')) { $domain = getOption('zpcookieconsent_domain'); } ?> <script> window.cookieconsent_options = { message: '<?php echo js_encode($message); ?> ', dismiss: '<?php echo js_encode($dismiss); ?> ', learnMore: '<?php echo $learnmore; ?> ', theme: '<?php echo $theme; ?> ', link: '<?php echo html_encode($link); ?> ', domain: '<?php echo $domain; ?> ', expiryDays: <?php echo getOption('zpcookieconsent_expirydays'); ?> }; </script> <script src="<?php echo FULLWEBPATH . '/' . USER_PLUGIN_FOLDER; ?> /zp_cookieconsent/cookieconsent.min.js"></script> <?php }