save() public method

public save ( array $Data, boolean $Settings = false ) : boolean
$Data array
$Settings boolean
return boolean
Example #1
0
 /**
  * Create the structure in the database.
  */
 public function structure()
 {
     // Make sure we have the OAuth2 provider.
     $provider = $this->provider();
     if (!val('AuthenticationKey', $provider)) {
         $model = new Gdn_AuthenticationProviderModel();
         $provider = ['AuthenticationKey' => $this->providerKey, 'AuthenticationSchemeAlias' => $this->providerKey, 'Name' => $this->providerKey, 'AcceptedScope' => 'profile', 'ProfileKeyEmail' => 'email', 'ProfileKeyPhoto' => 'picture', 'ProfileKeyName' => 'displayname', 'ProfileKeyFullName' => 'name', 'ProfileKeyUniqueID' => 'user_id'];
         $model->save($provider);
     }
 }
 /**
  *
  *
  * @param $Sender
  * @param $Args
  */
 public function socialController_googlePlus_create($Sender, $Args)
 {
     $Sender->permission('Garden.Settings.Manage');
     $Conf = new ConfigurationModule($Sender);
     $Conf->initialize(array('Plugins.GooglePlus.ClientID' => array('LabelCode' => 'Client ID'), 'Plugins.GooglePlus.Secret' => array('LabelCode' => 'Client secret'), 'Plugins.GooglePlus.SocialReactions' => array('Control' => 'checkbox', 'Default' => true), 'Plugins.GooglePlus.SocialSharing' => array('Control' => 'checkbox', 'Default' => true), 'Plugins.GooglePlus.UseAvatars' => array('Control' => 'checkbox', 'Default' => true), 'Plugins.GooglePlus.Default' => array('Control' => 'checkbox', 'LabelCode' => 'Make this connection your default signin method.')));
     if (Gdn::request()->isAuthenticatedPostBack()) {
         $Model = new Gdn_AuthenticationProviderModel();
         $Model->save(array('AuthenticationKey' => self::ProviderKey, 'IsDefault' => c('Plugins.GooglePlus.Default')));
     }
     $Sender->addSideMenu('dashboard/social');
     $Sender->setData('Title', sprintf(t('%s Settings'), 'Google+'));
     $Sender->ConfigurationModule = $Conf;
     $Sender->render('Settings', '', 'plugins/GooglePlus');
 }