Example #1
0
 /**
  * Generate database documentation
  *
  * @access public
  * @return Response
  */
 public function action_generate()
 {
     $this->template->active = 'generate';
     $data = array();
     if (Input::method() === 'POST') {
         /**
          * get Fieldset instance
          */
         $platform = Input::post('platform');
         $fieldset = static::_get_form($platform);
         /**
          * validation
          */
         $validation = $fieldset->validation();
         if ($validation->run(Input::post())) {
             $config = $validated = $validation->validated();
             Arr::delete($config, 'platform');
             Arr::delete($config, 'name');
             Arr::delete($config, 'submit');
             Arr::delete($config, Config::get('security.csrf_token_key'));
             /**
              * directory
              */
             $dir = DOCROOT . 'dbdocs' . DS . $validated['name'] . DS . 'dbdoc' . DS;
             /**
              * generate
              */
             $dd = Dbdocs::forge('default', $config);
             try {
                 $ret = $dd->generate($dir, true);
                 if ($ret !== true) {
                     Session::set_flash('error', 'System error occurred.');
                 }
                 Session::set_flash('success', 'Generated database documentation "' . $validated['name'] . '" !!');
             } catch (Exception $e) {
                 Session::set_flash('error', 'System error occurred.');
             }
             Response::redirect();
         } else {
             $validated = $validation->validated();
             $data['platform'] = $platform;
             Arr::delete($validated, Config::get('security.csrf_token_key'));
             $data['form'] = $fieldset->populate($validated);
             $this->template->content = View::forge('index/generate', array('data' => $data));
             Session::set_flash('error', $validation->error());
         }
     } else {
         $this->template->content = View::forge('index/generate', array('data' => $data));
     }
 }
Example #2
0
 /**
  * Deletes a (dot notated) config item
  *
  * @param
  *        	string a (dot notated) config key
  * @return array|bool the \Arr::delete result, success boolean or array of success booleans
  */
 public static function delete($item)
 {
     if (isset(static::$itemcache[$item])) {
         unset(static::$itemcache[$item]);
     }
     return \Arr::delete(static::$items, $item);
 }
Example #3
0
 /**
  * delete session variables
  *
  * @param	string	name of the variable to delete
  * @param	mixed	value
  * @access	public
  * @return	Fuel\Core\Session_Driver
  */
 public function delete($name)
 {
     \Arr::delete($this->data, $name);
     return $this;
 }
Example #4
0
File: lang.php Project: wushian/MDD
 /**
  * Deletes a (dot notated) language string
  *
  * @param    string       $item      a (dot notated) language key
  * @param    string       $group     group
  * @param    string|null  $language  name of the language to set, null for the configurated language
  * @return   array|bool              the \Arr::delete result, success boolean or array of success booleans
  */
 public static function delete($item, $group = null, $language = null)
 {
     $group === null or $line = $group . '.' . $line;
     if ($language === null) {
         $languages = static::$fallback;
         array_unshift($languages, $language ?: \Config::get('language'));
         $language = reset($languages);
     }
     return isset(static::$lines[$language]) ? \Arr::delete(static::$lines[$language], $item) : false;
 }
Example #5
0
 /**
  * Deletes a (dot notated) language string
  *
  * @param    string       $item      a (dot notated) language key
  * @param    string       $group     group
  * @param    string|null  $language  name of the language to set, null for the configurated language
  * @return   array|bool              the \Arr::delete result, success boolean or array of success booleans
  */
 public static function delete($item, $group = null, $language = null)
 {
     $group === null or $item = $group . '.' . $item;
     $language === null and $language = static::get_lang();
     return isset(static::$lines[$language]) ? \Arr::delete(static::$lines[$language], $item) : false;
 }
 /**
  * Buy credits checkout
  *
  * @access  public
  * @return  void
  */
 public function action_credits()
 {
     \View::set_global('title', 'Purchase Credits');
     if (\Input::post('buy')) {
         $products = array();
         $total = array('price' => 0, 'save' => 0);
         $bundles = \Input::post('bundles');
         $prices = \Config::get('job.bundles.multiple', array());
         // Rename array keys
         foreach ($bundles as $key => $value) {
             $new_key = str_replace('::', '.', $key);
             $bundles[$new_key] = $value;
             \Arr::delete($bundles, $key);
             if (\Arr::get($prices, $new_key, false)) {
                 list($quantity, $option) = explode('.', $new_key);
                 $product = \Arr::get($prices, $new_key);
                 $product['title'] = $quantity . ' Pack Job Bundle / ' . ucfirst($option);
                 $products[$key] = $product;
                 $total['price'] += $product['price'];
                 $total['save'] += $product['save'];
             }
         }
         // Save result in session
         \Session::set('checkout', array('products' => $products, 'total' => $total));
     } elseif (!\Session::get('checkout') || !\Session::get('checkout.products', array())) {
         // Session must exist to access this page. Return to purchase credits page
         $purchase_page = \Page\Model_Page::get_locked_pages('purchase_page', true);
         \Response::redirect(\Uri::front_create('page/' . $purchase_page->seo->slug));
     }
     // Set session key just to meke sure user can not retur to payment page from any other page but this
     \Session::set('payment_key', \Str::random('unique'));
     $this->page_theme = \Theme::instance()->set_partial('content', $this->view_dir . 'credits');
 }
Example #7
0
 /**
  * {@inheritdoc}
  */
 protected function clear_list($list)
 {
     is_array($list) or $list = array($list);
     foreach ($list as $_list) {
         $rcpt = array_keys($this->{$_list});
         \Arr::delete($this->rcpt_merge_vars, $rcpt);
         \Arr::delete($this->rcpt_metadata, $rcpt);
     }
     return parent::clear_list($list);
 }
Example #8
0
 protected function prep_props(array $props)
 {
     // Skip tree fields and primary keys
     $skip_fields = \Arr::merge(Model_Menu::primary_key(), Model_Menu::tree_config(), array('children'));
     \Arr::delete($skip_fields, array('read-only', 'title_field'));
     // Model properties
     $properties = \Arr::filter_keys($props, array_keys(Model_Menu::properties()));
     $properties = \Arr::filter_keys($properties, $skip_fields, true);
     //Model 'fields' property fields
     $fields = \Arr::filter_keys($props, array_keys($properties), true);
     $fields = \Arr::filter_keys($fields, $skip_fields, true);
     is_array($properties['fields']) or $properties['fields'] = array();
     $properties['fields'] = \Arr::merge($properties['fields'], $fields);
     return $properties;
 }
Example #9
0
 /**
  * Returns the container's data
  *
  * @return array
  */
 public function getContents()
 {
     // make a copy to leave the original container untouched
     $data = $this->data;
     // delete all expired variables
     foreach ($data[static::EXPIRE_DATA_KEY] as $key => $expiration) {
         if ($expiration[1] === static::EXPIRE_STATE_EXPIRED) {
             unset($data[static::EXPIRE_DATA_KEY][$key]);
             \Arr::delete($data, $this->prefixKey($key));
         }
     }
     // and return what's left over
     return $data;
 }
Example #10
0
 /**
  * Delete an item from the session data
  *
  * @param     string     Session data key
  * @returns   boolean    True if successful
  */
 public function delete($key)
 {
     return Arr::delete($_SESSION, $key);
 }
Example #11
0
 /**
  * Smartyへ割り当てた値を破棄します。
  *
  * @param string|array $key 破棄する変数名、もしくは、破棄する変数名の配列
  * @return Smarty 現在のインスタンス
  */
 public function clear($key)
 {
     Arr::delete($this->_assign, $key);
     return $this;
 }
Example #12
0
 /**
  * Deletes a (dot notated) config item
  *
  * @param    string       a (dot notated) config key
  * @return   array|bool   the \Arr::delete result, success boolean or array of success booleans
  */
 public static function delete($item)
 {
     return \Arr::delete(static::$items, $item);
 }
Example #13
0
 /**
  * Delete data from the container
  *
  * @param   string   $key  key to delete
  * @return  boolean  delete success boolean
  * @since   2.0.0
  */
 public function delete($key)
 {
     if ($this->readOnly) {
         throw new \RuntimeException('Changing values on this Data Container is not allowed.');
     }
     $this->isModified = true;
     if (($result = Arr::delete($this->data, $key)) === false and $this->parentEnabled) {
         $result = $this->parent->delete($key);
     }
     return $result;
 }
Example #14
0
 /**
  * @param string|null $name 削除するセッション変数のキー
  *     nullを指定するとセッション変数をクリアします。
  * @see Arr::delete() Arr::deleteメソッド
  */
 public static function delete($name = null)
 {
     return Arr::delete(self::getInstance()->session, $name);
 }
Example #15
0
 /**
  * Deletes a (dot notated) language string
  *
  * @param    string       a (dot notated) language key
  * @param    string       group
  * @return   array|bool   the \Arr::delete result, success boolean or array of success booleans
  */
 public static function delete($item, $group = null)
 {
     $group === null or $line = $group . '.' . $line;
     return \Arr::delete(static::$lines, $item);
 }