public function action_main($params = array())
 {
     $config = $this->config;
     $gConfig = \Config::load('novius_social_widget::config', true);
     if (Arr::get($gConfig, 'embed_js', true)) {
         if (!empty($config['js'])) {
             foreach ($config['js'] as $script) {
                 Nos::main_controller()->addJavascript($script);
             }
         }
     }
     $chrome = array();
     $typeList = array('chrome');
     foreach ($params as $param => $value) {
         if ($value) {
             foreach ($typeList as $type) {
                 $typePrefix = "{$type}-";
                 if ($value && \Str::starts_with($param, $typePrefix)) {
                     array_push(${$type}, \Str::sub($param, \Str::length($typePrefix)));
                 }
             }
         }
     }
     return \View::forge('novius_social_widget::front/enhancer/twitter', array('widgetId' => $params['widget-id'], 'chrome' => $chrome, 'limit' => \Arr::get($params, 'limit'), 'width' => \Arr::get($params, 'width'), 'height' => \Arr::get($params, 'height')), false);
 }
示例#2
0
 /**
  * Checks if the given group has the given permission
  * 
  * @param Ethanol\Model_User_Group|int $group
  * @param string $toCheck
  * @return boolean True if the group has the permission
  */
 public function group_has_permission($group, $toCheck)
 {
     if (is_numeric($group)) {
         $group = $this->get_group($group);
     }
     foreach ($group->permissions as $groupPermission) {
         if (\Str::starts_with($groupPermission->identifier, $toCheck) || \Str::starts_with($toCheck, $groupPermission->identifier)) {
             return true;
         }
     }
     return false;
 }
示例#3
0
 /**
  * Test for Str::starts_with()
  *
  * @test
  */
 public function test_starts_with()
 {
     $string = 'HELLO WORLD';
     $output = Str::starts_with($string, 'HELLO');
     $this->assertTrue($output);
     $output = Str::starts_with($string, 'hello');
     $this->assertFalse($output);
     $output = Str::starts_with($string, 'hello', true);
     $this->assertTrue($output);
 }
示例#4
0
 /**
  * {@inheritdoc}
  */
 public function attach($file, $inline = false, $cid = null, $mime = null, $name = null)
 {
     parent::attach($file, $inline, $cid, $mime, $name);
     if ($inline === true) {
         // Check the last attachment
         $attachment = end($this->attachments['inline']);
         if (!\Str::starts_with($attachment['mime'], 'image/')) {
             throw new \InvalidAttachmentsException('Non-image inline attachments are not supported by this driver.');
         }
     }
 }
示例#5
0
文件: template.php 项目: vano00/blog
    ?>
					</li>

					<?php 
    // Get the navigation bar's links from an helper. We moved
    // the code there because it is a bit long.
    $links = Helper::get_navigation_bar_links();
    foreach ($links as $link) {
        // A link will be active if the current url starts with
        // its url. For instance, we want the post link to be
        // active when requesting these urls:
        // http://myblog.app/blog/admin/post
        // http://myblog.app/blog/admin/post/create
        // http://myblog.app/blog/admin/post/view/1
        // ...
        $active = Str::starts_with(Uri::current(), Uri::base() . $link['url']);
        ?>
					<li class="<?php 
        echo $active ? 'active' : '';
        ?>
">
					<?php 
        echo Html::anchor($link['url'], $link['title']);
        ?>
					</li>
					<?php 
    }
    ?>
				</ul>
				<ul class="nav navbar-nav pull-right">
					<li class="dropdown">
示例#6
0
 /**
  * Saves the data posted and returns the referral.
  * 
  * @access public
  * @static
  * @param mixed $referral_id (default: null)
  * @return void
  */
 public static function save_current_post($referral_id = null)
 {
     // If we don't already have a referral id then we create a new referral
     if ($referral_id == 0 || is_null($referral_id)) {
         list($driver, $user_id) = Auth::get_user_id();
         $thisUser = \Model_User::find($user_id);
         \Log::write('Dispo', $thisUser->name . ' tried to create a NEW Referral', 'Controller_Crm_Ppi::save_current_post()');
         $clientID = \Crm\Referrals\Referrals_model::createReferral(array('user_id' => $user_id, 'company_id' => Input::post('company'), 'product_id' => 1, 'dialler_lead_id' => null, 'dialler_list_id' => null, 'dialler_list_name' => '', 'disposition_id' => '', 'title' => Input::post('referral_title'), 'forename' => Input::post('referral_forename'), 'surname' => Input::post('referral_surname'), 'street_and_number' => Input::post('referral_street_and_number'), 'area' => Input::post('referral_area'), 'district' => Input::post('referral_district'), 'town' => Input::post('referral_town'), 'county' => Input::post('referral_county'), 'post_code' => Input::post('referral_post_code'), 'date_of_birth' => Input::post('referral_date_of_birth'), 'tel_home' => Input::post('referral_tel_home'), 'tel_work' => Input::post('referral_tel_work'), 'tel_mobile' => Input::post('referral_tel_mobile'), 'email' => Input::post('referral_email'), 'notes' => Input::post('referral_notes'), 'introducer_id' => Input::post('introducer')));
         // -- Add a partner
         // ----------------
         if (Input::post('add_partner') == 'on') {
             $saveData['partner'] = array('title' => Input::post('referral_partner_title'), 'forename' => Input::post('referral_partner_forename'), 'surname' => Input::post('referral_partner_surname'), 'street_and_number' => Input::post('referral_partner_street_and_number'), 'area' => Input::post('referral_partner_area'), 'district' => Input::post('referral_partner_district'), 'town' => Input::post('referral_partner_town'), 'county' => Input::post('referral_partner_county'), 'post_code' => Input::post('referral_partner_post_code'), 'date_of_birth' => Input::post('referral_partner_date_of_birth'), 'tel_home' => Input::post('referral_partner_tel_home'), 'tel_work' => Input::post('referral_partner_tel_work'), 'tel_mobile' => Input::post('referral_partner_tel_mobile'), 'email' => Input::post('referral_partner_email'), 'notes' => Input::post('referral_partner_notes'));
         }
         \Log::write('Dispo', $thisUser->name . ' created a new client with the ID of ' . $clientID, 'Controller_Crm_Ppi::save_current_post()');
         $referral_id = $clientID;
     }
     $referral = Referrals_class::forge($referral_id);
     $creditorInformation = array();
     foreach ($_POST as $key => $value) {
         if (\Str::starts_with($key, "referral_")) {
             $dbKey = str_replace('referral_', '', $key);
             if ($dbKey == "date_of_birth") {
                 $referral->{$dbKey} = date("Y-m-d", strtotime($value));
             } else {
                 $referral->{$dbKey} = $value;
             }
         } else {
             if (\Str::starts_with($key, "creditor_")) {
                 $creditorType = str_replace('creditor_', '', $key);
                 $creditorInfo = explode("_", $creditorType);
                 $creditorNumber = (int) $creditorInfo[0];
                 $creditorString = str_replace($creditorNumber . '_', '', $key);
                 $creditorInformation[$creditorNumber][$creditorString] = $value;
             }
         }
     }
     $saveData['creditors'] = $creditorInformation;
     $referral->saveData($saveData);
     $referral->save();
     $referral = Referrals_class::forge($referral_id);
     return array($referral, $referral_id);
 }