本文整理汇总了PHP中osc_get_preference函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_get_preference函数的具体用法?PHP osc_get_preference怎么用?PHP osc_get_preference使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osc_get_preference函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processData
private function processData($products)
{
if (!empty($products)) {
$total = 0;
foreach ($products as $aRow) {
$row = array();
$row['id'] = $aRow['id'];
$row['description'] = $aRow['description'];
$row['amount'] = osc_format_price(1000000 * $aRow['amount'], osc_get_preference('currency', 'payment_pro'));
$row['quantity'] = $aRow['quantity'];
$row['total'] = osc_format_price(1000000 * $aRow['amount'] * $aRow['quantity'], osc_get_preference('currency', 'payment_pro'));
$row['delete'] = '<a href="' . osc_route_url('payment-pro-cart-delete', array('id' => $aRow['id'])) . '" >' . __('Delete', 'payment_pro') . '</a>';
$row = osc_apply_filter('payment_pro_processing_row', $row, $aRow);
$this->addRow($row);
$this->rawRows[] = $aRow;
$total += $aRow['amount'] * $aRow['quantity'];
}
$row = array();
$row['id'] = '';
$row['description'] = '';
$row['amount'] = '';
$row['quantity'] = '<b>' . __('Total', 'payment_pro') . '</b>';
$row['total'] = '<b>' . osc_format_price(1000000 * $total, osc_get_preference('currency', 'payment_pro')) . '</b>';
$row['delete'] = '';
$this->addRow($row);
//$this->rawRows[] = $row;
}
}
示例2: __construct
function __construct()
{
parent::__construct();
// check if is moderator and can enter to this page
if ($this->isModerator()) {
if (!in_array($this->page, osc_apply_filter('moderator_access', array('items', 'comments', 'media', 'login', 'admins', 'ajax', 'stats', '')))) {
osc_add_flash_error_message(_m("You don't have enough permissions"), 'admin');
$this->redirectTo(osc_admin_base_url());
}
}
osc_run_hook('init_admin');
$config_version = str_replace('.', '', OSCLASS_VERSION);
$config_version = preg_replace('|-.*|', '', $config_version);
if ($config_version > osc_get_preference('version')) {
if (get_class($this) == 'CAdminTools') {
} else {
if (get_class($this) != 'CAdminUpgrade') {
$this->redirectTo(osc_admin_base_url(true) . '?page=upgrade');
}
}
}
// show donation successful
if (Params::getParam('donation') == 'successful') {
osc_add_flash_ok_message(_m('Thank you very much for your donation'), 'admin');
}
// enqueue scripts
osc_enqueue_script('jquery');
osc_enqueue_script('jquery-ui');
osc_enqueue_script('admin-osc');
osc_enqueue_script('admin-ui-osc');
}
示例3: youtube_update
function youtube_update()
{
// convert version
$version = osc_get_preference('youtube_version', 'youtube');
if ($version == '') {
$version = 12;
}
if ($version < 200) {
$conn = DBConnectionClass::newInstance();
$data = $conn->getOsclassDb();
$dbCommand = new DBCommandClass($data);
$dbCommand->query(sprintf('ALTER TABLE %s ADD COLUMN s_id VARCHAR(15) NOT NULL DEFAULT \'-no-id-\' AFTER s_youtube', YOUTUBE_TABLE));
// update s_id
$dbCommand->select();
$dbCommand->from(YOUTUBE_TABLE);
$rs = $dbCommand->get();
if ($rs !== false) {
$result = $rs->result();
foreach ($result as $video) {
$video_code = youtube_get_code_from_url($video['s_youtube']);
$dbCommand->update(YOUTUBE_TABLE, array('s_id' => $video_code), array('fk_i_item_id' => $video['fk_i_item_id']));
}
}
osc_set_preference('youtube_version', '200', 'youtube', 'STRING');
osc_reset_preferences();
}
}
示例4: fjs_search
function fjs_search()
{
echo "\n";
?>
var sQuery = '<?php
echo osc_esc_js(osc_get_preference('keyword_placeholder', 'seeker'));
?>
' ;
$(document).ready(function(){
var element = $('input[name="sPattern"]');
element.focus(function(){
$(this).prev().hide();
}).blur(function(){
if($(this).val() == '') {
$(this).prev().show();
}
}).prev().click(function(){
$(this).hide();
$(this).next().focus();
});
if(element.val() != ''){
element.prev().hide();
}
});
function doSearch() {
var sPattern = $('input[name=sPattern]');
if(sPattern.val() == ''){
return false;
}
return true;
}
<?php
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->setTableName('t_facebook_connect');
$this->setPrimaryKey('fk_i_user_id');
$this->setFields(array('fk_i_user_id', 'i_facebook_uid'));
self::$facebook = new Facebook(array('appId' => osc_get_preference('fbc_appId', 'facebook_connect'), 'secret' => osc_get_preference('fbc_secret', 'facebook_connect')));
}
示例6: show_qrcode
function show_qrcode()
{
$filename = osc_item_id() . "_" . md5(osc_item_url()) . "_" . osc_get_preference("code_size", "qrcode") . ".png";
if (!file_exists(osc_get_preference('upload_path', 'qrcode') . $filename)) {
qrcode_generateqr(osc_item_url(), osc_item_id());
}
echo '<img src="' . osc_get_preference('upload_url', 'qrcode') . $filename . '" alt="QR CODE" id="qrcode_' . osc_item_id() . '" class="qrcode" />';
}
示例7: modern_compactmode_actions
function modern_compactmode_actions()
{
$compactMode = osc_get_preference('compact_mode', 'modern_admin_theme');
$modeStatus = array('compact_mode' => true);
if ($compactMode == true) {
$modeStatus['compact_mode'] = false;
}
osc_set_preference('compact_mode', $modeStatus['compact_mode'], 'modern_admin_theme');
echo json_encode($modeStatus);
}
示例8: customHead
function customHead()
{
$all = osc_get_preference('location_todo');
if ($all == '') {
$all = 0;
}
$worktodo = LocationsTmp::newInstance()->count();
?>
<script type="text/javascript">
function reload() {
window.location = '<?php
echo osc_admin_base_url(true) . '?page=tools&action=locations';
?>
';
}
function ajax_() {
$.ajax({
type: "POST",
url: '<?php
echo osc_admin_base_url(true);
?>
?page=ajax&action=location_stats&<?php
echo osc_csrf_token_url();
?>
',
dataType: 'json',
success: function(data) {
if(data.status=='done') {
$('span#percent').html(100);
}else{
var pending = data.pending;
var all = <?php
echo osc_esc_js($all);
?>
;
var percent = parseInt( ((all-pending)*100) / all );
$('span#percent').html(percent);
ajax_();
}
}
});
}
$(document).ready(function(){
if(<?php
echo $worktodo;
?>
> 0) {
ajax_();
}
});
</script>
<?php
}
示例9: item_success_update_version
function item_success_update_version()
{
$version = osc_get_preference('item_success_version', 'item_success');
if ($version == '') {
$version = 0;
}
if ($version < 110) {
osc_set_preference('item_success_add_meta_og', 'true', 'item_success', 'BOOLEAN');
osc_set_preference('item_success_version', '110', 'item_success', 'STRING');
osc_reset_preferences();
}
}
示例10: button
public static function button($amount = '0.00', $description = '', $itemnumber = '101', $extra_array = null)
{
$extra = payment_prepare_custom($extra_array);
$r = rand(0, 1000);
$extra .= 'random,' . $r;
$apcs = self::customToAPC($extra);
$RETURNURL = osc_base_url() . 'oc-content/plugins/' . osc_plugin_folder(__FILE__) . 'return.php?extra=' . $extra;
$CANCELURL = osc_base_url() . 'oc-content/plugins/' . osc_plugin_folder(__FILE__) . 'cancel.php?extra=' . $extra;
?>
<form method="post" action="https://secure.payza.com/checkout" >
<input type="hidden" name="ap_merchant" value="seller_1_desteban@osclass.org"/>
<input type="hidden" name="ap_purchasetype" value="service"/>
<input type="hidden" name="ap_itemname" value="<?php
echo $description;
?>
"/>
<input type="hidden" name="ap_amount" value="<?php
echo $amount;
?>
"/>
<input type="hidden" name="ap_currency" value="<?php
echo osc_get_preference('currency', 'payment');
?>
"/>
<input type="hidden" name="ap_quantity" value="1"/>
<input type="hidden" name="ap_itemcode" value="<?php
echo $itemnumber;
?>
"/>
<input type="hidden" name="ap_description" value="Audio equipment"/>
<input type="hidden" name="ap_returnurl" value="<?php
echo $RETURNURL;
?>
"/>
<input type="hidden" name="ap_cancelurl" value="<?php
echo $CANCELURL;
?>
"/>
<?php
foreach ($apcs as $k => $v) {
echo '<input type="hidden" name="apc_' . $k . '" value="' . $v . '"/>';
}
?>
<input type="image" src="<?php
echo osc_base_url() . 'oc-content/plugins/' . osc_plugin_folder(__FILE__);
?>
payza-buy-now.png"/>
</form>
<?php
}
示例11: listAll
/**
* List all email datas stored in the database.
* @return Array the complete list of datas for emails and footer. Ready to use.
*/
public function listAll()
{
// Retrieve email datas from database.
$datas = json_decode(osc_get_preference("email_datas", mdh_current_preferences_section()), true);
if (!is_array($datas)) {
// TODO. Handle error.
}
// Retrieve all emails from database;
$emails = Page::newInstance()->listAll(true);
$activeLocales = Madhouse_Utils_Collections::getFieldsFromList(osc_get_locales(), "pk_c_code");
// Complete the list of emails with new mails (not already in the JSON).
foreach ($emails as $e) {
if (!in_array($e["s_internal_name"], Madhouse_Utils_Collections::getFieldsFromList($datas["emails"], "s_internal_name"))) {
array_push($datas["emails"], Madhouse_EmailMagick_Utils::newEmptyEmail($e["s_internal_name"]));
}
}
// Complete, filter and sort emails.
$datas["emails"] = Madhouse_Utils_Collections::sortListByField(array_map(function ($e) use($emails, $activeLocales) {
$row = Madhouse_Utils_Collections::findByField($emails, "s_internal_name", $e["s_internal_name"]);
$e["pk_i_id"] = $row["pk_i_id"];
// Compute the filling rate.
$e["i_filled"] = Madhouse_EmailMagick_Utils::computeFillingRate($e);
// Is the email still exists ? (in oc_t_pages)
if (!in_array($e["s_internal_name"], Madhouse_Utils_Collections::getFieldsFromList($emails, "s_internal_name"))) {
$e["b_deleted"] = true;
}
// Add a locale for locales that have not been provided.
foreach ($activeLocales as $al) {
$el = Madhouse_Utils_Collections::findByField($e["locales"], "fk_c_locale_code", $al);
if (is_null($el)) {
array_push($e["locales"], Madhouse_EmailMagick_Utils::newEmptyLocale($al));
}
}
$e["locales"] = array_values(array_filter($e["locales"], function ($v) use($activeLocales) {
return in_array($v["fk_c_locale_code"], $activeLocales);
}));
return $e;
}, $datas["emails"]), "s_internal_name");
// Filter the footer datas (only active locales are left).
$datas["footer"]["locales"] = array_values(array_filter($datas["footer"]["locales"], function ($v) use($activeLocales) {
return in_array($v["fk_c_locale_code"], $activeLocales);
}));
// Add a locale for locales that have not been provided.
foreach ($activeLocales as $al) {
$fl = Madhouse_Utils_Collections::findByField($datas["footer"]["locales"], "fk_c_locale_code", $al);
if (is_null($fl)) {
array_push($datas["footer"]["locales"], Madhouse_EmailMagick_Utils::newEmptyLocale($al));
}
}
return $datas;
}
示例12: __construct
function __construct()
{
parent::__construct();
// check if is moderator and can enter to this page
if( $this->isModerator() ) {
if( !in_array($this->page, osc_apply_filter('moderator_access', array('items', 'comments', 'media', 'login', 'admins', 'ajax', 'stats',''))) ) {
osc_add_flash_error_message(_m("You don't have enough permissions"), 'admin');
$this->redirectTo(osc_admin_base_url());
}
}
osc_run_hook( 'init_admin' );
// check if exist a new version each day
if( (time() - osc_last_version_check()) > (24 * 3600) ) {
$data = osc_file_get_contents('http://osclass.org/latest_version_v1.php?callback=?');
$data = preg_replace('|^\?\((.*?)\);$|', '$01', $data);
$json = json_decode($data);
if( $json->version > osc_version() ) {
osc_set_preference( 'update_core_json', $data );
} else {
osc_set_preference( 'update_core_json', '' );
}
osc_set_preference( 'last_version_check', time() );
osc_reset_preferences();
}
$config_version = str_replace('.', '', OSCLASS_VERSION);
$config_version = preg_replace('|-.*|', '', $config_version);
if( $config_version > osc_get_preference('version') ) {
if(get_class($this) == 'CAdminTools') {
} else {
if(get_class($this) != 'CAdminUpgrade' )
$this->redirectTo(osc_admin_base_url(true) . '?page=upgrade');
}
}
// show donation successful
if( Params::getParam('donation') == 'successful' ) {
osc_add_flash_ok_message(_m('Thank you very much for your donation'), 'admin');
}
// enqueue scripts
osc_enqueue_script('jquery');
osc_enqueue_script('jquery-ui');
osc_enqueue_script('admin-osc');
osc_enqueue_script('admin-ui-osc');
}
示例13: cookie_load
function cookie_load()
{
?>
<script type="text/javascript" >
$(document).ready(function () {
var options = new Object();
<?php
if (osc_get_preference('accept', 'cookie') == 1) {
echo 'options.cookieAcceptButton = true;';
}
if (osc_get_preference('decline', 'cookie') == 1) {
echo 'options.cookieDeclineButton = true;';
}
if (osc_get_preference('reset', 'cookie') == 1) {
echo 'options.cookieResetButton = true;';
}
echo "options.cookiePolicyLink = '" . osc_esc_js(osc_get_preference('policy_link', 'cookie')) . "';";
echo "options.cookieWhatAreTheyLink = '" . osc_esc_js(osc_get_preference('what_are_link', 'cookie')) . "';";
echo "options.cookieAnalyticsMessage = '" . str_replace("'", "\\'", osc_get_preference('analytics_msg', 'cookie')) . "';";
echo "options.cookieMessage = '" . str_replace("'", "\\'", osc_get_preference('non_analytics_msg', 'cookie')) . "';";
if (osc_get_preference('analytics_id', 'cookie') != '') {
?>
options.cookieAnalytics = true;
if (jQuery.cookie('cc_cookie_decline') == "cc_cookie_decline") {
} else {
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<?php
echo osc_get_preference('analytics_id', 'cookie');
?>
']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document. getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
}
<?php
} else {
echo 'options.cookieAnalytics = false;';
}
?>
$.cookieCuttr(options);
});
</script>
<?php
}
示例14: update
/**
* Generates emails from the templates & datas.
* - For each emails and for each active locale :
* - Check if the emails is empty or does not exists anymore. If so, do nothing.
* - Combines templates and datas to produce the s_title and s_text fields.
* - Saves those settings for next run.
* @return void.
*/
public function update()
{
// Decode and transform into a PHP array (true as a second parameter).
$data = json_decode(Params::getParam("email_datas", false, false), true);
if (!is_array($data)) {
mdh_handle_error(sprintf(__("Given JSON datas are not correct (Error #%d)", mdh_current_plugin_name()), json_last_error()), mdh_emailmagick_url());
}
// Get the HTML template.
$template = Params::getParam("email_template", false, false);
// This is current emails datas (stored in the database).
$currentDatas = json_decode(osc_get_preference("email_datas", mdh_current_preferences_section()), true);
// Create a new array, merge of the old and the new one.
$newDatas = array("emails" => array(), "footer" => array("locales" => Madhouse_EmailMagick_Utils::mergeLocales($currentDatas["footer"]["locales"], $data["footer"]["locales"])));
// Iterate through new submitted emails data to update.
$i = 0;
foreach ($data["emails"] as $e) {
// Get the old email datas, as they are right now.
$oe = Madhouse_Utils_Collections::findByField($currentDatas["emails"], "s_internal_name", $e["s_internal_name"]);
if (is_null($oe)) {
// Not found in old emails. => new email has been installed.
$locales = $e["locales"];
} else {
// Found in old emails. Merge with new locales.
$locales = Madhouse_EmailMagick_Utils::mergeLocales($oe["locales"], $e["locales"]);
}
// Email exists, create in order to be filled and pushed to the new datas (at the end).
$nEmail = array("s_internal_name" => $e["s_internal_name"], "locales" => $locales);
// Get the email from the database.
$email = Page::newInstance()->findByInternalName($e["s_internal_name"]);
if ($email !== false && count($email) > 0) {
// Update the email.
$updated = Madhouse_EmailMagick_Models_Emails::newInstance()->update($template, $email["pk_i_id"], $newDatas, $nEmail);
$i += $updated;
}
array_push($newDatas["emails"], $nEmail);
}
// Saves the settings.
Madhouse_Utils_Controllers::doSettingsPost(array("email_template", "email_datas"), array("email_template" => $template, "email_datas" => json_encode($newDatas)), mdh_emailmagick_url(), null, sprintf(__("Sucessfully updated %d emails (out of %d)!", mdh_current_plugin_name()), $i, count($data["emails"]) * count(osc_get_locales())));
}
示例15: osc_google_analytics_id
function osc_google_analytics_id()
{
return osc_get_preference('google_analytics_id', 'plugin-google_analytics');
}