Last active
October 17, 2016 22:28
-
-
Save taylordaughtry/9805cf3ee227e834eac3b3d287be460a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <?php | |
| namespace Craft; | |
| class SeoForCraftService extends BaseApplicationComponent | |
| { | |
| /** | |
| * This method is an easy way to get a specific setting. It could be argued | |
| * that storing the settings array in a property on the class would be more | |
| * efficient, but I'm trading that microefficiency for code readability. | |
| * | |
| * @public | |
| * @param {string} $key The key of the setting you'd like to retrieve | |
| * @return {mixed} the value of the key passed | |
| */ | |
| public function getSetting($key) | |
| { | |
| $settings = craft()->plugins->getPlugin('SeoForCraft')->getSettings(); | |
| $val = $settings[$key]; | |
| return $val; | |
| } | |
| /** | |
| * An easy way to save a setting. See the `getSetting` method for info. | |
| * | |
| * @public | |
| * @param {string} $key The key of the setting you'd like to update | |
| * @param {mixed} $value The value of the setting you'd like to update | |
| * @return void | |
| */ | |
| public function saveSetting($key, $value) | |
| { | |
| $pluginInstance = craft()->plugins->getPlugin('SeoForCraft'); | |
| craft()->plugins->savePluginSettings($pluginInstance, array( | |
| $key => $value | |
| )); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment