PMA\libraries\Theme::checkImgPath PHP Метод

checkImgPath() публичный Метод

checks image path for existence - if not found use img from fallback theme
public checkImgPath ( ) : boolean
Результат boolean
    public function checkImgPath()
    {
        // try current theme first
        if (is_dir($this->getPath() . '/img/')) {
            $this->setImgPath($this->getPath() . '/img/');
            return true;
        }
        // try fallback theme
        $fallback = './themes/' . ThemeManager::FALLBACK_THEME . '/img/';
        if (is_dir($fallback)) {
            $this->setImgPath($fallback);
            return true;
        }
        // we failed
        trigger_error(sprintf(__('No valid image path for theme %s found!'), $this->getName()), E_USER_ERROR);
        return false;
    }

Usage Example

Пример #1
0
 /**
  * Test for Theme::checkImgPath
  *
  * @return void
  * @expectedException PHPUnit_Framework_Error
  */
 public function testCheckImgPathGlobalsWrongPath()
 {
     $prevThemePath = $GLOBALS['cfg']['ThemePath'];
     $GLOBALS['cfg']['ThemePath'] = 'no_themes';
     $this->object->setPath('/this/is/wrong/path');
     $this->object->checkImgPath();
     $GLOBALS['cfg']['ThemePath'] = $prevThemePath;
 }
All Usage Examples Of PMA\libraries\Theme::checkImgPath