/**
  * [nombre_del_formulario] [Esto ocupo para comparar el nombre del formulario para guardar en la tabla correcta]
  * 
  * [nombre_de_la_tabla] [se concatena con el prefijo seleccionado en la instalacion que por defecto es wp_ + nombre de la tabla a guardar]
  *
  *	[$submited['posted_data']['nombre_campo_form']] [Para jalar datos del formulario lo sacamos de un array $submited['posted_data'] seguido del nombre del campo ingresado en el form ['nombre_campo_form']]
  * 
  * [save_form Guarda en base cualquier formulario enviado por contact form 7]
  * @param  [type] $wpcf7 [variable global de wp que se utiliza para guardar datos en esta funcion]
  * @return [type]        [description]
*/
function save_form($wpcf7)
{
    global $wpdb;
    /*
     Note: since version 3.9 Contact Form 7 has removed $wpcf7->posted_data
     and now we use an API to get the posted data.
    */
    $submission = WPCF7_Submission::get_instance();
    if ($submission) {
        $submited = array();
        $submited['title'] = $wpcf7->title();
        $submited['posted_data'] = $submission->get_posted_data();
    }
    /**
     * Uso de la mayoría de formularios acerca de suscribirse o no
     */
    if ($submited['posted_data']['info'] == 'on') {
        $info = 'Si quiero recibir informacion';
    } else {
        $info = 'No quiero recibir informacion';
    }
    if ($submited['title'] == 'nombre_del_formulario') {
        $wpdb->insert($wpdb->prefix . 'nombre_de_la_tabla', array('nombre' => $submited['posted_data']['your-name'], 'apellido' => $submited['posted_data']['last-name'], 'email' => $submited['posted_data']['email-gana'], 'artista' => $submited['posted_data']['artist-fav'], 'info' => $info, 'fecha' => date('Y-m-d')));
    }
}
 /**
  * Enregistrement d'une action
  * @param  object $object    [description]
  * @param  string $action      [description]
  * @param  mixed  $from_user   [description]
  * @param  mixed  $to_user     [description]
  * @param  mixed  $child_object Peut être un objet enfant ou juste le type de cet objet
  * @return [type]              [description]
  */
 public function record($object, $action, $from_user = null, $child_object = null, $to_user = null)
 {
     $instantiator = new \Doctrine\Instantiator\Instantiator();
     $activity = $instantiator->instantiate($this->activity_class);
     $activity->setDate(new \DateTime());
     $activity->setObject($object);
     $activity->setObjectType($this->getClassBasename($object));
     $activity->setAction($action);
     if (!is_null($from_user) && $from_user instanceof AdvancedUserInterface) {
         $activity->setFromUser($from_user);
     }
     if (!is_null($to_user) && $to_user instanceof AdvancedUserInterface) {
         $activity->setToUser($to_user);
     }
     if (!is_null($child_object)) {
         if (is_object($child_object)) {
             $activity->setChildObject($child_object);
             $activity->setChildObjectType($this->getClassBasename($child_object));
         } else {
             $activity->setChildObjectType($child_object);
         }
     }
     $this->dm->persist($activity);
     $this->dm->flush();
 }
Example #3
0
 /**
  * [FunctionName description]
  * @param string $value [description]
  */
 public function activity()
 {
     $lastdate = \Carbon\Carbon::now()->subMonths(3);
     $checkins = $this->checkins->with('driver')->select(\DB::raw("*, COUNT(*) as activity , \n                            MONTHNAME(operasi_time) as mountname,\n                            MONTH(operasi_time) as mount"))->where('pool_id', $this->user->pool_id)->where('operasi_status_id', 1)->where('operasi_time', '>=', $lastdate->format('Y-m-d'))->where(\DB::raw('YEAR(operasi_time)'), date('Y'))->groupBy('driver_id')->groupBy(\DB::raw('MONTH(operasi_time)'))->get();
     //dd($drivers);
     return view('drivers.activity', compact('checkins'));
 }
 /**
  * [generatePresenteWhenInitNewDate description]
  * @param  [type] $calendar [description]
  * @param  [type] $month    [description]
  * @param  [type] $year     [description]
  * @return [type]           [description]
  */
 public function generatePresenteWhenInitNewDate($calendar, $month, $year)
 {
     $date = date("j");
     $time = Carbon::create($year, $month, $date, 0, 0, 0);
     $currentTime = Carbon::today();
     if ($time < $currentTime) {
         $date = 31;
     } else {
         if ($time > $currentTime) {
             $date = 1;
         }
     }
     $holidays = Setting::where('name', 'holidays')->first()->value;
     $arrHolidays = json_decode($holidays);
     // Carbon::createFromFormat('d/m/Y',);
     for ($i = 1; $i <= $date; $i++) {
         $dt = Carbon::create($year, $month, $i);
         if ($calendar->{'n' . $i} == "") {
             if ($this->checkExistDateInHoliday($dt->format('d/m/Y'), $arrHolidays)) {
                 $calendar->{'n' . $i} = "HO";
             } else {
                 if ($dt->dayOfWeek == 6 || $dt->dayOfWeek == 0) {
                     $calendar->{'n' . $i} = "W";
                 } else {
                     $calendar->{'n' . $i} = "P";
                 }
             }
         }
     }
     $calendar->save();
 }
Example #5
0
 /**
  * Outline all the events this class will be listening for. 
  * @param  [type] $events 
  * @return void         
  */
 public function subscribe($events)
 {
     $events->listen('sentinel.user.registered', 'Sentinel\\Mailers\\UserMailer@welcome', 10);
     $events->listen('sentinel.user.resend', 'Sentinel\\Mailers\\UserMailer@welcome', 10);
     $events->listen('sentinel.user.forgot', 'Sentinel\\Mailers\\UserMailer@forgotPassword', 10);
     $events->listen('sentinel.user.newpassword', 'Sentinel\\Mailers\\UserMailer@newPassword', 10);
 }
Example #6
0
 /**
  * Get price for a user
  * @param  [type] $user    [description]
  * @param  [type] $product [description]
  * @return float
  */
 public function price($user, $product)
 {
     if ($user instanceof User && $user->getCeten()) {
         return $product->getCetenPrice();
     }
     return $product->getPrice();
 }
 /**
  * Function to track history for unit testing on a 
  * guzzle client
  * 
  * @param  Guzzle\Client    $client       Guzzle client
  * @param  integer          $historyLimit number of requests to keep
  * @return void
  */
 public function trackHistory(&$client, $historyLimit = 5)
 {
     //record history for this client
     $this->history = new \Guzzle\Plugin\History\HistoryPlugin();
     $this->history->setLimit($historyLimit);
     $client->addSubscriber($this->history);
 }
Example #8
0
 /**
  * Outline all the events this class will be listening for. 
  * @param  [type] $events 
  * @return void         
  */
 public function subscribe($events)
 {
     $events->listen('user.signup', 'Edgji\\Sentrystart\\Mailers\\UserMailer@welcome');
     $events->listen('user.resend', 'Edgji\\Sentrystart\\Mailers\\UserMailer@welcome');
     $events->listen('user.forgot', 'Edgji\\Sentrystart\\Mailers\\UserMailer@forgotPassword');
     $events->listen('user.newpassword', 'Edgji\\Sentrystart\\Mailers\\UserMailer@newPassword');
 }
Example #9
0
 /**
  * [createResponse description]
  * @param  [type] $display [description]
  * @param  [type] $title   [description]
  * @param  [type] $message [description]
  * @return [type]          [description]
  */
 public static function createResponse($display, $title, $message)
 {
     $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     $message = array('title' => $title, 'message' => $message, 'referer' => $referer);
     $display->assign('message', $message);
     $display->display('base/message.html.twig');
 }
 /**
  * Create activity from Swift Message
  * @param  \Swift_Message $message 
  * @return EmailActivity
  */
 protected function createActivity(\Swift_Message $message)
 {
     // Creation du doc de trace d'activité avec les données basiques
     $from_email = $message->getHeaders()->get('From')->getFieldBody();
     $to_email = $message->getHeaders()->get('To')->getFieldBody();
     $message_id = $message->getHeaders()->get('Message-ID')->getId();
     $subject = $message->getSubject();
     $activity = new $this->activity_class();
     $activity->setFromEmail($from_email);
     $activity->setToEmail($to_email);
     $activity->setSubject($subject);
     $activity->setMessageId($message_id);
     // Récupération du document associé aux relations from_user et to_user
     $meta = $this->dm->getClassMetadata($this->activity_class);
     $class = $meta->getAssociationTargetClass('from_user');
     $repo = $this->dm->getRepository($class);
     $user = $repo->findOneByEmail($activity->getFromEmail());
     if (!is_null($user)) {
         $activity->setFromUser($user);
     }
     $class = $meta->getAssociationTargetClass('to_user');
     $repo = $this->dm->getRepository($class);
     $user = $repo->findOneByEmail($activity->getToEmail());
     if (!is_null($user)) {
         $activity->setToUser($user);
     }
     return $activity;
 }
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     if (!Cache::get('popular_categories')) {
         Cache::put('popular_categories', $this->categories->getPopular(), 60);
     }
     $view->with('popular_categories', Cache::get('popular_categories'));
 }
 /**
  * Handle the command.
  *
  * @param  RegisterNewUserCommand  $command
  * @return void
  */
 public function handle(RegisterNewLeaderUserCommand $command)
 {
     $user = User::registerLeader($command->role_id, $command->name, $command->email, $command->group, $command->password, $command->email_token);
     $this->repo->save($user);
     event(new UserWasRegistered($user));
     return $user;
 }
Example #13
0
 /**
  * /
  * @param  [type] $app [description]
  * @return [type]      [description]
  */
 public function route($app)
 {
     $app->get('', function () use($app) {
     });
     $app->post('', function () use($app) {
     });
 }
Example #14
0
 /**
  * [subscribe description]
  * @param  [type] $events [description]
  * @return [type]         [description]
  */
 public function subscribe($events)
 {
     $events->listen('tag.create', $this->eventPath . 'TagSubscriber@onCreate');
     $events->listen('tag.delete', $this->eventPath . 'TagSubscriber@onDelete');
     $events->listen('tag.move', $this->eventPath . 'TagSubscriber@onMove');
     $events->listen('tag.save', $this->eventPath . 'TagSubscriber@onSave');
 }
Example #15
0
 /**
  * [render description]
  * @method render
  * @return [type] [description]
  */
 public function render()
 {
     echo $this->twigHandler->render($this->twigTemplate, array("lists" => $this->getLists()));
     if (isPostback()) {
         var_dump($_POST);
     }
 }
Example #16
0
 /**
  * [Validate description]
  * @method Validate
  */
 public function Validate()
 {
     $this->version->Validate();
     $this->ValidateProperty("name");
     $this->ValidateProperty("description");
     $this->ValidateProperty("googleBlock");
 }
Example #17
0
 /**
  * Outline all the events this class will be listening for.
  * @param  [type] $events
  * @return void
  */
 public function subscribe($events)
 {
     $events->listen('user.signup', 'Lavalite\\User\\Mailers\\UserMailer@welcome');
     $events->listen('user.resend', 'Lavalite\\User\\Mailers\\UserMailer@welcome');
     $events->listen('user.forgot', 'Lavalite\\User\\Mailers\\UserMailer@forgotPassword');
     $events->listen('user.newpassword', 'Lavalite\\User\\Mailers\\UserMailer@newPassword');
 }
Example #18
0
 /**
  * Mock PHPExcel class
  * @return [type] [description]
  */
 public function mockPHPExcel()
 {
     $this->phpexcel = m::mock('Maatwebsite\\Excel\\Classes\\PHPExcel');
     $this->phpexcel->shouldReceive('getID');
     $this->phpexcel->shouldReceive('disconnectWorksheets');
     $this->phpexcel->shouldReceive('setDefaultProperties');
 }
Example #19
0
 /**
  * [subscribe description]
  * @param  [type] $events [description]
  * @return [type]         [description]
  */
 public function subscribe($events)
 {
     $events->listen('role.create', $this->eventPath . 'RoleSubscriber@onCreate');
     $events->listen('role.delete', $this->eventPath . 'RoleSubscriber@onDelete');
     $events->listen('role.move', $this->eventPath . 'RoleSubscriber@onMove');
     $events->listen('role.save', $this->eventPath . 'RoleSubscriber@onSave');
 }
Example #20
0
 /**
  * Front-end access to pages
  * @param  [type] $uri [description]
  * @return [type]      [description]
  */
 public function renderPage($uri)
 {
     if ($this->manager->publicPage($uri)) {
         return $this->manager->showPage();
     } else {
         return $this->manager->authPage();
     }
 }
Example #21
0
 /**
  * [toXmlNode description]
  * @param  [type] $parent [description]
  * @return [type]         [description]
  */
 public function attachNodeTo($parent)
 {
     if ($this->cdata && !preg_match("#^<!\\[CDATA#is", $this->value)) {
         $this->value = "<![CDATA[{$this->value}]]>";
     }
     $parent->addChild($this->name, '', $this->_namespace);
     $parent->{$this->name} = $this->value;
 }
 /**
  * get Single data of UpperHouse geo location by mongo id
  * @param  string $id
  * @return Hexcores\Api\Facades\Response
  */
 public function getById($id)
 {
     $geo = $this->model->find($id);
     if (!$geo) {
         return response_missing();
     }
     return response_ok($this->transform($geo, new GeoTransformer()));
 }
 /**
  * Check if an ingredient is in the fridge or not.
  *
  * @param  Ingredient $contestant [description]
  * @return boolean                return TRUE if in the fridge or FALSE if not
  */
 public function isSatisfiedBy($contestant)
 {
     if ($this->ingredient_repository->findByName($contestant->getName())) {
         return TRUE;
     }
     $this->addMessage('INGREDIENTS', 'Ingredient required for the recipe is not in the fridge.');
     return FALSE;
 }
 /**
  * Retourne le nom du fichier tel qu'il devrait être
  * @param  [type] $object [description]
  * @param  string $filename   un nom de fichier
  * @return [type]         [description]
  */
 public function getNormalizedName($object, $filename)
 {
     if (is_null($object->getId())) {
         throw new \Exception("Object id should not be null");
     }
     $extension = pathinfo($filename, PATHINFO_EXTENSION);
     return $object->getId() . '.' . $extension;
 }
Example #25
0
 /**
  * Scope queries to territories that are being worked on by the logged in user
  *
  * @param  [type] $query [description]
  * @return [type]        [description]
  */
 public function scopeMyMaps($query)
 {
     $user = Auth::user();
     //dd($user);
     //$query->whereNotNull('finished_on');
     $query->whereHas('users', function ($q) use($user) {
         $q->where('finished_on', NULL)->where('user_id', $user->id);
     });
 }
 /**
  * Randomize each Test Suite inside the main Test Suite.
  *
  * @param  [type] $suite Main Test Suite to randomize.
  * @param  [type] $seed  Seed to use.
  * @return \PHPUnit_Framework_Test
  */
 private function randomizeSuiteThatContainsOtherSuites($suite, $seed)
 {
     $order = 0;
     foreach ($suite->tests() as $test) {
         $this->randomizeSuite($test, $seed, $order);
         $order++;
     }
     return $this->randomizeSuite($suite, $seed, $order, false);
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $email = Input::get('email');
     $input['email'] = $email;
     $this->validation->validate($input);
     $input = array_merge($input, ['senderEmail' => Auth::user()->email]);
     $request = $this->execute(PublishFriendRequestCommand::class, $input);
     return $request;
 }
Example #28
0
 /**
  * 是否已经点击过了
  * @param  [type] $db          [description]
  * @param  [type] $contentid   [description]
  * @param  [type] $openid      [description]
  * @param  [type] $shareopenid [description]
  * @return [type]              [description]
  */
 public static function checkisClicked($db, $contentid, $openid, $shareopenid)
 {
     $result = $db->fetch_first("select * from clickcount where contentid=" . $contentid . " and clickOpenid='" . $openid . "' and shareOpenid='" . $shareopenid . "'");
     if (empty($result['id']) || $result['isvalid'] == 0) {
         return false;
     } else {
         return true;
     }
 }
 protected function _sendWebhook($url, $body)
 {
     $this->_logger->debug("Sending webhook for event " . $this->_getWebhookEvent() . " to " . $url);
     $bodyJson = $this->_jsonHelper->jsonEncode($body);
     $headers = ["Content-Type: application/json"];
     $this->_curlAdapter->write('POST', $url, '1.1', $headers, $bodyJson);
     $this->_curlAdapter->read();
     $this->_curlAdapter->close();
 }
/**
 * [rbm_pagesize description]
 * @param  [type] $query [description]
 * @return [type]        [description]
 */
function rbm_pagesize($query)
{
    if (is_admin() || !$query->is_main_query()) {
        return;
    }
    if (is_post_type_archive('members') || is_tax('member-types')) {
        $query->set('posts_per_page', -1);
        return;
    }
}