コード例 #1
0
ファイル: QuestionBase.php プロジェクト: mfavetti/LimeSurvey
 /**
  * This function saves question data. 
  * @param int $qid Question id.
  * @param string $key
  * @param string $language
  * @param mixed $value
  * @return boolean
  */
 protected function set($key, $value, $language = null, $questionId = null)
 {
     if (!isset($questionId) && isset($this->questionId)) {
         $questionId = $this->questionId;
         return $this->plugin->getStore()->set($this->plugin, $key, $value, 'Question', $questionId, $language);
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: Admin.php プロジェクト: Heyloyalty/wp-heyloyalty
 /**
  * Load assets.
  */
 public function load_assets()
 {
     wp_register_style('hl-admin-css', $this->plugin->url() . '/includes/css/heyloyalty.css', array(), $this->plugin->version());
     wp_register_script('hl-admin-js', $this->plugin->url() . '/includes/js/heyloyalty.js', array('jquery'), $this->plugin->version(), true);
     wp_register_script('hl-ajax-request', $this->plugin->url() . '/includes/js/heyloyalty-ajax.js', array('jquery'));
     wp_enqueue_script('hl-ajax-request');
     wp_enqueue_script('hl-admin-js');
     wp_enqueue_style('hl-admin-css');
     wp_enqueue_script('jquery-ui-draggable', false, array('jquery'));
     wp_enqueue_script('jquery-ui-droppable', false, array('jquery'));
     wp_localize_script('hl-ajax-request', 'HLajax', array('ajaxurl' => admin_url('admin-ajax.php')));
 }
コード例 #3
0
    /**
     * Outputs the boxes in the footer
     */
    public function print_boxes_html()
    {
        ?>
<!-- Scroll Triggered Boxes v<?php 
        echo $this->plugin->version();
        ?>
 - https://wordpress.org/plugins/scroll-triggered-boxes/--><?php 
        // print HTML for each of the boxes
        foreach ($this->get_matched_boxes() as $box) {
            /* @var $box Box */
            $box->print_html();
        }
        // print overlay element, we only need this once (it's re-used for all boxes)
        echo '<div id="stb-overlay"></div>';
        ?>
<!-- / Scroll Triggered Box --><?php 
    }
コード例 #4
0
 /**
  * Generates the real table name from plugin and tablename.
  * @param iPlugin $plugin
  * @param string $tableName
  */
 protected function getTableName(iPlugin $plugin, $tableName)
 {
     return App()->getDb()->tablePrefix . strtolower($plugin->getName()) . "_{$tableName}";
 }
コード例 #5
0
 /**
  * 
  * @param iPlugin $plugin
  * @param string $key
  * @param mixed data Default value to return if key could not be found.
  * @param string $model Optional model name to which the data was attached.
  * @param int $id Optional id of the model instance to which the data was attached.
  * @param string $language Optional language identifier used for storing the setting.
  * 
  * @return boolean
  */
 protected function setGeneric(iPlugin $plugin, $key, $data, $model, $id, $language)
 {
     if ($id == null && $model != null) {
         throw new Exception("DbStorage::set cannot store setting for model {$model} without valid id.");
     }
     $attributes = array('plugin_id' => $plugin->getId(), 'model' => $model, 'model_id' => $id, 'key' => $key);
     $record = PluginSetting::model()->findByAttributes($attributes);
     if (is_null($record)) {
         // New setting
         $record = PluginSetting::model()->populateRecord($attributes);
         $record->setIsNewRecord(true);
     }
     $record->value = json_encode($data);
     $result = $record->save();
     return $result;
 }