} function mw_print_stats_on_dashboard() { $active = url_param('view'); $cls = ''; if ($active == 'shop') { // $cls = ' class="active" '; } print ' <module type="site_stats/admin" subtype="graph" /> <module type="site_stats/admin" />'; //print '<microweber module="site_stats" view="admin" />'; } event_bind('frontend', function ($params = false) { if (!defined('MW_API_CALL')) { if (defined('MW_FRONTEND') and !isset($_REQUEST['isolate_content_field'])) { mw_stats_track_visit(); mw_stats_track_pageview(); } } }); function mw_stats_track_pageview() { if (!get_option('track_pageviews', 'stats')) { return; } if (defined('CONTENT_ID') and CONTENT_ID != 0) { $visit_date = date("Y-m-d H:i:s"); $existing = DB::table('stats_pageviews')->where('page_id', CONTENT_ID)->take(1)->pluck('id'); if ($existing) { $track = array('updated_at' => $visit_date); if (defined('MAIN_PAGE_ID')) { $track['main_page_id'] = MAIN_PAGE_ID;
unset($params['powered_by_link']); } $params = json_encode($params); return file_put_contents($file, $params); } function get_white_label_config() { $file = MW_WHITE_LABEL_SETTINGS_FILE; if (is_file($file)) { $cont = file_get_contents($file); $params = json_decode($cont, true); return $params; } } event_bind('mw_frontend', 'make_white_label'); event_bind('mw_backend', 'make_white_label'); function make_white_label() { $settings = get_white_label_config(); if (isset($settings['logo_admin']) and trim($settings['logo_admin']) != '') { $logo_admin = $settings['logo_admin']; mw()->ui->admin_logo = $logo_admin; } if (isset($settings['logo_live_edit']) and trim($settings['logo_live_edit']) != '') { $logo_live_edit = $settings['logo_live_edit']; mw()->ui->logo_live_edit = $logo_live_edit; } if (isset($settings['logo_login']) and trim($settings['logo_login']) != '') { $logo_login = $settings['logo_login']; mw()->ui->admin_logo_login = $logo_login; }
<?php event_bind('mw_admin_settings_menu', 'mw_print_admin_updates_settings_link'); function mw_print_admin_updates_settings_link() { $active = url_param('view'); $cls = ''; if ($active == 'comments') { $cls = ' class="active" '; } $notif_html = ''; $mname = module_name_encode('updates'); print "<li><a class=\"item-" . $mname . "\" href=\"#option_group=" . $mname . "\">" . _e("Updates", true) . "</a></li>"; //$notif_count = mw()->notifications_manager->get('module=comments&is_read=0&count=1'); /*if ($notif_count > 0) { $notif_html = '<sup class="mw-notif-bubble">' . $notif_count . '</sup>'; }*/ //print '<li' . $cls . '><a href="' . admin_url() . 'view:comments"><span class="ico icomment">' . $notif_html . '</span><span>Comments</span></a></li>'; }
mw()->ui->module('admin.dashboard.menu', $admin_dashboard_btn); } event_bind('mw_edit_product_admin', function ($data) { if (isset($data['id'])) { if (get_option('shop_disabled', 'website') == 'y') { return; } print '<module type="shop/products/product_options" content-id="' . $data['id'] . '" />'; } }); event_bind('module.content.edit.main', function ($data) { if (isset($data['id']) and isset($data['content_type']) and $data['content_type'] == 'product') { $data['prices'] = mw()->fields_manager->get("field_type=price&for=content&for_id=" . $data['id']); if ($data['prices'] == false) { $create_price_field = mw()->fields_manager->save("field_value=0&field_type=price&for=content&for_id=" . $data['id']); $data['prices'] = mw()->fields_manager->get("field_type=price&for=content&for_id=" . $data['id']); } $btn = array(); $btn['title'] = _e("Price", true); $btn['html'] = ' <module type="custom_fields" template="shop/products/edit_price" content_id="' . $data['id'] . '" />'; // $btn['class'] = 'mw-icon-product'; mw()->modules->ui('content.edit.title.after', $btn); } }); event_bind('mw.user.login', function ($data) { if (is_array($data) and isset($data['old_sid'])) { $cur_sid = mw()->user_manager->session_id(); Cart::where('session_id', $data['old_sid'])->update(array('session_id' => $cur_sid)); mw()->cache_manager->delete('cart'); } });
<?php function mw_hl_code_css() { template_head('//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/styles/github.min.css'); template_head('//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/highlight.min.js'); template_head("\n\t\t\t<script>\n\t\t\t\n\t\t\t\$(document).ready(function() {\n\t\t\t \$('.highlight_code_module > pre code').each(function(i, block) {\n\t\t\t\thljs.highlightBlock(block);\n\t\t\t });\n\t\t\t});\n\t\t\n\t\t\n\t\t</script>\n\t\t"); /*template_head('<script>hljs.initHighlightingOnLoad()</script>');*/ } event_bind("mw_frontend", function ($params = false) { return mw_hl_code_css($params); });
if (isset($data['id'])) { if (get_option('shop_disabled', 'website') == 'y') { return; } print '<module type="shop/products/product_options" content-id="' . $data['id'] . '" />'; } }); event_bind('module.content.edit.main', function ($data) { if (isset($data['id']) and isset($data['content_type']) and $data['content_type'] == 'product') { $data['prices'] = mw()->fields_manager->get("field_type=price&for=content&for_id=" . $data['id']); if ($data['prices'] == false) { $create_price_field = mw()->fields_manager->save("field_value=0&field_type=price&for=content&for_id=" . $data['id']); $data['prices'] = mw()->fields_manager->get("field_type=price&for=content&for_id=" . $data['id']); } $btn = array(); $btn['title'] = _e("Price", true); $btn['html'] = ' <module type="custom_fields" template="shop/products/edit_price" content_id="' . $data['id'] . '" />'; $btn['class'] = 'titlepricecolumn'; mw()->modules->ui('content.edit.title.after', $btn); } }); event_bind('mw.user.login', function ($data) { if (is_array($data) and isset($data['old_sid'])) { $cur_sid = mw()->user_manager->session_id(); Cart::where('session_id', $data['old_sid'])->update(array('session_id' => $cur_sid)); mw()->cache_manager->delete('cart'); } }); event_bind('recover_shopping_cart', function ($params = false) { return mw()->cart_manager->recover_cart($params); });
<?php /** * * Settings module api * * @package modules * @subpackage settings * @since Version 0.1 */ // ------------------------------------------------------------------------ event_bind('admin_header_menu', 'mw_print_admin_menu_settings_btn'); function mw_print_admin_menu_settings_btn() { $active = mw()->url_manager->param('view'); $cls = ''; if ($active == 'settings') { $cls = ' class="active" '; } print '<li' . $cls . '><a href="' . admin_url() . 'view:settings" title="' . _e("Settings", true) . '"><i class="ico inavsettings"></i><span>' . _e("Settings", true) . '</span></a></li>'; }
if (!is_array($params)) { $template_name = $params; } else { extract($params); } if (!isset($template_name)) { exit; } $template_name = str_replace('..', '', $template_name); if (defined('TEMPLATE_NAME') == false) { define('TEMPLATE_NAME', $template_name); } $custom_fn = TEMPLATES_DIR . $template_name; // d( $custom_fn); if (is_dir($custom_fn)) { $custom_fn = $custom_fn . DS . 'global_styles.php'; $custom_fn = normalize_path($custom_fn, false); if (is_file($custom_fn)) { header("Content-type: text/css", true); include $custom_fn; exit; } //d( $custom_fn); } } event_bind('mw_after_editor_toolbar', 'global_styles_editor_btn_insert'); function global_styles_editor_btn_insert() { //print ''; print '<module type="editor/global_styles" view="editor" id="mw-editor-global-styles-btn" />'; }
} $link = "<a class='comments-bubble' href='{$comments_link}' title='{$new}'>"; $link .= "<span class='mw-icon-comment'></span><span class='comment-number'>{$new}</span>"; $link .= "</a>"; print $link; } }); event_bind('module.content.edit.main', function ($item) { if (isset($item['id'])) { $new = get_comments('count=1&rel_type=content&rel_id=' . $item['id']); if ($new > 0) { $btn = array(); $btn['title'] = 'Comments'; $btn['class'] = 'mw-icon-comment'; $btn['html'] = '<module type="comments/comments_for_post" no_post_head="true" content_id=' . $item['id'] . ' />'; mw()->modules->ui('content.edit.tabs', $btn); } } }); event_bind('mw.admin.dashboard.links', function () { $admin_dashboard_btn = array(); $admin_dashboard_btn['view'] = 'comments'; $admin_dashboard_btn['icon_class'] = 'mw-icon-comment'; $notif_html = ''; $notif_count = mw()->notifications_manager->get('module=comments&is_read=0&count=1'); if ($notif_count > 0) { $notif_html = '<sup class="mw-notification-count">' . $notif_count . '</sup>'; } $admin_dashboard_btn['text'] = _e("Comments", true) . $notif_html; mw()->ui->module('admin.dashboard.menu', $admin_dashboard_btn); });
{ print '<microweber module="site_stats" view="admin" data-subtype="quick" data-user-sid="' . $sid . '" />'; } function mw_print_stats_on_dashboard() { $active = url_param('view'); $cls = ''; if ($active == 'shop') { // $cls = ' class="active" '; } print ' <module type="site_stats/admin" subtype="graph" /> <module type="site_stats/admin" />'; //print '<microweber module="site_stats" view="admin" />'; } event_bind('frontend', function ($params = false) { return stats_append_image($params); }); function stats_append_image($layout = false) { if (defined('MW_API_CALL')) { return true; } if (defined('MW_FRONTEND') and !isset($_REQUEST['isolate_content_field'])) { stats_insert(); } } api_expose('stats_image'); function stats_image() { stats_insert(); // $f = dirname(__FILE__);