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


PHP add_hook函数代码示例

本文整理汇总了PHP中add_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP add_hook函数的具体用法?PHP add_hook怎么用?PHP add_hook使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: hook_clientarea_tickets

function hook_clientarea_tickets()
{
    $moduleDetails = FetchSupportModule();
    if ($moduleDetails['value'] == 'kayako') {
        add_hook('ClientAreaPage', 1, 'hook_clientarea_details');
    }
}
开发者ID:TecSecret,项目名称:whmcs-integration,代码行数:7,代码来源:hooks.php

示例2: addHooks

 /**
  * Adds the hooks used by the Integrator to the WHMCS framework
  * @access		public
  * @version		1.0.0
  * 
  * @static
  * @since		1.0.0
  */
 public static function addHooks()
 {
     $hooks = array('ClientAreaPage' => 'tpl_override_clientarea');
     // Add the hooks to the WHMCS framework
     foreach ($hooks as $point => $fnxn) {
         add_hook($point, 30, $fnxn);
     }
 }
开发者ID:carriercomm,项目名称:TPL-Override,代码行数:16,代码来源:hook.php

示例3: initializePlugins

 /**
  * Intializes the plugin bundles in the kernel
  * 
  * @return void
  */
 public function initializePlugins()
 {
     foreach ($this->getBundles() as $bundle) {
         if (!$bundle instanceof PluginInterface) {
             continue;
         }
         foreach ($bundle->getHooks() as $hook) {
             add_hook($hook->getTag(), $hook->getCallback(), $hook->getPriority(), $hook->getAcceptedArgs());
         }
     }
 }
开发者ID:symfonypress,项目名称:symfonypress,代码行数:16,代码来源:SymfonyPressKernel.php

示例4: boot

 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     /** @var EventDispatcher $dispatcher */
     $dispatcher = $this->app->make("dispatcher");
     /** @var ExceptionHandler $exception */
     $exception = $this->app->make("exception_handler");
     foreach ($this->getHooks() as $hook => $expectedResult) {
         add_hook($hook, 1, function ($vars) use($hook, $expectedResult, $dispatcher, $exception) {
             // We don't want to show errors to the customer so let's catch them and add log entries instead
             try {
                 $result = $dispatcher->dispatch($hook, new WHMCSEvent($vars));
                 if ($result instanceof WHMCSEvent) {
                     $result = $result->getResult();
                 }
                 // @TODO check if dispatcher has returned correct data type using $expectedResult
                 return $result;
             } catch (\Exception $e) {
                 $exception->handle($e);
             }
         });
     }
 }
开发者ID:4ernovm,项目名称:whmcs-events,代码行数:27,代码来源:ServiceProvider.php

示例5: basename

/*
Plugin Name: Faker data
Plugin URI: https://github.com/atmoner
Description: This is a faker data 
Version: 1.0
Author: Atmoner
Author URI: https://github.com/atmoner
*/
//set plugin id as file name of plugin
$plugin_id = basename(__FILE__);
//some plugin data
$data['name'] = "Faker data";
$data['author'] = "Atmoner";
$data['url'] = "https://github.com/atmoner";
//register plugin data
register_plugin($plugin_id, $data);
//plugin function
function fakerdata()
{
    global $hook;
}
function addnewadminmenu_faker()
{
    global $hook;
    $hook->add_admin_menu('addmensssu', 'Faker data', 'admincp/fakerdata', 5);
}
add_hook('admin_action', 'addnewadminmenu_faker');
add_hook('new_admin_page', 'fakerdata');
add_hook('install', 'installSql');
开发者ID:relizont,项目名称:Bittytorrent,代码行数:29,代码来源:fakerData.plugin.php

示例6: mysql_fetch_array

    $data = mysql_fetch_array($result);
    $opennetworkissues = $data[0];
    $jquerycode = 'jQuery.post("index.php", { getsystemoverview: 1 },
    function(data){
        jQuery("#systemoverviewstats").html(data);
        jQuery("#systemoverviewstats").slideDown();
        jQuery("#sysoverviewbanner").html("<div style=\\"margin:0 0 -5px 0;padding: 10px;background-color: #FBEEEB;border: 1px dashed #cc0000;font-weight: bold;color: #cc0000;font-size:14px;text-align: center;-moz-border-radius: 10px;-webkit-border-radius: 10px;-o-border-radius: 10px;border-radius: 10px;\\">' . $_ADMINLANG['global']['attentionitems'] . ': &nbsp; <a href=\\"supporttickets.php\\">' . $ticketsawaitingreply . ' ' . $_ADMINLANG['stats']['ticketsawaitingreply'] . '</a> &nbsp;-&nbsp; <a href=\\"cancelrequests.php\\">' . $cancellationrequests . ' ' . $_ADMINLANG['stats']['pendingcancellations'] . '</a> &nbsp;-&nbsp; <a href=\\"todolist.php\\">' . $todoitemsdue . ' ' . $_ADMINLANG['stats']['todoitemsdue'] . '</a> &nbsp;-&nbsp; <a href=\\"networkissues.php\\">' . $opennetworkissues . ' ' . $_ADMINLANG['stats']['opennetworkissues'] . '</a></div>");
});';
    return array('title' => $title, 'content' => $content, 'jquerycode' => $jquerycode);
}
function widget_system_overview_home_banner()
{
    return '<div id="sysoverviewbanner"><div style="margin:0;padding: 10px;background-color: #FBEEEB;border: 1px dashed #cc0000;font-weight: bold;color: #cc0000;font-size:14px;text-align: center;"><img src="images/loading.gif" /></div></div>';
}
add_hook("AdminHomeWidgets", 1, "widget_system_overview");
add_hook("AdminHomepage", 1, "widget_system_overview_home_banner");
/*
#systemoverviewstats div {
    float: left;
    margin: 3px;
    padding: 5px;
    width: 30%;
    line-height: 24px;
    min-width: 250px;
    border: 1px solid #d9d9d9;
    background-color: #f2f2f2;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    -o-border-radius: 4px;
    border-radius: 4px;
    overflow: hidden;
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:system_overview.php

示例7: die

<?php

if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}
function widget_getting_started($vars)
{
    $title = "Getting Started with WHMCS";
    $content = '
<span style="font-weight:bold;font-size:14px;color:#29467C;">Welcome to WHMCS - The Complete Client Management, Billing & Support Solution!</span><br />
Here\'s our handy tips for getting up & running if this is your first time using WHMCS...<br />
<blockquote>
<b>Step 1:</b> Review & Configure <a href="configgeneral.php">General System Settings</a> including Company Name, URL, etc...<br />
<b>Step 2:</b> Activate & Configure <a href="configgateways.php">Payment Methods</a> you want to accept<br />
<b>Step 3:</b> Setup at least 1 <a href="configproducts.php">Product Group</a> & <a href="configproducts.php">Product/Service</a> in your system (<a href="http://docs.whmcs.com/Setting_Up_Your_First_Product">More Help</a>)<br />
</blockquote>
For more information please refer to our documentation @ <a href="http://docs.whmcs.com/" target="_blank">http://docs.whmcs.com/</a> for lots of useful information.
<div align="right" style="padding-top:5px;"><input type="submit" value="Dismiss Getting Started Guide" onclick="dismissgs()" /></div>
    ';
    $jscode = 'function dismissgs() {
    $("#getting_started").fadeOut();
    $.post("index.php", { dismissgs: 1 });
}';
    return array('title' => $title, 'content' => $content, 'jscode' => $jscode);
}
add_hook("AdminHomeWidgets", 1, "widget_getting_started");
开发者ID:billyprice1,项目名称:whmcs,代码行数:26,代码来源:getting_started.php

示例8: basename

 * To avoid naming collisions, it is imperative that all plugins incorporate a PHP class structure. 
 * Here is some example code that will allow you to set up a class structure.
 */
$plugin_id = basename(__FILE__);
$data['name'] = "Second plugin";
$data['author'] = "Eric Wang";
$data['url'] = "http://www.ericbess.com/";
//register plugin data
register_plugin($plugin_id, $data);
class plugin2
{
    function plg2()
    {
        echo 'Plugin2 hooks into TEST, priority = 2<br />';
    }
    function njeh()
    {
        echo "Plugin2 hooks into TEST1<br />";
    }
    function filter1($urls)
    {
        $return[] = "http://www.{$urls['0']}.com";
        $return[] = "http://www.{$urls['1']}.com";
        return $return;
    }
}
$plg2 = new plugin2();
add_hook('filter', array(&$plg2, 'filter1'), 2);
add_hook('test', array(&$plg2, 'plg2'), 2);
add_hook('test1', array(&$plg2, 'njeh'));
echo "<p>Plugin 2 LOADED!</p>";
开发者ID:sofagris,项目名称:phphooks,代码行数:31,代码来源:plugin2.plugin.php

示例9: str_replace

    $string = str_replace("р", "r", $string);
    $string = str_replace("Р", "R", $string);
    $string = str_replace("с", "s", $string);
    $string = str_replace("С", "S", $string);
    $string = str_replace("т", "t", $string);
    $string = str_replace("Т", "T", $string);
    $string = str_replace("у", "u", $string);
    $string = str_replace("У", "U", $string);
    $string = str_replace("ф", "f", $string);
    $string = str_replace("Ф", "F", $string);
    $string = str_replace("х", "h", $string);
    $string = str_replace("Х", "H", $string);
    $string = str_replace("ц", "c", $string);
    $string = str_replace("Ц", "C", $string);
    $string = str_replace("ч", "ch", $string);
    $string = str_replace("Ч", "Ch", $string);
    $string = str_replace("ш", "sh", $string);
    $string = str_replace("Ш", "Sh", $string);
    $string = str_replace("щ", "sht", $string);
    $string = str_replace("Щ", "Sht", $string);
    $string = str_replace("ъ", "a", $string);
    $string = str_replace("Ъ", "A", $string);
    $string = str_replace("ь", "j", $string);
    $string = str_replace("ю", "yu", $string);
    $string = str_replace("Ю", "Yu", $string);
    $string = str_replace("я", "ya", $string);
    $string = str_replace("Я", "Ya", $string);
    return $string;
}
add_hook("Transliteration", 1, "hook_transliterate");
开发者ID:deflax,项目名称:whmcs-cyrillic-transliteration,代码行数:30,代码来源:cyrillic.php

示例10: select_query

            $packageId = $package['PackageId'];
            // Get the associated WebsitePanel addon id
            $results = select_query('mod_wspaddons', 'wsp_id,is_ipaddress', array('whmcs_id' => $addonId));
            $addon = mysql_fetch_array($results);
            $addonPlanId = $addon['wsp_id'];
            $addonIsIpAddress = $addon['is_ipaddress'];
            // Add the Addon Plan to the customer's WebsitePanel package / hosting space
            $results = $wsp->addPackageAddonById($packageId, $addonPlanId);
            // Check the results to verify that the addon has been successfully allocated
            if ($results['Result'] > 0) {
                // If this addon is an IP address addon - attempt to randomly allocate an IP address to the customer's hosting space
                if ($addonIsIpAddress) {
                    $wsp->allocatePackageIPAddresses($packageId);
                }
                // Add log entry to client log
                logactivity("WebsitePanel Addon - Account {$username} addon successfully completed - Addon ID: {$addonId}", $userId);
            } else {
                // Add log entry to client log
                throw new Exception("Unknown", $results['Result']);
            }
        } catch (Exception $e) {
            // Error message to log / return
            $errorMessage = "websitepanel_addons_AddonActivation Fault: (Code: {$e->getCode()}, Message: {$e->getMessage()}, Service ID: {$serviceId})";
            // Log to WHMCS
            logactivity($errorMessage, $userId);
        }
    }
}
/* Addon Activation - WebsitePanel */
add_hook('AddonActivation', 1, 'websitepanel_addons_AddonActivation');
开发者ID:lfrauseo,项目名称:Websitepanel,代码行数:30,代码来源:hooks.php

示例11: wapo_ads

<?php

/* Hook to remove "Featured Advertiser" entries in WaPo.
 */
function wapo_ads($nodename, &$retval, &$context)
{
    # If the title is "Featured Advertiser", mark it as read.
    if (isset($retval['title']) && $retval['title'] == "Featured Advertiser") {
        $retval['is_read'] = true;
    }
    # Mark sports articles as read.
    if (isset($retval['wp:web-link']) && preg_match(',^http://www.washingtonpost.com/sports/,', $retval['wp:web-link'])) {
        $retval['is_read'] = true;
    }
    return true;
}
add_hook("item", "wapo_ads");
# Register hook
开发者ID:arensb,项目名称:newsbite,代码行数:18,代码来源:wapo-ads.php

示例12: verify_affiliate_coupon

<?php

/*
	Affiliate Coupons 1.2 - WHMCS Module
	Written by: Frank Laszlo <frank@asmallorange.com>
*/
function verify_affiliate_coupon($vars)
{
    if (isset($_SESSION['cart']['promo'])) {
        $promocode = $_SESSION['cart']['promo'];
        $data = select_query('tblpromotions', 'id', array("code" => "{$promocode}"));
        if (mysql_num_rows($data)) {
            $row = mysql_fetch_array($data);
            $couponid = $row[0];
            $pdata = select_query('tblaffcoupons', 'aff_id', array("coupon" => $couponid));
            if (mysql_num_rows($pdata)) {
                $prow = mysql_fetch_array($pdata);
                $affid = $prow[0];
                $_COOKIE['WHMCSAffiliateID'] = $affid;
            }
        }
    }
}
add_hook("PreShoppingCartCheckout", 1, "verify_affiliate_coupon", "");
开发者ID:shalintripathi,项目名称:WHMCS-Modules,代码行数:24,代码来源:affcoupons.php

示例13: webbug_hook

<?php

/* webbug_hook
 * Remove web bugs: images with width=1 and height=1 or less.
 */
function webbug_hook($nodename, &$retval, &$context)
{
    if (!is_string($retval)) {
        return;
    }
    $retval = preg_replace('{<img(\\s+\\w+=\\"[^\\"]*\\")* (height="[01]" width="[01]"|width="[01]" height="[01]")(\\s+\\w+=\\"[^\\"]*\\")*\\s*/>\\r?\\n?}', '', $retval);
    # Same thing, but with single quotes instead of double
    $retval = preg_replace('{<img(\\s+\\w+=\'[^\']*\')* (height=\'[01]\' width=\'[01]\'|width=\'[01]\' height=\'[01]\').*?/>\\r?\\n?}', '', $retval);
}
add_hook("summary", "webbug_hook");
add_hook("body", "webbug_hook");
开发者ID:arensb,项目名称:newsbite,代码行数:16,代码来源:bugs.php

示例14: die

<?php

if (!defined('WHMCS')) {
    die('This file cannot be accessed directly');
}
/**
 * This file is part of the whmcs-registrars-coza library.
 *
 * (c) Gunter Grodotzki <gunter@afri.cc>
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 */
add_hook('AdminHomeWidgets', 1, 'widget_coza_balance');
function widget_coza_balance($vars)
{
    require_once ROOTDIR . '/includes/registrarfunctions.php';
    require_once ROOTDIR . '/includes/classes/AfriCC/autoload.php';
    require_once ROOTDIR . '/modules/registrars/coza/Factory.php';
    $params = getRegistrarConfigOptions('coza');
    $title = 'CO.ZA Balance';
    $content = '<p align ="center" class="textblack"><strong>%s</strong></p>';
    $epp_client = \COZA\Factory::build($params);
    try {
        $epp_client->connect();
        $frame = new \AfriCC\EPP\Extension\COZA\Info\CozaContact();
        $frame->setId(!empty($params['OTE']) && $params['OTE'] === 'on' ? $params['TestUsername'] : $params['Username']);
        $frame->requestBalance();
        $response = $epp_client->request($frame);
        if (!$response instanceof \AfriCC\EPP\Frame\Response) {
            unset($epp_client);
开发者ID:Bugsy0001,项目名称:whmcs-registrars-cocca,代码行数:31,代码来源:coza_balance.php

示例15: i18n_str_to_utf8

            $_COOKIE['piv_name'] = $reg_user['name'];
            $_COOKIE['piv_url'] = $reg_user['url'];
        }
    }
    if (count($_COOKIE) > 0) {
        $cookie = @fill_comment_form($_COOKIE['piv_name'], $_COOKIE['piv_email'], $_COOKIE['piv_url'], $_COOKIE['piv_rememberinfo'], $_COOKIE['piv_comment']);
        $cookie = i18n_str_to_utf8($cookie);
        $output = str_replace("</body>", $cookie . "</body>", $output);
    }
    add_hook("display_entry", "post");
    execute_hook("display_entry", "post", $db->entry, $output, $dummy_variable);
    echo $output;
} else {
    if (isset($Pivot_Vars['f_title'])) {
        // This shows the entry in preview mode.
        define('PREVIEW', TRUE);
        $db = new db();
        $entry = get_entry_from_post();
        $entry['status'] = 'publish';
        $entry = $db->set_entry($entry);
        execute_hook("display_entry", "pre");
        $output = parse_entry($entry['code'], "");
        add_hook("display_entry", "post");
        execute_hook("display_entry", "post", $output);
        echo $output;
    } else {
        add_hook("display_entry", "post");
        execute_hook("display_entry", "post", $output);
        echo $output;
    }
}
开发者ID:wborbajr,项目名称:TecnodataApp,代码行数:31,代码来源:entry.php


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