File manager - Edit - /home/newsbmcs.com/public_html/static/img/logo/widgets.php.tar
Back
home/newsbmcs.com/public_html/play1/includes/widgets.php 0000644 00000012270 15027263417 0017420 0 ustar 00 <?php class Widget_HTML extends Widget { function __construct() { $this->name = 'HTML'; $this->id_base = 'html'; $this->description = 'Show HTML / TEXT'; } public function widget( $instance, $args = array() ){ echo $instance['text']; } public function form( $instance = array() ){ if(!isset( $instance['text'] )){ $instance['text'] = ''; } ?> <div class="mb-3"> <label class="form-label">HTML / TEXT:</label> <textarea class="form-control" rows="5" name="text"><?php echo $instance['text'] ?></textarea> </div> <?php } } register_widget( 'Widget_HTML' ); class Widget_Paragraph extends Widget { function __construct() { $this->name = 'Paragraph'; $this->id_base = 'paragraph'; $this->description = 'Show text paragraph (HTML not allowed)'; } public function widget( $instance, $args = array() ){ if(!isset( $instance['text'] )){ $instance['text'] = ''; } if(!isset( $instance['align'] )){ $instance['align'] = 'none'; } $align_class = null; if($instance['align'] != 'none'){ if($instance['align'] == 'left'){ $align_class = 'text-start text-left'; } else if($instance['align'] == 'center'){ $align_class = 'text-center'; } else if($instance['align'] == 'right'){ $align_class = 'text-end text-right'; } } echo '<p'.($align_class ? ' class="' . $align_class . '"' : '').'>'; echo htmlentities(nl2br($instance['text'])); echo '</p>'; } public function form( $instance = array() ){ if(!isset( $instance['text'] )){ $instance['text'] = ''; } if(!isset( $instance['align'] )){ $instance['align'] = 'none'; } ?> <div class="mb-3"> <label class="form-label">TEXT:</label> <textarea class="form-control" rows="5" name="text"><?php echo $instance['text'] ?></textarea> </div> <div class="mb-3"> <label class="form-label"><?php _e('Align') ?>:</label> <select class="form-control" name="align"> <?php $opts = array( 'none' => 'None', 'left' => 'Left', 'center' => 'Center', 'right' => 'Right' ); foreach ($opts as $key => $value) { $selected = ''; if($key == $instance['align']){ $selected = 'selected'; } echo '<option value="'.$key.'" '.$selected.'>'.$value.'</option>'; } ?> </select> </div> <?php } } register_widget( 'Widget_Paragraph' ); class Widget_Heading extends Widget { function __construct() { $this->name = 'Heading'; $this->id_base = 'heading'; $this->description = 'Heading typography, can be used as widget title or label.'; } public function widget( $instance, $args = array() ){ if(!isset( $instance['tag'] )){ $instance['tag'] = 'h3'; } if(!isset( $instance['class'] )){ $instance['class'] = ''; } if(!isset( $instance['text'] )){ $instance['text'] = ''; } echo '<'.$instance['tag'].' class="'.$instance['class'].'">'; echo htmlentities($instance['text']); echo '</'.$instance['tag'].'>'; } public function form( $instance = array() ){ if(!isset( $instance['tag'] )){ $instance['tag'] = 'h3'; } if(!isset( $instance['class'] )){ $instance['class'] = ''; } if(!isset( $instance['text'] )){ $instance['text'] = ''; } ?> <div class="mb-3"> <label class="form-label"><?php _e('Heading tag') ?>:</label> <select class="form-control" name="tag"> <?php $opts = array( 'h1' => 'h1', 'h2' => 'h2', 'h3' => 'h3', 'h4' => 'h4', 'h5' => 'h5', 'div' => 'div', ); foreach ($opts as $key => $value) { $selected = ''; if($key == $instance['tag']){ $selected = 'selected'; } echo '<option value="'.$key.'" '.$selected.'>'.$value.'</option>'; } ?> </select> </div> <div class="mb-3"> <label class="form-label">TEXT:</label> <textarea class="form-control" rows="5" name="text"><?php echo $instance['text'] ?></textarea> </div> <div class="mb-3"> <label class="form-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_Heading' ); class Widget_Banner extends Widget { function __construct() { $this->name = 'Banner Ad'; $this->id_base = 'banner_ad'; $this->description = 'Show banner advertisement'; } public function widget( $instance, $args = array() ){ echo '<div class="banner-ad-wrapper"><div class="banner-ad-content" style="padding: 20px 0; text-align: center;">'; echo $instance['text']; echo '</div></div>'; } public function form( $instance = array() ){ if(!isset( $instance['text'] )){ $instance['text'] = ''; } ?> <p>This widget is similar to HTML widget, the difference is that it comes with a banner div to fit the theme style. You can also style it on theme style.css</p> <div class="mb-3"> <label class="form-label">HTML / TEXT:</label> <textarea class="form-control" rows="5" name="text"><?php echo $instance['text'] ?></textarea> </div> <?php } } register_widget( 'Widget_Banner' ); ?>