Пример #1
0
function osc_static_page_url($locale = '')
{
    if ($locale != '') {
        if (osc_rewrite_enabled()) {
            return osc_base_url() . osc_static_page_field("s_internal_name") . "-p" . osc_static_page_field("pk_i_id") . "-" . $locale;
        } else {
            return osc_base_url(true) . "?page=page&id=" . osc_static_page_field("pk_i_id") . "&lang=" . $locale;
        }
    } else {
        if (osc_rewrite_enabled()) {
            return osc_base_url() . osc_static_page_field("s_internal_name") . "-p" . osc_static_page_field("pk_i_id");
        } else {
            return osc_base_url(true) . "?page=page&id=" . osc_static_page_field("pk_i_id");
        }
    }
}
Пример #2
0
/**
 * Gets current page meta information
 *
 * @return string
 */
function osc_static_page_meta($field = null)
{
    if (!View::newInstance()->_exists('page_meta')) {
        $meta = json_decode(osc_static_page_field("s_meta"), true);
    } else {
        $meta = View::newInstance()->_get('page_meta');
    }
    if ($field == null) {
        $meta = isset($meta[$field]) && !empty($meta[$field]) ? $meta[$field] : '';
    }
    return $meta;
}
Пример #3
0
/**
 * Render the specified file
 *
 * @param string $file must be a relative path, from PLUGINS_PATH
 */
function nc_osc_static_page_text($file = '')
{
    $locale = osc_current_user_locale();
    $content = osc_static_page_field("s_text", $locale);
    return do_shortcode($content);
    //return $content;
}
Пример #4
0
/**
 * Gets current page slug or internal name
 *
 * @return string
 */
function osc_static_page_slug()
{
    return osc_static_page_field("s_internal_name");
}
Пример #5
0
/**
 * Gets current page meta information
 *
 * @return string
 */
function osc_static_page_meta($field = null)
{
    if ($field == null) {
        if (!View::newInstance()->_exists('page_meta')) {
            return json_decode(osc_static_page_field("s_meta"), true);
        } else {
            return View::newInstance()->_get('s_meta');
        }
    } else {
        if (!View::newInstance()->_exists('page_meta')) {
            $meta = json_decode(osc_static_page_field("s_meta"), true);
        } else {
            $meta = View::newInstance()->_get('page_meta');
        }
        if (isset($meta[$field])) {
            return $meta[$field];
        } else {
            return '';
        }
    }
}