Пример #1
0
 function tool_private_is_private_post($post_id)
 {
     $go_private = get_option(TOOL_PRIVATE_OPTIONS_GO_PRIVATE);
     if ($go_private && $go_private == "1") {
         return true;
     } else {
         if ($go_private && $go_private == "2") {
             $private_items = get_option(TOOL_PRIVATE_OPTIONS_ITEMS . "-" . get_current_lang());
             if (!empty($private_items)) {
                 $parent_ids = get_post_ancestors($post_id);
                 $private_items = explode(",", $private_items);
                 if (in_array($post_id, $private_items)) {
                     return true;
                 } else {
                     foreach ($parent_ids as $parent_id) {
                         if (in_array($parent_id, $private_items)) {
                             return true;
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
 function site_url($uri = '', $lang = '')
 {
     $CI =& get_instance();
     if ($lang == '') {
         $lang = get_current_lang();
     }
     $final_url = $CI->config->site_url($lang . '/' . $uri);
     $CI->load->config('business_directory');
     if ($CI->config->item('use_ssl') == 'yes') {
         $final_url = str_replace('http://', 'https://', $final_url);
     }
     #uncomment this line if you want to force
     return $final_url;
 }
Пример #3
0
        <?php 
}
?>
    }
</style>

<script type="text/javascript">var old_ie = 0;</script>
<!--[if lte IE 8]> <script type="text/javascript"> old_ie = 1; </script> < ![endif]-->

</head>



<?php 
$CI = get_instance();
$curr_lang = get_current_lang();
if ($curr_lang == 'ar' || $curr_lang == 'fa' || $curr_lang == 'he' || $curr_lang == 'ur') {
    ?>
<link rel="stylesheet" href="<?php 
    echo theme_url();
    ?>
/assets/css/rtl-fix.css">
<body class="home" dir="rtl">
<?php 
} else {
    ?>
<body class="home" dir="<?php 
    echo get_settings('site_settings', 'site_direction', 'ltr');
    ?>
">
<?php 
Пример #4
0
 * $Date: 2009-12-14 17:22:19 +0800 (周一, 2009-12-14) $
 * $Id: index.php 16882 2009-12-14 09:22:19Z liubo $
 */
require_once './includes/init.php';
/* 初始化EC的字符集与语言变量*/
$updater_lang = $ec_charset = '';
if (!empty($_POST['lang'])) {
    $lang_charset = explode('_', $_POST['lang']);
    $updater_lang = $lang_charset[0] . '_' . $lang_charset[1];
    $ec_charset = $lang_charset[2];
}
if (empty($updater_lang)) {
    if (defined('EC_LANGUAGE')) {
        $updater_lang = EC_LANGUAGE;
    } else {
        $updater_lang = get_current_lang();
        if ($updater_lang === false) {
            die('Please set system\'s language!');
        }
    }
}
if (empty($ec_charset)) {
    if (isset($_COOKIE['ECCC'])) {
        $ec_charset = $_COOKIE['ECCC'];
    } elseif (defined('EC_CHARSET')) {
        $ec_charset = EC_CHARSET;
    } elseif (get_current_version() < 'v2.6.0') {
        $ec_charset = 'utf-8';
    } else {
        $ec_charset = 'utf-8';
    }
Пример #5
0
 function render_widgets($position = '')
 {
     $CI = get_instance();
     $CI->load->helper('inflector');
     $CI->load->helper('file');
     $widgets = get_widgets_by_position($position);
     if (!empty($widgets)) {
         foreach ($widgets as $row) {
             $query = $CI->db->get_where('widgets', array('alias' => $row));
             if ($query->num_rows() > 0) {
                 $row = $query->row();
                 if ($row->status == 1) {
                     $curr_lang = get_current_lang();
                     if (read_file('./application/modules/widgets/' . $curr_lang . '_' . $row->alias . '.php') != FALSE) {
                         require './application/modules/widgets/' . $curr_lang . '_' . $row->alias . '.php';
                     } else {
                         if (read_file('./application/modules/widgets/' . $row->alias . '.php') != FALSE) {
                             require './application/modules/widgets/' . $row->alias . '.php';
                         }
                     }
                 } else {
                     if ($row->status == 0) {
                         echo '';
                     } else {
                         echo '';
                     }
                 }
             } else {
                 echo '';
             }
         }
     }
 }
 function social_sharing_meta_tags_for_post($post = '')
 {
     if ($post != '' && $post->num_rows() > 0) {
         $CI = get_instance();
         $post = $post->row();
         $curr_lang = get_current_lang();
         $site_title = get_settings('site_settings', 'site_title', 'Memento');
         $title = get_post_data_by_lang($post, 'title');
         $detail_link = site_url('ads/' . $post->unique_id . '/' . dbc_url_title($title));
         $meta = '<meta name="twitter:card" content="photo" />' . "\n" . '<meta name="twitter:site" content="' . $site_title . '" />' . "\n" . '<meta name="twitter:image" content="' . get_featured_photo_by_id($post->featured_img) . '" />' . "\n" . '<meta property="og:title" content="' . $title . '" />' . "\n" . '<meta property="og:site_name" content="' . $site_title . '" />' . "\n" . '<meta property="og:url" content="' . $detail_link . '" />' . "\n" . '<meta property="og:description" content="Click to view detail..." />' . "\n" . '<meta property="og:type" content="article" />' . "\n" . '<meta property="og:image" content="' . get_featured_photo_by_id($post->featured_img) . '" />' . '<meta property="fb:app_id" content="' . get_settings('memento_settings', 'fb_app_id', 'none') . '" />';
         return $meta;
     } else {
         return '';
     }
 }
 public function rss()
 {
     $this->load->helper('xml');
     $curr_lang = get_current_lang();
     if ($curr_lang == '') {
         $curr_lang = default_lang();
     }
     $value = array();
     $value['curr_lang'] = $curr_lang;
     $value['feed_name'] = translate(get_settings('site_settings', 'site_title', 'Santa Barbara'));
     $value['encoding'] = 'utf-8';
     $value['feed_url'] = site_url('show/rss');
     $value['page_description'] = lang_key('your web description');
     $value['page_language'] = $curr_lang . '-' . $curr_lang;
     $value['creator_email'] = get_settings('webadmin_email', 'contact_email', '');
     $value['posts'] = $this->show_model->get_properties_by_range(0, $this->PER_PAGE, 'id', 'desc');
     # header("Content-Type: application/rss+xml");
     load_view('rss_view', $value, FALSE, $this->active_theme);
 }
Пример #8
0
 public function savesitesettings($key = 'site_settings')
 {
     $this->load->model('options_model');
     foreach ($_POST as $k => $value) {
         if ($k != 'ga_tracking_code') {
             $this->form_validation->set_rules($k, $k, 'required');
         }
     }
     if ($this->form_validation->run() == FALSE) {
         $this->sitesettings($key, 'error');
     } else {
         if (constant("ENVIRONMENT") == 'demo') {
             $this->session->set_flashdata('msg', '<div class="alert alert-success">Data updated.[NOT AVAILABLE ON DEMO]</div>');
         } else {
             $data['values'] = json_encode($_POST);
             $res = $this->options_model->getvalues($key);
             if ($res == '') {
                 $data['key'] = $key;
                 $this->options_model->addvalues($data);
             } else {
                 $this->options_model->updatevalues($key, $data);
             }
             $this->session->set_flashdata('msg', '<div class="alert alert-success">' . lang_key('data_updated') . '</div>');
         }
         $current_lang = get_current_lang();
         $url = site_url('admin/system/sitesettings/' . $key);
         $url = str_replace('/' . $current_lang . '/', '/' . default_lang() . '/', $url);
         redirect($url);
     }
 }
Пример #9
0
/**
 * save settings
 */
function tool_private_settings_save()
{
    if (!current_user_can('administrator')) {
        return;
    }
    if (!isset($_POST[TOOL_PRIVATE_OPTIONS_NONCE_ACTION]) || !wp_verify_nonce($_POST[TOOL_PRIVATE_OPTIONS_NONCE_ACTION], TOOL_PRIVATE_OPTIONS_NONCE_ACTION)) {
        return;
    }
    // TOOL_PRIVATE_OPTIONS_GO_PRIVATE
    if (isset($_POST[TOOL_PRIVATE_OPTIONS_GO_PRIVATE]) && !empty($_POST[TOOL_PRIVATE_OPTIONS_GO_PRIVATE])) {
        if (!get_option(TOOL_PRIVATE_OPTIONS_GO_PRIVATE)) {
            add_option(TOOL_PRIVATE_OPTIONS_GO_PRIVATE, sanitize_text_field($_POST[TOOL_PRIVATE_OPTIONS_GO_PRIVATE]));
        } else {
            update_option(TOOL_PRIVATE_OPTIONS_GO_PRIVATE, sanitize_text_field($_POST[TOOL_PRIVATE_OPTIONS_GO_PRIVATE]));
        }
    } else {
        delete_option(TOOL_PRIVATE_OPTIONS_GO_PRIVATE);
    }
    // TOOL_PRIVATE_OPTIONS_ITEMS
    $key = TOOL_PRIVATE_OPTIONS_ITEMS . "-" . get_current_lang();
    $items = "";
    foreach ($_POST as $k => $v) {
        if (startsWith($k, "tool-private-item-")) {
            if ($v = "on") {
                $id = str_replace("tool-private-item-", "", $k);
                if (!empty($items)) {
                    $items .= ",";
                }
                $items .= $id;
            }
        }
    }
    if (!empty($items)) {
        if (!get_option($key)) {
            add_option($key, $items);
        } else {
            update_option($key, $items);
        }
    } else {
        delete_option($key);
    }
    // TOOL_PRIVATE_OPTIONS_MESSAGE
    $key = TOOL_PRIVATE_OPTIONS_MESSAGE . "-" . get_current_lang();
    if (isset($_POST[$key]) && !empty($_POST[$key])) {
        if (!get_option($key)) {
            add_option($key, sanitize_text_field($_POST[$key]));
        } else {
            update_option($key, sanitize_text_field($_POST[$key]));
        }
    } else {
        delete_option($key);
    }
}
?>
					</div>
				</div><!-- .site-branding -->
			</div>
		</header><!-- .site-header -->
	
		<div class="main site-main">
		
			<div class="site-main-container">

				<div id="primary" class="content-area tool-private">
				
					<div id="content" class="site-content" role="main">
					
						<?php 
$private_message = get_option(TOOL_PRIVATE_OPTIONS_MESSAGE . "-" . get_current_lang(), "");
if (!empty($private_message)) {
    ?>
							<h2><?php 
    echo $private_message;
    ?>
</h2>
							<?php 
}
?>
						<div class="button-wrapper">
							<a href="<?php 
echo wp_login_url(get_current_url(true));
?>
" class="button"><?php 
_e("sign in", CUSTOM_PLUGIN_TEXT_DOMAIN);
Пример #11
0
echo TOOL_PRIVATE_OPTIONS_MESSAGE . "-" . get_current_lang();
?>
"><?php 
_e("Message", CUSTOM_PLUGIN_TEXT_DOMAIN);
?>
 : </label>
				</th>
				<td valign="middle">
					<?php 
$meta = get_option(TOOL_PRIVATE_OPTIONS_MESSAGE . "-" . get_current_lang(), "");
?>
					<input type="text" id="<?php 
echo TOOL_PRIVATE_OPTIONS_MESSAGE . "-" . get_current_lang();
?>
" name="<?php 
echo TOOL_PRIVATE_OPTIONS_MESSAGE . "-" . get_current_lang();
?>
" value="<?php 
echo esc_attr($meta);
?>
" size="40" placeholder="<?php 
_e("Private area");
?>
..." />
				</td>
				<td valign="middle"></td>
			</tr>
			<tr valign="top" class="private-options private-options-2">
				<th class="metabox_label_column" align="left" valign="middle"></th>
				<td valign="middle">
					<?php