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


PHP mosHTML::emailCloaking方法代码示例

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


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

示例1: botMosEmailCloak

/**
* Mambot that Cloaks all emails in content from spambots via javascript
*/
function botMosEmailCloak($published, &$row, &$cparams, $page = 0, $params)
{
    global $database;
    // load mambot params info
    /*$query = "SELECT id FROM #__mambots WHERE element = 'mosemailcloak' AND folder = 'content'";
    	$database->setQuery( $query );
    	$id 	= $database->loadResult();
    	$mambot = new mosMambot( $database );
    	$mambot->load( $id );*/
    $mambots =& mosMambotHandler::getInstance();
    $mambot = $mambots->getBot('mosemailcloack', 'content');
    $params =& new mosParameters(isset($mambot->params) ? $mambot->params : '');
    $mode = $params->def('mode', 1);
    //$search 	= "([[:alnum:]_\.\-]+)(\@[[:alnum:]\.\-]+\.+)([[:alnum:]\.\-]+)";
    $search = "([[:alnum:]_\\.\\-]+)(\\@[[:alnum:]\\.\\-]+\\.+)([[:alnum:]\\.\\-\\?\\=\\%]+)";
    $search_text = "([[:alnum:][:space:][:punct:]][^<>]+)";
    // search for derivativs of link code <a href="mailto:email@amail.com">email@amail.com</a>
    // extra handling for inclusion of title and target attributes either side of href attribute
    $searchlink = "(<a [[:alnum:] _\"\\'=\\@\\.\\-]*href=[\"\\']mailto:" . $search . "[\"\\'][[:alnum:] _\"\\'=\\@\\.\\-]*>)" . $search . "</a>";
    if (is_callable(array($row, 'getText'))) {
        $localtext = $row->getText();
    } else {
        $localtext = $row->text;
    }
    while (eregi($searchlink, $localtext, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4];
        $mail_text = $regs[5] . $regs[6] . $regs[7];
        // check to see if mail text is different from mail addy
        if ($mail_text) {
            $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text);
        } else {
            $replacement = mosHTML::emailCloaking($mail, $mode);
        }
        // replace the found address with the js cloacked email
        $localtext = str_replace($regs[0], $replacement, $localtext);
    }
    // search for derivativs of link code <a href="mailto:email@amail.com">anytext</a>
    // extra handling for inclusion of title and target attributes either side of href attribute
    $searchlink = "(<a [[:alnum:] _\"\\'=\\@\\.\\-]*href=[\"\\']mailto:" . $search . "[\"\\'][[:alnum:] _\"\\'=\\@\\.\\-]*)>" . $search_text . "</a>";
    while (eregi($searchlink, $localtext, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4];
        $mail_text = $regs[5];
        $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text, 0);
        // replace the found address with the js cloacked email
        $localtext = str_replace($regs[0], $replacement, $localtext);
    }
    // search for plain text email@amail.com
    while (eregi($search, $localtext, $regs)) {
        $mail = $regs[0];
        $replacement = mosHTML::emailCloaking($mail, $mode);
        // replace the found address with the js cloacked email
        $localtext = str_replace($regs[0], $replacement, $localtext);
    }
    if (is_callable(array($row, 'saveText'))) {
        $row->saveText($localtext);
    } else {
        $row->text = $localtext;
    }
}
开发者ID:jwest00724,项目名称:mambo,代码行数:62,代码来源:mosemailcloak.php

示例2: view

 function view()
 {
     $database = mamboDatabase::getInstance();
     $query = "SELECT a.*, a.id AS value, CONCAT_WS( ' - ', a.name, a.con_position ) AS text" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = '1'" . "\n AND cc.published = '1'" . "\n AND a.access <=" . $this->user->gid . "\n AND cc.access <=" . $this->user->gid . "\n ORDER BY a.default_con DESC, a.ordering ASC";
     $database->setQuery($query);
     $list = $database->loadObjectList();
     $count = count($list);
     if ($count == 0) {
         $params =& new mosParameters('');
         $params->def('back_button', mamboCore::get('mosConfig_back_button'));
         HTML_contact::nocontact($params);
         return;
     }
     if ($this->contact_id == 0) {
         $this->contact_id = $list[0]->id;
     }
     foreach ($list as $cont) {
         if ($cont->id == $this->contact_id) {
             $contact =& $cont;
             break;
         }
     }
     if (!isset($contact)) {
         echo T_('You are not authorized to view this resource.');
         return;
     }
     // creates dropdown select list
     $contact->select = mosHTML::selectList($list, 'contact_id', 'class="inputbox" onchange="ViewCrossReference(this);"', 'value', 'text', $this->contact_id);
     // Adds parameter handling
     $params =& $this->makeParams($contact->params);
     // load mambot params info
     $query = "SELECT id FROM #__mambots WHERE element = 'mosemailcloak' AND folder = 'content'";
     $database->setQuery($query);
     $id = $database->loadResult();
     $mambot = new mosMambot($database);
     $mambot->load($id);
     $params2 =& $this->makeParams($mambot->params);
     if ($contact->email_to and $params->get('email')) {
         // email cloacking
         $contact->email = mosHTML::emailCloaking($contact->email_to, $params2->get('mode'));
     }
     // loads current template for the pop-up window
     $pop = mosGetParam($_REQUEST, 'pop', 0);
     if ($pop) {
         $params->set('popup', 1);
         $params->set('back_button', 0);
     }
     if ($params->get('email_description')) {
         $params->set('email_description', $params->get('email_description_text'));
     } else {
         $params->set('email_description', '');
     }
     // needed to control the display of the Address marker
     $temp = $params->get('street_address') . $params->get('suburb') . $params->get('state') . $params->get('country') . $params->get('postcode');
     $params->set('address_check', $temp);
     // determines whether to use Text, Images or nothing to highlight the different info groups
     $this->groupMarking($params);
     // params from menu item
     $menuhandler = mosMenuHandler::getInstance();
     $menu =& $menuhandler->getMenuByID($this->Itemid);
     $menu_params =& new mosParameters($menu->params);
     $menu_params->def('page_title', 1);
     $menu_params->def('header', $menu->name);
     $menu_params->def('pageclass_sfx', '');
     HTML_contact::viewcontact($contact, $params, $count, $list, $menu_params);
 }
开发者ID:jwest00724,项目名称:mambo,代码行数:66,代码来源:contact.php

示例3: botMosEmailCloak

/**
* Mambot that Cloaks all emails in content from spambots via javascript
*/
function botMosEmailCloak($published, &$row, &$params, $page = 0)
{
    global $database, $_MAMBOTS;
    // check whether mambot has been unpublished
    if (!$published) {
        return true;
    }
    // simple performance check to determine whether bot should process further
    if (strpos($row->text, '@') === false) {
        return true;
    }
    // simple check to allow disabling of bot
    $regex = '{emailcloak=off}';
    if (strpos($row->text, $regex) !== false) {
        $row->text = str_replace($regex, '', $row->text);
        return true;
    }
    // check if param query has previously been processed
    if (!isset($_MAMBOTS->_content_mambot_params['mosemailcloak'])) {
        // load mambot params info
        $query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'mosemailcloak'" . "\n AND folder = 'content'";
        $database->setQuery($query);
        $database->loadObject($mambot);
        // save query to class variable
        $_MAMBOTS->_content_mambot_params['mosemailcloak'] = $mambot;
    }
    // pull query data from class variable
    $mambot = $_MAMBOTS->_content_mambot_params['mosemailcloak'];
    $botParams = new mosParameters($mambot->params);
    $mode = $botParams->def('mode', 1);
    // any@email.address.com
    $search_email = "([[:alnum:]_\\.\\-]+)(\\@[[:alnum:]\\.\\-]+\\.+)([[:alnum:]\\.\\-]+)";
    // any@email.address.com?subject=anyText
    $search_email_msg = "([[:alnum:]_\\.\\-]+)(\\@[[:alnum:]\\.\\-]+\\.+)([[:alnum:]\\.\\-]+)([[:alnum:][:space:][:punct:]][^\"<>]+)";
    // anyText
    $search_text = "([[:alnum:][:space:][:punct:]][^<>]+)";
    // search for derivativs of link code <a href="mailto:email@amail.com">email@amail.com</a>
    $pattern = botMosEmailCloak_searchPattern($search_email, $search_email);
    while (eregi($pattern, $row->text, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4];
        $mail_text = $regs[5] . $regs[6] . $regs[7];
        // check to see if mail text is different from mail addy
        if ($mail_text) {
            $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text);
        } else {
            $replacement = mosHTML::emailCloaking($mail, $mode);
        }
        // replace the found address with the js cloacked email
        $row->text = str_replace($regs[0], $replacement, $row->text);
    }
    // search for derivativs of link code <a href="mailto:email@amail.com">anytext</a>
    $pattern = botMosEmailCloak_searchPattern($search_email, $search_text);
    while (eregi($pattern, $row->text, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4];
        $mail_text = $regs[5];
        $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text, 0);
        // replace the found address with the js cloacked email
        $row->text = str_replace($regs[0], $replacement, $row->text);
    }
    // search for derivativs of link code <a href="mailto:email@amail.com?subject=Text&body=Text">email@amail.com</a>
    $pattern = botMosEmailCloak_searchPattern($search_email_msg, $search_email);
    while (eregi($pattern, $row->text, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4] . $regs[5];
        $mail_text = $regs[6] . $regs[7] . $regs[8];
        //needed for handling of Body parameter
        $mail = str_replace('&amp;', '&', $mail);
        // check to see if mail text is different from mail addy
        if ($mail_text) {
            $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text);
        } else {
            $replacement = mosHTML::emailCloaking($mail, $mode);
        }
        // replace the found address with the js cloacked email
        $row->text = str_replace($regs[0], $replacement, $row->text);
    }
    // search for derivativs of link code <a href="mailto:email@amail.com?subject=Text&body=Text">anytext</a>
    $pattern = botMosEmailCloak_searchPattern($search_email_msg, $search_text);
    while (eregi($pattern, $row->text, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4] . $regs[5];
        $mail_text = $regs[6];
        //needed for handling of Body parameter
        $mail = str_replace('&amp;', '&', $mail);
        $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text, 0);
        // replace the found address with the js cloacked email
        $row->text = str_replace($regs[0], $replacement, $row->text);
    }
    // search for plain text email@amail.com
    while (eregi($search_email, $row->text, $regs)) {
        $mail = $regs[0];
        $replacement = mosHTML::emailCloaking($mail, $mode);
        // replace the found address with the js cloacked email
        $row->text = str_replace($regs[0], $replacement, $row->text);
    }
}
开发者ID:patricmutwiri,项目名称:joomlaclube,代码行数:97,代码来源:mosemailcloak.php

示例4: showTable


//.........这里部分代码省略.........
					<?php 
                echo T_('Fax');
                ?>
					</td>
					<?php 
            }
            ?>
				<td width="100%"></td>
			</tr>
			<?php 
        }
        $k = 0;
        foreach ($rows as $row) {
            $link = 'index.php?option=com_contact&amp;task=view&amp;contact_id=' . $row->id . '&amp;Itemid=' . $Itemid;
            ?>
			<tr>
				<td width="25%" height="20" class="<?php 
            echo $tabclass[$k];
            ?>
">
				<a href="<?php 
            echo sefRelToAbs($link);
            ?>
" class="category<?php 
            echo $params->get('pageclass_sfx');
            ?>
">
				<?php 
            echo $row->name;
            ?>
				</a>
				</td>
				<?php 
            if ($params->get('position')) {
                ?>
					<td width="25%" class="<?php 
                echo $tabclass[$k];
                ?>
">
					<?php 
                echo $row->con_position;
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('email')) {
                if ($row->email_to) {
                    $row->email_to = mosHTML::emailCloaking($row->email_to, 1);
                }
                ?>
					<td width="20%" class="<?php 
                echo $tabclass[$k];
                ?>
">
					<?php 
                echo $row->email_to;
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('telephone')) {
                ?>
					<td width="15%" class="<?php 
                echo $tabclass[$k];
                ?>
">
					<?php 
                echo $row->telephone;
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('fax')) {
                ?>
					<td width="15%" class="<?php 
                echo $tabclass[$k];
                ?>
">
					<?php 
                echo $row->fax;
                ?>
					</td>
					<?php 
            }
            ?>
				<td width="100%"></td>
			</tr>
			<?php 
            $k = 1 - $k;
        }
        ?>
		</table>
		<?php 
    }
开发者ID:jwest00724,项目名称:mambo,代码行数:101,代码来源:contact.html.php

示例5: contactpage

function contactpage($contact_id)
{
    global $mainframe, $database, $my, $Itemid;
    $query = "SELECT a.id AS value, CONCAT_WS( ' - ', a.name, a.con_position ) AS text, a.catid, cc.access AS cat_access" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = 1" . "\n AND cc.published = 1" . "\n AND a.access <= " . (int) $my->gid . "\n ORDER BY a.default_con DESC, a.ordering ASC";
    $database->setQuery($query);
    $checks = $database->loadObjectList();
    $count = count($checks);
    if ($count) {
        if ($contact_id < 1) {
            $contact_id = $checks[0]->value;
        }
        $query = "SELECT a.*, cc.access AS cat_access" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = 1" . "\n AND a.id = " . (int) $contact_id . "\n AND a.access <= " . (int) $my->gid;
        $database->SetQuery($query);
        $contacts = $database->LoadObjectList();
        if (!$contacts) {
            echo _NOT_AUTH;
            return;
        }
        $contact = $contacts[0];
        /*
         * check whether category access level allows access
         */
        if ($contact->cat_access > $my->gid) {
            mosNotAuth();
            return;
        }
        $list = array();
        foreach ($checks as $check) {
            if ($check->catid == $contact->catid) {
                $list[] = $check;
            }
        }
        // creates dropdown select list
        $contact->select = mosHTML::selectList($list, 'contact_id', 'class="inputbox" onchange="ViewCrossReference(this);"', 'value', 'text', $contact_id);
        // Adds parameter handling
        $params = new mosParameters($contact->params);
        $params->set('page_title', 0);
        $params->def('pageclass_sfx', '');
        $params->def('back_button', $mainframe->getCfg('back_button'));
        $params->def('print', !$mainframe->getCfg('hidePrint'));
        $params->def('name', 1);
        $params->def('email', 0);
        $params->def('street_address', 1);
        $params->def('suburb', 1);
        $params->def('state', 1);
        $params->def('country', 1);
        $params->def('postcode', 1);
        $params->def('telephone', 1);
        $params->def('fax', 1);
        $params->def('misc', 1);
        $params->def('image', 1);
        $params->def('email_description', 1);
        $params->def('email_description_text', _EMAIL_DESCRIPTION);
        $params->def('email_form', 1);
        $params->def('email_copy', 0);
        // global pront|pdf|email
        $params->def('icons', $mainframe->getCfg('icons'));
        // contact only icons
        $params->def('contact_icons', 0);
        $params->def('icon_address', '');
        $params->def('icon_email', '');
        $params->def('icon_telephone', '');
        $params->def('icon_fax', '');
        $params->def('icon_misc', '');
        $params->def('drop_down', 0);
        $params->def('vcard', 0);
        if ($contact->email_to && $params->get('email')) {
            // email cloacking
            $contact->email = mosHTML::emailCloaking($contact->email_to);
        }
        // loads current template for the pop-up window
        $pop = intval(mosGetParam($_REQUEST, 'pop', 0));
        if ($pop) {
            $params->set('popup', 1);
            $params->set('back_button', 0);
        }
        if ($params->get('email_description')) {
            $params->set('email_description', $params->get('email_description_text'));
        } else {
            $params->set('email_description', '');
        }
        // needed to control the display of the Address marker
        $temp = $params->get('street_address') . $params->get('suburb') . $params->get('state') . $params->get('country') . $params->get('postcode');
        $params->set('address_check', $temp);
        // determines whether to use Text, Images or nothing to highlight the different info groups
        switch ($params->get('contact_icons')) {
            case 1:
                // text
                $params->set('marker_address', _CONTACT_ADDRESS);
                $params->set('marker_email', _CONTACT_EMAIL);
                $params->set('marker_telephone', _CONTACT_TELEPHONE);
                $params->set('marker_fax', _CONTACT_FAX);
                $params->set('marker_misc', _CONTACT_MISC);
                $params->set('column_width', '100');
                break;
            case 2:
                // none
                $params->set('marker_address', '');
                $params->set('marker_email', '');
                $params->set('marker_telephone', '');
//.........这里部分代码省略.........
开发者ID:allenahner,项目名称:mizzou,代码行数:101,代码来源:contact.php


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