本文整理汇总了PHP中gpPlugin类的典型用法代码示例。如果您正苦于以下问题:PHP gpPlugin类的具体用法?PHP gpPlugin怎么用?PHP gpPlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了gpPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($text)
{
parent::__construct($text);
$this->dom_array = gpPlugin::Filter('Html_Output', array($this->dom_array));
$this->Clean();
$this->Rebuild();
}
示例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();
}
示例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();
}
示例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;
}
示例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']);
}
}
示例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>';
}
示例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);
}
示例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);
}
示例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();
}
示例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;
}
示例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)
*
*/
示例12: GetContent
function GetContent()
{
$this->GetGpxContent();
echo '<div id="gpAfterContent">';
gpOutput::Get('AfterContent');
gpPlugin::Action('GetContent_After');
echo '</div>';
}
示例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>';
}
}
示例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";
}
示例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));
}