本文整理汇总了PHP中DataList::removeByFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP DataList::removeByFilter方法的具体用法?PHP DataList::removeByFilter怎么用?PHP DataList::removeByFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataList
的用法示例。
在下文中一共展示了DataList::removeByFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UpdateLists
public function UpdateLists()
{
$api = new MCAPI($this->apikey);
$retval = $api->lists();
if ($api->errorCode) {
SS_Log::log("Unable to load lists()! Error Code = " . $api->errorCode . " Error Msg = " . $api->errorMessage, SS_Log::ERR);
return false;
} else {
foreach ($retval['data'] as $list) {
// Get DataList of All MCLists
$dl = MCList::get();
$l = $dl->where("ListID = '" . $list['id'] . "'")->first();
// If the Current Iterations List Object Does Not Yet Exist, Create It
if (!is_object($l)) {
$l = new MCList();
$l->setField("ListID", $list['id']);
}
// Populate/Overwrite the List Data
$l->setField("Name", $list['name']);
$l->setField("WebID", $list['web_id']);
$l->setField("Subscribed", $list['stats']['member_count']);
$l->setField("Unsubscribed", $list['stats']['unsubscribe_count']);
$l->setField("Cleaned", $list['stats']['cleaned_count']);
$l->write();
// Add/Delete any New/Removed Merge Tags
// (Newly Added Merge Tags Will Need Linking/Relating to the Appropriate DB Field Name
// via Admin -> Setting -> MC Lists -> List Field Relationships)
$retval = $api->listMergeVars($l->ListID);
if ($api->errorCode) {
SS_Log::log("Unable to load listMergeVars()! Code = " . $api->errorCode . " Msg = " . $api->errorMessage, SS_Log::ERR);
return false;
} else {
$currTags = array();
foreach ($retval as $mergeTagData) {
$currTags[] = $mergeTag = $mergeTagData['tag'];
$listField = $l->getComponents("MCListFields", "\"MergeTag\" = '" . $mergeTag . "'")->first();
if (empty($listField)) {
$lf = new MCListField();
$lf->setField("MergeTag", $mergeTag);
$lf->write();
$l->getComponents("MCListFields")->add($lf);
}
}
// Create DataList of All Existing MC List Fields Which Are No Longer Present In MailChimp (Old Merge Tags) and Delete Them
$dl = new DataList("MCListField");
$filter = "\"MCListID\" = '" . $l->ID . "' AND \"MergeTag\" NOT IN (" . $this->arrayToCSV($currTags) . ")";
SS_Log::log("Cleaning up historical merge fields. MCListField delete filter = '" . $filter . "'", SS_Log::NOTICE);
$dl->removeByFilter($filter);
}
}
}
return true;
}