本文整理汇总了PHP中gpPlugin类的典型用法代码示例。如果您正苦于以下问题:PHP gpPlugin类的具体用法?PHP gpPlugin怎么用?PHP gpPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了gpPlugin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($text)
{
parent::__construct($text);
$this->dom_array = gpPlugin::Filter('Html_Output', array($this->dom_array));
$this->Clean();
$this->Rebuild();
}
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:7,代码来源:HTML_Output.php
示例2: gp_html_output
function gp_html_output($text)
{
$this->gp_html_parse($text);
$this->dom_array = gpPlugin::Filter('Html_Output', array($this->dom_array));
$this->Clean();
$this->Rebuild();
}
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:7,代码来源:HTML_Output.php
示例3: Example_Ajax
function Example_Ajax()
{
global $page, $addonRelativeCode;
//prepare the page
$page->head_js[] = $addonRelativeCode . 'static/02_script.js';
$page->admin_js = true;
//get request parameters and execute any commands
$string = '';
if (isset($_REQUEST['string'])) {
$string = $_REQUEST['string'];
}
$cmd = common::GetCommand();
switch ($cmd) {
case 'randomstring':
$string = common::RandomString(10);
break;
}
//display the form
echo '<h2>Example Ajax Requests</h2>';
echo '<form method="post" action="' . $page->title . '">';
echo 'Text: <input type="text" name="string" value="' . htmlspecialchars($string) . '" size="30" />';
echo ' <input type="submit" class="gpajax" value="Post Form Asynchronosly" /> ';
echo common::Link($page->title, 'Get Random String', 'cmd=randomstring', 'name="gpajax"');
echo '</form>';
//output the $_REQUEST variable
echo '<h3>Request</h3>';
echo showArray($_REQUEST);
//plugin example navigation
gpPlugin::incl('navigation.php');
PluginExampleNavigation();
}
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:31,代码来源:02_Ajax.php
示例4: Check
/**
* Verify the user submitted form by checking anti-spam hooks and/or recaptcha if they exist
* @static
*
*/
static function Check()
{
global $page, $langmessage, $config, $dataDir;
// if hooks return false, stop
if (!gpPlugin::Filter('AntiSpam_Check', array(true))) {
return false;
}
// if recaptcha inactive, stop
if (!gp_recaptcha::hasRecaptcha()) {
return true;
}
//prevent undefined index warnings if there is a bot
$_POST += array('recaptcha_challenge_field' => '', 'recaptcha_response_field' => '');
//includeFile('thirdparty/recaptchalib.php');
require_once $dataDir . '/include/thirdparty/recaptchalib.php';
$resp = recaptcha_check_answer($config['recaptcha_private'], $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
if (!$resp->is_valid) {
message($langmessage['INCORRECT_CAPTCHA']);
//if( common::LoggedIn() ){
// message($langmessage['recaptcha_said'],$resp->error);
//}
return false;
}
return true;
}
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:30,代码来源:recaptcha.php
示例5: Save
function Save()
{
global $langmessage;
$theme =& $_POST['theme'];
if (isset($this->themes[$theme])) {
$this->config['theme'] = $theme;
}
if (gpPlugin::SaveConfig($this->config)) {
message($langmessage['SAVED']);
} else {
message($langmessage['OOPS']);
}
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:13,代码来源:Admin.php
示例6: GetContent
function GetContent()
{
$this->GetGpxContent();
if (!empty($this->non_admin_content)) {
echo '<div class="filetype-text cf">';
//echo '<div id="gpx_content" class="filetype-text">'; //id="gpx_content" conflicts with admin content
echo $this->non_admin_content;
echo '</div>';
}
echo '<div id="gpAfterContent">';
gpOutput::Get('AfterContent');
gpPlugin::Action('GetContent_After');
echo '</div>';
}
开发者ID:jdearaujo,项目名称:gpEasy-CMS,代码行数:14,代码来源:admin_display.php
示例7: RunScript
function RunScript()
{
global $gp_index, $langmessage, $page;
$scriptinfo = special_display::GetScriptInfo($this->title);
if ($scriptinfo === false) {
switch ($this->title) {
case 'Special_ExtraJS':
$this->ExtraJS();
//dies
}
$this->Error_404($this->title);
return;
}
$this->gp_index = $gp_index[$this->title];
$this->TitleInfo = $scriptinfo;
$menu_permissions = false;
if (common::LoggedIn()) {
$menu_permissions = admin_tools::HasPermission('Admin_Menu');
if ($menu_permissions) {
$page->admin_links[] = common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', 'data-cmd="gpajax"');
$page->admin_links[] = common::Link('Admin_Menu', $langmessage['current_layout'], 'cmd=layout&from=page&index=' . urlencode($this->gp_index), array('title' => $langmessage['current_layout'], 'data-cmd' => 'gpabox'));
}
if (admin_tools::HasPermission('Admin_User')) {
$page->admin_links[] = common::Link('Admin_Users', $langmessage['permissions'], 'cmd=file_permissions&index=' . urlencode($this->gp_index), array('title' => $langmessage['permissions'], 'data-cmd' => 'gpabox'));
}
}
//allow addons to affect page actions and how a page is displayed
$cmd = common::GetCommand();
$cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
if ($cmd !== $cmd_after) {
$cmd = $cmd_after;
if ($cmd === 'return') {
return;
}
}
if ($menu_permissions) {
switch ($cmd) {
// rename & details
case 'renameform':
$this->RenameForm();
return;
case 'renameit':
if ($this->RenameFile()) {
return;
}
break;
}
}
$this->contentBuffer = special_display::ExecInfo($scriptinfo);
}
开发者ID:Knuzen,项目名称:gpEasy-CMS,代码行数:50,代码来源:special.php
示例8: RunScript
function RunScript()
{
global $gp_index, $langmessage, $page;
$scriptinfo = special_display::GetScriptInfo($this->title);
if ($scriptinfo === false) {
switch ($this->title) {
case 'Special_ExtraJS':
$this->ExtraJS();
//dies
}
$this->Error_404($this->title);
return;
}
$this->gp_index = $gp_index[$this->title];
$this->TitleInfo = $scriptinfo;
if (!$this->CheckVisibility()) {
return false;
}
//allow addons to affect page actions and how a page is displayed
$cmd = common::GetCommand();
$cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
if ($cmd !== $cmd_after) {
$cmd = $cmd_after;
if ($cmd === 'return') {
return;
}
}
if (common::LoggedIn()) {
$menu_permissions = admin_tools::HasPermission('Admin_Menu');
if ($menu_permissions) {
switch ($cmd) {
// rename & details
case 'renameform':
$this->RenameForm();
return;
case 'renameit':
if ($this->RenameFile()) {
return;
}
break;
case 'ToggleVisibility':
$this->ToggleVisibility();
break;
}
}
$this->AdminLinks();
}
$this->contentBuffer = special_display::ExecInfo($scriptinfo);
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:49,代码来源:special.php
示例9: Example_Map
function Example_Map()
{
global $page, $addonRelativeCode;
//add css and js to <head>
$page->head .= '<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />';
$page->head .= '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=en"></script>';
$page->head .= '<script type="text/javascript" src="' . $addonRelativeCode . '/static/01_script.js"></script>';
//html contents of the page
echo '<h2>Display a Google Map With Directions</h2>';
echo '<div id="input">';
echo '<input id="map_address" type="textbox" value="starting point" />';
echo '<input type="button" value="calculate route" id="calc_route_button" />';
echo '</div>';
echo '<div id="directionsPanel" style="float:right;width:300px;"></div>';
echo '<div id="map_canvas" style="width:500px;height:500px;"></div>';
//plugin example navigation
gpPlugin::incl('navigation.php');
PluginExampleNavigation();
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:19,代码来源:01_Map.php
示例10: Check
/**
* Verify the user submitted form by checking anti-spam hooks and/or recaptcha if they exist
* @static
*
*/
static function Check()
{
global $page, $langmessage, $config, $dataDir;
// if hooks return false, stop
if (!gpPlugin::Filter('AntiSpam_Check', array(true))) {
return false;
}
// if recaptcha inactive, stop
if (!gp_recaptcha::hasRecaptcha()) {
return true;
}
if (empty($_POST['g-recaptcha-response'])) {
return false;
}
require_once $dataDir . '/include/thirdparty/recaptcha/autoload.php';
if (!ini_get('allow_url_fopen')) {
// allow_url_fopen = Off
$recaptcha = new \ReCaptcha\ReCaptcha($config['recaptcha_private'], new \ReCaptcha\RequestMethod\SocketPost());
} else {
// allow_url_fopen = On
$recaptcha = new \ReCaptcha\ReCaptcha($config['recaptcha_private']);
}
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $ip);
if (!$resp->isSuccess()) {
//$error_codes = $resp->getErrorCodes();
//error_log();
msg($langmessage['INCORRECT_CAPTCHA']);
return false;
}
return true;
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:43,代码来源:recaptcha.php
示例11: defined
<?php
defined('is_running') or die('Not an entry point...');
gpPlugin::Incl('Common.php');
class MultiLang_Admin extends MultiLang_Common
{
protected $cmds = array();
//executable commands
public function __construct()
{
global $config;
$config += array('menus' => array());
parent::__construct();
$this->AddResources();
$this->cmds['TitleSettingsSave'] = '';
$this->cmds['TitleSettings'] = '';
$this->cmds['RemoveTitle'] = 'TitleSettings';
$this->cmds['NotTranslated'] = '';
$this->cmds['SaveLanguages'] = 'SelectLanguages';
$this->cmds['SelectLanguages'] = '';
$this->cmds['PrimaryLanguage'] = '';
$this->cmds['PrimaryLanguageSave'] = 'DefaultDisplay';
$this->cmds['AllTitles'] = '';
$cmd = common::GetCommand();
$this->RunCommands($cmd);
}
/**
* Run Commands
* See \gp\Base::RunCommands() (available in TS 5.0)
*
*/
开发者ID:Typesetter,项目名称:Multi-Language,代码行数:31,代码来源:Admin.php
示例12: GetContent
function GetContent()
{
$this->GetGpxContent();
echo '<div id="gpAfterContent">';
gpOutput::Get('AfterContent');
gpPlugin::Action('GetContent_After');
echo '</div>';
}
开发者ID:jozefkrz,项目名称:gpEasy-CMS,代码行数:8,代码来源:display.php
示例13: defined
<?php
defined('is_running') or die('Not an entry point...');
gpPlugin::incl('SimpleBlogCommon.php', 'require_once');
class SimpleBlogCategories
{
function SimpleBlogCategories()
{
global $addonPathData;
SimpleBlogCommon::AddCSS();
$gadget_file = $addonPathData . '/gadget_categories.php';
$content = '';
if (file_exists($gadget_file)) {
$content = file_get_contents($gadget_file);
}
//fix edit links
if (strpos($content, 'simple_blog_gadget_label')) {
new SimpleBlogCommon();
$content = file_get_contents($gadget_file);
}
if (empty($content)) {
return;
}
echo '<div class="simple_blog_gadget"><div>';
echo '<span class="simple_blog_gadget_label">';
echo gpOutput::GetAddonText('Categories');
echo '</span>';
echo $content;
echo '</div></div>';
}
}
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:31,代码来源:CategoriesGadget.php
示例14: CheckContent
/**
* Add syntax highlighting to the page
* Check for <pre class="brush:jscript;">.. php...
* Add the appropriate js and css files
*
*/
static function CheckContent()
{
global $page, $addonRelativeCode;
$content = ob_get_contents();
$avail_brushes['css'] = 'shBrushCss.js';
$avail_brushes['diff'] = 'shBrushDiff.js';
$avail_brushes['ini'] = 'shBrushIni.js';
$avail_brushes['jscript'] = 'shBrushJScript.js';
$avail_brushes['php'] = 'shBrushPhp.js';
$avail_brushes['plain'] = 'shBrushPlain.js';
$avail_brushes['sql'] = 'shBrushSql.js';
$avail_brushes['xml'] = 'shBrushXml.js';
$brushes = array();
preg_match_all('#<pre[^<>]*>#', $content, $matches);
if (!count($matches)) {
return;
}
foreach ($matches[0] as $match) {
preg_match('#class=[\'"]([^\'"]+)[\'"]#', $match, $classes);
if (!isset($classes[1])) {
continue;
}
preg_match('#brush:([^;\'"]+)[;"\']?#', $match, $type);
if (!isset($type[1])) {
continue;
}
$type = strtolower(trim($type[1]));
if (!isset($avail_brushes[$type])) {
continue;
}
$brushes[] = $avail_brushes[$type];
}
if (!count($brushes)) {
return;
}
$config = gpPlugin::GetConfig();
$theme =& $config['theme'];
$page->head .= "\n\n";
$page->head .= '<link rel="stylesheet" type="text/css" href="' . $addonRelativeCode . '/syntaxhighlighter/styles/shCore.css" />' . "\n";
$css_file = 'shThemeDefault.css';
switch ($theme) {
case 'django':
$css_file = 'shThemeDjango.css';
break;
case 'eclipse':
$css_file = 'shThemeEclipse.css';
break;
case 'emacs':
$css_file = 'shThemeEmacs.css';
break;
case 'fadetogrey':
$css_file = 'shThemeFadeToGrey.css';
break;
case 'midnight':
$css_file = 'shThemeMidnight.css';
break;
case 'rdark':
$css_file = 'shThemeRDark.css';
break;
case 'none':
$css_file = false;
break;
}
if ($css_file) {
$page->head .= '<link rel="stylesheet" type="text/css" href="' . $addonRelativeCode . '/syntaxhighlighter/styles/' . $css_file . '" />' . "\n";
}
$page->head .= '<script language="javascript" type="text/javascript" src="' . $addonRelativeCode . '/syntaxhighlighter/scripts/shCore.js"></script>' . "\n";
foreach ($brushes as $brush) {
$page->head .= '<script language="javascript" type="text/javascript" src="' . $addonRelativeCode . '/syntaxhighlighter/scripts/' . $brush . '"></script>' . "\n";
}
$page->jQueryCode .= "\nSyntaxHighlighter.all();\n";
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:78,代码来源:HighlighterPlugin.php
示例15: PostedSlug
/**
* Clean a slug posted by the user
* @param string $slug The slug provided by the user
* @return string
* @since 2.4b5
*/
static function PostedSlug($string, $from_label = false)
{
global $config;
includeFile('tool/strings.php');
$orig_string = $string;
// Remove control characters
$string = preg_replace('#[[:cntrl:]]#u', '', $string);
// [\x00-\x1F\x7F]
//illegal characters
$string = str_replace(array('?', '*', ':', '|'), array('', '', '', ''), $string);
//change known entities to their character equivalent
$string = gp_strings::entity_unescape($string);
//if it's from a label, remove any html
if ($from_label) {
$string = admin_tools::LabelHtml($string);
$string = strip_tags($string);
//after removing tags, unescape special characters
$string = str_replace(array('<', '>', '"', ''', '&'), array('<', '>', '"', "'", '&'), $string);
}
// # character after unescape for entities and unescape of special chacters when $from_label is true
$string = str_replace('#', '', $string);
//slashes
$string = admin_tools::SlugSlashes($string);
$string = str_replace(' ', $config['space_char'], $string);
return gpPlugin::Filter('PostedSlug', array($string, $orig_string, $from_label));
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:32,代码来源:admin_tools.php
示例16: defined
<?php
defined('is_running') or die('Not an entry point...');
gpPlugin::Incl('Languages.php');
class MultiLang_Common
{
var $config_file;
var $config;
var $lists = array();
var $titles = array();
var $langs = array();
var $lang;
var $language;
function Init()
{
global $addonPathData, $config, $ml_languages;
$this->config_file = $addonPathData . '/config.php';
$this->lang = $config['language'];
$this->GetData();
}
function GetData()
{
global $ml_languages;
$config = array();
if (file_exists($this->config_file)) {
require $this->config_file;
}
$config += array('titles' => array(), 'lists' => array(), 'langs' => array());
$this->config = $config;
$this->FixConfig();
$this->lists = $this->config['lists'];
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:31,代码来源:Common.php
示例17: SectionToContent
/**
* Return formatted content for the $section_data
* @return string
*
*/
static function SectionToContent($section_data, $section_num)
{
$section_data = gpPlugin::Filter('SectionToContent', array($section_data, $section_num));
switch ($section_data['type']) {
case 'text':
return self::TextContent($section_data['content']);
case 'include':
return self::IncludeContent($section_data);
case 'gallery':
common::ShowingGallery();
return $section_data['content'];
}
return $section_data['content'];
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:19,代码来源:SectionContent.php
示例18: GetAdminLink
/**
* Outputs the sitemap link, admin login/logout link, powered by link, admin html and messages
* @static
*/
static function GetAdminLink()
{
global $config, $langmessage, $page;
if (!isset($config['showsitemap']) || $config['showsitemap']) {
echo ' <span class="sitemap_link">';
echo common::Link('Special_Site_Map', $langmessage['site_map']);
echo '</span>';
}
if (!isset($config['showlogin']) || $config['showlogin']) {
echo ' <span class="login_link">';
if (common::LoggedIn()) {
echo common::Link($page->title, $langmessage['logout'], 'cmd=logout', array('data-cmd' => 'creq', 'rel' => 'nofollow'));
} else {
echo common::Link('Admin', $langmessage['login'], 'file=' . rawurlencode($page->title), ' rel="nofollow" data-cmd="login"');
}
echo '</span>';
}
if (!isset($config['showgplink']) || $config['showgplink']) {
echo ' <span id="powered_by_link">';
echo 'Powered by <a href="http://gpEasy.com" title="A Free and Easy CMS in PHP" target="_blank">gp|Easy CMS</a>';
echo '</span>';
}
gpPlugin::Action('GetAdminLink');
echo GetMessages();
//global $gpLayouts;
//echo pre($gpLayouts);
//$included = get_included_files();
//echo pre($included);
}
开发者ID:Bomberus,项目名称:gpEasy-CMS,代码行数:33,代码来源:gpOutput.php
示例19: InlineEdit
static function InlineEdit($section_data)
{
$section_data += array('type' => '', 'content' => '');
$scripts = array();
$scripts[] = '/include/js/inline_edit/inline_editing.js';
$type = 'text';
if (!empty($section_data['type'])) {
$type = $section_data['type'];
}
switch ($type) {
case 'gallery':
$scripts = gpAjax::InlineEdit_Gallery($scripts);
break;
case 'include':
$scripts = gpAjax::InlineEdit_Include($scripts);
break;
case 'text':
$scripts = gpAjax::InlineEdit_Text($scripts);
break;
case 'image':
echo 'var gp_blank_img = ' . gpAjax::quote(common::GetDir('/include/imgs/blank.gif')) . ';';
$scripts[] = '/include/js/jquery.auto_upload.js';
$scripts[] = '/include/js/inline_edit/image_common.js';
$scripts[] = '/include/js/inline_edit/image_edit.js';
break;
}
$scripts = gpPlugin::Filter('InlineEdit_Scripts', array($scripts, $type));
self::SendScripts($scripts);
//replace resized images with their originals
if (isset($section_data['resized_imgs']) && is_array($section_data['resized_imgs']) && count($section_data['resized_imgs'])) {
includeFile('tool/editing.php');
$section_data['content'] = gp_edit::RestoreImages($section_data['content'], $section_data['resized_imgs']);
}
//create the section object that will be passed to gp_init_inline_edit
$section_object = common::JsonEncode($section_data);
//send call to gp_init_inline_edit()
echo ';if( typeof(gp_init_inline_edit) == "function" ){';
echo 'gp_init_inline_edit(';
echo gpAjax::quote($_GET['area_id']);
echo ',' . $section_object;
echo ');';
echo '}else{alert("gp_init_inline_edit() is not defined");}';
}
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:43,代码来源:ajax.php
示例20: RenameFileWorker
static function RenameFileWorker($title)
{
global $langmessage, $dataDir, $gp_index;
//use new_label or new_title
if (isset($_POST['new_title'])) {
$new_title = admin_tools::PostedSlug($_POST['new_title']);
} else {
$new_title = admin_tools::LabelToSlug($_POST['new_label']);
}
//title unchanged
if ($new_title == $title) {
return $title;
}
$special_file = false;
if (common::SpecialOrAdmin($title)) {
$special_file = true;
}
if (!admin_tools::CheckTitle($new_title, $message)) {
msg($message);
return false;
}
$old_gp_index = $gp_index;
//re-index: make the new title point to the same data index
$old_file = gpFiles::PageFile($title);
$file_index = $gp_index[$title];
unset($gp_index[$title]);
$gp_index[$new_title] = $file_index;
//rename the php file
if (!$special_file) {
$new_file = gpFiles::PageFile($new_title);
//we don't have to rename files if we're using the index naming convention. See gpFiles::PageFile() for more info
if ($new_file == $old_file) {
//if the file being renamed doesn't use the index naming convention, then we'll still need to rename it
} elseif (!rename($old_file, $new_file)) {
msg($langmessage['OOPS'] . ' (N3)');
$gp_index = $old_gp_index;
return false;
}
//gallery rename
includeFile('special/special_galleries.php');
special_galleries::RenamedGallery($title, $new_title);
}
//create a 301 redirect
if (isset($_POST['add_redirect']) && $_POST['add_redirect'] == 'add') {
includeFile('admin/admin_missing.php');
admin_missing::AddRedirect($title, $new_title);
}
gpPlugin::Action('RenameFileDone', array($file_index, $title, $new_title));
return $new_title;
}
开发者ID:Knuzen,项目名称:gpEasy-CMS,代码行数:50,代码来源:Page_Rename.php
注:本文中的gpPlugin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论