本文整理汇总了PHP中base类的典型用法代码示例。如果您正苦于以下问题:PHP base类的具体用法?PHP base怎么用?PHP base使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了base类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apply
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$structure = $databox->get_structure();
$DOM = new DOMDocument();
$DOM->loadXML($structure);
$xpath = new DOMXpath($DOM);
foreach ($xpath->query('/record/subdefs/subdefgroup[@name="video"]/subdef[@name="preview"]/acodec') as $node) {
$node->nodeValue = 'libvo_aacenc';
}
foreach ($xpath->query('/record/subdefs/subdefgroup[@name="video"]/subdef[@name="preview"]/vcodec') as $node) {
$node->nodeValue = 'libx264';
}
$databox->saveStructure($DOM);
$subdefgroups = $databox->get_subdef_structure();
foreach ($subdefgroups as $groupname => $subdefs) {
foreach ($subdefs as $name => $subdef) {
$this->addScreenDeviceOption($subdefgroups, $subdef, $groupname);
if (in_array($name, ['preview', 'thumbnail'])) {
if ($name == 'thumbnail' || $subdef->getSubdefType()->getType() != \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO) {
$this->addMobileSubdefImage($subdefgroups, $subdef, $groupname);
} else {
$this->addMobileSubdefVideo($subdefgroups, $subdef, $groupname);
}
}
if ($subdef->getSubdefType()->getType() != \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO) {
continue;
}
$this->addHtml5Video($subdefgroups, $subdef, $groupname);
}
}
return true;
}
示例2: apply
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$conn = $databox->get_connection();
$sql = 'SELECT value FROM pref WHERE prop = "structure"';
$stmt = $conn->prepare($sql);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if (!$result) {
throw new \RuntimeException('Unable to find structure');
}
$DOMDocument = new DOMDocument();
$DOMDocument->loadXML($result['value']);
$XPath = new DOMXPath($DOMDocument);
foreach ($XPath->query('/record/subdefs/subdefgroup/subdef/delay') as $delay) {
$delay->nodeValue = min(500, max(50, (int) $delay->nodeValue * 400));
}
foreach ($XPath->query('/record/subdefs/subdefgroup/subdef/acodc') as $acodec) {
if ($acodec->nodeValue == 'faac') {
$acodec->nodeValue = 'libvo_aacenc';
}
}
$sql = 'UPDATE pref SET value = :structure WHERE prop = "structure"';
$stmt = $conn->prepare($sql);
$stmt->execute([':structure' => $DOMDocument->saveXML()]);
$stmt->closeCursor();
return true;
}
示例3: apply
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
foreach ($databox->get_meta_structure() as $databox_field) {
$databox_field->save();
}
return true;
}
示例4: traer_opciones_menu
function traer_opciones_menu($padre = "", $nivel = 0)
{
$cdb = new base();
$salida = "";
$seleccion = array("id", "url", "titulo", "acceso");
$limitantes[] = array("", "estatus", "!=", "0");
if ($padre != "") {
$limitantes[] = array("and", "padre", "=", $padre);
} else {
$limitantes[] = array("and", "padre", "IS", $padre);
}
$tabla[] = "menu";
$cdb->set_referencia("posicion");
$cdb->set_forma("asc");
$respuesta = $cdb->seleccionar($seleccion, $limitantes, $tabla);
if ($respuesta['codigo'] == 1) {
if ($padre == "") {
$salida .= "<ul class=nav >";
} else {
$salida .= "<ul>";
}
for ($i = 0; $i < count($respuesta['mensaje']); $i++) {
$salida .= "<li><a href=\"" . $respuesta['mensaje'][$i]['url'] . "\" >" . $respuesta['mensaje'][$i]['titulo'] . "</a>";
$salida .= traer_opciones_menu($respuesta['mensaje'][$i]['id'], $nivel + 1);
$salida .= "</li>";
}
$salida .= "</ul>";
return $salida;
}
}
示例5: apply
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$dql = 'SELECT u FROM Phraseanet:User u WHERE u.nonce IS NULL';
$q = $app['orm.em']->createQuery($dql);
$q->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true);
$users = $q->getResult();
$n = 0;
foreach ($users as $user) {
$user->setNonce($app['random.medium']->generateString(64));
$app['orm.em']->persist($user);
$n++;
if ($n % 100 === 0) {
$app['orm.em']->flush();
}
}
$app['orm.em']->flush();
$sql = 'SELECT task_id, `class` FROM task2';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$sql = 'UPDATE task2 SET `class` = :class WHERE task_id = :task_id';
$stmt = $appbox->get_connection()->prepare($sql);
foreach ($rs as $row) {
if (strpos($row['class'], 'task_period_') !== false) {
continue;
}
$params = [':task_id' => $row['task_id'], ':class' => str_replace('task_', 'task_period_', $row['class'])];
$stmt->execute($params);
}
$stmt->closeCursor();
return true;
}
示例6: apply
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
if (!$this->hasSessionTable($app)) {
return true;
}
// Remove deleted users sessions
$sql = 'SELECT s.id FROM `Sessions` s INNER JOIN Users u ON (u.id = s.user_id) WHERE u.deleted = 1';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute();
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rows as $row) {
if (null !== ($session = $app['repo.sessions']->find($row['id']))) {
$app['orm.em']->remove($session);
}
}
// Remove API sessions
$query = $app['orm.em']->createQuery('SELECT s FROM Phraseanet:Session s WHERE s.user_agent LIKE :guzzle');
$query->setParameter(':guzzle', 'Guzzle%');
foreach ($query->getResult() as $session) {
$app['orm.em']->remove($session);
}
$app['orm.em']->flush();
return true;
}
示例7: apply
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$sql = 'DELETE FROM Tasks';
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
$sql = 'SELECT task_id, active, crashed, name, class, settings FROM task2';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row) {
try {
$job = $this->createJob($app, $row['class']);
} catch (\RuntimeException $e) {
continue;
}
$settings = simplexml_load_string($row['settings']);
$period = $job->getEditor()->getDefaultPeriod();
if ($settings->period) {
$period = (int) $settings->period;
unset($settings->period);
$row['settings'] = $settings->asXML();
}
$task = new Task();
$task->setCrashed($row['crashed'])->setJobId($job->getJobId())->setName($row['name'])->setPeriod($period)->setSettings($row['settings'])->setStatus($row['active'] ? Task::STATUS_STARTED : Task::STATUS_STOPPED);
$app['EM']->persist($task);
}
$app['EM']->flush();
}
示例8: apply
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$sql = "UPDATE log_docs SET `action`='mail' WHERE `action`='download' AND LOCATE('@', comment)";
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
return true;
}
示例9: apply
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$sql = 'SELECT id, src FROM metadatas_structure';
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$update = [];
$tagDirname = new \Alchemy\Phrasea\Metadata\Tag\TfDirname();
$tagBasename = new \Alchemy\Phrasea\Metadata\Tag\TfBasename();
foreach ($rs as $row) {
if (strpos(strtolower($row['src']), 'tf-parentdir') !== false) {
$update[] = ['id' => $row['id'], 'src' => $tagDirname->getTagname()];
}
if (strpos(strtolower($row['src']), 'tf-filename') !== false) {
$update[] = ['id' => $row['id'], 'src' => $tagBasename->getTagname()];
}
}
$sql = 'UPDATE metadatas_structure SET src = :src
WHERE id = :id';
$stmt = $databox->get_connection()->prepare($sql);
foreach ($update as $row) {
$stmt->execute([':src' => $row['src'], ':id' => $row['id']]);
}
$stmt->closeCursor();
return true;
}
示例10: apply
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$sql = "UPDATE metadatas_structure SET `aggregable`=20 WHERE `aggregable`=1";
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
return true;
}
示例11: apply
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$sql = 'SELECT `key`, `value` FROM `registry`
WHERE `key` = "GV_X_Accel_Redirect"
OR `key` = "GV_X_Accel_Redirect_mount_point"
OR `key` = "GV_modxsendfile"';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute();
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
$registry = ['GV_X_Accel_Redirect' => null, 'GV_X_Accel_Redirect_mount_point' => null, 'GV_modxsendfile' => null];
foreach ($rows as $row) {
$registry[$row['key']] = $row['value'];
}
$xsendfilePath = $registry['GV_X_Accel_Redirect'];
$xsendfileMountPoint = $registry['GV_X_Accel_Redirect_mount_point'];
$config = $app['configuration.store']->setDefault('xsendfile')->getConfig();
$config['xsendfile']['enabled'] = (bool) $registry['GV_modxsendfile'];
$config['xsendfile']['type'] = $config['xsendfile']['enabled'] ? 'nginx' : '';
if (null !== $xsendfilePath && null !== $xsendfileMountPoint) {
$config['xsendfile']['mapping'] = [['directory' => $xsendfilePath, 'mount-point' => $xsendfileMountPoint]];
}
$app['configuration.store']->setConfig($config);
$toRemove = ['GV_X_Accel_Redirect', 'GV_X_Accel_Redirect_mount_point', 'GV_modxsendfile'];
$sql = 'DELETE FROM registry WHERE `key` = :k';
$stmt = $appbox->get_connection()->prepare($sql);
foreach ($toRemove as $registryKey) {
$stmt->execute([':k' => $registryKey]);
}
$stmt->closeCursor();
return true;
}
示例12: get
public static function get()
{
$base = new base(Config::$driver);
$base->setup(Config::$host, Config::$user, Config::$pass, Config::$base);
$base->record_style('fields');
$base->debug_on(Config::$debug);
return $base;
}
示例13: guardar_multiple
function guardar_multiple($id, $datos, $tabla)
{
$cdb = new base();
foreach ($datos as $dato) {
$respuesta = $cdb->insertar(array("negocio" => $id, "categoria" => $dato, "estatus" => "1"), $tabla, "0");
}
return $respuesta;
}
示例14: apply
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$sql = 'DELETE FROM basusr WHERE actif = "0"';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
return true;
}
示例15: apply
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$sql = 'UPDATE record SET parent_record_id = "1"
WHERE parent_record_id != "0"';
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
return true;
}