本文整理汇总了PHP中Core::make方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::make方法的具体用法?PHP Core::make怎么用?PHP Core::make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::make方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view()
{
$db = Loader::db();
$r = $db->query("SELECT * FROM btProBlogSettings");
while ($row = $r->fetchrow()) {
$this->set('tweet', $row['tweet']);
$this->set('google', $row['google']);
$this->set('fb_like', $row['fb_like']);
$this->set('addthis', $row['addthis']);
$this->set('sharethis', $row['sharethis']);
$this->set('embedly', $row['embedly']);
$this->set('alchemy', $row['alchemy']);
$this->set('author', $row['author']);
$this->set('comments', $row['comments']);
$this->set('trackback', $row['trackback']);
$this->set('canonical', $row['canonical']);
$this->set('search_path', $row['search_path']);
$this->set('mobile_path', $row['mobile_path']);
$this->set('disqus', $row['disqus']);
$this->set('icon_color', $row['icon_color']);
$this->set('thumb_width', $row['thumb_width']);
$this->set('thumb_height', $row['thumb_height']);
$this->set('ctID', $row['ctID']);
$this->set('breakSyntax', $row['breakSyntax']);
$this->set('pageTemplate', $row['pageTemplate']);
}
$this->set('pageTemplates', $this->getPageTemplates());
// $request = \Request::getInstance();
// $session = $request->getSession();
// if(!$session) {
// $session = new SymfonySession();
// }
$this->set('session', \Core::make('session'));
}
示例2: view
public function view()
{
session_write_close();
$keywords = $_REQUEST['q'];
$pl = new \PageList();
$pl->filterByName($keywords);
$pl->sortBy('cID', 'asc');
$pl->setItemsPerPage(5);
$pl->setPermissionsChecker(function ($page) {
$pp = new \Permissions($page);
return $pp->canViewPageInSitemap();
});
$pagination = $pl->getPagination();
$pages = $pagination->getCurrentPageResults();
$results = array();
$nh = \Core::make('helper/navigation');
foreach ($pages as $c) {
$obj = new \stdClass();
$obj->href = $nh->getLinkToCollection($c);
$obj->cID = $c->getCollectionID();
$obj->name = $c->getCollectionName();
$results[] = $obj;
}
echo json_encode($results);
\Core::shutdown(array('jobs' => true));
}
示例3: getService
/**
* @return Community
*/
public function getService()
{
if (!$this->service) {
$this->service = \Core::make('authentication/community');
}
return $this->service;
}
示例4: up
public function up(Schema $schema)
{
\Concrete\Core\Database\Schema\Schema::refreshCoreXMLSchema(array('Stacks'));
if (\Core::make('multilingual/detector')->isEnabled()) {
StackList::rescanMultilingualStacks();
}
}
示例5: action
public function action()
{
$token = isset($this->validationToken) ? $this->validationToken : get_class($this);
$url = call_user_func_array('parent::action', func_get_args());
$url .= '?ccm_token=' . \Core::make('helper/validation/token')->generate($token);
return $url;
}
示例6: process
public static function process($source, $process = array())
{
$args = func_get_args();
if (count($args) > 2) {
$process = array_slice($args, 1);
}
if (empty($process)) {
return $source;
}
$process = (array) $process;
foreach ($process as $name => $config) {
if (is_int($name) && is_string($config)) {
$name = $config;
$config = array();
} else {
if (is_int($name) && is_array($config)) {
$source = self::process($source, $config);
}
}
if (!isset(self::$process[$name])) {
continue;
}
if (!is_string(self::$process[$name])) {
$source = Core::invoke(self::$process[$name], array($source));
} else {
$p = Core::make(self::$process[$name]);
if (!Core_Types::is_subclass_of('Text.Process.ProcessInterface', $p)) {
continue;
}
$p->configure($config);
$source = $p->process($source);
}
}
return $source;
}
示例7: getObjectCollection
public function getObjectCollection(\SimpleXMLElement $element)
{
$manager = \Core::make('migration/manager/import/attribute/key');
$categoryManager = \Core::make('migration/manager/import/attribute/category');
$collection = new AttributeKeyObjectCollection();
if ($element->attributekeys->attributekey) {
foreach ($element->attributekeys->attributekey as $node) {
$importer = $manager->driver((string) $node['type']);
$key = $importer->getEntity();
$key->setHandle((string) $node['handle']);
$key->setName((string) $node['name']);
$key->setPackage((string) $node['package']);
$categoryImporter = $categoryManager->driver((string) $node['category']);
$category = $categoryImporter->getEntity();
$categoryImporter->loadFromXml($category, $node);
$key->setCategory($category);
if ((string) $node['indexed'] == 1) {
$key->setIsIndexed(true);
}
if ((string) $node['internal'] == 1) {
$key->setIsInternal(true);
}
if ((string) $node['searchable'] == 1) {
$key->setIsSearchable(true);
}
$importer->loadFromXml($key, $node);
$collection->getKeys()->add($key);
$key->setCollection($collection);
}
}
return $collection;
}
示例8: getObjectCollection
public function getObjectCollection(\SimpleXMLElement $element)
{
$manager = \Core::make('migration/manager/import/permission/access_entity');
$collection = new KeyObjectCollection();
if ($element->permissionkeys->permissionkey) {
foreach ($element->permissionkeys->permissionkey as $node) {
$key = new Key();
$key->setHandle((string) $node['handle']);
$key->setName((string) $node['name']);
$key->setPackage((string) $node['package']);
$key->setCategory((string) $node['category']);
if ((string) $node['can-trigger-workflow']) {
$key->setCanTriggerWorkflow(true);
}
if ((string) $node['has-custom-class']) {
$key->setHasCustomClass(true);
}
if (isset($node->access)) {
foreach ($node->access->children() as $ch) {
if ($ch->getName() == 'entity') {
$importer = $manager->driver((string) $ch['type']);
$entity = $importer->getEntity();
$entity->setEntityType((string) $ch['type']);
$importer->loadFromXml($entity, $ch);
$entity->setKey($key);
$key->getAccessEntities()->add($entity);
}
}
}
$collection->getKeys()->add($key);
$key->setCollection($collection);
}
}
return $collection;
}
示例9: storage
public function storage()
{
if (!self::$storage_object) {
self::$storage_object = Core::make(self::$storage);
}
return self::$storage_object;
}
示例10: quickSelect
public function quickSelect($key, $cID = false, $args = array())
{
$v = \View::getInstance();
$v->requireAsset('selectize');
$selectedCID = 0;
if (isset($_REQUEST[$key])) {
$selectedCID = $_REQUEST[$key];
} else {
if ($cID > 0) {
$selectedCID = $cID;
}
}
$cName = '';
if ($selectedCID > 0) {
$oc = Page::getByID($selectedCID);
$cp = new Permissions($oc);
if ($cp->canViewPage()) {
$cName = $oc->getCollectionName();
}
}
$valt = Core::make('helper/validation/token');
$token = $valt->generate('quick_page_select_' . $key);
$html = "\n\t\t<script type=\"text/javascript\">\n\t\t\$(function () {\n\t\t\t\$('#ccm-quick-page-selector-" . $key . " input').unbind().selectize({\n valueField: 'value',\n labelField: 'label',\n searchField: ['label'],";
if ($selectedCID) {
$html .= "options: [{'label': '" . h($cName) . "', 'value': " . intval($selectedCID) . "}],\n\t\t\t\titems: [" . intval($selectedCID) . "],";
}
$html .= "maxItems: 1,\n load: function(query, callback) {\n if (!query.length) return callback();\n \$.ajax({\n url: '" . REL_DIR_FILES_TOOLS_REQUIRED . "/pages/autocomplete?key=" . $key . "&token=" . $token . "&term=' + encodeURIComponent(query),\n type: 'GET',\n\t\t\t\t\t\tdataType: 'json',\n error: function() {\n callback();\n },\n success: function(res) {\n callback(res);\n }\n });\n }\n\t\t });\n\t\t} );\n\t\t</script>";
$form = \Core::make("helper/form");
$html .= '<span id="ccm-quick-page-selector-' . $key . '">' . $form->hidden($key, '', $args) . '</span>';
return $html;
}
示例11: update_profiles
public function update_profiles()
{
/** @var Token $token */
$token = \Core::make('token');
if (!$token->validate("update_profile")) {
$this->error->add('Invalid Token.');
return;
}
if ($this->isPost()) {
$config = $this->getSite()->getConfigRepository();
$config->save('user.profiles_enabled', $this->post('public_profiles') ? true : false);
$config->save('user.gravatar.enabled', $this->post('gravatar_fallback') ? true : false);
$config->save('user.gravatar.max_level', Loader::helper('security')->sanitizeString($this->post('gravatar_max_level')));
$config->save('user.gravatar.image_set', Loader::helper('security')->sanitizeString($this->post('gravatar_image_set')));
// $message = ($this->post('public_profiles')?t('Public profiles have been enabled'):t('Public profiles have been disabled.'));
if ($this->post('public_profiles')) {
Single::add('/members');
$c = Single::add('/members/profile');
Single::add('/members/directory');
$c->update(['cName' => 'View Profile']);
$this->redirect('/dashboard/system/registration/profiles/profiles_enabled');
} else {
foreach ($this->app->make('site')->getList() as $site) {
foreach (['/members/directory', '/members/profile', '/members'] as $path) {
$c = \Page::getByPath($path, 'RECENT', $site);
$c->delete();
}
}
$this->redirect('/dashboard/system/registration/profiles/profiles_disabled');
}
}
}
示例12: getPrettyUrlRule
/**
* @return RuleInterface
*/
protected function getPrettyUrlRule()
{
$rule = new Rule(function (Rule $rule) {
$DIR_REL = $rule->getOption('dir_rel')->getValue();
if ($DIR_REL === null) {
if (\Core::make('app')->isRunThroughCommandLineInterface()) {
throw new Exception(t('When executed from the command line, you need to specify the %s option', 'dir_rel'));
} else {
$DIR_REL = DIR_REL;
}
}
$DIR_REL = trim((string) $DIR_REL, '/');
if ($DIR_REL !== '') {
$DIR_REL = '/' . $DIR_REL;
}
$DISPATCHER_FILENAME = DISPATCHER_FILENAME;
return <<<EOT
<IfModule mod_rewrite.c>
\tRewriteEngine On
\tRewriteBase {$DIR_REL}/
\tRewriteCond %{REQUEST_FILENAME} !-f
\tRewriteCond %{REQUEST_FILENAME}/index.html !-f
\tRewriteCond %{REQUEST_FILENAME}/index.php !-f
\tRewriteRule . {$DISPATCHER_FILENAME} [L]
</IfModule>
EOT;
}, function () {
return (bool) \Config::get('concrete.seo.url_rewriting');
}, "# -- concrete5 urls start --", "# -- concrete5 urls end --");
$option = new RuleOption(t('concrete5 path relative to website root'), function () {
return \Core::make('app')->isRunThroughCommandLineInterface();
});
$rule->addOption('dir_rel', $option);
return $rule;
}
示例13: fixTrackingCode
protected function fixTrackingCode()
{
$this->output(t('Updating tracking code.'));
$service = \Core::make('site');
$site = $service->getDefault();
$config = $site->getConfigRepository();
$proceed = true;
$tracking = $config->get('seo.tracking');
if (is_array($tracking) && isset($tracking['header']) && $tracking['header']) {
$proceed = false;
}
if (is_array($tracking) && isset($tracking['footer']) && $tracking['footer']) {
$proceed = false;
}
if ($proceed) {
// we saved it in the wrong place on the 8.0 upgrade.
$tracking = (array) \Config::get('concrete.seo.tracking', []);
$trackingCode = array_get($tracking, 'code');
if (!is_array($trackingCode)) {
array_set($tracking, 'code', ['header' => '', 'footer' => '']);
$trackingCode = (string) $trackingCode;
switch (array_get($tracking, 'code_position')) {
case 'top':
array_set($tracking, 'code.header', $trackingCode);
break;
case 'bottom':
default:
array_set($tracking, 'code.footer', $trackingCode);
break;
}
}
unset($tracking['code_position']);
$config->save('seo.tracking', $tracking);
}
}
示例14: transform
public function transform($entity, ItemInterface $item, TargetItem $targetItem, Batch $batch)
{
$mapper = new \PortlandLabs\Concrete5\MigrationTool\Batch\ContentMapper\Type\Attribute();
$ak = $mapper->getTargetItemContentObject($targetItem);
if (is_object($ak)) {
$type = $ak->getAttributeKeyType()->getAttributeTypeHandle();
} else {
$collection = $batch->getObjectCollection('attribute_key');
foreach ($collection->getKeys() as $key) {
if ($key->getHandle() == $item->getIdentifier()) {
$type = $key->getType();
break;
}
}
}
if (isset($type)) {
$manager = \Core::make('migration/manager/import/attribute/value');
try {
$driver = $manager->driver($type);
} catch (\Exception $e) {
}
if (isset($driver)) {
$xml = simplexml_load_string($entity->getValue());
$value = $driver->parse($xml);
$attribute = $entity->getAttribute();
$attribute->setAttributeValue($value);
$manager = \ORM::entityManager('migration_tools');
$manager->persist($attribute);
$manager->remove($entity);
$manager->flush();
}
}
}
示例15: getService
/**
* @return Facebook
*/
public function getService()
{
if (!$this->service) {
$this->service = \Core::make('authentication/facebook');
}
return $this->service;
}