Send a broadcast.

@param array  $targets Array of numbers to send to
@param object $node
@param        $type

@return string
424471
protected function sendBroadcast($targets, $node, $type)
    {
        if (!is_array($targets)) {
            $targets = [$targets];
        }

        $toNodes = [];
        foreach ($targets as $target) {
            $jid = $this->getJID($target);
            $hash = ['jid' => $jid];
            $toNode = new ProtocolNode('to', $hash, null, null);
            $toNodes[] = $toNode;
        }

        $broadcastNode = new ProtocolNode('broadcast', null, $toNodes, null);

        $msgId = $this->createMsgId();

        $messageNode = new ProtocolNode('message',
            [
                'to'   => time().'@broadcast',
                'type' => $type,
                'id'   => $msgId,
            ], [$node, $broadcastNode], null);

        $this->sendNode($messageNode);
        $this->waitForServer($msgId);
        //listen for response
        $this->eventManager()->fire('onSendMessage',
            [
                $this->phoneNumber,
                $targets,
                $msgId,
                $node,
            ]);

        return $msgId;
    }
333911
protected function numberData(SimpleXmlElement $xml, $node,  $type='latn')
    {

        if (!$xml->numbers) {
            return;
        }

        foreach ($xml->numbers->children() as $child) {
            if ( $child->getName() == $node && $child['numberSystem'] == $type) {
                return $child;
            }
            
        }
    }
739380
public function addDebugListener($listener, $type = "")
    {
        if (!Text::isEmpty($type) && !in_array($type, ["exec", "query"])) {
            throw new DbException("Invalid filter type. Valid filter types are 'exec' and 'query'");
        }
        
        $types = Text::isEmpty($type)? ["exec", "query"]: [$type];
        foreach ($types as $type) {
            $this->_debugger->on($type, $listener);
        }
    }
1162143
protected function extractNodeType($targetType, array $source)
    {
        if (isset($source['__nodeType'])) {
            $nodeTypeName = $source['__nodeType'];
        } else {
            $matches = [];
            preg_match(self::EXTRACT_CONTENT_TYPE_PATTERN, $targetType, $matches);
            if (isset($matches['nodeType'])) {
                $nodeTypeName = $matches['nodeType'];
            } else {
                $nodeTypeName = 'unstructured';
            }
        }
        return $this->nodeTypeManager->getNodeType($nodeTypeName);
    }
63492
public function createNode($type)
    {
        $node = new Node();
        $node->setType($type);
        $node->setCreated(new \DateTime());

        $event = new NodeCreateEvent($type, $node);
        $event = $this->dispatcher
            ->dispatch(NodeEvents::CREATE, $event);

        $entity = $event->getEntity();
        if (!$entity) {
            throw new \Exception('Not found.');
        }

        $entity->setNode($event->getNode());
        $entity->getNode()->setPublication(new NodePublication());

        return $entity;
    }
759695
public function publishTypeAndFields($typeId, $sourceVersion, $targetVersion)
    {
        $query = $this->dbHandler->createUpdateQuery();
        $query->update(
            $this->dbHandler->quoteTable('ezcontentclass')
        )->set(
            $this->dbHandler->quoteColumn('version'),
            $query->bindValue($targetVersion, null, \PDO::PARAM_INT)
        )->where(
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('id'),
                    $query->bindValue($typeId, null, \PDO::PARAM_INT)
                ),
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('version'),
                    $query->bindValue($sourceVersion, null, \PDO::PARAM_INT)
                )
            )
        );

        $query->prepare()->execute();

        $query = $this->dbHandler->createUpdateQuery();
        $query->update(
            $this->dbHandler->quoteTable('ezcontentclass_classgroup')
        )->set(
            $this->dbHandler->quoteColumn('contentclass_version'),
            $query->bindValue($targetVersion, null, \PDO::PARAM_INT)
        )->where(
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('contentclass_id'),
                    $query->bindValue($typeId, null, \PDO::PARAM_INT)
                ),
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('contentclass_version'),
                    $query->bindValue($sourceVersion, null, \PDO::PARAM_INT)
                )
            )
        );

        $query->prepare()->execute();

        $query = $this->dbHandler->createUpdateQuery();
        $query->update(
            $this->dbHandler->quoteTable('ezcontentclass_attribute')
        )->set(
            $this->dbHandler->quoteColumn('version'),
            $query->bindValue($targetVersion, null, \PDO::PARAM_INT)
        )->where(
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('contentclass_id'),
                    $query->bindValue($typeId, null, \PDO::PARAM_INT)
                ),
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('version'),
                    $query->bindValue($sourceVersion, null, \PDO::PARAM_INT)
                )
            )
        );

        $query->prepare()->execute();

        $query = $this->dbHandler->createUpdateQuery();
        $query->update(
            $this->dbHandler->quoteTable('ezcontentclass_name')
        )->set(
            $this->dbHandler->quoteColumn('contentclass_version'),
            $query->bindValue($targetVersion, null, \PDO::PARAM_INT)
        )->where(
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('contentclass_id'),
                    $query->bindValue($typeId, null, \PDO::PARAM_INT)
                ),
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('contentclass_version'),
                    $query->bindValue($sourceVersion, null, \PDO::PARAM_INT)
                )
            )
        );

        $query->prepare()->execute();

        $subQuery = $this->connection->createQueryBuilder();
        $subQuery
            ->select('attr.id as ezcontentclass_attribute_id')
            ->from('ezcontentclass_attribute', 'attr')
            ->where('attr.contentclass_id = :typeId')
            ->andWhere('attr.id = ezcontentclass_attribute_ml.contentclass_attribute_id');

        $mlDataPublishQuery = $this->connection->createQueryBuilder();
        $mlDataPublishQuery
            ->update('ezcontentclass_attribute_ml')
            ->set('version', ':newVersion')
            ->where(
                sprintf('EXISTS (%s)', $subQuery->getSQL())
            )
            ->andWhere('ezcontentclass_attribute_ml.version = :sourceVersion')
            ->setParameter('typeId', $typeId, ParameterType::INTEGER)
            ->setParameter('newVersion', $targetVersion, ParameterType::INTEGER)
            ->setParameter('sourceVersion', $sourceVersion, ParameterType::INTEGER);

        $mlDataPublishQuery->execute();
    }
1091356
public function sendDeleteBroadcastLists($lists)
    {
        $msgId = $this->createIqId();
        $listNode = [];
        if ($lists != null && count($lists) > 0) {
            for ($i = 0; $i < count($lists); $i++) {
                $listNode[$i] = new ProtocolNode('list', ['id' => $lists[$i]], null, null);
            }
        } else {
            $listNode = null;
        }
        $deleteNode = new ProtocolNode('delete', null, $listNode, null);
        $node = new ProtocolNode('iq',
            [
                'id'    => $msgId,
                'xmlns' => 'w:b',
                'type'  => 'set',
                'to'    => Constants::WHATSAPP_SERVER,
            ], [$deleteNode], null);

        $this->sendNode($node);
    }
443663
public function canHandle(\DOMNode $node, NodeInterface $target)
    {
        return strtolower($node->nodeName) == 'enclosure' && $target Instanceof ItemInterface;
    }
142832
public function send($type, $id = null, $endpoint = null, $message = null)
        {
            if (!is_int($type) || $type > 8) {
                throw new Exception('Socketio::send() type parameter must be an integer strictly inferior to 9.');
            }

            $raw_message = $type . ':' . $id . ':' . $endpoint . ':' . $message;
            $payload = new Payload();
            $payload->setOpcode(Payload::OPCODE_TEXT)
                ->setMask(true)
                ->setPayload($raw_message);

            $encoded = $payload->encodePayload();

            fwrite($this->fd, $encoded);

            // wait 100ms before closing connexion
            usleep(100 * 1000);

            $this->stdout('debug', 'Sent '.$raw_message);

            return $this;
        }
1182788
public function publishNodeAction(NodeInterface $node, Workspace $selectedWorkspace)
    {
        $this->publishingService->publishNode($node);
        $this->addFlashMessage($this->translator->translateById('workspaces.selectedChangeHasBeenPublished', [], null, null, 'Modules', 'Neos.Neos'));
        $this->redirect('show', null, null, ['workspace' => $selectedWorkspace]);
    }
1065773
public function executeNodeReactions($reaction_type, NodeInterface $node) {
    $provider = new NodeContextProvider($node);
    $provided = $provider->getRuntimeContexts([]);
    $this->contextManager->evaluateContexts($provided);

    // Fire off index reactions.
    foreach ($this->contextManager->getActiveReactions($reaction_type) as $reaction) {
      $reaction->execute($node);
    }
  }
1246514
function emitSerializedTypeReferenceNode(node) {
                var location = node.parent;
                while (ts.isDeclaration(location) || ts.isTypeNode(location)) {
                    location = location.parent;
                }
                // Clone the type name and parent it to a location outside of the current declaration.
                var typeName = ts.cloneEntityName(node.typeName, location);
                var result = resolver.getTypeReferenceSerializationKind(typeName);
                switch (result) {
                    case ts.TypeReferenceSerializationKind.Unknown:
                        var temp = createAndRecordTempVariable(0 /* Auto */);
                        write("(typeof (");
                        emitNodeWithoutSourceMap(temp);
                        write(" = ");
                        emitEntityNameAsExpression(typeName, /*useFallback*/ true);
                        write(") === 'function' && ");
                        emitNodeWithoutSourceMap(temp);
                        write(") || Object");
                        break;
                    case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:
                        emitEntityNameAsExpression(typeName, /*useFallback*/ false);
                        break;
                    case ts.TypeReferenceSerializationKind.VoidType:
                        write("void 0");
                        break;
                    case ts.TypeReferenceSerializationKind.BooleanType:
                        write("Boolean");
                        break;
                    case ts.TypeReferenceSerializationKind.NumberLikeType:
                        write("Number");
                        break;
                    case ts.TypeReferenceSerializationKind.StringLikeType:
                        write("String");
                        break;
                    case ts.TypeReferenceSerializationKind.ArrayLikeType:
                        write("Array");
                        break;
                    case ts.TypeReferenceSerializationKind.ESSymbolType:
                        if (languageVersion < 2 /* ES6 */) {
                            write("typeof Symbol === 'function' ? Symbol : Object");
                        }
                        else {
                            write("Symbol");
                        }
                        break;
                    case ts.TypeReferenceSerializationKind.TypeWithCallSignature:
                        write("Function");
                        break;
                    case ts.TypeReferenceSerializationKind.ObjectType:
                        write("Object");
                        break;
                }
            }
1314563
public function scopeWhereExtensionAttribute(Builder $query, $type, $key, $value)
    {
        // We do this for querying, searching and sorting with source attributes
        $this->setNodeTypeName($type);

        return $query->whereHas('nodeSourceExtensions', function (Builder $query) use ($key, $value)
        {
            $query->where(source_table_name($this->getNodeTypeName()) . '.' . $key, $value);
        });
    }
874028
protected function publishNodeCanBeSkipped(NodeInterface $node, Workspace $targetWorkspace)
    {
        if ($this->baseWorkspace === null) {
            return true;
        }
        if ($node->getWorkspace() !== $this) {
            return true;
        }
        // Might happen if a node which has been published during an earlier call of publishNode() is attempted to
        // be published again:
        if ($node->getWorkspace() === $targetWorkspace) {
            return true;
        }
        $this->verifyPublishingTargetWorkspace($targetWorkspace);
        if ($node->getPath() === '/') {
            return true;
        }

        return false;
    }
1365564
public function broadcast(array $channels, $event, array $payload = [])
    {
        $payload = ['event' => $event, 'data' => $payload];
        foreach ($channels as $channel) {
            if ($this->async)
                $this->fanout->publish_async($channel, $payload);
            else
                $this->fanout->publish($channel, $payload);
        }
    }
832838
public function send($exchange, $routing_key, $message, $type = self::TYPE_TOPIC)
    {
        $message = $this->prepareMessage($message);
        if ($type == self::TYPE_TOPIC) {
            $this->channel->exchange_declare($exchange, $type, false, true, false);
        }
        $this->channel->basic_publish($message, $exchange, $routing_key);
    }
805050
public function canHandle(\DOMNode $node, NodeInterface $target)
    {
        return strtolower($node->nodeName) == 'lastbuilddate' && $target instanceof FeedInterface;
    }