当前位置: 首页>>代码示例>>PHP>>正文


PHP modX::addExtensionPackage方法代码示例

本文整理汇总了PHP中modX::addExtensionPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP modX::addExtensionPackage方法的具体用法?PHP modX::addExtensionPackage怎么用?PHP modX::addExtensionPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在modX的用法示例。


在下文中一共展示了modX::addExtensionPackage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: modX

/**
 * Use this script to add your extension package to MODX's "radar".
 * This should only need to be done once.
 * Note that we have to instantiate MODX: xPDO is not sufficient
 * because we're running functions that exist only in MODX, not in the 
 * underlying xPDO framework.
 *
 * USAGE:
 * 1. Copy this file into the docroot (web root) of your MODX installation.
 * 2. Execute the file by visiting it in a browser, e.g. http://yoursite.com/add_extension.php
 */
//------------------------------------------------------------------------------
//! CONFIGURATION
//------------------------------------------------------------------------------
// Your package shortname:
$package_name = '';
//------------------------------------------------------------------------------
//  DO NOT TOUCH BELOW THIS LINE
//------------------------------------------------------------------------------
define('MODX_API_MODE', true);
require_once 'index.php';
if (!defined('MODX_CORE_PATH')) {
    print '<p>MODX_CORE_PATH not defined! Did you put this script in the web root of your MODX installation?</p>';
    exit;
}
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->addExtensionPackage($package_name, "[[++core_path]]components/{$package_name}/model/");
print 'Success!';
开发者ID:idcooldi,项目名称:modx_utils,代码行数:31,代码来源:add_ext_pkg.php

示例2: die

if (!file_exists(dirname(dirname(__FILE__)) . '/config.core.php')) {
    die('ERROR: missing ' . dirname(dirname(__FILE__)) . '/config.core.php file defining the MODX core path.');
}
echo "<pre>";
/* Boot up MODX */
echo "Loading modX...\n";
require_once dirname(dirname(__FILE__)) . '/config.core.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
echo "Initializing manager...\n";
$modx->initialize('mgr');
$modx->getService('error', 'error.modError', '', '');
$componentPath = dirname(dirname(__FILE__));
$FlickrSource = $modx->getService('flickrsource', 'FlickrSource', $componentPath . '/core/components/flickrsource/model/flickrsource/', array('flickrsource.core_path' => $componentPath . '/core/components/flickrsource/'));
/* Extension Package */
$modx->addExtensionPackage('flickrsource', $componentPath . '/core/components/flickrsource/model/');
/* Namespace */
if (!createObject('modNamespace', array('name' => 'flickrsource', 'path' => $componentPath . '/core/components/flickrsource/', 'assets_path' => $componentPath . '/assets/components/flickrsource/'), 'name', false)) {
    echo "Error creating namespace flickrsource.\n";
}
/* Path settings */
if (!createObject('modSystemSetting', array('key' => 'flickrsource.core_path', 'value' => $componentPath . '/core/components/flickrsource/', 'xtype' => 'textfield', 'namespace' => 'flickrsource', 'area' => 'Paths', 'editedon' => time()), 'key', false)) {
    echo "Error creating flickrsource.core_path setting.\n";
}
if (!createObject('modSystemSetting', array('key' => 'flickrsource.assets_path', 'value' => $componentPath . '/assets/components/flickrsource/', 'xtype' => 'textfield', 'namespace' => 'flickrsource', 'area' => 'Paths', 'editedon' => time()), 'key', false)) {
    echo "Error creating flickrsource.assets_path setting.\n";
}
/* Fetch assets url */
$url = 'http';
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
    $url .= 's';
开发者ID:exside,项目名称:FlickrSource,代码行数:31,代码来源:index.php


注:本文中的modX::addExtensionPackage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。