Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Personalisering #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ting.client.inc
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,11 @@ function ting_execute_cache($request) {
if (!isset($calls)) {
$calls = array();
}
$calls[] = $request->getRequest()->getParameters();
$params = $request->getRequest()->getParameters();
$start_time = microtime(TRUE);
$reply = ting_execute($request);
$params['time'] = microtime(TRUE) - $start_time;
$calls[] = $params;

// Cache any sub-objects (mostly true for collections).
if (isset($reply->objects)) {
Expand Down
5 changes: 5 additions & 0 deletions ting.entities.inc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class TingEntity extends DingEntity {
public $isPartOf = DingEntityBase::NULL;
public $extent = DingEntityBase::NULL;
public $classification = DingEntityBase::NULL;
public $publisher = DingEntityBase::NULL;

public function getExtent() {
return !empty($this->reply->record['dcterms:extent'][''][0]) ? $this->reply->record['dcterms:extent'][''][0] : FALSE;
Expand Down Expand Up @@ -135,6 +136,10 @@ class TingEntity extends DingEntity {
return !empty($this->reply->record) ? $this->reply->record : false;
}

public function getPublisher() {
return !empty($this->reply->record['dc:publisher'][''][0]) ? $this->reply->record['dc:publisher'][''][0] : FALSE;
}

function getRelations() {
// If relations are not set; do another request to get relations
if( !isset($this->reply->relationsData) ) {
Expand Down
8 changes: 5 additions & 3 deletions ting.module
Original file line number Diff line number Diff line change
Expand Up @@ -520,14 +520,14 @@ function ting_ding_entity_buttons($type, $entity) {
*/
function ting_page_alter(&$page) {
$calls = &drupal_static('ting_execute_cache');
if (sizeof($calls) > 1) {
if (sizeof($calls) > 5) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the number of calls need to trigger the messages ? Maybe we should make this configurable ?

$calls_str = array();
foreach ($calls as $call) {
$calls_str[] = print_r($calls, TRUE);
}
watchdog('ting', 'Warning, ting_execute called @x times:<br />"@queries"', array('@x' => sizeof($calls), '@queries' => join('" "', $calls_str)), WATCHDOG_WARNING);
if (function_exists('dpm') && user_access('access devel information')) {
drupal_set_message(t('Warning, ting_execute called @x times.', array('@x' => sizeof($calls))), 'error');
//drupal_set_message(t('Warning, ting_execute called @x times.', array('@x' => sizeof($calls))), 'error');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should comment out this waring to the developers!

dpm($calls, 'ting_execute queries:');
}
}
Expand All @@ -554,7 +554,9 @@ function ting_collection_page_view($object) {
* Page title callback.
*/
function ting_page_title($object) {
return check_plain($object->title);
// check_plain is handled later on.
return $object->title;
// return check_plain($object->title);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment out code :-)

}

/**
Expand Down