PHP Classes

File: aksara/Modules/Blogs/Views/read.php

Recommend this page to a friend!
  Classes of Aby Dahana  >  Aksara  >  aksara/Modules/Blogs/Views/read.php  >  Download  
File: aksara/Modules/Blogs/Views/read.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Aksara
A CodeIgniter based API and CRUD generator
Author: By
Last change: Update security patch for module and theme import
Initial commit for update 4.2.8

- Add the capability to get nearest features when using OpenLayers;
- Refine the core module views.
Initial commit for update 4.2.8

Change the phrase
Initial commit for update version 4.2.8

1. \aksara\Laboratory\Core.php: assign the method of "parent_module" related to view template and permission, add the option parameter for "set_title" to set the individual title for current action (index, create, read, update), improve the autocomplete function;

2. \aksara\Laboratory\Model.php: add the method to get error message, throwing an error message than error exception;

3. \aksara\Laboratory\Permission.php: change the thrown error method when validate AJAX request;

4. \aksara\Laboratory\Template.php: correct the view path finder of sub-modules;

5. Change the template of core modules;

6. Add the reverse geocoding for openlayers when updating the layer feature;

7. Minor updates for core plugins.
Revert "Initial commit for updat 4.2.8"

This reverts commit 5d2eaabba9d42ad8dc108eaf4303b2d58a50a735.
Initial commit for update 3.2.8

1. \aksara\Laboratory\Core.php: assign the method of "parent_module" related to view template and permission, add the option parameter for "set_title" to set the individual title for current action (index, create, read, update), improve the autocomplete function;

2. \aksara\Laboratory\Model.php: add the method to get error message, throwing an error message than error exception;

3. \aksara\Laboratory\Permission.php: change the thrown error method when validate AJAX request;

4. \aksara\Laboratory\Template.php: correct the view path finder of sub-modules;

5. Change the template of core modules;

6. Add the reverse geocoding for openlayers when updating the layer feature;

7. Minor updates for core plugins.
Revert "Revert "Revert "Initial commit for updat 4.2.8"""

This reverts commit 73226fbaf324b253ed2c3888e8eabd81ca8ef946.
Revert "Revert "Initial commit for updat 4.2.8""

This reverts commit 94a714c958f637d932a6bea4bb15a884ddef733e.
Revert "Initial commit for updat 4.2.8"

This reverts commit 5d2eaabba9d42ad8dc108eaf4303b2d58a50a735.
Revert "Revert "Initial commit for updat 4.2.8""

This reverts commit 91ca274f4924f2ba97344ab5d80cb64f6a1a1274.
Revert "Initial commit for updat 4.2.8"

This reverts commit 5d2eaabba9d42ad8dc108eaf4303b2d58a50a735.
Initial commit for updat 4.2.8

1. \aksara\Laboratory\Core.php: assign the method of "parent_module" related to view template and permission, add the option parameter for "set_title" to set the individual title for current action (index, create, read, update), improve the autocomplete function;

2. \aksara\Laboratory\Model.php: add the method to get error message, throwing an error message than error exception;

3. \aksara\Laboratory\Permission.php: change the thrown error method when validate AJAX request;

4. \aksara\Laboratory\Template.php: correct the view path finder of sub-module;

5. Change the template of core module;

6. Add the reverse geocoding for openlayers when updating the layer feature;

7. Minor update for core plugins.
Date: 5 days ago
Size: 6,365 bytes
 

Contents

Class file image Download
<div class="jumbotron jumbotron-fluid leading relative" style="background:url(<?php echo get_image('blogs', (isset($results[0]->featured_image) ? $results[0]->featured_image : 'placeholder.png')); ?>) center center no-repeat; background-size:cover">
    <div class="clip gradient-top"></div>
    <div class="container pt-5 pb-5">
        <div class="row">
            <div class="col-md-8 offset-md-2">
                <h1 class="text-center text-light">
                    <?php echo $meta->title; ?>
</h1>
                <p class="lead text-center text-light mb-5">
                    <?php echo $meta->description; ?>
</p>
            </div>
        </div>
    </div>
</div>

<div class="container">
    <div class="row">
        <div class="col-md-8 pt-3 pb-3">
            <?php
                $output
= null;
               
                if(
$results)
                {
                    foreach(
$results as $key => $val)
                    {
                       
$item_tags = explode(',', $val->post_tags);
                       
$tags = null;
                       
                        if(
sizeof($item_tags) > 0)
                        {
                            foreach(
$item_tags as $label => $badge)
                            {
                                if(!
$badge) continue;
                               
                               
$tags .= '
                                    <a href="'
. go_to('../tags', array('q' => trim($badge))) . '" class="--xhr">
                                        <span class="badge badge-secondary">
                                            '
. trim($badge) . '
                                        </span>
                                    </a>
                                '
;
                            }
                        }
                       
                       
$output .= '
                            <div class="mt-5 mb-5 text-break-word">
                                '
. str_replace('MsoNormalTable', 'table table-bordered', preg_replace('/(width|height)="\d*"\s/', '', preg_replace('~<p[^>]*>~', '<p class="text-justify article text-break-word">', preg_replace('/style[^>]*/', '', $val->post_content)))) . '
                            </div>
                            <p class="mb-5">
                                '
. $tags . '
                            </p>
                           
                            '
. load_comment_plugin(current_page()) . '
                        '
;
                    }
                }
               
                if(
$output)
                {
                   
/* show author */
                   
echo '
                        <div class="row">
                            <div class="col-sm-6 col-md-8 mb-3">
                                <div class="row no-gutters">
                                    <div class="col-2 col-sm-1">
                                        <a href="'
. base_url('user/' . $results[0]->username) . '" class="--xhr">
                                            <img src="'
. get_image('users', $results[0]->photo, 'thumb') . '" class="img-fluid rounded-circle" />
                                        </a>
                                    </div>
                                    <div class="col-10 col-sm-11 pl-3">
                                        <a href="'
. base_url('user/' . $results[0]->username) . '" class="--xhr">
                                            <h6 class="mb-0">
                                                '
. $results[0]->first_name . ' ' . $results[0]->last_name . '
                                            </h6>
                                        </a>
                                        <p>
                                            <span class="text-sm text-muted" data-toggle="tooltip" title="'
. $results[0]->updated_timestamp . '">
                                                '
. time_ago($results[0]->updated_timestamp) . '
                                            </span>
                                        </p>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 col-md-4 mb-3">
                                <div class="btn-group d-flex">
                                    <a href="//www.facebook.com/sharer/sharer.php?u='
. current_page() . '" class="btn btn-primary" data-toggle="tooltip" title="' . phrase('share_to_facebook') . '" target="_blank">
                                        <i class="mdi mdi-facebook"></i>
                                    </a>
                                    <a href="//www.twitter.com/share?url='
. current_page() . '" class="btn btn-info" data-toggle="tooltip" title="' . phrase('share_to_twitter') . '" target="_blank">
                                        <i class="mdi mdi-twitter"></i>
                                    </a>
                                    <a href="//wa.me/?text='
. current_page() . '" class="btn btn-success" data-toggle="tooltip" title="' . phrase('send_to_whatsapp') . '" target="_blank">
                                        <i class="mdi mdi-whatsapp"></i>
                                    </a>
                                </div>
                            </div>
                        </div>
                    '
;
                   
                   
/* show featured image */
                   
if($results[0]->featured_image)
                    {
                        echo
'<a href="' . get_image('blogs', $results[0]->featured_image) . '" target="_blank"><img id="og-image" src="' . get_image('blogs', $results[0]->featured_image) . '" class="img-fluid rounded-more" width="100%" /></a>';
                    }
                   
                   
/* show post content */
                   
echo preg_replace('/<img src="(.*?)"/i', '<img id="og-image" src="$1" class="img-fluid rounded-more"', $output);
                }
                else
                {
                    echo
'
                        <div class="alert alert-warning">
                            <i class="mdi mdi-alert-outline"></i>
                            '
. phrase('the_post_you_requested_does_not_exist') . '
                        </div>
                    '
;
                }
           
?>
</div>
        <div class="col-md-4 pt-3 pb-3">
            <div class="sticky-top">
                <?php
                   
if($similar)
                    {
                       
$similar_article = null;
                       
                        foreach(
$similar as $key => $val)
                        {
                           
$similar_article .= '
                                <div class="row form-group">
                                    <div class="col-2 col-sm-1 col-md-2 pr-0">
                                        <a href="'
. go_to('../' . $val->category_slug . '/' . $val->post_slug) . '" class="--xhr">
                                            <img src="'
. get_image('blogs', $val->featured_image, 'icon') . '" class="img-fluid rounded" />
                                        </a>
                                    </div>
                                    <div class="col col-sm-11 col-md-10">
                                        <a href="'
. go_to('../' . $val->category_slug . '/' . $val->post_slug) . '" class="--xhr">
                                            <b>
                                                '
. $val->post_title . '
                                            </b>
                                        </a>
                                    </div>
                                </div>
                            '
;
                        }
                       
                        echo
'
                            <div class="mb-5">
                                <h5 class="mb-3">
                                    '
. phrase('similar_articles') . '
                                </h5>
                               
                                '
. $similar_article . '
                            </div>
                        '
;
                    }
                   
                    if(
$categories)
                    {
                       
$similar_category = null;
                       
                        foreach(
$categories as $key => $val)
                        {
                           
$similar_category .= '
                                <div class="row form-group">
                                    <div class="col-2 pr-0">
                                        <a href="'
. go_to('../' . $val->category_slug) . '" class="--xhr">
                                            <img src="'
. get_image('blogs', $val->category_image, 'icon') . '" class="img-fluid rounded" />
                                        </a>
                                    </div>
                                    <div class="col">
                                        <a href="'
. go_to('../' . $val->category_slug) . '" class="--xhr">
                                            <h6>
                                                '
. $val->category_title . '
                                            </h6>
                                            <p class="text-muted mb-0">
                                                '
. number_format($val->total_data) . ' ' . ($val->total_data > 1 ? phrase('articles') : phrase('article')) . '
                                            </p>
                                        </a>
                                    </div>
                                </div>
                            '
;
                        }
                       
                        echo
'
                            <div class="mb-5">
                                <h5 class="mb-3">
                                    '
. phrase('similar_categories') . '
                                </h5>
                               
                                '
. $similar_category . '
                            </div>
                        '
;
                    }
               
?>
</div>
        </div>
    </div>
</div>

For more information send a message to info at phpclasses dot org.