File manager - Edit - /home/newsbmcs.com/public_html/static/img/logo/arcade-two.tar
Back
options.php 0000644 00000017241 15027322116 0006754 0 ustar 00 <?php if (!has_admin_access()) { exit; } $allow_mobile_version = get_option('arcade-two-mobile-version'); $allow_mobile_version = is_null($allow_mobile_version) ? true : ($allow_mobile_version === 'true'); if (isset($_POST['action'])) { switch ($_POST['action']) { case 'update-icons-data': file_put_contents(ABSPATH . TEMPLATE_PATH . '/includes/category-icons.json', $_POST['data']); show_alert('SAVED!', 'success'); break; case 'update-allow-mobile': $allow_mobile_version = isset($_POST['mobile-version']); update_option('arcade-two-mobile-version', $allow_mobile_version ? 'true' : 'false'); show_alert('SAVED!', 'success'); break; case 'update-background': update_option('arcade-two-background', $_POST['background']); show_alert('SAVED!', 'success'); break; case 'upload-frame': $targetDir = ABSPATH . TEMPLATE_PATH . '/images/frame/'; // Ensure the directory exists if (!file_exists($targetDir)) { mkdir($targetDir, 0777, true); } $file = $_FILES['frame_file']; if ($file['error'] === UPLOAD_ERR_OK) { $fileName = basename($file['name']); $targetFilePath = $targetDir . $fileName; $fileType = strtolower(pathinfo($targetFilePath, PATHINFO_EXTENSION)); $allowedTypes = ['jpg', 'jpeg', 'png', 'svg']; if (in_array($fileType, $allowedTypes)) { if (move_uploaded_file($file['tmp_name'], $targetFilePath)) { update_option('arcade-two-frame-image', TEMPLATE_PATH . '/images/frame/' . $fileName); show_alert('File uploaded successfully!', 'success'); } else { show_alert('Failed to move the file.', 'danger'); } } else { show_alert('Invalid file type. Allowed types: JPG, JPEG, PNG, SVG.', 'danger'); } } else { show_alert('Upload error code: ' . $file['error'], 'danger'); } break; } } $current_frame_image = get_option('arcade-two-frame-image'); ?> <br> <!-- Frame Upload --> <h4>Frame Upload</h4> <div class="mb-3"> <form method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="upload-frame" /> <div class="form-group"> <label for="frameFile">Upload Frame File:</label> <input type="file" class="form-control" id="frameFile" name="frame_file" accept=".png,.jpg,.jpeg,.svg" required onchange="previewImage(event)"> </div> <div id="preview-container" style="margin-top: 10px;"> <img id="framePreview" src="" alt="Preview" style="display: none; width: 150px; height: 150px; border: 1px solid #ccc;"> </div> <button type="submit" class="btn btn-primary btn-md">Upload</button> </form> </div> <br> <!-- Existing Frame Image --> <!-- <div class="frame-image-container"> <h5>Current Frame Image:</h5> <img src="<?php echo $current_frame_image; ?>" alt="Frame Image" style="width: 150px; height: 150px; border: 1px solid #ccc;"> </div> --> <!-- JavaScript for image preview --> <script> function previewImage(event) { const file = event.target.files[0]; const reader = new FileReader(); reader.onload = function() { const preview = document.getElementById('framePreview'); preview.style.display = 'block'; preview.src = reader.result; }; if (file) { reader.readAsDataURL(file); } } </script> <br> <?php $category_icons = json_decode(file_get_contents(ABSPATH . TEMPLATE_PATH . '/includes/category-icons.json'), true); echo '<h4>'._t('Allow mobile version').'</h4>'; echo '<br>'; echo '<form method="post">'; echo '<input type="hidden" name="action" value="update-allow-mobile"/>'; $checked = ''; if($allow_mobile_version){ $checked = 'checked'; } ?> <div class="form-check"> <input type="checkbox" class="form-check-input" name="mobile-version" id="check1" <?php echo $checked ?>> <label class="form-check-label" for="check1"><?php _e('Allow mobile version') ?></label> </div> <?php echo '<br>'; echo '<button type="submit" class="btn btn-primary btn-md">'._t('SAVE').'</button>'; echo '</form>'; ?> <br> <!-- Background --> <div class="mb-3"> <h4>Background</h4> <form method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="update-background"> <div class="mb-3"> <select class="form-select" name="background"> <?php $bg_list = array( 'Background 1' => 'background1.png', 'Background 2' => 'background2.png', 'None' => '' ); $selected_bg = get_option('arcade-two-background'); if(is_null($selected_bg)){ $selected_bg = reset($bg_list); } foreach ($bg_list as $key => $value) { $selected = ''; if($selected_bg == $value){ $selected = 'selected'; } echo '<option value="'.$value.'" '.$selected.'>'.$key.'</option>'; } ?> </select> </div> <button id="save-background-conf" class="btn btn-primary btn-md">Save</button> </form> </div> <br> <!-- Category --> <div class="mb-3"> <h4>Category Icons</h4> <form method="post" id="form-icons"> <input type="hidden" name="action" value="update-icons-data" /> <input type="hidden" id="data-target" name="data" value="" /> <div class="row"> <div class="col"> <label>ID:</label> </div> <div class="col"> <label>Category Slug (separated by comma):</label> </div> </div> <?php foreach ($category_icons as $key => $value) { ?> <div class="row"> <img src="<?php echo get_template_path(); ?>/images/icon/<?php echo $key; ?>.svg"> <div class="form-group col"> <input type="text" class="form-control t-key" name="val" value="<?php echo $key ?>" readonly required> </div> <div class="form-group col"> <input type="text" class="form-control t-value" name="val" value="<?php echo implode(',', $value); ?>" required> </div> </div> <?php } ?> </form> <button id="save-icon-conf" class="btn btn-primary btn-md">Save</button> </div> <!-- js --> <script type="text/javascript"> $(document).ready(()=>{ $('#save-icon-conf').click(()=>{ if(true){ let res = '{'; let error; let t1 = $('.t-key').serializeArray(); let t2 = $('.t-value').serializeArray(); let total = t1.length; for(let i=0; i<total; i++){ if(t1[i].value && t2[i].value){ res += '"'+t1[i].value+'"'+': '+JSON.stringify(t2[i].value.split(','))+','; } } if(res.slice(-1) === ','){ res = res.slice(0, -1); } res += '}'; let x = JSON.parse(res); if(res != '{}'){ $('#data-target').val(res); $('form#form-icons').submit(); } } }); }); </script> functions.php 0000644 00000031774 15027322116 0007300 0 ustar 00 <?php function list_games($type, $amount, $count = false){ echo '<div class="row gamelist-widget">'; $data = get_game_list($type, $amount, 0, $count); $games = $data['results']; foreach ( $games as $game ) { ?> <div class="col-4 list-grid"> <a href="<?php echo get_permalink('game', $game->slug) ?>"> <div class="list-game"> <div class="list-thumbnail"><img src="<?php echo get_small_thumb($game) ?>" class="small-thumb img-rounded" alt="<?php echo esc_string($game->title) ?>"></div> </div> </a> </div> <?php } echo '</div>'; } function list_games_vertical($type, $amount, $count = false){ echo '<div class="row gamelist-vertical-widget">'; $data = get_game_list($type, $amount, 0, $count); $games = $data['results']; foreach ( $games as $game ) { $_game_title = get_content_title_translation('game', $game->id, $game->title); ?> <div class="list-vertical"> <a href="<?php echo get_permalink('game', $game->slug) ?>"> <div class="col-12 list-game"> <div class="list-thumbnail"><img src="<?php echo get_small_thumb($game) ?>" class="small-thumb img-rounded" alt="<?php echo esc_string($_game_title) ?>"></div> <div class="list-info"> <div class="list-title"><?php echo esc_string($_game_title) ?></div> <div class="list-category"><?php echo str_replace(',', ', ', esc_string($game->category)) ?></div> <div class="list-rating"> <i class="bi bi-star-fill"></i> <?php echo get_rating('5-decimal', $game) ?>/5 </div> </div> </div> </a> </div> <?php } echo '</div>'; } function list_games_by_category($cat, $amount){ echo '<div class="row">'; $data = get_game_list_category($cat, $amount); $games = $data['results']; foreach ( $games as $game ) { ?> <?php include TEMPLATE_PATH . "/includes/grid1.php" ?> <?php } echo '</div>'; } function list_games_by_categories($cat, $amount){ // Deprecated echo '<div class="row">'; $data = get_game_list_categories($cat, $amount); $games = $data['results']; foreach ( $games as $game ) { ?> <?php include TEMPLATE_PATH . "/includes/grid2.php" ?> <?php } echo '</div>'; } function show_user_profile_header(){ global $login_user; if($login_user){ ?> <div class="user-avatar"> <img src="<?php echo get_user_avatar() ?>"> </div> <ul class="user-links hidden"> <li> <strong> <?php echo $login_user->username ?> </strong> <div class="label-xp"><?php echo $login_user->xp ?>xp</div> </li> <hr> <a href="<?php echo get_permalink('user', $login_user->username) ?>"> <li><?php _e('My Profile') ?></li> </a> <a href="<?php echo get_permalink('user', $login_user->username, array('edit' => 'edit')) ?>"> <li><?php _e('Edit Profile') ?></li> </a> <hr> <a href="<?php echo DOMAIN ?>admin.php?action=logout"> <li class="text-danger"><?php _e('Log Out') ?></li> </a> </ul> <?php } } function the_body_background(){ $selected_bg = get_option('arcade-two-background'); if(is_null($selected_bg)){ $selected_bg = 'background1.png'; } if($selected_bg != ''){ // Not "none" $bg_size = ''; if($selected_bg == 'background1.png'){ $bg_size = 'background-size: cover;'; } echo 'style="background: url(\'/content/themes/arcade-two/images/backgrounds/'.$selected_bg.'\'); '.$bg_size.'"'; } } function wgt_list_games_grid($type, $amount){ echo '<div class="row">'; $data = fetch_games_by_type($type, $amount, 0, false); $games = $data['results']; foreach ( $games as $game ) { ?> <div class="col-4 p-0 wgt-list-game-grid list-tile"> <a href="<?php echo get_permalink('game', $game->slug) ?>"> <div class="wgt-list-game"> <div class="wgt-list-thumbnail"><img src="<?php echo get_small_thumb($game) ?>" class="small-thumb" alt="<?php echo esc_string($game->title) ?>"></div> </div> </a> </div> <?php } echo '</div>'; } function wgt_list_games_vertical($type, $amount){ echo '<div class="row">'; $data = fetch_games_by_type($type, $amount, 0, false); $games = $data['results']; foreach ( $games as $game ) { $_game_title = get_content_title_translation('game', $game->id, $game->title); $category = $game->category; $categories = explode(",", $category); foreach ($categories as $key => $cat){ $categories[$key] = _t($cat); } $category = implode(",", $categories); ?> <div class="wgt-list-game-vertical"> <a href="<?php echo get_permalink('game', $game->slug) ?>"> <div class="wgt-list-game"> <div class="col-4 p-0 wgt-list-thumbnail"> <img src="<?php echo get_small_thumb($game) ?>" class="small-thumb" alt="<?php echo esc_string($_game_title) ?>"> </div> <div class="col-8 p-0 wgt-list-content"> <div class="wgt-list-title"><?php echo esc_string($_game_title); ?></div> <div class="wgt-list-category"><?php echo _t(esc_string($category)); ?></div> </div> </div> </a> </div> <?php } echo '</div>'; } register_sidebar(array( 'name' => 'Head', 'id' => 'head', 'description' => 'HTML element before </head>', )); register_sidebar(array( 'name' => 'Header', 'id' => 'header', 'description' => 'Header placement for Header widget', )); register_sidebar(array( 'name' => 'Popup-Ads', 'id' => 'pop-ads', 'description' => 'popup ads', )); register_sidebar(array( 'name' => 'Top Content', 'id' => 'top-content', 'description' => 'Above main content element. Recommended for Ad banner placement.', )); register_sidebar(array( 'name' => 'Center Ads', 'id' => 'center-ads', 'description' => 'Display Ads at top.', )); register_sidebar(array( 'name' => 'Bottom Content', 'id' => 'bottom-content', 'description' => 'Under main content element. Recommended for Ad banner placement.', )); register_sidebar(array( 'name' => 'Sidebar 1', 'id' => 'sidebar-1', 'description' => 'Right sidebar', )); register_sidebar(array( 'name' => 'Footer 1', 'id' => 'footer-1', 'description' => 'Footer 1', )); // register_sidebar(array( // 'name' => 'Footer 2', // 'id' => 'footer-2', // 'description' => 'Footer 2', // )); // register_sidebar(array( // 'name' => 'Footer 3', // 'id' => 'footer-3', // 'description' => 'Footer 3', // )); // register_sidebar(array( // 'name' => 'Footer 4', // 'id' => 'footer-4', // 'description' => 'Footer 4', // )); register_sidebar(array( 'name' => 'Homepage Bottom', 'id' => 'homepage-bottom', 'description' => 'Bottom content on homepage. Can be used to show site description or explaining about your site.', )); register_sidebar(array( 'name' => 'Footer Copyright', 'id' => 'footer-copyright', 'description' => 'Copyright section.', )); class Widget_Game_List extends Widget { function __construct() { $this->name = 'Game List'; $this->id_base = 'game-list'; $this->description = 'Show game list ( Grid ). Is recommended to put this on sidebar.'; } public function widget( $instance, $args = array() ){ $label = isset($instance['label']) ? $instance['label'] : ''; $class = isset($instance['class']) ? $instance['class'] : 'widget'; $type = isset($instance['type']) ? $instance['type'] : 'new'; $amount = isset($instance['amount']) ? $instance['amount'] : 9; $layout = isset($instance['layout']) ? $instance['layout'] : 'grid'; echo '<div class="'.$class.'">'; if($label != ''){ echo '<h4 class="widget-title">'._t($label).'</h4>'; } if($layout == 'grid'){ wgt_list_games_grid($type, (int)$amount); } else if($layout == 'vertical'){ wgt_list_games_vertical($type, (int)$amount); } //list_games($type, (int)$amount); echo '</div>'; } public function form( $instance = array() ){ if(!isset( $instance['label'] )){ $instance['label'] = ''; } if(!isset( $instance['type'] )){ $instance['type'] = 'new'; } if(!isset( $instance['amount'] )){ $instance['amount'] = 9; } if(!isset( $instance['class'] )){ $instance['class'] = 'widget'; } if(!isset( $instance['layout'] )){ $instance['layout'] = 'grid'; // vertical, grid } ?> <div class="form-group"> <label><?php _e('Widget label/title (optional)') ?>:</label> <input type="text" class="form-control" name="label" placeholder="NEW GAMES" value="<?php echo $instance['label'] ?>"> </div> <div class="form-group"> <label><?php _e('Sort game list by') ?>:</label> <select class="form-control" name="type"> <?php $opts = array( 'new' => 'New', 'popular' => 'Popular', 'random' => 'Random', 'likes' => 'Likes', 'trending' => 'Trending' ); foreach ($opts as $key => $value) { $selected = ''; if($key == $instance['type']){ $selected = 'selected'; } echo '<option value="'.$key.'" '.$selected.'>'.$value.'</option>'; } ?> </select> </div> <div class="form-group"> <label><?php _e('Amount') ?>:</label> <input type="number" class="form-control" name="amount" placeholder="9" min="1" value="<?php echo $instance['amount'] ?>"> </div> <div class="mb-3"> <label class="form-label"><?php _e('Layout') ?>:</label> <select name="layout" class="form-control"> <option value="vertical" <?php echo $instance['layout'] == 'vertical' ? 'selected' : '' ?>>Vertical</option> <option value="grid" <?php echo $instance['layout'] == 'grid' ? 'selected' : '' ?>>Grid</option> </select> </div> <div class="form-group"> <label><?php _e('Div class (Optional)') ?>:</label> <input type="text" class="form-control" name="class" placeholder="widget" value="<?php echo $instance['class'] ?>"> </div> <?php } } register_widget( 'Widget_Game_List' ); class Widget_Header extends Widget { function __construct() { $this->name = 'Header'; $this->id_base = 'header'; $this->description = 'Put this widget on Header placement'; } public function widget( $instance, $args = array() ){ $_style = ''; if(isset($instance['bg-img']) && $instance['bg-img'] != ''){ $_style = 'style="background: url('.$instance['bg-img'].'); background-position: center;"'; } //Localization if(_t('_widget_header_title') !== '_widget_header_title'){ // Have a translation $instance['title'] = _t('_widget_header_title'); } if(_t('_widget_header_description') !== '_widget_header_description'){ // Have a translation $instance['content'] = _t('_widget_header_description'); } ?> <section class="section-header"> <div class="container"> <div class="header-area"> <div class="masthead-title"> <h1><?php echo htmlspecialchars($instance['title']) ?></h1> </div> <div class="masthead-description"> <h3><?php echo $instance['content'] ?></h3> </div> </div> </div> </section> <?php } public function form( $instance = array() ){ if(!isset( $instance['title'] )){ $instance['title'] = ''; } if(!isset( $instance['content'] )){ $instance['content'] = ''; } ?> <div class="form-group"> <label>Header Title:</label> <input type="text" class="form-control" name="title" value="<?php echo $instance['title'] ?>"> </div> <div class="form-group"> <label>Description (HTML Allowed):</label> <textarea class="form-control" rows="5" name="content"><?php echo $instance['content'] ?></textarea> </div> <?php } } register_widget( 'Widget_Header' ); class Widget_Category extends Widget { function __construct() { $this->name = 'Categories'; $this->id_base = 'categories'; $this->description = 'Show all categories'; } public function widget( $instance, $args = array() ){ $label = isset($instance['label']) ? $instance['label'] : ''; ?> <div class="widget"> <?php if($label != ''){ echo '<h4 class="widget-title">'.$label.'</h4>'; } ?> <div class="category-wrapper"> <?php global $category_icons; $categories = get_all_categories(); echo '<ul class="category-item">'; foreach ($categories as $cat) { $icon = get_category_icon($cat->slug, $category_icons); $count = Category::getCategoryCount($cat->id); if($count > 0){ echo '<a href="'. get_permalink('category', $cat->slug) .'"><li><span class="icon-category"><img src="'.get_template_path().'/images/icon/'.$icon.'.svg" alt="<?php echo $category_title ?>" width="40" height="40"></span>'. esc_string($cat->name) .'</li></a>'; } } echo '</ul>'; ?> </div> </div> <div class="clearfix"></div> <?php } public function form( $instance = array() ){ if(!isset( $instance['label'] )){ $instance['label'] = ''; } ?> <div class="form-group"> <label><?php _e('Widget label/title (optional)') ?>:</label> <input type="text" class="form-control" name="label" placeholder="Categories" value="<?php echo $instance['label'] ?>"> </div> <?php } } register_widget( 'Widget_Category' ); if(file_exists(ABSPATH . TEMPLATE_PATH . '/includes/custom.php')){ include(ABSPATH . TEMPLATE_PATH . '/includes/custom.php'); } ?>