Пример #1
0
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);
}
Пример #2
0
 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;
     }
 }
<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>
Пример #4
0
 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)
 }
Пример #5
0
        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'];
?>
   </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'],
Пример #7
0
 /**
  * @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));
 }
Пример #8
0
 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);
 }
Пример #9
0
 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));
 }
 /**
  * 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);
 }
Пример #11
0
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;
}
Пример #12
0
 * - $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;
    }
Пример #13
0
 /**
  * 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)));
 }
Пример #14
0
/**
 * 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') . ""));
    }
}
Пример #15
0
 /**
  * @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)]);
 }
Пример #16
0
 public function getManagedTargetsAsJSON()
 {
     return drupal_json_encode(array_values($this->getManagedTargets(FALSE, TRUE)));
 }
Пример #17
0
 public function addConfigurationOptionsJs()
 {
     if ($this->isCustomConfigurationCodeEnabled()) {
         $configurationOptionsJavascript = $this->getCustomConfigurationCode();
     } else {
         $enabledServices = $this->getServiceNamesAsCommaSeparatedString($this->getEnabledServices()) . 'more';
         $excludedServices = $this->getServiceNamesAsCommaSeparatedString($this->getExcludedServices());
         global $language;
         $configuration = array('pubid' => $this->getProfileId(), 'services_compact' => $enabledServices, 'services_exclude' => $excludedServices, '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);
         // The $addthis_share variable is not passed through the alter to support
         // legacy implementation of the templates variable.
         //
         // Any additional values passed back into the $configuration variable will
         // be merged with the $addthis_share.
         //
         $addthis_share = array('templates' => $configuration['templates']);
         unset($configuration['templates']);
         if (isset($configuration['addthis_share'])) {
             $addthis_share = array_merge($addthis_share, $configuration['addthis_share']);
             unset($configuration['addthis_share']);
         }
         $configurationOptionsJavascript = 'var addthis_config = ' . drupal_json_encode($configuration) . "\n";
         $configurationOptionsJavascript .= 'var addthis_share = ' . drupal_json_encode($addthis_share);
     }
     drupal_add_js($configurationOptionsJavascript, array('type' => 'inline', 'scope' => 'footer', 'every_page' => TRUE));
 }
Пример #18
0
 public static function getLanguagesWithoutSourceAsJSON($source_lingotek_locale)
 {
     return drupal_json_encode(array_values(self::getLanguages('lingotek_locale', FALSE, $source_lingotek_locale)));
 }
Пример #19
0
  </ul>
  <?php 
    foreach ($slides as $index => $slide) {
        ?>
    <div id="tabs-<?php 
        print $index + 1;
        ?>
" class="md-tabcontent clearfix" data-timelinewidth="<?php 
        print $slide->settings['timelinewidth'];
        ?>
">
      <div class="settings">
        <a href="#" class="panel-settings-link">[Settings]</a> &nbsp;
        <a class="panel-clone" href="#">[Clone slide]</a>
        <input type="hidden" autocomplete="off" class="panelsettings" value='<?php 
        print drupal_json_encode($slide->settings);
        ?>
' />
      </div>
      <div class="md-slidewrap<?php 
        print $class_fullwidth;
        ?>
" style="height: <?php 
        print $slider->settings['height'];
        ?>
px;<?php 
        if (!$slider->settings['full_width']) {
            print 'width:' . $slider->settings['width'] . 'px';
        }
        ?>
">
 /**
  * {@inheritdoc}
  */
 public function render(array $structured_data)
 {
     return drupal_json_encode($structured_data);
 }
Пример #21
0
        ?>
"><a href="#"><i class="ic ac-icon-star"></i></a></li>
              <?php 
    }
    ?>
            </ul>
          </div>
          <div class="template-entry">
            <div class="template-entry-col">
              <h3 class="template-title"><?php 
    print $template->title;
    ?>
</h3>
            </div>
              <textarea style="display: none" class="ac-template-data"><?php 
    print drupal_json_encode($template);
    ?>
</textarea>
          </div>
        </div>
      </div>
    <?php 
}
?>
  </div>
  <div class="template-row text-center"<?php 
if (!$load_more) {
    print ' style="display: none"';
}
?>
>
Пример #22
0
 /**
  * Gets the comment-specific parameters for use in a createContentDocumentWithTargets API call.
  *
  * @param LingotekComment
  *   The comment entity to be translated.
  *
  * @return array
  *   An array of API parameter values.
  */
 protected function getCommentCreateWithTargetsParams(LingotekComment $comment)
 {
     $target_locales = Lingotek::availableLanguageTargets("lingotek_locale");
     $parameters = array('projectId' => variable_get('lingotek_project', NULL), 'documentName' => 'comment - ' . $comment->cid, 'documentDesc' => 'comment ' . $comment->cid . ' on node ' . $comment->nid, 'format' => $this->xmlFormat(), 'applyWorkflow' => 'true', 'workflowId' => variable_get('lingotek_translate_comments_workflow_id', NULL), 'sourceLanguage' => Lingotek::convertDrupal2Lingotek($comment->language), 'tmVaultId' => variable_get('lingotek_vault', 1), 'content' => $comment->documentLingotekXML(), 'targetAsJSON' => drupal_json_encode(array_values($target_locales)), 'note' => url('node/' . $comment->nid, array('absolute' => TRUE, 'alias' => TRUE)));
     $this->addAdvancedParameters($parameters, $comment);
     return $parameters;
 }
Пример #23
0
/**
 * Generates the JavaScript for rotating the header image.
 *
 * @return string
 *   The JavaScript for rotating the header.
 */
function _nitobe_random_header_js()
{
    global $base_url;
    $files = _nitobe_get_header_list();
    $names = array();
    foreach ($files as $file => $data) {
        $names[] = $base_url . '/' . $file;
    }
    $names_js = drupal_json_encode($names);
    $js = <<<EOJS
jQuery(document).ready(function() {
  var names = {$names_js};
  jQuery(".region-masthead").css("background-image", "url(" + names[Math.floor(Math.random() * names.length)] + ")");
});
EOJS;
    return $js;
}
Пример #24
0
if ($controller['request']) {
    ?>
                window.thejit_spacetree['<?php 
    echo $options['id'];
    ?>
'].st.config.request = <?php 
    echo $controller['request'];
    ?>
;
<?php 
}
?>
			
<?php 
if ($tree) {
    ?>
                window.thejit_spacetree['<?php 
    echo $options['id'];
    ?>
'].render(<?php 
    echo drupal_json_encode($tree);
    ?>
);
<?php 
}
?>
            }
          }
        };
</script>
Пример #25
0
 /**
  * Converts the input to JSON and saves it.
  *  Normally, this function would echo the result of the JSON conversion to
  *  stdout. For testing purposes, this will be saved in a internal variable,
  *  which can be retrieved with GetLastDrupalJsonOutput
  * @param type $var
  * @return type
  */
 public static function drupal_json_output($var = null)
 {
     self::$last_drupal_json_output = drupal_json_encode($var);
 }
Пример #26
0
/**
 * Backup Theme Settings
 */
function md_boom_multi_backup_theme_settings()
{
    $theme_settings = variable_get('theme_md_boom_multi_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_boom_multi_backup';
    if (file_prepare_directory($bu_folder) === false) {
        drupal_mkdir($bu_folder);
    }
    if (file_unmanaged_save_data($backup_file, $bu_folder . '/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!"));
    }
}