_check = $icon_check; $this->_theme_dir = $theme_dir; $this->_default_icon = $default; $this->_custom_icons = $custom; // Set default icons $this->_loadStableIcons(); // Merge in additional ones $this->_stable_icons = array_merge($this->_stable_icons, array_column($custom, 'first_icon')); $this->_loadIcons(); } /** * Return the icon specified by idx, or the default icon for invalid names * * @param int|string $idx * @return string */ public function __get($idx) { // Not a standard topic icon if (!isset($this->data[$idx])) { $this->_setUrl($idx); } return $this->data[$idx]; } /** * Load the stable icon array */ protected function _loadStableIcons() { // Setup the default topic icons... $this->_stable_icons = array( 'xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'poll', 'moved', 'recycled', 'wireless', 'clip' ); } /** * This simple function returns the message topic icon array. */ protected function _loadIcons() { // Allow addons to add to the message icon array call_integration_hook('integrate_messageindex_icons', array(&$this->_stable_icons)); $this->data = array(); foreach ($this->_stable_icons as $icon) { $this->_setUrl($icon); } } /** * Set the icon URL location * * @param string $icon */ protected function _setUrl($icon) { global $settings; if ($this->_check) { $this->data[$icon] = $settings[file_exists($this->_theme_dir . '/images/post/' . $icon . '.png') ? self::IMAGE_URL : self::DEFAULT_URL] . '/post/' . $icon . '.png'; } else { $this->data[$icon] = $settings[self::IMAGE_URL] . '/post/' . $icon . '.png'; } } }