コード例 #1
0
    public function onAction()
    {
        parent::onAction();
        // TODO proper email sending
        $target = $this->plugin->getData('target');
        $actionResp = getApi()->invoke("/action/{$target['id']}/view.json", EpiRoute::httpGet);
        if ($actionResp['code'] !== 200) {
            return;
        }
        $action = $actionResp['result'];
        $email = getConfig()->get('user')->email;
        $subject = 'You got a new comment on your photo';
        if ($action['type'] == 'comment') {
            $body = <<<BODY
{$action['email']} left a comment on your photo.

====
{$action['value']}
====

See the comment here: {$action['permalink']}
BODY;
        } else {
            $body = <<<BODY
{$action['email']} favorited a photo of yours.

See the favorite here: {$action['permalink']}
BODY;
        }
        $headers = "From: Trovebox Robot <*****@*****.**>\r\n" . "Reply-To: no-reply@trovebox.com\r\n" . 'X-Mailer: Trovebox';
        mail($email, $subject, $body, $headers);
    }
コード例 #2
0
ファイル: Plugin.php プロジェクト: zwq/unpei
 public function __get($name)
 {
     $value = parent::__get($name);
     if (!$value && isset($this->info[$name])) {
         return $this->info[$name];
     }
 }
コード例 #3
0
    public function renderFooter()
    {
        parent::renderFooter();
        $conf = $this->getConf();
        return <<<MKP
  <div id="fb-root"></div>
  <script>
    window.fbAsyncInit = function() {
      FB.init({
        appId      : '{$conf->id}', // App ID
        status     : true, // check login status
        cookie     : true, // enable cookies to allow the server to access the session
        oauth      : true, // enable OAuth 2.0
        xfbml      : false  // parse XFBML
      });

      // Additional initialization code here
    };

    (function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId={$conf->id}";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
  </script>
MKP;
    }
コード例 #4
0
ファイル: Submission.php プロジェクト: SAM-IT/ls2-submission
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     $this->subscribe('afterSurveyComplete');
     $this->subscribe('beforeSurveySettings');
     $this->subscribe('newDirectRequest');
 }
コード例 #5
0
ファイル: ShowResponse.php プロジェクト: mfavetti/LimeSurvey
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     /**
      * Here you should handle subscribing to the events your plugin will handle
      */
     $this->subscribe('afterSurveyComplete', 'showTheResponse');
 }
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     $this->subscribe('beforeActivate');
     $this->subscribe('listExportPlugins');
     $this->subscribe('listExportOptions');
     $this->subscribe('newExport');
 }
コード例 #7
0
ファイル: PluginAbstract.php プロジェクト: zwq/unpei
 public function __get($name)
 {
     $value = parent::__get($name);
     if (!$value && $this->plugin->{$name} !== NULL) {
         return $this->plugin->{$name};
     } else {
         return $value;
     }
 }
コード例 #8
0
ファイル: MixpanelPlugin.php プロジェクト: gg1977/frontend
    public function renderHead()
    {
        parent::renderHead();
        $conf = $this->getConf();
        return <<<MKP
<!-- start Mixpanel --><script type="text/javascript">var mpq=[];mpq.push(["init","{$conf->id}"]);(function(){var b,a,e,d,c;b=document.createElement("script");b.type="text/javascript";b.async=true;b.src=(document.location.protocol==="https:"?"https:":"http:")+"//api.mixpanel.com/site_media/js/api/mixpanel.js";a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(b,a);e=function(f){return function(){mpq.push([f].concat(Array.prototype.slice.call(arguments,0)))}};d=["init","track","track_links","track_forms","register","register_once","identify","name_tag","set_config"];for(c=0;c<d.length;c++){mpq[d[c]]=e(d[c])}})();
</script><!-- end Mixpanel -->
MKP;
    }
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     $this->subscribe('beforeSurveySettings');
     $this->subscribe('newSurveySettings');
     //Can call plugin
     $this->subscribe('newDirectRequest');
     // Add js and css
     $this->subscribe('beforeSurveyPage');
 }
コード例 #10
0
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     // Register Event-Listeners Plug-in needs
     $this->subscribe('beforeActivate');
     $this->subscribe('afterAdminMenuLoad');
     $this->subscribe('newDirectRequest');
     $this->subscribe('beforeSurveySettings');
     $this->subscribe('newSurveySettings');
 }
コード例 #11
0
ファイル: ExportR.php プロジェクト: jdbaltazar/survey-office
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     /**
      * Here you should handle subscribing to the events your plugin will handle
      */
     $this->subscribe('listExportPlugins');
     $this->subscribe('listExportOptions');
     $this->subscribe('newExport');
 }
コード例 #12
0
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     /**
      * Subscribes to plugin settings event for each survey (beforeSurveySettings, newSurveySettings)
      * Subscribes to afterSurveyComplete event in order to send email notification
      */
     $this->subscribe('afterSurveyComplete', 'afterSurveyComplete');
     $this->subscribe('beforeSurveySettings', 'beforeSurveySettings');
     $this->subscribe('newSurveySettings');
 }
コード例 #13
0
ファイル: Example.php プロジェクト: mfavetti/LimeSurvey
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     /**
      * Here you should handle subscribing to the events your plugin will handle
      */
     $this->subscribe('afterPluginLoad', 'helloWorld');
     $this->subscribe('afterAdminMenuLoaded');
     $this->subscribe('beforeSurveySettings');
     $this->subscribe('newSurveySettings');
 }
コード例 #14
0
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     $this->subscribe('beforeSurveySettings');
     $this->subscribe('newSurveySettings');
     $this->subscribe('beforeActivate');
     $this->subscribe('beforeUserSave');
     $this->subscribe('beforeUserDelete');
     $this->subscribe('beforePermissionSetSave');
     $this->subscribe('beforeParticipantSave');
     $this->subscribe('beforeParticipantDelete');
 }
コード例 #15
0
ファイル: TutorialPlugin.php プロジェクト: gg1977/frontend
 public function routeHandler($route)
 {
     parent::routeHandler($route);
     switch ($route) {
         case '/update.json':
             getAuthentication()->requireAuthentication();
             $user = new User();
             $user->setAttribute($_POST['section'], $_POST['key']);
             return array('message' => sprintf('Updated tutorial for %s', $_POST['section']), 'code' => 200, 'result' => true);
             break;
     }
 }
コード例 #16
0
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     // Provides survey specific settings.
     $this->subscribe('beforeSurveySettings');
     // Saves survey specific settings.
     $this->subscribe('newSurveySettings');
     // Encrypt data on survey completion.
     $this->subscribe('afterSurveyComplete');
     // Create table for encrypted data.
     $this->subscribe('beforeActivate');
     $this->subscribe('newDirectRequest');
 }
コード例 #17
0
    public function renderPhotoDetail()
    {
        parent::renderPhotoDetail();
        $photo = $this->plugin->getData('photo');
        if ($this->plugin->getData('page') !== 'photo-detail') {
            return;
        }
        if (!isset($photo['permission']) || $photo['permission'] == 0) {
            return;
        }
        return <<<MKP
<div class="fb-like"></div>
MKP;
    }
コード例 #18
0
ファイル: AuditLog.php プロジェクト: rouben/LimeSurvey
        public function __construct(PluginManager $manager, $id) {
            parent::__construct($manager, $id);

            $this->subscribe('beforeSurveySettings');
            $this->subscribe('newSurveySettings');
            $this->subscribe('beforeActivate');
            $this->subscribe('beforeUserSave');
            $this->subscribe('beforeUserDelete');
            $this->subscribe('beforePermissionSetSave'); 
            $this->subscribe('beforeParticipantSave'); 
            $this->subscribe('beforeParticipantDelete'); 
            $this->subscribe('beforeLogout');
            $this->subscribe('afterSuccessfulLogin');
            $this->subscribe('afterFailedLoginAttempt');
        }
コード例 #19
0
ファイル: PiwikPlugin.php プロジェクト: gg1977/frontend
    public function renderFooter()
    {
        parent::renderFooter();
        return <<<MKP
  <!-- Piwik modal code -->
  <script type="text/javascript">
    OP.Util.on("photo:viewed", function(params){
      // Get URL and title that were changed by modal
      _paq.push(['setCustomUrl', window.location]);
      _paq.push(['setDocumentTitle', document.title]);
      // Track page view and enable link tracking
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
    });
  </script>
  <!-- End modal Piwik Code -->
MKP;
    }
コード例 #20
0
ファイル: GaugesPlugin.php プロジェクト: gg1977/frontend
    public function renderHead()
    {
        parent::renderHead();
        $conf = $this->getConf();
        return <<<MKP
  <script type="text/javascript">
    var _gauges = _gauges || [];
    (function() {
      var t   = document.createElement('script');
      t.type  = 'text/javascript';
      t.async = true;
      t.id    = 'gauges-tracker';
      t.setAttribute('data-site-id', '{$conf->id}');
      t.src = '//secure.gaug.es/track.js';
      var s = document.getElementsByTagName('script')[0];
     s.parentNode.insertBefore(t, s);
    })();
  </script>
MKP;
    }
コード例 #21
0
    public function renderHead()
    {
        parent::renderHead();
        $conf = $this->getConf();
        return <<<MKP
  <script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', '{$conf->id}']);
    _gaq.push(['_trackPageview']);

    (function() {
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

  </script>
MKP;
    }
コード例 #22
0
    public function renderHead()
    {
        parent::renderHead();
        $utility = new Utility();
        $page = $this->plugin->getData('page');
        $username = $utility->getEmailHandle($this->config->user->email, false);
        switch ($page) {
            case 'photo-detail':
                $photo = $this->plugin->getData('photo');
                $prefix = '';
                if ($photo['title'] != '') {
                    $prefix = sprintf('%s - ', $photo['title']);
                } elseif ($photo['filenameOriginal'] != '') {
                    $prefix = sprintf('%s - ', $photo['filenameOriginal']);
                }
                return <<<MKP
<title>{$prefix}{$username}'s photos - The OpenPhoto Project</title>
MKP;
                break;
            case 'photos':
                return <<<MKP
<title>{$username}'s photos - The OpenPhoto Project</title>
MKP;
                break;
            case 'tags':
                return <<<MKP
<title>{$username}'s tags - The OpenPhoto Project</title>
MKP;
                break;
            default:
                return <<<MKP
<title>{$username}'s OpenPhoto site - The OpenPhoto Project</title>
MKP;
                break;
        }
    }
コード例 #23
0
    public function renderHead()
    {
        parent::renderHead();
        $user = new User();
        $page = $this->plugin->getData('page');
        $username = $user->getNameFromEmail($this->config->user->email);
        switch ($page) {
            case 'photo-detail':
                $photo = $this->plugin->getData('photo');
                $prefix = '';
                if ($photo['title'] != '') {
                    $prefix = sprintf('%s - ', $photo['title']);
                } elseif ($photo['filenameOriginal'] != '') {
                    $prefix = sprintf('%s - ', $photo['filenameOriginal']);
                }
                return <<<MKP
<title>{$prefix}{$username}'s photos - Trovebox</title>
MKP;
                break;
            case 'photos':
                return <<<MKP
<title>{$username}'s photos - Trovebox</title>
MKP;
                break;
            case 'tags':
                return <<<MKP
<title>{$username}'s tags - Trovebox</title>
MKP;
                break;
            default:
                return <<<MKP
<title>{$username}'s Photo site - Trovebox</title>
MKP;
                break;
        }
    }
コード例 #24
0
 public function __construct()
 {
     parent::__construct();
 }
コード例 #25
0
 public function onPhotoUploaded()
 {
     parent::onPhotoUploaded();
     $photo = $this->plugin->getData('photo');
     $this->createPost($photo);
 }
コード例 #26
0
ファイル: index.php プロジェクト: ZeitZumSterben/website-cms
 function __destruct()
 {
     parent::__destruct();
     //Destruct
 }
コード例 #27
0
ファイル: UnActivatable.php プロジェクト: mfavetti/LimeSurvey
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     $this->subscribe('beforeActivate');
 }
コード例 #28
0
ファイル: oldUrlCompat.php プロジェクト: mfavetti/LimeSurvey
 public function __construct(PluginManager $manager, $id)
 {
     parent::__construct($manager, $id);
     $this->subscribe('afterPluginLoad', 'oldUrlCompat');
 }
コード例 #29
0
 public function __construct(PluginManager $manager, $id) {
     parent::__construct($manager, $id);
     $this->subscribe('beforeSurveyPage');
     $this->subscribe('beforeSurveySettings');
     $this->subscribe('newSurveySettings');
 }
 public function getPluginSettings($getValues = true)
 {
     $assetUrl = Yii::app()->assetManager->publish(dirname(__FILE__) . '/assets');
     Yii::app()->clientScript->registerCssFile($assetUrl . '/settingsfix.css');
     return parent::getPluginSettings($getValues);
 }