Use of the shared default cover photo
authorAlexander Ebert <ebert@woltlab.com>
Tue, 19 Mar 2019 12:45:44 +0000 (13:45 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 19 Mar 2019 12:45:44 +0000 (13:45 +0100)
com.woltlab.wcf/templates/articleListItems.tpl
wcfsetup/install/files/lib/data/style/Style.class.php
wcfsetup/install/files/lib/data/user/cover/photo/DefaultUserCoverPhoto.class.php

index 803b37661f4ad66473b80cdad01cb7bde30ac967..695ca9630b16c59bda69d5a09c8d56911850bea2 100644 (file)
@@ -2,7 +2,7 @@
        {foreach from=$objects item='article'}
                <article class="contentItem">
                        <a href="{$article->getLink()}" class="contentItemLink">
-                               <div class="contentItemImage" style="background-image: url({if $article->getImage()}{$article->getImage()->getThumbnailLink('medium')}{else}https://thunderstrike/w/22/images/coverPhotos/default.jpg{/if})">
+                               <div class="contentItemImage" style="background-image: url({if $article->getImage()}{$article->getImage()->getThumbnailLink('medium')}{else}{$__wcf->getStyleHandler()->getStyle()->getCoverPhotoURL()}{/if})">
                                        {hascontent}
                                                <div class="contentItemBadges">
                                                        {content}
index 472ef6ca2d09693f3a3b1aa862cd4263070b0678..d17c7a97f136a95c4b53100c145b34190847777e 100644 (file)
@@ -217,6 +217,7 @@ class Style extends DatabaseObject {
         * Returns the cover photo filename.
         * 
         * @return      string
+        * @since 3.1
         */
        public function getCoverPhoto() {
                if ($this->coverPhotoExtension) {
@@ -226,6 +227,22 @@ class Style extends DatabaseObject {
                return 'default.jpg';
        }
        
+       /**
+        * @return string
+        * @since 5.2
+        */
+       public function getCoverPhotoLocation() {
+               return WCF_DIR . 'images/coverPhotos/' . $this->getCoverPhoto();
+       }
+       
+       /**
+        * @return string
+        * @since 5.2
+        */
+       public function getCoverPhotoUrl() {
+               return WCF::getPath() . 'images/coverPhotos/' . $this->getCoverPhoto();
+       }
+       
        /**
         * Returns the path to a favicon-related file.
         * 
index ffa5852e8738d0ece22e802e68a0f2b11e261ff5..ec314e11e4e97aa0c1210d9926854e41dd4558c2 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 namespace wcf\data\user\cover\photo;
 use wcf\system\style\StyleHandler;
-use wcf\system\WCF;
 
 /**
  * Represents a default cover photo.
@@ -23,14 +22,14 @@ class DefaultUserCoverPhoto implements IUserCoverPhoto {
         * @inheritDoc
         */
        public function getLocation() {
-               return WCF_DIR . 'images/coverPhotos/' . $this->getFilename();
+               return StyleHandler::getInstance()->getStyle()->getCoverPhotoLocation();
        }
        
        /**
         * @inheritDoc
         */
        public function getURL() {
-               return WCF::getPath() . 'images/coverPhotos/' . $this->getFilename();
+               return StyleHandler::getInstance()->getStyle()->getCoverPhotoUrl();
        }
        
        /**