Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor contacts image code to allow sender country flags to be impl…
…emented within it
- Loading branch information
Showing
12 changed files
with
188 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* Copyright 2013 Horde LLC (http://www.horde.org/) | ||
* | ||
* See the enclosed file COPYING for license information (GPL). If you | ||
* did not receive this file, see http://www.horde.org/licenses/gpl. | ||
* | ||
* @category Horde | ||
* @copyright 2013 Horde LLC | ||
* @license http://www.fsf.org/copyleft/gpl.html GPL | ||
* @package IMP | ||
*/ | ||
|
||
/** | ||
* Interface for a contact avatar image backend. | ||
* | ||
* @author Michael Slusarz <slusarz@horde.org> | ||
* @category Horde | ||
* @copyright 2013 Horde LLC | ||
* @license http://www.horde.org/licenses/gpl GPL | ||
* @package IMP | ||
*/ | ||
interface IMP_Contacts_Avatar_Backend | ||
{ | ||
/** | ||
* URL of the contact avatar image. | ||
* | ||
* @param string $email An email address. | ||
* | ||
* @return array See IMP_Contacts_Image#getImage(). | ||
*/ | ||
public function avatarImg($email); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* Copyright 2013 Horde LLC (http://www.horde.org/) | ||
* | ||
* See the enclosed file COPYING for license information (GPL). If you | ||
* did not receive this file, see http://www.horde.org/licenses/gpl. | ||
* | ||
* @category Horde | ||
* @copyright 2013 Horde LLC | ||
* @license http://www.fsf.org/copyleft/gpl.html GPL | ||
* @package IMP | ||
*/ | ||
|
||
/** | ||
* Interface for a contacts flag image backend. | ||
* | ||
* @author Michael Slusarz <slusarz@horde.org> | ||
* @category Horde | ||
* @copyright 2013 Horde LLC | ||
* @license http://www.horde.org/licenses/gpl GPL | ||
* @package IMP | ||
*/ | ||
interface IMP_Contacts_Flag_Backend | ||
{ | ||
/** | ||
* URL of the contact flag image. | ||
* | ||
* @param string $email An email address. | ||
* | ||
* @return array See IMP_Contacts_Image#getImage(). | ||
*/ | ||
public function flagImg($email); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Copyright 2013 Horde LLC (http://www.horde.org/) | ||
* | ||
* See the enclosed file COPYING for license information (GPL). If you | ||
* did not receive this file, see http://www.horde.org/licenses/gpl. | ||
* | ||
* @category Horde | ||
* @copyright 2013 Horde LLC | ||
* @license http://www.fsf.org/copyleft/gpl.html GPL | ||
* @package IMP | ||
*/ | ||
|
||
/** | ||
* Interface for a contacts flag image backend based on the sending host. | ||
* | ||
* @author Michael Slusarz <slusarz@horde.org> | ||
* @category Horde | ||
* @copyright 2013 Horde LLC | ||
* @license http://www.horde.org/licenses/gpl GPL | ||
* @package IMP | ||
*/ | ||
class IMP_Contacts_Flag_Host implements IMP_Contacts_Flag_Backend | ||
{ | ||
/** | ||
*/ | ||
public function flagImg($email) | ||
{ | ||
$addr = new Horde_Mail_Rfc822_Address($email); | ||
if ($flag = Horde_Core_Ui_FlagImage::getFlagImageObByHost($addr->host)) { | ||
return array( | ||
'desc' => $flag['name'], | ||
'url' => $flag['ob']->base64img | ||
); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
} |
Oops, something went wrong.