// check that we have access
defined( '_VALID_MOS' ) or die( 'Restricted access' );
// register our event. It would be great of joomla had more events
$_MAMBOTS->registerFunction( 'onPrepareContent', 'JoomSEO' );
function JoomSEO($published, &$row, &$params, $page=0) {
global $database, $mainframe, $mosConfig_MetaKeys, $mosConfig_MetaDesc, $mosConfig_sitename;
// perform a published check
if (!$published) {
return;
}
// get our bot parameters
$query = "SELECT id FROM #__mambots WHERE element = 'JoomSEO' AND folder = 'content'";
$database->setQuery($query);
$id = $database->loadResult();
// get our mambot object
$mambot = new mosMambot($database);
$mambot->load($id);
$botParams = new mosParameters($mambot->params);
// load all our vars
//Title
$titleLength = $botParams->get('titleLength', false);
$titleOrder = $botParams->get('titleOrder', 1);
$prependTitle = $botParams->get('prependTitle', false);
$appendTitle = $botParams->get('appendTitle', false);
// site name
$showTitleSiteName = $botParams->get('showTitleSiteName', true);
$overrideSiteName = $botParams->get('overrideSiteName', false);
// content / heading title
$showContentHeading = $botParams->get('showContentHeading', true);
// paragraph
$showFirstParagraph = $botParams->get('showFirstParagraph', false);
$paragraphMinLength = $botParams->get('paragraphMinLength', 20);
$paragraphLength = $botParams->get('paragraphLength', 50);
// keywords
$showTitleKeywords = $botParams->get('showTitleKeywords', true);
$overrideTitleKeywords = $botParams->get('overrideTitleKeywords', false);
$keywordMinCharacters = $botParams->get('keywordMinCharacters', 3);
$titleKeywordQuantity = $botParams->get('titleKeywordQuantity', 5);
// meta
$metaKeywordsCount = $botParams->get('metaKeywordsCount', 50);
$metaDescriptionMinLength = $botParams->get('metaDescriptionMinLength', 80);
$metaDescriptionLength = $botParams->get('metaDescriptionLength', 150);
// filter
// when bot was first installed these were not being added unless bot was *saved*
$defStickWords = "";
$stickyWords = $botParams->get('stickyWords', $defStickWords);
$defBadWords = "0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z about an are as at be by com de en for from how in is it its la of on or that the this to was what when where who will with und the www and all has been your us up youll can if youve do know we not many you our but there they then more";
$badWords = $botParams->get('badWords', $defBadWords);
$defBadCharacters = "0 1 2 3 4 5 6 7 8 9 > < & - , . ; : ) ( ? ! { } [ ] / ' " %";
$badCharacters = $botParams->get('badCharacters', $defBadCharacters);
// bot activation
$disableFrontpage = $botParams->get('disableFrontpage', false);
// activation specific
$disableFrontpageTitle = $botParams->get('disableFrontpageTitle', false);
$disableFrontpageKeywords = $botParams->get('disableFrontpageKeywords', false);
$disableFrontpageDescription = $botParams->get('disableFrontpageDescription', false);
// front page overrides. Front page or corresponding item must be enabled though
$overrideFrontPageTitle = $botParams->get('overrideFrontPageTitle', false);
$overrideFrontPageKeywords = $botParams->get('overrideFrontPageKeywords', false);
$overrideFrontPageDescription = $botParams->get('overrideFrontPageDescription', false);
// SEO / Accessability
// defaulted to false to as not to break existing templates
$addHeadingTags = $botParams->get('addHeadingTags', false);
// current settings
$currentTitle = gettitle();
$currentContentHeading = $row->title;
$currentMetaKeys = $mosConfig_MetaKeys;
$currentMetaDesc = $mosConfig_MetaDesc;
// added to limit sql queries
$isFrontPage = IsFrontPage();
// firstly add our generator tag.
// please leave this here as it will not affect seo
// and gives my countless hours of programming an idea of use.
global $beenHere;
if (!$beenHere) {
// add JoomSEO bot to Generator meta
ReplaceMeta('Generator', ' JoomSEO by Phill Brown (http://www.joomseo.com).');
}
// encompass our headings with hX tags
// added first as we want this active even if the front page is disabled
if ($addHeadingTags) {
$row->title = AddHeadingTags($row->title, $addHeadingTags);
}
// check if we are enabled on the front page
if (($isFrontPage) && ($disableFrontpage)) {
// removed after added front page overrides and specific disabled attributes
// were added after release 0.9
//if ($disabledFrontPageTitle) {
// apply replacement text instead of joomla default
// replacetitle($disabledFrontPageTitle);
//}
// exit from this bot
return;
}
// clean and organise our text
$text = PrepareText($row->text);
// all CleanChars() no longer used as it was stopping other languages from operating proplerly
//$text = CleanChars($text);
$stickyWords = PrepareText($stickyWords);
//$stickyWords = CleanChars($stickyWords);
$badWords = PrepareText($badWords);
//$badWords = CleanChars($badWords);
$badCharacters = PrepareText($badCharacters);
//$badCharacters = CleanChars($badCharacters);
// clear existing meta keywords and descriptions
$mosConfig_MetaKeys = "";
$mosConfig_MetaDesc = "";
// was thinking of adding later a check to use only first article or all articles
// this get the total content from all articles from a com_frontpage
global $botSefText;
$botSefText .= $text;
// get our site name
// added to get the site title once
global $newSiteName;
//$newSiteName = null;
if (!$newSiteName) {
if ($showTitleSiteName) {
$newSiteName = $mosConfig_sitename;
if ($overrideSiteName) {
$newSiteName = $overrideSiteName;
}
}
}
// get our content heading
// added this to get first heading
global $newContentHeading;
//$newContentHeading = null;
if (!$newContentHeading) {
if ($showContentHeading) {
$newContentHeading = $currentContentHeading;
}
}
// get our first paragraph
// added to get the paragraph once only
global $newFirstParagraph;
//$newFirstParagraph = null;
if (!$newFirstParagraph) {
if ($showFirstParagraph) {
$newFirstParagraph = trim(GetDescription($botSefText, $paragraphMinLength, $paragraphLength));
}
}
// get our title keywords
// no global as we need this to parse all keywords
$newTitleKeywords = null;
if ($showTitleKeywords) {
$newTitleKeywords = GlueItems(GetKeywords($botSefText,$keywordMinCharacters,$titleKeywordQuantity,$stickyWords,$badWords,$badCharacters));
if ($overrideTitleKeywords) {
$newTitleKeywords = GlueItems(GetKeywords($overrideTitleKeywords));
}
}
// sort our title
$titleArray = array();
Push($titleArray, $prependTitle);
switch ($titleOrder) {
case 1://
Push($titleArray, $newSiteName);
if ($newContentHeading != null) {
Push($titleArray, ($newFirstParagraph) ? $newContentHeading ." - ". $newFirstParagraph : $newContentHeading);
} else {
Push($titleArray, $newFirstParagraph);
}
Push($titleArray, $newTitleKeywords);
break;
case 2://
Push($titleArray, $newSiteName);
Push($titleArray, $newTitleKeywords);
if ($newContentHeading != null) {
Push($titleArray, ($newFirstParagraph) ? $newContentHeading ." - ". $newFirstParagraph : $newContentHeading);
} else {
Push($titleArray, $newFirstParagraph);
}
break;
case 3://
if ($newContentHeading != null) {
Push($titleArray, ($newFirstParagraph) ? $newContentHeading ." - ". $newFirstParagraph : $newContentHeading);
} else {
Push($titleArray, $newFirstParagraph);
}
Push($titleArray, $newSiteName);
Push($titleArray, $newTitleKeywords);
break;
case 4://
if ($newContentHeading != null) {
Push($titleArray, ($newFirstParagraph) ? $newContentHeading ." - ". $newFirstParagraph : $newContentHeading);
} else {
Push($titleArray, $newFirstParagraph);
}
Push($titleArray, $newTitleKeywords);
Push($titleArray, $newSiteName);
break;
case 5://
Push($titleArray, $newTitleKeywords);
Push($titleArray, $newSiteName);
if ($newContentHeading != null) {
Push($titleArray, ($newFirstParagraph) ? $newContentHeading ." - ". $newFirstParagraph : $newContentHeading);
} else {
Push($titleArray, $newFirstParagraph);
}
break;
case 6://
Push($titleArray, $newTitleKeywords);
if ($newContentHeading != null) {
Push($titleArray, ($newFirstParagraph) ? $newContentHeading ." - ". $newFirstParagraph : $newContentHeading);
} else {
Push($titleArray, $newFirstParagraph);
}
Push($titleArray, $newSiteName);
break;
}
Push($titleArray, $appendTitle);
if ($titleLength) {
$newTitle = substr(implode(' | ', $titleArray),0,$titleLength);
} else {
$newTitle = implode(' | ', $titleArray);
}
// its the front page so do front page specific handling
if ($isFrontPage) {
// get our frontpage title
if ($disableFrontpageTitle) {
// use the joomla generated title
$newTitle = $currentTitle;
} else {
$newTitle = ($overrideFrontPageTitle) ? $overrideFrontPageTitle : $newTitle;
}
// get our frontpage keywords
if ($disableFrontpageKeywords) {
// use the joomla default
$metaKeywords = $currentMetaKeys;
} else {
$metaKeywords = ($overrideFrontPageKeywords) ? $overrideFrontPageKeywords : GlueItems(GetKeywords($botSefText,$keywordMinCharacters,$metaKeywordsCount,$stickyWords,$badWords,$badCharacters));
}
// get our frontpage description
if ($disableFrontpageDescription) {
// use the joomla default
$metaDescription = $currentMetaDesc;
} else {
$metaDescription = ($overrideFrontPageDescription) ? $overrideFrontPageDescription : GetDescription($botSefText, $metaDescriptionMinLength, $metaDescriptionLength);
}
} else {
// we are on any other page so perform normal operations
$metaKeywords = GlueItems(GetKeywords($botSefText,$keywordMinCharacters,$metaKeywordsCount,$stickyWords,$badWords,$badCharacters));
$metaDescription = GetDescription($botSefText, $metaDescriptionMinLength, $metaDescriptionLength);
}
replacetitle($newTitle);
ReplaceMeta('keywords', $metaKeywords);
ReplaceMeta('description', $metaDescription);
// set our been here status
$beenHere = true;
}
/**
* Add an item to our array
*
* @param array $stack
* @param text $var
*/
function Push(&$stack, $var) {
if ($var) {
array_push($stack, $var);
}
}
/**
* Add H1, H2, H3... tags to text
*
* @param string $title
* @param int $num
* @return string
*/
function AddHeadingTags($title, $num) {
return "$title";
}
/**
* Checks if current page is Joomla front page
*
* @return unknown
*/
function IsFrontPage() {
global $database;
global $Itemid;
// if we have no option then we should have arrived at the front page of the site.
// sef url mapping bypasses this but is caught below
if (mosGetParam($_GET,'option','') == '') {
return true;
}
// get the first menu item in mainmenu as this is the front page in joomla
$query = "SELECT * from #__menu WHERE menutype = 'mainmenu' AND published = '1' ORDER BY ordering LIMIT 1";
$database->setQuery($query);
$row = null;
$database->loadObject($row);
if ($Itemid == $row->id) {
return true;
}
return false;
}
/**
* Replaces current Joomla meta tag
* code based from joomla.php
*
* @param string $name
* @param string $content
*/
function ReplaceMeta($name, $content) {
global $mainframe;
$name = trim(htmlspecialchars($name));
$n = count($mainframe->_head['meta']);
for ($i = 0; $i < $n; $i++) {
if ($mainframe->_head['meta'][$i][0] == $name) {
$content = trim(htmlspecialchars($content));
if ($content) {
$mainframe->_head['meta'][$i][1] = $content;
}
return;
}
}
$mainframe->addMetaTag($name, $content);
}
/**
* Get current meta content
* code based from joomla.php
*
* @param string $name
* @return string
*/
function GetMeta($name) {
global $mainframe;
$name = trim(htmlspecialchars($name));
$n = count($mainframe->_head['meta']);
for ($i = 0; $i < $n; $i++) {
if ($mainframe->_head['meta'][$i][0] == $name) {
return $mainframe->_head['meta'][$i][1];
}
}
}
/**
* Get a string of formatted keywords
*
* @param array key=>value $items
* @return string
*/
function GlueItems($items) {
// as format is in a $key=>$value pair extract the keys
$keys = array_keys($items);
// glue our array into a single string
$ret = implode(', ', $keys);
return $ret;
}
/**
* Replace current title
*
* @param string $content
*/
function replacetitle($content) {
global $mainframe;
$mainframe->_head['title'] = $content;
}
/**
* Append to current title
*
* @param string $content
*/
function appendtitle($content) {
global $mainframe;
$mainframe->_head['title'] .= $content;
}
/**
* Get the current title
*
* @return string
*/
function gettitle() {
global $mainframe;
return $mainframe->_head['title'];
}
/**
* Gets the description for the meta description tag
* uses the sentence inside $minLength and $maxLength
* or sentence... if sentence is bigger than $maxLength
*
* @param string $text
* @param int $minLength
* @param int $maxLength
* @return string
*/
function GetDescription($text, $minLength = 100, $maxLength = 250) {
if ($minLength > $maxLength) return;
if (!$text) return;
// previously sentences including 'Joomla 1.0' was stopping at "Joomla 1." therefor the philosophy has changed here.
// we want a minumim of $minLength chars and a max of $maxLength chars, stopping at a sentence inbetween.
// get pos of '.'
$stop = strpos($text,'.');
if (($stop >= $minLength) && ($stop <= $maxLength)) {
// display the full sentence as it is
$desc = trim(substr($text,0,$stop + 1));
} else {
// display the sentence cut short
$desc = trim(substr($text, 0, $maxLength -3))."...";
}
return ucfirst($desc);
}
/**
* Returns an array of keywords
*
* @param string $text
* @param int $keywordMinCharacters
* @param int $top
* @param string $stickyWords
* @param string $badWords
* @param string $badCharacters
* @param bool $capitalise
* @param char $delim
* @return array key=>value
*/
function GetKeywords($text, $keywordMinCharacters = 1, $top = 0, $stickyWords = null, $badWords = null, $badCharacters = null, $capitalise = true, $delim=" ") {
$text = strtolower($text);
// remove any email addresses
$regex = '/(([_A-Za-z0-9-]+)(\\.[_A-Za-z0-9-]+)*@([A-Za-z0-9-]+)(\\.[A-Za-z0-9-]+)*)/iex';
$replacement = ' ';
$text = preg_replace($regex, $replacement, $text);
// remove and unwanted characters
$badCharacters = explode($delim, $badCharacters);
foreach ($badCharacters as $badChar) {
$text = str_replace ($badChar, null, $text);
}
// remove any unwanted words
$badWords = explode($delim,$badWords);
$firstWord = substr($text, 0, (strpos($text, " ")) +1);
$lastWord = substr($text , strrpos($text, " "));
foreach ($badWords as $badWord) {
// remove all instances at the beginning
if (strcasecmp("$badWord ",$firstWord) == 0) {
$text = substr($text, strlen($firstWord));
}
// remove all instances in the middle
$text = Replace(" $badWord ", " ", $text);
// remove all instances at the end
if (strcasecmp(" $badWord", $lastWord) == 0) {
$text = substr($text, 0, strlen($text) - strlen($lastWord));
}
}
// capitalise our text
if ($capitalise == true) {
$text = ucwords($text);
$stickyWords = ucwords($stickyWords);
}
$wordCount = array();
// add our stickywords
$stickyWords = explode($delim,$stickyWords);
foreach ($stickyWords as $stickyWord) {
$wordCount[$stickyWord]=1;
}
// loop through all our words and count instances
$words = explode($delim,$text);
foreach ($words as $word) {
$word = trim($word);
// after all checking was still getting null chars from somewhere
if (($word != null) && (strlen($word) >= $keywordMinCharacters)) {
// check that word already has been added
if (array_key_exists($word,$wordCount)) {
// it does so add to our count
$wordCount[$word] += 1;
} else {
// it doesnt so put it in once
$wordCount[$word] = 1;
}
}
}
// sort the new word array
@arsort($wordCount);
$ret = array();
// return all elements
if ($top == 0) {
return $wordCount;
}
// return the top X number of elements
if ($top < count($wordCount)) {
$ret = array_slice($wordCount, 0, $top);
} else {
$ret = $wordCount;
}
//foreach ($wordCount as $key=>$val) {
// echo "Key: $key Value: $val ";
//}
return $ret;
}
/**
* Clean and prepare text, remove any unwanted tags etc
*
* @param string $text
* @return string
*/
function PrepareText($text) {
// removed as redundant from strip_tags
// and was causing parsing problems due to incorrect regex.
// regex is fixed for the sake of being fixed.
// convert html br to space
/*$regex = '/()/i';*/
//$text = preg_replace($regex, " ", $text);
// remove links
/*$regex = '/()(.*?)(<\/a>)/i';*/
//$text = preg_replace($regex, " $2 ", $text);
// convert html entities to chars
$text = html_entity_decode($text, ENT_QUOTES);
// strip any remaining html tags
$text = strip_tags($text);
// remove any mambot codes
$regex = '(\{.*?\})';
$text = preg_replace($regex, " ", $text);
// convert tabs to spaces
// added below
//$text = str_replace("\t", " ",$text);
// convert newlines and tabs to spaces
$text = str_replace(array("\r\n", "\r", "\n", "\t"), " ", $text);
// remove any extra spaces
while (strchr($text," ")) {
$text = str_replace(" ", " ",$text);
}
// general sentence tidyup
for ($cnt = 1; $cnt < strlen($text); $cnt++) {
// add a space after any full stops or comma's for readability
// added as strip_tags was often leaving no spaces
if (($text{$cnt} == '.') || ($text{$cnt} == ',')) {
if (isset($text{$cnt+1})) {
if ($text{$cnt+1} != ' ') {
$text = substr_replace($text, ' ', $cnt + 1, 0);
}
}
}
}
return trim($text);
}
/**
* Removes any non readable characters
*
* @param string $text
* @return string
*/
function CleanChars($text) {
for ($cnt=0; $cnt < strlen($text); $cnt++) {
$chr = $text{$cnt};
$ord = ord($chr);
if ($ord < 32 or $ord > 126) {
$chr = " ";
$text{$cnt} = $chr;
}
}
return $text;
}
/**
* Case insensitive replace
*
* @param string $search
* @param string $replace
* @param string $subject
* @return string
*/
function Replace($search, $replace, $subject, $word = false) {
if ($word) {
$regex = "/\b$search\b/i";
} else {
$regex = "/$search/i";
}
return preg_replace($regex, $replace, $subject);
}
?>
Сексуальное влечение, половое влечение версия для печати
Автор Administrator
13.12.2008 г.
Страница 8 из 18
Они постоянно играли в эту эротическую игру, которая возбуждала их
обоих. Настя прекрасно сознавала, что все, что делает для неё свекор,
это неспроста, она ему очень нравится, и однажды призналась своей
матери, что не за того вышла замуж. Мать от её слов пришла в ужас,
замахала на неё руками и сказала, чтобы Настя даже не смела думать о
таком «бесстыдстве» — выйти замуж за сына и «крутить шашни» с его
отцом. Она требовала, чтобы дочь выбросила «все тряпки», которые дарил
ей свекор, и прекратила с ним все отношения, иначе это «не доведет до
добра».
Но Настя уже давно поняла, что мужа она не любит, он был избалованным,
инфантильным «маменькиным сынком», ему явно рано было жениться, он так
и не стал ни мужем, о котором мечтала Настя, ни нормальным сексуальным
партнером.
Хотя теперь они имели возможность жить половой жизнью вполне легально,
и у них была своя комната в квартире матери Бориса, но их интимная
жизнь не изменилась к лучшему. По-прежнему у Бориса после нескольких
фрикций наступало семяизвержение, а когда он пытался неумело ласкать
Настю, она с трудом терпела его ласки.
Они довольно часто бывали в гостях у отца Бориса, и когда однажды к
нему неожиданно пришла его очередная любовница, Настя испытала такую
ревность, что даже не смогла ответить на её приветствие, отвернулась и
быстро ушла на кухню.
Свекор, конечно, заметил Настину реакцию и прошел за ней на кухню. Она
стояла у окна, с трудом сдерживая слезы, а он ласково приподнял её за
подбородок и сказал: «Что, малышка, больно тебе? А мне, думаешь, не
больно, когда я думаю, что этот обалдуй шарит своими тощими руками по
твоему телу?!» Настя с трудом взяла себя в руки и вышла к гостье, но
весь вечер была задумчивой и грустной.
После этого случая она категорически отказывалась пойти с мужем к его
отцу. Свекор тоже ей не звонил. Она рассказывала, что это был самый
тяжелый период в её жизни. Она прекрасно понимала, что их обоих тянет
друг к другу, но все же для неё существовала какая-то психологическая
преграда, и она не могла её преодолеть.
Родители воспитывали её довольно строго, отношения между её родителями
были очень теплыми, и это было для Насти эталоном взаимоотношений. Она
знала, что её родители никогда не изменяли друг другу, и мать всегда
внушала ей понятия о нравственности. А в её отношениях со свекром шла
речь не просто о возможной измене, Настя расценивала это почти как
кровосмешение и считала недопустимым.
Но на душе у неё было очень тяжело, она тосковала о свекре, вспоминала
его взгляд, его улыбку, каждый его жест, и он казался ей необычайно
привлекательным. Она страдала и от того, что он не звонил, хотя раньше
звонил очень часто, даже просто поинтересоваться, как дела, как её
настроение и успехи в учебе.
Она старалась быть более внимательной и ласковой с мужем, даже жалела
его, но понимала, что он слабый и неуверенный в себе человек, который
сам ещё нуждается в поддержке. Но Настя понимала, что не любит его, не
испытывает к нему сексуального влечения, а от легкого прикосновения
свекра или даже его многозначительного взгляда её всю бросало в жар.
И когда её муж сказал, что он был у отца и тот пригласил их отдохнуть
летом у него на даче, Настя сразу согласилась. Она уже так измучилась
бороться с собой, что махнула на все рукой и решила для себя: «Будь что
будет, от судьбы не уйдешь».
Все это время он Насте не звонил. Она мучилась сомнениями и терялась в
догадках, почему он не звонит, раз сам пригласил на дачу их обоих, а
потом решила, что он уже разлюбил её и его приглашение — чисто
по-родственному, чтобы показать ей, что все в прошлом. Она решила идти
до конца, надеясь, что увидев свекра равнодушным, сама излечится от
своей любви. Они с Борисом успешно сдали экзаменационную сессию, Борис
взял машину отца, и они поехали к нему на дачу.
Когда они подъехали, отец Бориса стоял у калитки и ждал их. Пока Борис
переносил их вещи в дом, Настя подошла к свекру. Ей не понадобилось
никаких слов, чтобы понять, что ничего не прошло. Они даже не сказали
друг другу ни единого слова, стояли и смотрели друг другу в глаза.
Потом он молча повернулся и пошел в дом. «Все, я пропала», — сказала
себе Настя и пошла за ним.
Весь вечер Настя была неестественно оживленной, смеялась, хлопотала и
готовила ужин, боясь снова встретиться взглядом со свекром. Потом они
сидели при свечах, глядя друг на друга и пили шампанское.
Муж Насти быстро опьянел и стал болтливым и навязчивым. Он ничего не
замечал и пытался заплетающимся языком рассказать какую-то длинную
историю, но они его не слушали. Потом свекор подняла бокал и произнес
тост: «За нас!» «За нас!», — эхом откликнулась Настя. Борис наконец
умолк и уснул, уронив голову на стол.
Настя со свекром вышли в сад. Он сорвал розу с куста и вдел её в
кармашек её блузки. Неожиданно для себя самой Настя взяла его руку и
поцеловала. Он погладил её по щеке и сказал: «Никогда не делай этого,
малышка. Руки целуют только женщинам».
Warning: include_once(/home/mshouse/domains/sdvigov.net/public_html/includes/foot2er.php) [function.include-once]: failed to open stream: No such file or directory in /home/mshouse/domains/sdvigov.net/public_html/templates/sdvigov/index.php on line 194
Warning: include_once() [function.include]: Failed opening '/home/mshouse/domains/sdvigov.net/public_html/includes/foot2er.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/mshouse/domains/sdvigov.net/public_html/templates/sdvigov/index.php on line 194