/**
* Plugin Name: Foodbakery Disable Menu Order
* Plugin URI: http://themeforest.net/user/Chimpstudio/
* Description: Foodbakery Disable Menu Order is an Addon for Foodbakery which disables the menu ordering system.
* Version: 2.0
* Author: ChimpStudio
* Author URI: http://themeforest.net/user/Chimpstudio/
* @package Foodbakery
* Text Domain: foodbakery-disable-menu-order
*/
// Direct access not allowed.
if (!defined('ABSPATH')) {
exit;
}
if (!class_exists('Foodbakery_Disable_Menu_Order')) {
class Foodbakery_Disable_Menu_Order
{
public $admin_notices;
/**
* Start construct Functions
*/
public function __construct()
{
// Define constants
define('FOODBAKERY_DISABLE_MENU_ORDER_PLUGIN_VERSION', '1.6');
define('FOODBAKERY_DISABLE_MENU_ORDER_PLUGIN_DOMAIN', 'foodbakery-disable-menu-order');
define('FOODBAKERY_DISABLE_MENU_ORDER_PLUGIN_URL', WP_PLUGIN_URL . '/foodbakery-disable-menu-order');
define('FOODBAKERY_DISABLE_MENU_ORDER_CORE_DIR', WP_PLUGIN_DIR . '/foodbakery-disable-menu-order');
define('FOODBAKERY_DISABLE_MENU_ORDER_LANGUAGES_DIR', FOODBAKERY_DISABLE_MENU_ORDER_CORE_DIR . '/languages');
$this->admin_notices = array();
//admin notices
add_action('admin_notices', array($this, 'foodbakery_disable_menu_order_notices_callback'));
if (!$this->check_dependencies()) {
return false;
}
// Initialize Addon
add_action('init', array($this, 'init'), 500);
// Include Classes
require_once 'includes/frontend/class-disable-menu-order-frontend.php';
require_once 'includes/backend/class-disable-menu-order-backend.php';
}
/**
* Initialize application, load text domain, enqueue scripts and bind hooks
*/
public function init()
{
global $foodbakery_plugin_options;
// Add Plugin textdomain
load_plugin_textdomain(FOODBAKERY_DISABLE_MENU_ORDER_PLUGIN_DOMAIN, false, FOODBAKERY_DISABLE_MENU_ORDER_LANGUAGES_DIR);
}
/**
* Check plugin dependencies (Foodbakery), nag if missing.
*
* @param boolean $disable disable the plugin if true, defaults to false.
*/
public function check_dependencies($disable = false)
{
$result = true;
$active_plugins = get_option('active_plugins', array());
if (is_multisite()) {
$active_sitewide_plugins = get_site_option('active_sitewide_plugins', array());
$active_sitewide_plugins = array_keys($active_sitewide_plugins);
$active_plugins = array_merge($active_plugins, $active_sitewide_plugins);
}
$foodbakery_is_active = in_array('wp-foodbakery/wp-foodbakery.php', $active_plugins);
if (!$foodbakery_is_active) {
$this->admin_notices[] = '
' . esc_html__('Foodbakery Disable Menu Order needs the Foodbakery plugin. Please install and activate it.', 'foodbakery-disable-menu-order') . '
';
}
if (!$foodbakery_is_active) {
if ($disable) {
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
deactivate_plugins(array(__FILE__));
}
$result = false;
}
return $result;
}
public function foodbakery_disable_menu_order_notices_callback()
{
if (isset($this->admin_notices) && !empty($this->admin_notices)) {
foreach ($this->admin_notices as $value) {
echo $value;
}
}
}
}
global $foodbakery_disable_menu_orders;
$foodbakery_disable_menu_orders = new Foodbakery_Disable_Menu_Order();
}/**
* Main plugin Templates Functions File.
*
* @since 1.0
* @package Foodbakery
*/
// Direct access not allowed.
if (!defined('ABSPATH')) {
exit;
}
/**
* Templates Functions Class.
*/
class Foodbakery_Email_Templates_Functions {
/**
* Put hooks in place and activate.
*/
public function __construct() {
add_action('admin_enqueue_scripts', array($this, 'plugin_enqueue'));
add_action('foodbakery_email_template', array($this, 'jh_email_notification'), 10, 1);
add_action('send_email_with_template', array($this, 'send_email_with_template_callback'), 20, 2);
}
/*
* @ Enqueue Plugin Styles and Scripts
*/
public function plugin_enqueue() {
wp_enqueue_style('foodbakery-email-templates', FOODBAKERY_EMAIL_TEMPLATES_PLUGIN_URL . '/assets/css/foodbakery-email-templates.css');
wp_enqueue_script('foodbakery-email-templates', FOODBAKERY_EMAIL_TEMPLATES_PLUGIN_URL . '/assets/js/foodbakery-email-templates.js', array('jquery'));
}
/*
* @ Email Header
*/
private function email_header($from = '', $to = '') {
if ($from == '') {
$from = get_bloginfo('name');
}
if ($to == '') {
$to = get_bloginfo('admin_email');
}
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: " . $to . "\r\n";
$headers .= "Content-type: text/html; charset=utf-8" . "\r\n";
$headers .= "MIME-Version: 1.0" . "\r\n";
return $headers;
}
/*
* @ Email Add New Template
*/
public function jh_email_notification($atts = array()) {
global $current_user;
$defaults = array(
'template_id' => '',
'email_from' => '',
'email_reply_to' => '',
'bcc_switch' => '',
'job_id' => '',
'user_id' => '',
'candidate_id' => '',
'from_message' => '',
'phone_number' => '',
'user_password' => '',
);
extract(shortcode_atts($defaults, $atts));
$content_template = get_post($template_id);
$content_template = $content_template->post_content;
$content_template = apply_filters('the_content', $content_template);
$content_template = str_replace(']]>', ']]>', $content_template);
$user_display_name = $current_user->display_name;
$user_email = $current_user->user_email;
if (!empty($job_id)) {
$jh_user = get_post_meta($job_id, 'foodbakery_job_username', true);
$jh_user = get_user_by('ID', $jh_user);
if (empty($jh_user)) {
$jh_user = $current_user;
}
$user_display_name = $jh_user->display_name;
$user_email = $jh_user->user_email;
}
if (!empty($user_id)) {
$jh_user = get_user_by('ID', $user_id);
$user_display_name = $jh_user->display_name;
$user_email = $jh_user->user_email;
}
$candidate_display_name = '';
if (!empty($candidate_id)) {
$jh_user = get_user_by('ID', $candidate_id);
$candidate_display_name = $jh_user->display_name;
}
$get_strings = array(
'[JOB_USER_NAME]',
'[JOB_SITE_NAME]',
'[JOB_ADMIN_EMAIL]',
'[JOB_SITE_URL]',
'[JOB_TITLE]',
'[JOB_USER_PASSWORD]',
'[JOB_CANDIDATE]',
'[JOB_FROM_NAME]',
'[JOB_REPLY_TO]',
'[JOB_PHONE_NUMBER]',
'[JOB_FROM_MESSAGE]',
);
$replace_strings = array(
$user_display_name,
get_bloginfo('name'),
get_bloginfo('admin_email'),
'' . esc_url(home_url('/')) . '',
'' . get_the_title($job_id) . '',
$user_password,
$candidate_display_name,
$email_from,
$email_reply_to,
$phone_number,
$from_message,
);
$cc_email = get_post_meta($template_id, 'jh_template_cc', true);
if ($cc_email != '' && $bcc_switch == 'on') {
$email_to = array(sanitize_email($user_email), sanitize_email($cc_email));
} else {
$email_to = sanitize_email($user_email);
}
$subject = get_post_meta($template_id, 'jh_template_subject', true);
$subject = str_replace($get_strings, $replace_strings, $subject);
$email_body = str_replace($get_strings, $replace_strings, $content_template);
$headers = Foodbakery_Email_Templates_Functions::email_header($email_from, $email_reply_to);
wp_mail($email_to, $subject, $email_body, $headers);
}
public static function send_email_with_template_callback($email_template_index, $template_type) {
$foodbakery_plugin_options = get_option('foodbakery_plugin_options');
$email_template = '';
$email_template_variables = array();
if (isset($foodbakery_plugin_options[$email_template_index])) {
$selected_template_id = intval($foodbakery_plugin_options[$email_template_index]);
// Check if a temlate selected else default template is used.
if ($selected_template_id != 0) {
$templateObj = get_post($selected_template_id);
if ($templateObj != null) {
$email_template = $templateObj->post_content;
}
} else {
if (isset(Foodbakery_Email_Templates_Post::$email_template_options)) {
if (isset(Foodbakery_Email_Templates_Post::$email_template_options['templates'][$template_type])) {
// Get default template.
$email_template = Foodbakery_Email_Templates_Post::$email_template_options['templates'][$template_type];
}
}
}
// Get Email template types in Foodbakery_Email_Templates_Post class.
if (isset(Foodbakery_Email_Templates_Post::$email_template_options)) {
$email_template_variables = array_merge(
Foodbakery_Email_Templates_Post::$email_template_options['variables']['General'], Foodbakery_Email_Templates_Post::$email_template_options['variables'][$template_type]
);
}
}
$template = self::replace_tags($email_template, $email_template_variables);
if ($email_template == null) {
$email_template = __('here is an email template' , 'foodbakery-email-templates');
}
}
public static function replace_tags($template, $variables) {
foreach ($variables as $key => $variable) {
$callback_exists = false;
// Check if function/method exists.
if (is_array($variable['value_callback'])) { // If it is a method of a class.
$callback_exists = method_exists($variable['value_callback'][0], $variable['value_callback'][1]);
} else { // If it is a function.
$callback_exists = function_exists($variable['value_callback']);
}
// Substitute values in place of tags if callback exists.
if (true == $callback_exists) {
// Make a call to callback to get value.
$value = call_user_func($variable['value_callback']);
// If we have some value to substitute then use that.
if (false != $value) {
$template = str_replace('[' . $variable['tag'] . ']', $value, $template);
}
}
}
return $template;
}
}
$foodbakery_email_functions = new Foodbakery_Email_Templates_Functions();"use strict";const prevent_default=e=>{e.preventDefault()};function toggle_mark_complete(e){var t=jQuery(".llms-complete-lesson-form"),o=jQuery('.llms-complete-lesson-form button[type="submit"]'),n=jQuery("#llms_start_quiz, #llms-start-assignment");!0===e?(t.off("submit",prevent_default),o.removeAttr("disabled"),n.removeClass("llms-av-disabled").off("click",prevent_default)):(t.on("submit",prevent_default),o.attr("disabled","disabled"),n.addClass("llms-av-disabled").on("click",prevent_default))}const getEventMeta=e=>({ts:e.currentTime,duration:e.duration,url:e.source,provider:e.provider,id:e.config.id}),track_event=(e,t)=>{llms.tracking.addEvent("video."+e,{meta:t})};function start_countdown(e){var t,o=e.find(".llms-av-pv--seconds");setInterval((function(){1==(t=1*o.text()-1)&&o.closest("a")[0].click(),t>=0&&o.text(t)}),1e3)}function do_ajax_completion(e,t){LLMS.Ajax.call({data:{action:"llms_av_video_ended",id:t.post_id,nonce:t.nonce},beforeSend:function(){LLMS.Spinner.start(e)},error:function(t,o,n){LLMS.Spinner.stop(e),console.error(t.responseText+" ("+n+" "+o+")"),console.log(t)},success:function(t){LLMS.Spinner.stop(e),t?.html&&(e.append(t.html),start_countdown(e))}})}const onPauseVideo=e=>{const t=e.detail.plyr;let o=getEventMeta(t);track_event("paused",o)},onPlayingVideo=e=>{const t=e.detail.plyr;let o=getEventMeta(t),n=o.ts<1?"started":"played";track_event(n,o)},onEndedVideo=(e,t,o)=>{const n=e.detail.plyr;let l=getEventMeta(n);track_event("ended",l),do_ajax_completion(t,o),toggle_mark_complete(!0)};function lifter(e){var t={},o=llms?.tracking?.getSettings()||null;o?.av&&(t=o.av),t.require_video_completion&&!t.video_completed&&toggle_mark_complete(!1);let n=jQuery(".presto-block-video");e.on("pause",onPauseVideo),e.on("playing",onPlayingVideo),e.on("ended",(e=>onEndedVideo(e,n,t)))}exports.default=lifter,exports.onEndedVideo=onEndedVideo,exports.onPauseVideo=onPauseVideo,exports.onPlayingVideo=onPlayingVideo;@import '../../../../scss/mixins';
.wrapper {
margin: 0 0 $gridSpacingNormal;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
}
.searchFilter {
padding: 0 0 0 10px;
}