Obtém a Conexão e a Syntax, executa a query!
340195
private function execute()
    {
        $this->Connect();
        try {
            $this->delete->execute($this->places);
            $this->result = true;
        } catch (\PDOException $e) {
            $this->result = null;
            $this->erro = "<b>Erro ao Deletar:</b> {$e->getMessage()}";
        }

        parent::setDefault();
    }
1333940
def quadro?(node)
      # Texto original: 
      # Quadro perfil: Perfil dos voluntários do experimento
      #
      # Depois do parse:
      #
      # {"t"=>"Para","c"=>[{"t"=>"Str","c"=>"Quadro"},{"t"=>"Space"},{"t"=>"Str","c"=>"perfil:"},{"t"=>"Space"},{"t"=>"Str","c"=>"Perfil"},{"t"=>"Space"},{"t"=>"Str","c"=>"dos"},{"t"=>"Space"},{"t"=>"Str","c"=>"voluntários"},{"t"=>"Space"},{"t"=>"Str","c"=>"do"},{"t"=>"Space"},{"t"=>"Str","c"=>"experimento"}]}
      para = node["c"]
      
      node["t"] == "Para" and node["c"].length>=5 and string_contendo?("Quadro",para[0]) and space?(para[1]) and quadro_id?(para[2]) and space?(para[3]) and string?(para[4])
    end
741391
function ObjectDeepFind(obj, propertyPath) {
	
    // Divide todas as propriedades pelo .
	var paths = propertyPath.split('.');
	
    // Copia o objeto
	var currentObj = obj;

    // Para cada propriedade vou pegar a próxima até encontrar o valor do path inteiro da propriedade
	for (var i = 0; i < paths.length; ++i) {
		if (currentObj[paths[i]] == undefined) {
			return undefined;
		} else {
			currentObj = currentObj[paths[i]];
		}
	}
	
	return currentObj;
}
54215
function requestNew()
    {
        $db = new Db;

        //Search from first register with [article.status] 5 and [article.editdate] <= datetime - 24 hours.
        $result = $db->query('SELECT MIN(id)id, (SELECT MAX(id+1) FROM article)nid
                              FROM article
                              WHERE status = 6
                              OR (status = 5 AND editdate <=  STR_TO_DATE(\''.date('Y-m-d H:i:s', time()-86400).'\', \'%Y-%m-%d %H:%i:%s\'))');

        if (isset($result[0])) {
            $this->editdate = date('Y-m-d H:i:s');
            $this->pubdate = $this->editdate;


            //Criando novo registro
            if ($result[0]->get('id') == null) {
                $this->id = $result[0]->get('nid');

                $db->query('INSERT INTO articlecontent
                           SET article = '.$this->id.',
                           	   content = "",
            				   editdate = "'.$this->editdate.'"');

                $db->query('INSERT INTO article
                           SET id = '.$this->id.',
                               status = 5,
                               editdate = \''.$this->editdate.'\'');

            //Atualizando o registro
            } else {
                $this->id = $result[0]->get('id');

                $db->query('UPDATE article
                           SET status = 5,
                               pubdate = \''.$this->pubdate.'\',
            				   editdate = \''.$this->editdate.'\',
            				   rateup = 0,
            				   ratedown = 0,
            				   access = 0,
            				   link = "",
            				   tags = "",
            				   title = "",
            				   media = "{}",
            				   resume = ""
            				   
            			 WHERE id = '.$this->id.'');

                $db->query('UPDATE articlecontent
                           SET content = "",
            				   editdate = \''.$this->editdate.'\'
            			 WHERE article = '.$this->id.'');
            }

                //Make dir clean (delete all files)
                $this->clearDir();
                return $this;
        }

            return false;
    }
676239
public function getConnection()
    {
        // Autre BDD que celle par defaut. soit avec un autre connector de la config, ou avec autre ID de connexion de la config
        if ($this->dbConnector !== null || count($this->idConnection) > 0) {
            $dbConnector = ($this->dbConnector !== null) ? $this->dbConnector : Config::get()['connection'];
            $connector = 'DawPhpOrm\Database\Connectors\\'.ucfirst($dbConnector).'Connector';

            $db = new $connector($this->idConnection);
            
            return $db->getConnection();
        }

        // BDD par defaut avec connector de config et avec ID de config
        if (self::$connection === null) {
            $connector = 'DawPhpOrm\Database\Connectors\\'.ucfirst(Config::get()['connection']).'Connector';

            $db = new $connector();
            self::$connection = $db->getConnection();
        }

        return self::$connection;
    }
894159
private function execute()
    {
        $this->connect();
        try {
            $this->create->execute($this->dados);
            $this->result = $this->conn->lastInsertId();
            $this->react = new React("create", str_replace(PRE, '', $this->tabela), array_merge(["id" => $this->result], $this->dados));
        } catch (\PDOException $e) {
            $this->result = null;
            $this->erro = "<b>Erro ao cadastrar: ({$this->tabela})</b> {$e->getMessage()}";
        }

        parent::setDefault();
    }
372418
public function create()
    {
        $fs = new Filesystem();

        if (!$this->sourceDir) {
            throw new \Exception('O diretório de código fonte "singular.directory.src" da aplicação não foi definido!');
        }

        $migrationDir = $this->getMigrationDir();

        if (!$fs->exists($migrationDir)) {
            throw new \Exception(sprintf('O diretório de migration não existe!'));
        }

        $timestamp = time();

        $aplicacoes = $this->getAplicacoesToMigration();

        if (count($aplicacoes) > 0) {
            $template = file_get_contents(
                __DIR__.DIRECTORY_SEPARATOR."templates".DIRECTORY_SEPARATOR."app_migration.tpl"
            );

            $template = str_replace('$TIMESTAMP',$timestamp, $template);
            $template = str_replace('$APLICACOES', $this->arrayToString($aplicacoes, $timestamp) , $template);

            $dt = new \DateTime('now', new \DateTimeZone('UTC'));
            $date = $dt->format('YmdHis');

            file_put_contents($migrationDir.DIRECTORY_SEPARATOR.$date.'_insere_registros_aplicacoes_'.$timestamp.'.php', $template);
        }

        $modulos = $this->getModulosToMigration();

        if (count($modulos) > 0) {
            $template = file_get_contents(
                __DIR__.DIRECTORY_SEPARATOR."templates".DIRECTORY_SEPARATOR."mod_migration.tpl"
            );

            $template = str_replace('$TIMESTAMP',$timestamp, $template);
            $template = str_replace('$MODULOS', $this->arrayToString($modulos, $timestamp) , $template);

            sleep(1);

            $dt = new \DateTime('now', new \DateTimeZone('UTC'));
            $date = $dt->format('YmdHis');

            file_put_contents($migrationDir.DIRECTORY_SEPARATOR.$date.'_insere_registros_modulos_'.$timestamp.'.php', $template);
        }

        $this->clearMigrations();

        return count($modulos) + count($aplicacoes);
    }
698843
function _query($sql,$inputarr=false)
	{
		$rez = sqlite_query($sql,$this->_connectionID);
		if (!$rez) {
			$this->_errorNo = sqlite_last_error($this->_connectionID);
		}
		// If no data was returned, we don't need to create a real recordset
		// Note: this code is untested, as I don't have a sqlite2 setup available
		elseif (sqlite_num_fields($rez) == 0) {
			$rez = true;
		}

		return $rez;
	}
676245
public function create($msg)
    {
        // Verificar se mensagem pode ser traduzida pelo sistema da Lang do Laravel
        if (is_string($msg) && ($this->lang->has($msg)))
            $msg = $this->lang->get($msg);

        // Se msg for um objeto ou array deve fazer um print_r
        if (is_object($msg) || is_array($msg))
            $msg = print_r($msg, true);

        $args    = func_get_args();
        $args[0] = $msg;
        $msg     = trim(call_user_func_array('sprintf', $args));

        $code = $args[count($args) - 1];

        if (is_numeric($code))
            return new \Exception($msg, $code);
        else
            return new \Exception($msg);
    }
1023237
def _get_notification(self, email, token):
        '''  '''        
        url = u'{notification_url}{notification_code}?email={email}&token={token}'.format(
            notification_url=self.notification_url,
            notification_code=self.notification_code,
            email=email,
            token=token)
        req = requests.get(url)
        if req.status_code == 200:
            self.xml = req.text
            logger.debug( u'XML com informacoes da transacao recebido: {0}'.format(self.xml) )
            transaction_dict = xmltodict.parse(self.xml)
            # Validar informações recebidas
            transaction_schema(transaction_dict)
            self.transaction = transaction_dict.get('transaction')
        else:
            raise PagSeguroApiException(
                        u'Erro ao fazer request para a API de notificacao:' + 
                        ' HTTP Status=%s - Response: %s' % (req.status_code, req.text))
494606
function (loop, variables) {
    var variable = false;
    try {
        variable = varsParser.evaluate('(' + loop.variable + ')', variables);
    } catch (err) {
        throw new Error('Error executing loop expression: ' + loop.variable + ' <' + err.message + '>');
    }

    var html = '';
    var loopVariables = _.clone(variables, true);

    (function (iterate) {
        if (Array.isArray(variable)) {
            for (var i = 0, l = variable.length; i < l; i++) {
                iterate(i, variable[i]);
            }
        } else {
            for (var i in variable) {
                if (!variable.hasOwnProperty(i)) {
                    continue;
                }
                iterate(i, variable[i]);
            }
        }
    })(function (key, value) {
        loopVariables.$key = loopVariables[loop.keyName] = key;
        loopVariables.$value = loopVariables[loop.valueName] = value;

        var loopHtml = loop.content;

         //<if/> (condicionais, execução das condicionais para geração do template)
        loopHtml = conditionalParser(loopHtml, loopVariables);

        loop.children.forEach(function (child) {
            loopHtml = loopHtml.replace(child.mark, proccessLoop(child, loopVariables));
        });

        // #{vars} (escapando as variaveis no template)
        loopHtml = varsParser.escapeValues(loopHtml, loopVariables);

        html += loopHtml;
    });

    return html;
}
108659
public function start_el( &$output, $item, $depth = 0, $args = array(), $current_object_id = 0 )
	{
		global $wp_query, $wpdb;
		$indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent


		// só faz pesquisa pelos filhos no primeiro nível
		$has_children = 0;
		if($depth == 0){
			$has_children = $wpdb -> get_var( "SELECT COUNT(meta_id) FROM {$wpdb->prefix}postmeta WHERE meta_key='_menu_item_menu_item_parent' AND meta_value='" . $item->ID . "'" );

		}

		// depth dependent classes
		$depth_classes = array(
			( $depth == 0 ? 'dropdown' : 'sub-menu-item' ),
			$item->current ? 'active' : '',

		);
		$depth_class_names = esc_attr( implode( ' ', $depth_classes ) );

		// passed classes
		$classes = empty( $item->classes ) ? array() : (array) $item->classes;
		$class_names = esc_attr( implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ) );

		// build html
		$output .= $indent . '<li id="nav-menu-item-'. $item->ID . '" class="' . $depth_class_names . ' ' . $class_names . '">';

		// link attributes
		// <a href="#" class="dropdown-toggle" data-toggle="dropdown">biblioteca <b class="caret"></b></a>
		$attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
		$attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
		$attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
		$attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
		$attributes .= ' class="menu-link menu-depth-'.$depth . ( $depth > 0 ? '' : ' dropdown-toggle' ) . '"';
		$attributes .= $has_children > 0 ? ' data-toggle="dropdown"' : '';

		$caret = $has_children > 0 ? ' <b class="caret"></b>' : '';

		$item_output = sprintf( '%1$s<a%2$s>%3$s%4$s%5$s</a>%6$s',
			$args->before,
			$attributes,
			$args->link_before,
			apply_filters( 'the_title', $item->title, $item->ID ),
			$args->link_after . $caret,
			$args->after
		);

		// build html
		$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
	}
1357635
public static function check(?string $v, ?array $aux = null) : bool
    {
        if ($v === null) {
            return false;
        } else {
            // Apenas se passar na validação do formato em sí
            if (StringExtension::isPatternMatch($v, static::RegExp) === true) {
                // Remove todos os caracteres de pontuação, ficando apenas com
                // os dígitos
                $v = StringExtension::onlyCharCollection($v, "0123456789");
                $l = mb_strlen($v);

                // Ficando a string entre os limites de quantidade de caracteres
                // a string é aceita.
                if ($l === 10) {
                    return true;
                }
            }
        }

        return false;
    }
1166232
def ConsultarRemito(self, cod_remito=None, id_req=None,
                        tipo_comprobante=None, punto_emision=None, nro_comprobante=None):
        ""
        print(self.client.help("consultarRemito"))
        response = self.client.consultarRemito(
                                authRequest={'token': self.Token, 'sign': self.Sign, 'cuitRepresentada': self.Cuit},
                                codRemito=cod_remito,
                                idReq=id_req,
                                tipoComprobante=tipo_comprobante,
                                puntoEmision=punto_emision,
                                nroComprobante=nro_comprobante)
        ret = response.get("consultarRemitoReturn", {})
        id_req = ret.get("idReq", 0)
        self.remito = rec = ret.get("remito", {})
        self.__analizar_errores(ret)
        self.__analizar_observaciones(ret)
        self.__analizar_evento(ret)
        self.AnalizarRemito(rec)
        return id_req
350929
private function execute()
    {
        $this->connect();
        try {
            $this->create->execute($this->dados);
            $this->result = $this->conn->lastInsertId();
        } catch (\PDOException $e) {
            $this->result = null;
            $this->erro = "<b>Erro ao cadastrar: ({$this->tabela})</b> {$e->getMessage()}";
        }

        parent::setDefault();
    }
733041
private function clauseJoin($table,$column,$operator,$value, $scape_quote,$type) {
      $closure = false;
      $type = strtoupper($type);
      $this->connection();
      $schema = $this->schema?"{$this->schema}.":'';

      if (is_array($column)) {
         foreach ($column as $key => $val) {
            // $this->operators
            if (preg_match('/([\.a-zA-Z0-9_-]+) *(.*)/i', $key,$match)) {
               if (trim($match[2])) {
                  $this-> clauseJoin($table,trim($match[1]), trim($match[2]), $val, $scape_quote, $type);
               }
               else {
                  $this-> clauseJoin($table,trim($match[1]), $val, $value, $scape_quote, $type);
               }
            }
         }
         return;
      }

      // si es un closure lo ejecutamos
      if ($column instanceof \Closure) {
         // el resultado resuelto es almacenado en la variable $_ENV para luego terminar de agruparlo
         $column(new \Daniia\Daniia());
         $str = $_ENV["daniia_daniia"]->on;
         $_ENV["daniia_daniia"] = null;
         $closure = true;
      }

      // si no es un operador valido
      if ( $operator instanceof \Closure ) {
         list($operator, $value, $scape_quote) = ['=', $operator, $value];
      }elseif ( is_array($operator) ) {
         list($operator, $value, $scape_quote) = ['in', $operator, $value];
      }elseif ( !in_array(strtolower(trim($operator)), $this->operators, true) ) {
         list($operator, $value, $scape_quote) = ['=', $operator, $value];
      }

      if ($value instanceof \Closure) {
         // el resultado resuelto es almacenado en la variable $_ENV para luego terminar de agruparlo
         $value(new \Daniia\Daniia());
         $get_sql = $_ENV["daniia_daniia"]->get_sql();
         $_ENV["daniia_daniia"] = null;
         $value = $get_sql;
      }

      if( is_array($value) ) {
         $in = [];
         foreach($value as $val){
            if ( $val===NULL ) {
               $in[] = ' NULL ' ;
            }
            elseif ( gettype($val)==='boolean' ) {
               $in[] = $val ? ' TRUE ' : ' FALSE ' ;
            }
            else {
               $in[] = $this->id_conn->quote($val);
            }
         }
         $scape_quote = FALSE;
         $value = ' ('.implode(',',$in).') ';
      }
      elseif ( $value===NULL ) {
         $scape_quote = FALSE;
         $value = ' NULL ' ;
      }
      elseif ( gettype($value)==='boolean' ) {
         $scape_quote = FALSE;
         $value = $value ? ' TRUE ' : ' FALSE ' ;
      }

      if (!$closure) {
         $str = $column.' '.strtoupper($operator).' '.($scape_quote?$this->id_conn->quote($value):$value);
         $this->join .= " {$type} JOIN {$schema}{$table} ON {$str} ";
      }
      else {
         $this->join .= " {$type} JOIN {$schema}{$table} {$str} ";
      }

      $this->get_instance();
      return $this;
   }
115645
public function query()
    {
        // check if the host is in ipv4 format
        $host = filter_var($this->host, FILTER_VALIDATE_IP) ? $this->host : gethostbyname($this->host);
        
        $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
        socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 1, 'usec' => 0));
        socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 1, 'usec' => 0));

        if (!@socket_connect($socket, $host, $this->port)) {
            return false;
        }
        
        // create the handshake and ping packet
        $handshakePacket = new HandshakePacket($host, $this->port, 107, 1);
        $pingPacket = new PingPacket();

        $handshakePacket->send($socket);

        // high five
        $start = microtime(true);
        $pingPacket->send($socket);
        $length = $this->readVarInt($socket);
        $ping = round((microtime(true) - $start) * 1000);

        // read the requested data
        $data = socket_read($socket, $length, PHP_NORMAL_READ);
        $data = strstr($data, '{');
        $data = json_decode($data);

        $descriptionRaw = isset($data->description) ? $data->description : null;
        $description = $descriptionRaw;

        // colorize the description if it is supported
        if (gettype($descriptionRaw) == 'object') {
            $description = '';

            if (isset($descriptionRaw->text)) {
                $color = isset($descriptionRaw->color) ? $descriptionRaw->color : null;
                $description = $descriptionRaw->text;
                if ($color !== null) {
                    $description = '<font color="' . $color . '">' . $descriptionRaw->text . '</font>';
                }
            }

            if (isset($descriptionRaw->extra)) {
                foreach ($descriptionRaw->extra as $item) {
                    $description .= isset($item->bold) && $item->bold ? '<b>' : null;
                    $description .= isset($item->color) ? '<font color="' . $item->color . '">' . $item->text . '</font>' : $item->text;
                    $description .= isset($item->bold) && $item->bold ? '</b>' : null;
                }
            }
        }

        $this->data
            ->setHostname($host)
            ->setPort($this->port)
            ->setPing($ping)
            ->setVersion(isset($data->version->name) ? $data->version->name : null)
            ->setProtocol(isset($data->version->protocol) ? $data->version->protocol : null)
            ->setPlayers(isset($data->players->online) ? $data->players->online : null)
            ->setMaxPlayers(isset($data->players->max) ? $data->players->max : null)
            ->setDescription($description)
            ->setDescriptionRaw($descriptionRaw)
            ->setFavicon(isset($data->favicon) ? $data->favicon : null)
            ->setModinfo(isset($data->modinfo) ? $data->modinfo : null)
        ;

        return true;
    }