当前位置: 首页>>代码示例>>PHP>>正文


PHP drupal_json_encode函数代码示例

本文整理汇总了PHP中drupal_json_encode函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_json_encode函数的具体用法?PHP drupal_json_encode怎么用?PHP drupal_json_encode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drupal_json_encode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mss_call_drupal

function mss_call_drupal($functionname, $params, $keys)
{
    // TODO: check for valid call and return
    // TODO: validate function name and params
    $data = call_user_func($functionname, $params);
    $retval = mss_array_get_safe($data, $keys);
    return drupal_json_encode($retval);
}
开发者ID:apperceive,项目名称:dpipes,代码行数:8,代码来源:dpips.php

示例2: send

 public function send($endpoint, $payload = array())
 {
     $this->debug('Sending data to ' . $endpoint);
     // Attach the transaction to the payload.
     $payload['transaction'] = $this->generateTransactionObject();
     // Generate the full endpoint URL.
     $request_url = trim($this->remote->url, '/') . '/' . self::ENDPOINT_PREFIX . $endpoint;
     // Generate the headers.
     $headers = $this->generateHeaders();
     // Generate the payload.
     $this->debug($payload);
     $payload = \drupal_json_encode($payload);
     // Set the payload.
     $this->payload = $payload;
     // Start the curl request.
     $handle = curl_init($request_url);
     curl_setopt($handle, CURLOPT_POST, true);
     curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($handle, CURLOPT_POSTFIELDS, $payload);
     // Execute the request and debug the output.
     $response = curl_exec($handle);
     $json = \drupal_json_decode($response);
     if ($json === null) {
         $this->debug($response);
         throw new TransactionException('Response from server was malformed. Check the recent log messages for more details. Response: ' . $response);
     } else {
         $this->debug($json);
         // Update the data for the current transaction.
         if (isset($json['transaction']['data']) && is_array($json['transaction']['data'])) {
             $this->data = $json['transaction']['data'];
         }
         // If there were messages sent back from the server, forward them to drupal_set_message.
         if (array_key_exists('messages', $json) && is_array($json['messages']) && count($json['messages']) > 0) {
             foreach ($json['messages'] as $message) {
                 drupal_set_message('[' . $this->remote->label . '] ' . $message['message'], $message['type']);
             }
         }
         return $json;
     }
 }
开发者ID:sammarks,项目名称:publisher,代码行数:41,代码来源:Transaction.php

示例3: drupal_json_encode

<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link type="text/css" rel="stylesheet" href="https://api.jirafe.com/dashboard/css/magento_ui.css" media="all" />
  <script type="text/javascript" src="https://api.jirafe.com/dashboard/js/magento_ui.js"></script>
</head>
<body>
<div id="jirafe"></div>

<script type="text/javascript">
(function($) {
  $(function() {
    $('#jirafe').jirafe(<?php 
echo drupal_json_encode($data);
?>
);
    setTimeout(function() { if ($('mod-jirafe') == undefined){ $('messages').insert ("<ul class=\"messages\"><li class=\"error-msg\">We're unable to connect with the Jirafe service for the moment. Please wait a few minutes and refresh this page later.</li></ul>"); } }, 4000);
  });
  setInterval(function() {
    $('iframe', window.parent.document).css('height', document.body.scrollHeight);
  }, 100);
})(jQuery);
</script>
</body>
</html>
开发者ID:bunnywong,项目名称:isnatura.com.hk,代码行数:25,代码来源:jirafe-dashboard-iframe.tpl.php

示例4: populate

 private function populate()
 {
     $json = $this->notation;
     $json_array = drupal_json_decode($json);
     dsm($json_array);
     // Object Type
     if (isset($json_array['objectType'])) {
         if ($json_array['objectType'] == 'Activity') {
         } else {
             // some kind of validation error
         }
     } else {
         $this->object_type = 'Activity';
     }
     // activity_id
     if (isset($json_array['id'])) {
         $this->activity_id = $json_array['id'];
     }
     // Definition
     if (isset($json_array['definition'])) {
         // Name
         if (isset($json_array['definition']['name'])) {
             // full name language map as json
             $this->name_json = drupal_json_encode($json_array['definition']['name']);
             // US English name
             if (isset($json_array['definition']['name']['en-US'])) {
                 $this->name_en_us = $json_array['definition']['name']['en-US'];
             }
         }
         // Description
         if (isset($json_array['definition']['description'])) {
             // full description language map as json
             $this->description_json = drupal_json_encode($json_array['definition']['description']);
             // US English description
             if (isset($json_array['definition']['description']['en-US'])) {
                 $this->description_en_us = $json_array['definition']['description']['en-US'];
             }
         }
         // type
         if (isset($json_array['definition']['type'])) {
             $this->type = $json_array['definition']['type'];
         }
         // more_info
         if (isset($json_array['definition']['moreInfo'])) {
             $this->more_info = $json_array['definition']['moreInfo'];
         }
         // extensions
         if (isset($json_array['definition']['extensions'])) {
             $this->type = drupal_json_encode($json_array['definition']['extensions']);
         }
         //interaction_type
         if (isset($json_array['definition']['interactionType'])) {
             $this->interaction_type = $json_array['definition']['interactionType'];
         }
         // correct_responses_pattern
         if (isset($json_array['definition']['correctResponsesPattern'])) {
             $this->correct_responses_pattern = drupal_json_encode($json_array['definition']['correctResponsesPattern']);
         }
         //Next the interaction fields
         $this->interaction_components_json = '';
         $intact_type = array('choices', 'scale', 'source', 'steps', 'target');
         foreach ($intact_type as $type) {
             if (isset($json_array['definition'][$type]) && is_array($json_array['definition'][$type])) {
                 if (!isset($json_array['definition'][$type][0])) {
                     $this->{'tincan_interaction_com_' . $type}[LANGUAGE_NONE][0]['json'] = drupal_json_encode($json_array['definition'][$type]);
                     $this->interaction_components_json .= ' ' . drupal_json_encode($item) . ' ';
                     if (isset($json_array['definition'][$type]['id'])) {
                         $this->{'tincan_interaction_com_' . $type}[LANGUAGE_NONE][0]['id'] = $json_array['definition'][$type]['id'];
                     }
                     if (isset($json_array['definition'][$type]['description'])) {
                         $this->{'tincan_interaction_com_' . $type}[LANGUAGE_NONE][0]['description'] = drupal_json_encode($json_array['definition'][$type]['description']);
                     }
                     if (isset($json_array['definition'][$type]['description']['en-US'])) {
                         $this->{'tincan_interaction_com_' . $type}[LANGUAGE_NONE][0]['description_en_us'] = $json_array['definition'][$type]['description']['en-US'];
                     }
                 } else {
                     $count = 0;
                 }
                 foreach ($json_array['definition'][$type] as $key => $item) {
                     $this->{'tincan_interaction_com_' . $type}[LANGUAGE_NONE][$count]['json'] = drupal_json_encode($item);
                     $this->interaction_components_json .= ' ' . drupal_json_encode($item) . ' ';
                     if (isset($item['id'])) {
                         $this->{'tincan_interaction_com_' . $type}[LANGUAGE_NONE][$count]['id'] = $item['id'];
                     }
                     if (isset($item['description'])) {
                         $this->{'tincan_interaction_com_' . $type}[LANGUAGE_NONE][$count]['description'] = drupal_json_encode($item['description']);
                     }
                     if (isset($item['description']['en-US'])) {
                         $this->{'tincan_interaction_com_' . $type}[LANGUAGE_NONE][$count]['description_en_us'] = $item['description']['en-US'];
                     }
                     $count += 1;
                 }
                 //end else
             }
             //end if isset(type)
         }
         // end foreach type
     }
     //end if isset(definition)
 }
开发者ID:jackrabbithanna,项目名称:tincan_lrs,代码行数:100,代码来源:Activity.php

示例5: l

        print $playlist_node->video_files['channels']['1']['url'];
        ?>
",
              <?php 
    }
    ?>
              authorUrl: '<?php 
    print l($playlist_node->name, 'user/' . $playlist_node->uid);
    ?>
',
              date: '<?php 
    print date('M d, Y', $playlist_node->created);
    ?>
',
              trackingImgUrl: <?php 
    print drupal_json_encode($playlist_node->tracking_img_url);
    ?>
            }<?php 
    if (++$c != $nodes_count) {
        print ",";
    }
    ?>
         <?php 
}
?>
        ],
      }
    },
      {type:"download",config:{file: "<?php 
print $video_file['file_absolute'];
?>
开发者ID:johnedelatorre,项目名称:fusion,代码行数:31,代码来源:videoplayer.tpl.php

示例6: safe_tags

   </div>
  <div class="clear"/>
</div>
    
<script type="text/javascript" src="<?php 
echo $options['js_uploader'];
?>
" id="simple-ajax-uploader-js"></script>
<script type="text/javascript">
 (function() {
    function safe_tags(str) {
      return str.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;') ;
    }
 
    var options = <?php 
echo drupal_json_encode($options);
?>
;
    
    var p_width = options['width'], p_height = options['height'];

    var btn  = document.getElementById('upload-btn'),
      wrap   = document.getElementById('pic-progress-wrap'),
      picBox = document.getElementById('picbox'),
      previewBox = document.getElementById('previewBox'),
      errBox     = document.getElementById('errormsg');
	
    var uploader = new ss.SimpleUpload({
        button: btn,
        url: options['url_upload'],
        progressUrl: options['url_progress'],
开发者ID:drupalconnect,项目名称:finsearches,代码行数:31,代码来源:avatar-uploader-panel.tpl.php

示例7: modStatus

 /**
  * @param $keystandard
  * @param $keystr
  * @param $status
  * @return mixed|string
  * @todo 修改商品在微信的状态,及提交审核/取消发布商品
  */
 function modStatus($keystandard, $keystr, $status)
 {
     $data = ['keystandard' => $keystandard, 'keystr' => $keystr, 'status' => $status];
     $url = "https://api.weixin.qq.com/scan/product/modstatus?access_token={$this->access_token()}";
     return $this->request($url, 'POST', drupal_json_encode($data));
 }
开发者ID:sosyuki,项目名称:wechat,代码行数:13,代码来源:ScanController.php

示例8: populateContext

 private function populateContext($json_array)
 {
     if (isset($json_array['registration'])) {
         $this->tincan_context[LANGUAGE_NONE][0]['registration'] = $json_array['registration'];
     }
     if (isset($json_array['revision'])) {
         $this->tincan_context[LANGUAGE_NONE][0]['revision'] = $json_array['revision'];
     }
     if (isset($json_array['platform'])) {
         $this->tincan_context[LANGUAGE_NONE][0]['platform'] = $json_array['platform'];
     }
     if (isset($json_array['language'])) {
         $this->tincan_context[LANGUAGE_NONE][0]['language'] = $json_array['language'];
     }
     if (isset($json_array['statement'])) {
         if (isset($json_array['statement']['objectType'])) {
             $this->tincan_context[LANGUAGE_NONE][0]['statement_reference_object_type'] = $json_array['statement']['objectType'];
         }
         if (isset($json_array['statement']['id'])) {
             $this->tincan_context[LANGUAGE_NONE][0]['statement_reference_statement_id'] = $json_array['statement']['id'];
         }
     }
     if (isset($json_array['instructor'])) {
         $target_id = $this->findAgent($json_array);
         if (!$target_id) {
             $target_id = $this->createAgent($json_array);
         }
         if ($target_id) {
             $this->tincan_instructor[LANGUAGE_NONE][0]['target_id'] = $target_id;
         }
     }
     if (isset($json_array['team'])) {
         $target_id = $this->findAgent($json_array);
         if (!$target_id) {
             $target_id = $this->createAgent($json_array);
         }
         if ($target_id) {
             $this->tincan_team[LANGUAGE_NONE][0]['target_id'] = $target_id;
         }
     }
     if (isset($json_array['contextActivities'])) {
         $this->tincan_context[LANGUAGE_NONE][0]['context_activities_json'] = drupal_json_encode($json_array['contextActivities']);
         $context_activities_types = array('parent', 'grouping', 'category', 'other');
         foreach ($context_activities_types as $type) {
             if (isset($json_array['contextActivities'][$type]) && is_array($json_array['contextActivities'][$type])) {
                 if (!isset($json_array['contextActivities'][$type][0])) {
                     $target_id = $this->findActivity($json_array['contextActivities'][$type]);
                     if (!$target_id) {
                         $target_id = $this->createActivity($json_array['contextActivities'][$type]);
                     }
                     if ($target_id) {
                         $this->{'tincan_context_activity_' . $type}[LANGUAGE_NONE][0]['target_id'] = $target_id;
                     }
                 } else {
                     $count = 0;
                     foreach ($json_array['contextActivities'][$type] as $item) {
                         $target_id = $this->findActivity($item);
                         if (!$target_id) {
                             $target_id = $this->createActivity($item);
                         }
                         if ($target_id) {
                             $this->{'tincan_context_activity_' . $type}[LANGUAGE_NONE][$count]['target_id'] = $target_id;
                         }
                         $count += 1;
                     }
                 }
             }
         }
     }
     if (isset($json_array['extensions'])) {
         $this->tincan_context[LANGUAGE_NONE][0]['extensions'] = drupal_json_encode($json_array['extensions']);
     }
     //need context_activities_json
     $this->tincan_context[LANGUAGE_NONE][0]['json'] = drupal_json_encode($json_array);
 }
开发者ID:jackrabbithanna,项目名称:tincan_lrs,代码行数:75,代码来源:Statement.php

示例9: addConfigurationOptionsJs

 public function addConfigurationOptionsJs()
 {
     if ($this->isCustomConfigurationCodeEnabled()) {
         $configurationOptionsJavascript = $this->getCustomConfigurationCode();
     } else {
         $enabledServices = $this->getServiceNamesAsCommaSeparatedString() . 'more';
         global $language;
         $configuration = array('services_compact' => $enabledServices, 'data_track_clickback' => $this->isClickbackTrackingEnabled(), 'ui_508_compliant' => $this->get508Compliant(), 'ui_click' => $this->isClickToOpenCompactMenuEnabled(), 'ui_cobrand' => $this->getCoBrand(), 'ui_delay' => $this->getUiDelay(), 'ui_header_background' => $this->getUiHeaderBackgroundColor(), 'ui_header_color' => $this->getUiHeaderColor(), 'ui_open_windows' => $this->isOpenWindowsEnabled(), 'ui_use_css' => $this->isStandardCssEnabled(), 'ui_use_addressbook' => $this->isAddressbookEnabled(), 'ui_language' => $language->language);
         if (module_exists('googleanalytics')) {
             if ($this->isGoogleAnalyticsTrackingEnabled()) {
                 $configuration['data_ga_property'] = variable_get('googleanalytics_account', '');
                 $configuration['data_ga_social'] = $this->isGoogleAnalyticsSocialTrackingEnabled();
             }
         }
         $configuration['templates']['twitter'] = $this->getTwitterTemplate();
         drupal_alter('addthis_configuration', $configuration);
         $templates = array('templates' => $configuration['templates']);
         unset($configuration['templates']);
         $configurationOptionsJavascript = 'var addthis_config = ' . drupal_json_encode($configuration) . "\n";
         $configurationOptionsJavascript .= 'var addthis_share = ' . drupal_json_encode($templates);
     }
     drupal_add_js($configurationOptionsJavascript, array('type' => 'inline', 'scope' => 'footer', 'every_page' => TRUE));
 }
开发者ID:tasfya,项目名称:maktaba,代码行数:23,代码来源:AddThis.php

示例10: request

 /**
  * Performs a Web Service JSON request
  *
  * @param $request_state
  *   @see CommerceFirstDataGGE4Controller::resolvePaymentState()
  *
  * @return
  *   An array of response parameters
  */
 public function request(&$request_state)
 {
     $empty_response = array('transaction_approved' => 0, 'bank_message' => '');
     // Exit if request is not valid
     if (!$this->requestValidate($request_state)) {
         // merge errors into response
         return $empty_response + array('validation_errors' => $request_state['validation_errors']);
     }
     // Build the request
     $params = $this->requestBuild($request_state);
     // Exit if empty request
     if (empty($params)) {
         return $empty_response;
     }
     // Add some request params to empty response
     $empty_response['transaction_type'] = $params['transaction_type'];
     // Get settings
     $settings = $this->getSettings();
     $log_settings = $this->controller->getSettings('log');
     // Add API credentials
     $params += array('gateway_id' => $settings['gateway_id'], 'password' => $settings['gateway_password']);
     /** @todo: live test mode parameter for WS?**/
     // if ($this->controller->getSettings('txn_mode') == FIRSTDATA_GGE4_TXN_MODE_LIVE_TEST)
     // Get request url
     $request_url = $this->getServerUrl();
     // Log the request if specified.
     if ($log_settings['request'] == 'request') {
         $this->controller->log('First Data GGe4 web service request', $params);
     }
     // Prepare the JSON string.
     ksort($params);
     $request_content = drupal_json_encode($params);
     $request_content_type = 'application/json';
     // Add content headers
     $request_headers = array('Content-Type' => $request_content_type . '; charset=UTF-8', 'Accept' => $request_content_type, 'Content-Length' => strlen($request_content));
     // Add security headers
     $request_headers += $this->generateSecurityRequestHeaders($request_headers['Content-Type'], $request_content, 'POST');
     // Combine header keys and values
     foreach ($request_headers as $header_key => &$header_value) {
         $header_value = $header_key . ': ' . $header_value;
     }
     // Setup the cURL request.
     $curl_options = array(CURLOPT_URL => $request_url, CURLOPT_VERBOSE => 0, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $request_content, CURLOPT_RETURNTRANSFER => 1, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_NOPROGRESS => 1, CURLOPT_FOLLOWLOCATION => 0, CURLOPT_FRESH_CONNECT => 1, CURLOPT_FORBID_REUSE => 1, CURLOPT_TIMEOUT => 60, CURLOPT_HTTPHEADER => array_values($request_headers));
     $ch = curl_init();
     curl_setopt_array($ch, $curl_options);
     $raw_response = curl_exec($ch);
     // Check for cURL errors.
     $errorno = NULL;
     if ($errorno = curl_errno($ch)) {
         watchdog('commerce_firstdata_gge4', 'Error with cURL request: (@error_no). Message: @error_message', array('@error_no' => $errorno, '@error_message' => curl_error($ch)), WATCHDOG_ERROR);
         curl_close($ch);
         return $empty_response;
     }
     curl_close($ch);
     // @todo: Response Hash check
     // First Data calculates security hash using the response body.
     // This would require CURLOPT_HEADER => 1 and parsing the response into a
     // header and body, then extracting the headers for date, etc to calcualte.
     // Process response
     $response = drupal_json_decode($raw_response);
     // Handle empty / non-json responses
     if (empty($response)) {
         if (is_string($raw_response) && strlen($raw_response) > 0) {
             $error_message = $raw_response;
         } else {
             $error_message = t('Empty response from the gateway.');
         }
         // Add custom error property
         $response = array('gge4_fatal_error' => $error_message, 'bank_message' => $error_message, 'transaction_approved' => 0) + $empty_response;
         watchdog('commerce_firstdata_gge4', 'Request error: @error_message', array('@error_message' => $error_message), WATCHDOG_ERROR);
     }
     // Sort alphabetically
     ksort($response);
     // Create / Update Commerce payment transaction
     $transaction = $this->controller->saveTransaction($response, $request_state);
     if ($transaction) {
         $request_state['transaction'] = $transaction;
     }
     // Allow other plugins and modules to react to non-fatal responses
     if (empty($response['gge4_fatal_error'])) {
         $event_context = array('plugin' => $this->plugin['name'], 'response' => $response, 'state' => $request_state);
         $this->controller->trigger('response_process', $event_context);
     }
     // Log the response if specified.
     if ($log_settings['response'] == 'response') {
         $this->controller->log('First Data GGe4 web service response', $response);
     }
     return $this->controller->sanitizeParameters($response);
 }
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:98,代码来源:CommerceFirstDataGGE4ComponentWS.class.php

示例11: bootstrap_theme_dashboard_request_to_be_contributor

function bootstrap_theme_dashboard_request_to_be_contributor($account)
{
    require_once dirname(__FILE__) . '/../../privatemsg/privatemsg.module';
    $to = variable_get('site_mail');
    //drupal_mail('bootstrap_theme', 'to_become_contributor', $to, LANGUAGE_NONE, array('subject' => 'Request to Become a Contributor', 'message' => url('dashboard/become-contributor', array('absolute' => TRUE))), $account->email);
    //drupal_set_message('Thanks for your request to become contributor.');
    global $user;
    $editor = bootstrap_theme_get_editor();
    //$to = variable_get('site_mail');
    //drupal_mail('bootstrap_theme', 'to_become_contributor', $to, LANGUAGE_NONE, array('subject' => 'Request to Become a Contributor', 'message' => url('dashboard/become-contributor/'.$user->uid, array('absolute' => TRUE))), $user->email);
    //drupal_set_message('Thanks for your request.');
    $account->field_is_pending_contributor[LANGUAGE_NONE][0]['value'] = 1;
    user_save($account);
    bootstrap_theme_send_message($user, $editor, 'Request to Become a Contributor', url('user/' . $user->uid, array('absolute' => true)));
    drupal_set_message('Thanks for your request to become contributor.');
    /*$recipient = $editor;
        $recipient->recipient = $editor->uid;
        $recipient->type = 'user';
    
        $new_message = new stdClass();
        $new_message->author = $user;
        $new_message->timestamp = time();
        $new_message->recipient = $editor->name;
        $new_message->recipients = array(
            'user_'.$editor->uid => $recipient
        );
    
        $new_message->subject = 'Request to Become a Contributor';
        $new_message->body = url('user/'.$user->uid, array('absolute' => true));
    
        _privatemsg_send($new_message);*/
    $form_state['no_redirect'] = TRUE;
    $form_state['rebuild'] = TRUE;
    $form_state['programmed'] = FALSE;
    echo drupal_json_encode(array('url' => url('user/' . $account->uid . '/edit')));
    exit;
}
开发者ID:episolve,项目名称:clasnetworkdev,代码行数:37,代码来源:page.dashboard.php

示例12: array

 * - $features: Features data to be serialized as GeoJSON
 * - $options: Array of options for this style
 *
 * @ingroup views_templates
 */
$jsonp_prefix = $options['jsonp_prefix'];
$features_collection = array('type' => 'FeatureCollection', 'features' => $features);
if ($view->override_path) {
    // We're inside a live preview where the GeoJSON is pretty-printed.
    $json = _views_geojson_encode_formatted($features_collection);
    if ($jsonp_prefix) {
        $json = "{$jsonp_prefix}({$json})";
    }
    print "<code>{$json}</code>";
} else {
    $json = drupal_json_encode($features_collection);
    if ($jsonp_prefix) {
        $json = "{$jsonp_prefix}({$json})";
    }
    if ($options['using_views_api_mode']) {
        // We're in Views API mode.
        print $json;
    } else {
        // We want to send the JSON as a server response so switch the content
        // type and stop further processing of the page.
        $content_type = $options['content_type'] == 'default' ? 'application/json' : $options['content_type'];
        drupal_add_http_header("Content-Type", "{$content_type}; charset=utf-8");
        print $json;
        //Don't think this is needed in .tpl.php files: module_invoke_all('exit');
        exit;
    }
开发者ID:ph3l1x,项目名称:mydea,代码行数:31,代码来源:views-views-geojson-style.tpl.php

示例13: displayListUsers

 /**
  * Display all users of list.
  *
  * @param array $listids
  *   An array of lists.
  * @param int $page
  *   A page number.
  * @param int $page_limit
  *   A page limit per one page.
  *
  * @return array
  *   An array of users.
  */
 public function displayListUsers($listids = array(), $page = 0, $page_limit = 50)
 {
     return $this->post("list/display", drupal_json_encode(array("listids" => $listids, "page" => $page, "page_limit" => $page_limit)));
 }
开发者ID:geodesfour,项目名称:dp741,代码行数:17,代码来源:sendinblue.mailin.php

示例14: md_leaders_backup_theme_settings

/**
 * Backup Theme Settings
 */
function md_leaders_backup_theme_settings()
{
    global $theme_key;
    $theme_settings = variable_get('theme_md_leaders_settings');
    $current_time = time();
    $cv_datetime = date("Y-m-d", $current_time);
    $backup_file = serialize(base64_encode(drupal_json_encode($theme_settings)));
    $bu_folder = 'public://md_leaders_backup';
    if (file_prepare_directory($bu_folder) === false) {
        drupal_mkdir($bu_folder);
    }
    if (file_unmanaged_save_data($backup_file, $bu_folder . '/' . str_replace('_', '-', 'md_leaders') . '-backup-' . $cv_datetime . '-' . $current_time . '.txt', FILE_EXISTS_REPLACE) === FALSE) {
        drupal_set_message(t("Could not create backup file."));
        return;
    } else {
        drupal_set_message(t("Backup Theme Settings Successful!"));
        drupal_set_message(t("Your backup settings is stored in " . file_create_url('' . $bu_folder . '/' . str_replace('_', '-', 'md_leaders') . '-backup-' . $cv_datetime . '-' . $current_time . '.txt') . ""));
    }
}
开发者ID:aman4you,项目名称:sselling,代码行数:22,代码来源:theme-settings.php

示例15: execute

 /**
  * @param string $method
  *   WYSIWYG editor method.
  * @param string $selector
  *   Editor selector.
  * @param array $arguments
  *   Arguments for method of WYSIWYG editor.
  *
  * @throws \Exception
  *   Throws an exception if the editor does not exist.
  *
  * @return string
  *   Result of JS evaluation.
  */
 protected function execute($method, $selector = '', array $arguments = [])
 {
     return $this->context->executeJs("return !object.{$method}(!args);", ['!object' => $this->getInstance($selector), '!args' => substr(drupal_json_encode($arguments), 1, -1)]);
 }
开发者ID:arrrtem,项目名称:TqExtension,代码行数:18,代码来源:Wysiwyg.php


注:本文中的drupal_json_encode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。